diff options
author | alelenv <40001162+alelenv@users.noreply.github.com> | 2020-05-21 04:38:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-21 05:38:41 -0600 |
commit | 59216d5cd87eee78dc979e30645c4c2240a7c351 (patch) | |
tree | ce11b7ee5da7c10cd783a6d00cc2bac31ee42754 /glslang/MachineIndependent | |
parent | eba1389a01f7d1935773c432522f4481caf568aa (diff) | |
download | glslang-59216d5cd87eee78dc979e30645c4c2240a7c351.tar.gz |
Add support for primitive culling layout qualifier. (#2220)
* Add support for primitive culling layout qualifier.
* Add error checks for primitive flags and negative test.
Diffstat (limited to 'glslang/MachineIndependent')
-rw-r--r-- | glslang/MachineIndependent/ParseHelper.cpp | 18 | ||||
-rw-r--r-- | glslang/MachineIndependent/localintermediate.h | 6 |
2 files changed, 23 insertions, 1 deletions
diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 39027d34..a35d41a0 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -5173,6 +5173,12 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi } } } + + if (id == "primitive_culling") { + requireExtensions(loc, 1, &E_GL_EXT_ray_flags_primitive_culling, "primitive culling"); + publicType.shaderQualifiers.layoutPrimitiveCulling = true; + return; + } #endif error(loc, "unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4)", id.c_str(), ""); @@ -6104,6 +6110,8 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua error(loc, message, "num_views", ""); if (shaderQualifiers.interlockOrdering != EioNone) error(loc, message, TQualifier::getInterlockOrderingString(shaderQualifiers.interlockOrdering), ""); + if (shaderQualifiers.layoutPrimitiveCulling) + error(loc, "can only be applied as standalone", "primitive_culling", ""); #endif } @@ -8368,6 +8376,16 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con { checkIoArraysConsistency(loc); } + + if (publicType.shaderQualifiers.layoutPrimitiveCulling) { + if (publicType.qualifier.storage != EvqTemporary) + error(loc, "layout qualifier can not have storage qualifiers", "primitive_culling","", ""); + else { + intermediate.setLayoutPrimitiveCulling(); + } + // Exit early as further checks are not valid + return; + } #endif const TQualifier& qualifier = publicType.qualifier; diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 996e347f..9f7b9977 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -276,7 +276,8 @@ public: needToLegalize(false), binaryDoubleOutput(false), usePhysicalStorageBuffer(false), - uniformLocationBase(0) + uniformLocationBase(0), + layoutPrimitiveCulling(false) #endif { localSize[0] = 1; @@ -742,6 +743,8 @@ public: void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; } bool hasLayoutDerivativeModeNone() const { return computeDerivativeMode != LayoutDerivativeNone; } ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; } + void setLayoutPrimitiveCulling() { layoutPrimitiveCulling = true; } + bool getLayoutPrimitiveCulling() const { return layoutPrimitiveCulling; } bool setPrimitives(int m) { if (primitives != TQualifier::layoutNotSet) @@ -974,6 +977,7 @@ protected: ComputeDerivativeMode computeDerivativeMode; int primitives; int numTaskNVBlocks; + bool layoutPrimitiveCulling; // Base shift values std::array<unsigned int, EResCount> shiftBinding; |