From 002b3f55c7852408100cc20b799aeb0f8646a77a Mon Sep 17 00:00:00 2001 From: Greg Fischer Date: Wed, 10 Nov 2021 15:03:07 -0700 Subject: [PATCH] Generate error for binding on push_constant --- Test/baseResults/vulkan.frag.out | 53 +++++++++++++++--------------- Test/vulkan.frag | 3 ++ glslang/MachineIndependent/ParseHelper.cpp | 2 ++ 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/Test/baseResults/vulkan.frag.out b/Test/baseResults/vulkan.frag.out index e620898..28134ae 100644 --- a/Test/baseResults/vulkan.frag.out +++ b/Test/baseResults/vulkan.frag.out @@ -24,37 +24,38 @@ ERROR: 0:39: 'push_constant' : can only be used with a uniform ERROR: 0:43: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan ERROR: 0:43: 'push_constant' : can only be used with a block ERROR: 0:45: 'push_constant' : cannot declare a default, can only be used on a block -ERROR: 0:51: 'binding' : sampler/texture/image requires layout(binding=X) -ERROR: 0:52: 'binding' : sampler/texture/image requires layout(binding=X) -ERROR: 0:52: 'input_attachment_index' : can only be used with a subpass -ERROR: 0:53: 'binding' : sampler/texture/image requires layout(binding=X) -ERROR: 0:53: 'input_attachment_index' : can only be used with a subpass +ERROR: 0:46: 'binding' : cannot be used with push_constant ERROR: 0:54: 'binding' : sampler/texture/image requires layout(binding=X) -ERROR: 0:54: 'subpass' : requires an input_attachment_index layout qualifier ERROR: 0:55: 'binding' : sampler/texture/image requires layout(binding=X) -ERROR: 0:60: 'subpassLoadMS' : no matching overloaded function found -ERROR: 0:61: 'subpassLoad' : no matching overloaded function found +ERROR: 0:55: 'input_attachment_index' : can only be used with a subpass +ERROR: 0:56: 'binding' : sampler/texture/image requires layout(binding=X) +ERROR: 0:56: 'input_attachment_index' : can only be used with a subpass +ERROR: 0:57: 'binding' : sampler/texture/image requires layout(binding=X) +ERROR: 0:57: 'subpass' : requires an input_attachment_index layout qualifier +ERROR: 0:58: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:63: 'subpassLoadMS' : no matching overloaded function found -ERROR: 0:66: 'subroutine' : not allowed when generating SPIR-V -ERROR: 0:66: 'subroutine' : feature not yet implemented -ERROR: 0:67: 'subroutine' : not allowed when generating SPIR-V -ERROR: 0:67: 'subroutine' : feature not yet implemented -ERROR: 0:69: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan -ERROR: 0:73: 'texture' : no matching overloaded function found -ERROR: 0:74: 'imageStore' : no matching overloaded function found -WARNING: 0:82: '' : all default precisions are highp; use precision statements to quiet warning, e.g.: +ERROR: 0:64: 'subpassLoad' : no matching overloaded function found +ERROR: 0:66: 'subpassLoadMS' : no matching overloaded function found +ERROR: 0:69: 'subroutine' : not allowed when generating SPIR-V +ERROR: 0:69: 'subroutine' : feature not yet implemented +ERROR: 0:70: 'subroutine' : not allowed when generating SPIR-V +ERROR: 0:70: 'subroutine' : feature not yet implemented +ERROR: 0:72: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan +ERROR: 0:76: 'texture' : no matching overloaded function found +ERROR: 0:77: 'imageStore' : no matching overloaded function found +WARNING: 0:85: '' : all default precisions are highp; use precision statements to quiet warning, e.g.: "precision mediump int; precision highp float;" -ERROR: 0:91: 'call argument' : sampler constructor must appear at point of use -ERROR: 0:92: 'call argument' : sampler constructor must appear at point of use -ERROR: 0:93: ',' : sampler constructor must appear at point of use -ERROR: 0:94: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' temp sampler2D' and a right operand of type ' temp sampler2D' (or there is no acceptable conversion) ERROR: 0:94: 'call argument' : sampler constructor must appear at point of use -ERROR: 0:96: 'gl_NumSamples' : undeclared identifier -ERROR: 0:101: 'noise1' : no matching overloaded function found -ERROR: 0:102: 'noise2' : no matching overloaded function found -ERROR: 0:103: 'noise3' : no matching overloaded function found -ERROR: 0:104: 'noise4' : no matching overloaded function found -ERROR: 53 compilation errors. No code generated. +ERROR: 0:95: 'call argument' : sampler constructor must appear at point of use +ERROR: 0:96: ',' : sampler constructor must appear at point of use +ERROR: 0:97: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' temp sampler2D' and a right operand of type ' temp sampler2D' (or there is no acceptable conversion) +ERROR: 0:97: 'call argument' : sampler constructor must appear at point of use +ERROR: 0:99: 'gl_NumSamples' : undeclared identifier +ERROR: 0:104: 'noise1' : no matching overloaded function found +ERROR: 0:105: 'noise2' : no matching overloaded function found +ERROR: 0:106: 'noise3' : no matching overloaded function found +ERROR: 0:107: 'noise4' : no matching overloaded function found +ERROR: 54 compilation errors. No code generated. ERROR: Linking fragment stage: Only one push_constant block is allowed per stage diff --git a/Test/vulkan.frag b/Test/vulkan.frag index 46c14f3..25bfefe 100644 --- a/Test/vulkan.frag +++ b/Test/vulkan.frag @@ -43,6 +43,9 @@ layout(push_constant) buffer pcb { // ERROR, not on a buffer layout(push_constant) uniform float pcfloat; // ERROR 2X: not on a non-block, and non-opaque outside block layout(push_constant) uniform; // ERROR, needs an object +layout(binding=2, push_constant) uniform pcbnd1 { // ERROR, can't have binding + int a; +} pcbnd1inst; layout(std430, push_constant) uniform pcb1 { int a; } pcb1inst; layout(push_constant) uniform pcb2 { int a; diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 9ab1207..7f2f171 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -6496,6 +6496,8 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier error(loc, "can only be used with a uniform", "push_constant", ""); if (qualifier.hasSet()) error(loc, "cannot be used with push_constant", "set", ""); + if (qualifier.hasBinding()) + error(loc, "cannot be used with push_constant", "binding", ""); } if (qualifier.hasBufferReference()) { if (qualifier.storage != EvqBuffer) -- 2.7.4