aboutsummaryrefslogtreecommitdiff
path: root/glslang/Include/Types.h
diff options
context:
space:
mode:
authorwill brown <will.brown039@gmail.com>2020-06-09 20:43:48 -0400
committerMalcolm Bechard <malcolm@derivative.ca>2021-03-08 13:31:39 -0500
commitecc9b9149f8f6367e4dc109e1f9ce3635a851968 (patch)
tree7a9b47a05b8c8d0a3c2671668b1ef634ed6874c6 /glslang/Include/Types.h
parent159b05708055fdb7cb2f01005d7c35545be6852f (diff)
downloadglslang-ecc9b9149f8f6367e4dc109e1f9ce3635a851968.tar.gz
Implement GL_EXT_vulkan_glsl_relaxed option
Diffstat (limited to 'glslang/Include/Types.h')
-rw-r--r--glslang/Include/Types.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h
index 603203db..bb6d0bd8 100644
--- a/glslang/Include/Types.h
+++ b/glslang/Include/Types.h
@@ -501,6 +501,7 @@ public:
noContraction = false;
nullInit = false;
#endif
+ defaultBlock = false;
}
// drop qualifiers that don't belong in a temporary variable
@@ -514,6 +515,7 @@ public:
specConstant = false;
nonUniform = false;
nullInit = false;
+ defaultBlock = false;
clearLayout();
}
@@ -572,6 +574,7 @@ public:
bool specConstant : 1;
bool nonUniform : 1;
bool explicitOffset : 1;
+ bool defaultBlock : 1; // default blocks with matching names have structures merged when linking
#ifdef GLSLANG_WEB
bool isWriteOnly() const { return false; }
@@ -756,6 +759,46 @@ public:
}
}
+ TBlockStorageClass getBlockStorage() const {
+ if (storage == EvqUniform && !isPushConstant()) {
+ return EbsUniform;
+ }
+ else if (storage == EvqUniform) {
+ return EbsPushConstant;
+ }
+ else if (storage == EvqBuffer) {
+ return EbsStorageBuffer;
+ }
+ return EbsNone;
+ }
+
+ void setBlockStorage(TBlockStorageClass newBacking) {
+#ifndef GLSLANG_WEB
+ layoutPushConstant = (newBacking == EbsPushConstant);
+#endif
+ switch (newBacking) {
+ case EbsUniform :
+ if (layoutPacking == ElpStd430) {
+ // std430 would not be valid
+ layoutPacking = ElpStd140;
+ }
+ storage = EvqUniform;
+ break;
+ case EbsStorageBuffer :
+ storage = EvqBuffer;
+ break;
+#ifndef GLSLANG_WEB
+ case EbsPushConstant :
+ storage = EvqUniform;
+ layoutSet = TQualifier::layoutSetEnd;
+ layoutBinding = TQualifier::layoutBindingEnd;
+ break;
+#endif
+ default:
+ break;
+ }
+ }
+
#ifdef GLSLANG_WEB
bool isPerView() const { return false; }
bool isTaskMemory() const { return false; }
@@ -852,6 +895,7 @@ public:
return hasNonXfbLayout() ||
hasXfb();
}
+
TLayoutMatrix layoutMatrix : 3;
TLayoutPacking layoutPacking : 4;
int layoutOffset;