diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 1676b9d8..1a8ba449 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -521,9 +521,9 @@ spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TTy // descriptor set. bool IsDescriptorResource(const glslang::TType& type) { - // uniform and buffer blocks are included + // uniform and buffer blocks are included, unless it is a push_constant if (type.getBasicType() == glslang::EbtBlock) - return type.getQualifier().isUniformOrBuffer(); + return type.getQualifier().isUniformOrBuffer() && ! type.getQualifier().layoutPushConstant; // non block... // basically samplerXXX/subpass/sampler/texture are all included diff --git a/Test/baseResults/spv.pushConstant.vert.out b/Test/baseResults/spv.pushConstant.vert.out index aff99ae9..6b314e08 100644 --- a/Test/baseResults/spv.pushConstant.vert.out +++ b/Test/baseResults/spv.pushConstant.vert.out @@ -24,7 +24,6 @@ Linked vertex stage: MemberDecorate 11(Material) 0 Offset 0 MemberDecorate 11(Material) 1 Offset 4 Decorate 11(Material) Block - Decorate 13(matInst) DescriptorSet 0 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 diff --git a/Test/baseResults/vulkan.vert.out b/Test/baseResults/vulkan.vert.out index 1e70b5b2..0cac808f 100644 --- a/Test/baseResults/vulkan.vert.out +++ b/Test/baseResults/vulkan.vert.out @@ -22,7 +22,8 @@ ERROR: 0:25: 'packed' : not allowed when using GLSL for Vulkan ERROR: 0:32: 'initializer' : can't use with types containing arrays sized with a specialization constant ERROR: 0:34: '=' : can't use with types containing arrays sized with a specialization constant ERROR: 0:35: '==' : can't use with types containing arrays sized with a specialization constant -ERROR: 22 compilation errors. No code generated. +ERROR: 0:39: 'set' : cannot be used with push_constant +ERROR: 23 compilation errors. No code generated. diff --git a/Test/vulkan.vert b/Test/vulkan.vert index a4ee9cd1..ad33a53b 100644 --- a/Test/vulkan.vert +++ b/Test/vulkan.vert @@ -34,4 +34,6 @@ void foo() a1 = a2; // ERROR, can't assign, even though the same type if (a1 == a2) // ERROR, can't compare either ++color; -} \ No newline at end of file +} + +layout(set = 1, push_constant) uniform badpc { int a; } badpcI; // ERROR, no descriptor set with push_constant diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 03370b88..8cee3e4b 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -4483,6 +4483,8 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier if (qualifier.layoutPushConstant) { if (qualifier.storage != EvqUniform) error(loc, "can only be used with a uniform", "push_constant", ""); + if (qualifier.hasSet()) + error(loc, "cannot be used with push_constant", "set", ""); } }