diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 745dd7f2..07556366 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -7482,7 +7482,7 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: id = builder.createCompositeExtract(mulOp, typeId, 0); for (int i = 1; i < componentCount; ++i) { builder.setPrecision(id, precision); - id = builder.createBinOp(spv::OpIAdd, typeId, id, builder.createCompositeExtract(operands[0], typeId, i)); + id = builder.createBinOp(spv::OpIAdd, typeId, id, builder.createCompositeExtract(mulOp, typeId, i)); } } else { switch (consumedOperands) { diff --git a/Test/130.frag b/Test/130.frag index 8a5bfd52..c352df42 100644 --- a/Test/130.frag +++ b/Test/130.frag @@ -62,12 +62,14 @@ void bar2() b3 < b3; // ERROR uv3 > uv3; // ERROR uvec2(2, 3) >= uvec2(3,3); // ERROR + int samples = gl_NumSamples; // ERROR int(bl4) <= int(bl4); // true int(bl4.x) > int(bl4.y); // false } #extension GL_ARB_texture_gather : enable #extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_sample_shading : enable uniform sampler2D samp2D; uniform sampler2DShadow samp2DS; @@ -83,6 +85,7 @@ void bar23() s = textureGatherOffset(samp2DA, vec3(0.3), ivec2(1)); s = textureGatherOffset(samp2DS, vec2(0.3), 1.3, ivec2(1)); // ERROR s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1), 2); // ERROR + int samples = gl_NumSamples; } #extension GL_ARB_gpu_shader5 : enable diff --git a/Test/140.frag b/Test/140.frag index 2bc2f59f..5efdbed7 100644 --- a/Test/140.frag +++ b/Test/140.frag @@ -17,6 +17,7 @@ void main() #error GL_ES is not set #endif + in struct S { float f; } s; // ERROR float patch = 3.1; @@ -51,3 +52,9 @@ float fooi() { return i1 + i2; } + +uniform sampler2DMS aaa1; // ERROR + +#extension GL_ARB_texture_multisample : enable + +uniform sampler2DMS aaa2; diff --git a/Test/atomic_uint.frag b/Test/atomic_uint.frag index 9a95a48a..41552144 100644 --- a/Test/atomic_uint.frag +++ b/Test/atomic_uint.frag @@ -1,6 +1,7 @@ #version 420 core layout(binding = 0) uniform atomic_uint counter; +layout(binding = 0, offset = 9) uniform atomic_uint counter; uint func(atomic_uint c) { @@ -41,7 +42,7 @@ uniform atomic_uint aNoBind; // ERROR, no binding layout(binding=0, offset=32) uniform atomic_uint aOffset; layout(binding=0, offset=4) uniform atomic_uint; layout(binding=0) uniform atomic_uint bar3; // offset is 4 -layout(binding=0) uniform atomic_uint ac[3]; // offset = 8 +layout(binding=0) uniform atomic_uint ac[2]; // offset = 8 layout(binding=0) uniform atomic_uint ad; // offset = 20 layout(offset=8) uniform atomic_uint bar4; // ERROR, no binding layout(binding = 0, offset = 12) uniform atomic_uint overlap; // ERROR, overlapping offsets diff --git a/Test/baseResults/130.frag.out b/Test/baseResults/130.frag.out index 0af9ab9f..6115f69c 100644 --- a/Test/baseResults/130.frag.out +++ b/Test/baseResults/130.frag.out @@ -7,36 +7,38 @@ WARNING: 0:45: extension GL_ARB_texture_gather is being used for textureGather(. ERROR: 0:62: '<' : wrong operand types: no operation '<' exists that takes a left-hand operand of type ' temp 3-component vector of bool' and a right operand of type ' temp 3-component vector of bool' (or there is no acceptable conversion) ERROR: 0:63: '>' : wrong operand types: no operation '>' exists that takes a left-hand operand of type ' temp 3-component vector of uint' and a right operand of type ' temp 3-component vector of uint' (or there is no acceptable conversion) ERROR: 0:64: '>=' : wrong operand types: no operation '>=' exists that takes a left-hand operand of type ' const 2-component vector of uint' and a right operand of type ' const 2-component vector of uint' (or there is no acceptable conversion) -ERROR: 0:80: 'textureGatherOffset' : no matching overloaded function found -ERROR: 0:80: 'assign' : cannot convert from ' const float' to ' temp 4-component vector of float' -ERROR: 0:81: 'textureGatherOffset(...)' : not supported for this version or the enabled extensions -ERROR: 0:84: 'textureGatherOffset(...)' : not supported for this version or the enabled extensions -ERROR: 0:85: 'textureGatherOffset(...)' : not supported for this version or the enabled extensions -WARNING: 0:88: '#extension' : extension is only partially supported: GL_ARB_gpu_shader5 -ERROR: 0:120: 'line continuation' : not supported for this version or the enabled extensions -ERROR: 0:126: 'uniform block' : not supported for this version or the enabled extensions -ERROR: 0:140: 'length' : does not operate on this type: temp bool -ERROR: 0:140: 'boolb' : can't use function syntax on variable -ERROR: 0:141: 'length' : does not operate on this type: temp float -ERROR: 0:141: '' : function call, method, or subroutine call expected -ERROR: 0:141: '' : no matching overloaded function found -ERROR: 0:142: 'length' : incomplete method syntax -ERROR: 0:143: 'length' : method does not accept any arguments -ERROR: 0:146: 'gl_FogFragCoord' : identifiers starting with "gl_" are reserved -ERROR: 0:151: 'int' : must be qualified as flat in -ERROR: 0:151: 'redeclaration' : cannot change the type of gl_FogFragCoord -ERROR: 0:153: 'early_fragment_tests' : not supported for this version or the enabled extensions -ERROR: 0:154: 'image load store' : not supported for this version or the enabled extensions -ERROR: 0:154: 'iimage2D' : Reserved word. -ERROR: 0:169: 'early_fragment_tests' : can only apply to 'in' -ERROR: 0:173: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions -ERROR: 29 compilation errors. No code generated. +ERROR: 0:65: 'gl_NumSamples' : required extension not requested: GL_ARB_sample_shading +ERROR: 0:82: 'textureGatherOffset' : no matching overloaded function found +ERROR: 0:82: 'assign' : cannot convert from ' const float' to ' temp 4-component vector of float' +ERROR: 0:83: 'textureGatherOffset(...)' : not supported for this version or the enabled extensions +ERROR: 0:86: 'textureGatherOffset(...)' : not supported for this version or the enabled extensions +ERROR: 0:87: 'textureGatherOffset(...)' : not supported for this version or the enabled extensions +WARNING: 0:91: '#extension' : extension is only partially supported: GL_ARB_gpu_shader5 +ERROR: 0:123: 'line continuation' : not supported for this version or the enabled extensions +ERROR: 0:129: 'uniform block' : not supported for this version or the enabled extensions +ERROR: 0:143: 'length' : does not operate on this type: temp bool +ERROR: 0:143: 'boolb' : can't use function syntax on variable +ERROR: 0:144: 'length' : does not operate on this type: temp float +ERROR: 0:144: '' : function call, method, or subroutine call expected +ERROR: 0:144: '' : no matching overloaded function found +ERROR: 0:145: 'length' : incomplete method syntax +ERROR: 0:146: 'length' : method does not accept any arguments +ERROR: 0:149: 'gl_FogFragCoord' : identifiers starting with "gl_" are reserved +ERROR: 0:154: 'int' : must be qualified as flat in +ERROR: 0:154: 'redeclaration' : cannot change the type of gl_FogFragCoord +ERROR: 0:156: 'early_fragment_tests' : not supported for this version or the enabled extensions +ERROR: 0:157: 'image load store' : not supported for this version or the enabled extensions +ERROR: 0:157: 'iimage2D' : Reserved word. +ERROR: 0:172: 'early_fragment_tests' : can only apply to 'in' +ERROR: 0:176: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions +ERROR: 30 compilation errors. No code generated. Shader version: 130 Requested GL_ARB_explicit_attrib_location Requested GL_ARB_explicit_uniform_location Requested GL_ARB_gpu_shader5 +Requested GL_ARB_sample_shading Requested GL_ARB_separate_shader_objects Requested GL_ARB_shader_image_load_store Requested GL_ARB_shading_language_420pack @@ -122,259 +124,267 @@ ERROR: node is still EOpNull! 0:63 false (const bool) 0:64 Constant: 0:64 false (const bool) -0:65 Constant: -0:65 true (const bool) +0:65 Sequence +0:65 move second child to first child ( temp int) +0:65 'samples' ( temp int) +0:65 'gl_NumSamples' ( uniform int SampleMaskIn) 0:66 Constant: -0:66 false (const bool) -0:77 Function Definition: bar23( ( global void) -0:77 Function Parameters: +0:66 true (const bool) +0:67 Constant: +0:67 false (const bool) +0:79 Function Definition: bar23( ( global void) +0:79 Function Parameters: 0:? Sequence -0:80 's' ( temp 4-component vector of float) -0:81 move second child to first child ( temp 4-component vector of float) -0:81 's' ( temp 4-component vector of float) -0:81 textureGatherOffset ( global 4-component vector of float) -0:81 'samp2DR' ( uniform sampler2DRect) -0:81 Constant: -0:81 0.300000 -0:81 0.300000 -0:81 Constant: -0:81 1 (const int) -0:81 1 (const int) -0:82 move second child to first child ( temp 4-component vector of float) -0:82 's' ( temp 4-component vector of float) -0:82 textureGatherOffset ( global 4-component vector of float) -0:82 'samp2D' ( uniform sampler2D) -0:82 Constant: -0:82 0.300000 -0:82 0.300000 -0:82 Constant: -0:82 1 (const int) -0:82 1 (const int) +0:82 's' ( temp 4-component vector of float) 0:83 move second child to first child ( temp 4-component vector of float) 0:83 's' ( temp 4-component vector of float) 0:83 textureGatherOffset ( global 4-component vector of float) -0:83 'samp2DA' ( uniform sampler2DArray) +0:83 'samp2DR' ( uniform sampler2DRect) 0:83 Constant: 0:83 0.300000 0:83 0.300000 -0:83 0.300000 0:83 Constant: 0:83 1 (const int) 0:83 1 (const int) 0:84 move second child to first child ( temp 4-component vector of float) 0:84 's' ( temp 4-component vector of float) 0:84 textureGatherOffset ( global 4-component vector of float) -0:84 'samp2DS' ( uniform sampler2DShadow) +0:84 'samp2D' ( uniform sampler2D) 0:84 Constant: 0:84 0.300000 0:84 0.300000 0:84 Constant: -0:84 1.300000 -0:84 Constant: 0:84 1 (const int) 0:84 1 (const int) 0:85 move second child to first child ( temp 4-component vector of float) 0:85 's' ( temp 4-component vector of float) 0:85 textureGatherOffset ( global 4-component vector of float) -0:85 'samp2D' ( uniform sampler2D) +0:85 'samp2DA' ( uniform sampler2DArray) 0:85 Constant: 0:85 0.300000 0:85 0.300000 +0:85 0.300000 0:85 Constant: 0:85 1 (const int) 0:85 1 (const int) -0:85 Constant: -0:85 2 (const int) -0:90 Function Definition: bar234( ( global void) -0:90 Function Parameters: +0:86 move second child to first child ( temp 4-component vector of float) +0:86 's' ( temp 4-component vector of float) +0:86 textureGatherOffset ( global 4-component vector of float) +0:86 'samp2DS' ( uniform sampler2DShadow) +0:86 Constant: +0:86 0.300000 +0:86 0.300000 +0:86 Constant: +0:86 1.300000 +0:86 Constant: +0:86 1 (const int) +0:86 1 (const int) +0:87 move second child to first child ( temp 4-component vector of float) +0:87 's' ( temp 4-component vector of float) +0:87 textureGatherOffset ( global 4-component vector of float) +0:87 'samp2D' ( uniform sampler2D) +0:87 Constant: +0:87 0.300000 +0:87 0.300000 +0:87 Constant: +0:87 1 (const int) +0:87 1 (const int) +0:87 Constant: +0:87 2 (const int) +0:88 Sequence +0:88 move second child to first child ( temp int) +0:88 'samples' ( temp int) +0:88 'gl_NumSamples' ( uniform int SampleMaskIn) +0:93 Function Definition: bar234( ( global void) +0:93 Function Parameters: 0:? Sequence -0:93 move second child to first child ( temp 4-component vector of float) -0:93 's' ( temp 4-component vector of float) -0:93 textureGatherOffset ( global 4-component vector of float) -0:93 'samp2D' ( uniform sampler2D) -0:93 Constant: -0:93 0.300000 -0:93 0.300000 -0:93 Constant: -0:93 1 (const int) -0:93 1 (const int) -0:94 move second child to first child ( temp 4-component vector of float) -0:94 's' ( temp 4-component vector of float) -0:94 textureGatherOffset ( global 4-component vector of float) -0:94 'samp2DA' ( uniform sampler2DArray) -0:94 Constant: -0:94 0.300000 -0:94 0.300000 -0:94 0.300000 -0:94 Constant: -0:94 1 (const int) -0:94 1 (const int) -0:95 move second child to first child ( temp 4-component vector of float) -0:95 's' ( temp 4-component vector of float) -0:95 textureGatherOffset ( global 4-component vector of float) -0:95 'samp2DR' ( uniform sampler2DRect) -0:95 Constant: -0:95 0.300000 -0:95 0.300000 -0:95 Constant: -0:95 1 (const int) -0:95 1 (const int) 0:96 move second child to first child ( temp 4-component vector of float) 0:96 's' ( temp 4-component vector of float) 0:96 textureGatherOffset ( global 4-component vector of float) -0:96 'samp2DS' ( uniform sampler2DShadow) +0:96 'samp2D' ( uniform sampler2D) 0:96 Constant: 0:96 0.300000 0:96 0.300000 0:96 Constant: -0:96 1.300000 -0:96 Constant: 0:96 1 (const int) 0:96 1 (const int) 0:97 move second child to first child ( temp 4-component vector of float) 0:97 's' ( temp 4-component vector of float) 0:97 textureGatherOffset ( global 4-component vector of float) -0:97 'samp2D' ( uniform sampler2D) +0:97 'samp2DA' ( uniform sampler2DArray) 0:97 Constant: 0:97 0.300000 0:97 0.300000 +0:97 0.300000 0:97 Constant: 0:97 1 (const int) 0:97 1 (const int) -0:97 Constant: -0:97 2 (const int) -0:107 Function Definition: bar235( ( global void) -0:107 Function Parameters: -0:109 Sequence -0:109 Sequence -0:109 move second child to first child ( temp 3-component vector of int) -0:109 'a' ( temp 3-component vector of int) -0:109 textureSize ( global 3-component vector of int) -0:109 'Sca' ( uniform samplerCubeArray) -0:109 Constant: -0:109 3 (const int) -0:110 Sequence -0:110 move second child to first child ( temp 4-component vector of float) -0:110 'b' ( temp 4-component vector of float) -0:110 texture ( global 4-component vector of float) -0:110 'Sca' ( uniform samplerCubeArray) -0:110 'i' ( smooth in 4-component vector of float) -0:111 Sequence -0:111 move second child to first child ( temp 4-component vector of int) -0:111 'c' ( temp 4-component vector of int) -0:111 texture ( global 4-component vector of int) -0:111 'Isca' ( uniform isamplerCubeArray) -0:111 'i' ( smooth in 4-component vector of float) -0:111 Constant: -0:111 0.700000 +0:98 move second child to first child ( temp 4-component vector of float) +0:98 's' ( temp 4-component vector of float) +0:98 textureGatherOffset ( global 4-component vector of float) +0:98 'samp2DR' ( uniform sampler2DRect) +0:98 Constant: +0:98 0.300000 +0:98 0.300000 +0:98 Constant: +0:98 1 (const int) +0:98 1 (const int) +0:99 move second child to first child ( temp 4-component vector of float) +0:99 's' ( temp 4-component vector of float) +0:99 textureGatherOffset ( global 4-component vector of float) +0:99 'samp2DS' ( uniform sampler2DShadow) +0:99 Constant: +0:99 0.300000 +0:99 0.300000 +0:99 Constant: +0:99 1.300000 +0:99 Constant: +0:99 1 (const int) +0:99 1 (const int) +0:100 move second child to first child ( temp 4-component vector of float) +0:100 's' ( temp 4-component vector of float) +0:100 textureGatherOffset ( global 4-component vector of float) +0:100 'samp2D' ( uniform sampler2D) +0:100 Constant: +0:100 0.300000 +0:100 0.300000 +0:100 Constant: +0:100 1 (const int) +0:100 1 (const int) +0:100 Constant: +0:100 2 (const int) +0:110 Function Definition: bar235( ( global void) +0:110 Function Parameters: +0:112 Sequence 0:112 Sequence -0:112 move second child to first child ( temp 4-component vector of uint) -0:112 'd' ( temp 4-component vector of uint) -0:112 texture ( global 4-component vector of uint) -0:112 'Usca' ( uniform usamplerCubeArray) -0:112 'i' ( smooth in 4-component vector of float) -0:114 move second child to first child ( temp 4-component vector of float) -0:114 'b' ( temp 4-component vector of float) -0:114 textureLod ( global 4-component vector of float) -0:114 'Sca' ( uniform samplerCubeArray) -0:114 'i' ( smooth in 4-component vector of float) -0:114 Constant: -0:114 1.700000 -0:115 move second child to first child ( temp 3-component vector of int) -0:115 'a' ( temp 3-component vector of int) -0:115 textureSize ( global 3-component vector of int) -0:115 'Scas' ( uniform samplerCubeArrayShadow) -0:115 direct index ( temp int) -0:115 'a' ( temp 3-component vector of int) -0:115 Constant: -0:115 0 (const int) -0:116 Sequence -0:116 move second child to first child ( temp float) -0:116 'f' ( temp float) -0:116 texture ( global float) -0:116 'Scas' ( uniform samplerCubeArrayShadow) -0:116 'i' ( smooth in 4-component vector of float) -0:116 direct index ( temp float) -0:116 'b' ( temp 4-component vector of float) -0:116 Constant: -0:116 1 (const int) -0:117 move second child to first child ( temp 4-component vector of int) -0:117 'c' ( temp 4-component vector of int) -0:117 textureGrad ( global 4-component vector of int) -0:117 'Isca' ( uniform isamplerCubeArray) +0:112 move second child to first child ( temp 3-component vector of int) +0:112 'a' ( temp 3-component vector of int) +0:112 textureSize ( global 3-component vector of int) +0:112 'Sca' ( uniform samplerCubeArray) +0:112 Constant: +0:112 3 (const int) +0:113 Sequence +0:113 move second child to first child ( temp 4-component vector of float) +0:113 'b' ( temp 4-component vector of float) +0:113 texture ( global 4-component vector of float) +0:113 'Sca' ( uniform samplerCubeArray) +0:113 'i' ( smooth in 4-component vector of float) +0:114 Sequence +0:114 move second child to first child ( temp 4-component vector of int) +0:114 'c' ( temp 4-component vector of int) +0:114 texture ( global 4-component vector of int) +0:114 'Isca' ( uniform isamplerCubeArray) +0:114 'i' ( smooth in 4-component vector of float) +0:114 Constant: +0:114 0.700000 +0:115 Sequence +0:115 move second child to first child ( temp 4-component vector of uint) +0:115 'd' ( temp 4-component vector of uint) +0:115 texture ( global 4-component vector of uint) +0:115 'Usca' ( uniform usamplerCubeArray) +0:115 'i' ( smooth in 4-component vector of float) +0:117 move second child to first child ( temp 4-component vector of float) +0:117 'b' ( temp 4-component vector of float) +0:117 textureLod ( global 4-component vector of float) +0:117 'Sca' ( uniform samplerCubeArray) 0:117 'i' ( smooth in 4-component vector of float) 0:117 Constant: -0:117 0.100000 -0:117 0.100000 -0:117 0.100000 -0:117 Constant: -0:117 0.200000 -0:117 0.200000 -0:117 0.200000 -0:129 Function Definition: bar23444( ( global void) -0:129 Function Parameters: +0:117 1.700000 +0:118 move second child to first child ( temp 3-component vector of int) +0:118 'a' ( temp 3-component vector of int) +0:118 textureSize ( global 3-component vector of int) +0:118 'Scas' ( uniform samplerCubeArrayShadow) +0:118 direct index ( temp int) +0:118 'a' ( temp 3-component vector of int) +0:118 Constant: +0:118 0 (const int) +0:119 Sequence +0:119 move second child to first child ( temp float) +0:119 'f' ( temp float) +0:119 texture ( global float) +0:119 'Scas' ( uniform samplerCubeArrayShadow) +0:119 'i' ( smooth in 4-component vector of float) +0:119 direct index ( temp float) +0:119 'b' ( temp 4-component vector of float) +0:119 Constant: +0:119 1 (const int) +0:120 move second child to first child ( temp 4-component vector of int) +0:120 'c' ( temp 4-component vector of int) +0:120 textureGrad ( global 4-component vector of int) +0:120 'Isca' ( uniform isamplerCubeArray) +0:120 'i' ( smooth in 4-component vector of float) +0:120 Constant: +0:120 0.100000 +0:120 0.100000 +0:120 0.100000 +0:120 Constant: +0:120 0.200000 +0:120 0.200000 +0:120 0.200000 +0:132 Function Definition: bar23444( ( global void) +0:132 Function Parameters: 0:? Sequence -0:132 Sequence -0:132 move second child to first child ( temp float) -0:132 'a1' ( temp float) -0:132 direct index ( temp float) -0:132 direct index ( temp 3-component vector of float) -0:132 'm43' ( temp 4X3 matrix of float) -0:132 Constant: -0:132 3 (const int) -0:132 Constant: -0:132 1 (const int) -0:134 Sequence -0:134 move second child to first child ( temp int) -0:134 'a2' ( temp int) -0:134 Constant: -0:134 4 (const int) -0:135 add second child into first child ( temp int) -0:135 'a2' ( temp int) -0:135 Constant: -0:135 3 (const int) -0:136 add second child into first child ( temp int) -0:136 'a2' ( temp int) -0:136 Constant: -0:136 3 (const int) +0:135 Sequence +0:135 move second child to first child ( temp float) +0:135 'a1' ( temp float) +0:135 direct index ( temp float) +0:135 direct index ( temp 3-component vector of float) +0:135 'm43' ( temp 4X3 matrix of float) +0:135 Constant: +0:135 3 (const int) +0:135 Constant: +0:135 1 (const int) 0:137 Sequence -0:137 move second child to first child ( temp float) -0:137 'b' ( const (read only) float) -0:137 component-wise multiply ( temp float) -0:137 Constant: -0:137 2.000000 -0:137 'a1' ( temp float) -0:138 move second child to first child ( temp float) -0:138 direct index ( temp float) -0:138 'a' ( global 3-component vector of float) -0:138 Constant: -0:138 0 (const int) +0:137 move second child to first child ( temp int) +0:137 'a2' ( temp int) +0:137 Constant: +0:137 4 (const int) +0:138 add second child into first child ( temp int) +0:138 'a2' ( temp int) 0:138 Constant: -0:138 -1.000000 -0:140 Constant: -0:140 0.000000 -0:141 Constant: -0:141 0.000000 +0:138 3 (const int) +0:139 add second child into first child ( temp int) +0:139 'a2' ( temp int) +0:139 Constant: +0:139 3 (const int) +0:140 Sequence +0:140 move second child to first child ( temp float) +0:140 'b' ( const (read only) float) +0:140 component-wise multiply ( temp float) +0:140 Constant: +0:140 2.000000 +0:140 'a1' ( temp float) +0:141 move second child to first child ( temp float) +0:141 direct index ( temp float) +0:141 'a' ( global 3-component vector of float) +0:141 Constant: +0:141 0 (const int) +0:141 Constant: +0:141 -1.000000 0:143 Constant: -0:143 1 (const int) -0:162 Function Definition: qux2( ( global void) -0:162 Function Parameters: +0:143 0.000000 +0:144 Constant: +0:144 0.000000 +0:146 Constant: +0:146 1 (const int) +0:165 Function Definition: qux2( ( global void) +0:165 Function Parameters: 0:? Sequence -0:165 imageAtomicCompSwap ( global int) -0:165 'iimg2D' (layout( r32i) uniform iimage2D) -0:165 Construct ivec2 ( temp 2-component vector of int) -0:165 'i' ( temp int) -0:165 'i' ( temp int) -0:165 'i' ( temp int) -0:165 'i' ( temp int) -0:166 Sequence -0:166 move second child to first child ( temp 4-component vector of int) -0:166 'pos' ( temp 4-component vector of int) -0:166 imageLoad ( global 4-component vector of int) -0:166 'iimg2D' (layout( r32i) uniform iimage2D) -0:166 Construct ivec2 ( temp 2-component vector of int) -0:166 'i' ( temp int) -0:166 'i' ( temp int) +0:168 imageAtomicCompSwap ( global int) +0:168 'iimg2D' (layout( r32i) uniform iimage2D) +0:168 Construct ivec2 ( temp 2-component vector of int) +0:168 'i' ( temp int) +0:168 'i' ( temp int) +0:168 'i' ( temp int) +0:168 'i' ( temp int) +0:169 Sequence +0:169 move second child to first child ( temp 4-component vector of int) +0:169 'pos' ( temp 4-component vector of int) +0:169 imageLoad ( global 4-component vector of int) +0:169 'iimg2D' (layout( r32i) uniform iimage2D) +0:169 Construct ivec2 ( temp 2-component vector of int) +0:169 'i' ( temp int) +0:169 'i' ( temp int) 0:? Linker Objects 0:? 'a' ( global 3-component vector of float) 0:? 'b' ( global float) @@ -416,6 +426,7 @@ Shader version: 130 Requested GL_ARB_explicit_attrib_location Requested GL_ARB_explicit_uniform_location Requested GL_ARB_gpu_shader5 +Requested GL_ARB_sample_shading Requested GL_ARB_separate_shader_objects Requested GL_ARB_shader_image_load_store Requested GL_ARB_shading_language_420pack diff --git a/Test/baseResults/140.frag.out b/Test/baseResults/140.frag.out index 7ce21703..702718a2 100644 --- a/Test/baseResults/140.frag.out +++ b/Test/baseResults/140.frag.out @@ -1,14 +1,15 @@ 140.frag WARNING: 0:3: varying deprecated in version 130; may be removed in future release ERROR: 0:17: '#error' : GL_ES is not set -ERROR: 0:20: 'fragment-shader struct input' : not supported for this version or the enabled extensions -ERROR: 0:24: 'location' : not supported for this version or the enabled extensions -ERROR: 0:24: 'location qualifier on input' : not supported for this version or the enabled extensions -ERROR: 0:26: 'location' : not supported for this version or the enabled extensions -ERROR: 0:26: 'location qualifier on output' : not supported for this version or the enabled extensions -ERROR: 0:40: 'assign' : l-value required "v" (can't modify shader input) -ERROR: 0:40: 'out' : Non-L-value cannot be passed for 'out' or 'inout' parameters. -ERROR: 8 compilation errors. No code generated. +ERROR: 0:21: 'fragment-shader struct input' : not supported for this version or the enabled extensions +ERROR: 0:25: 'location' : not supported for this version or the enabled extensions +ERROR: 0:25: 'location qualifier on input' : not supported for this version or the enabled extensions +ERROR: 0:27: 'location' : not supported for this version or the enabled extensions +ERROR: 0:27: 'location qualifier on output' : not supported for this version or the enabled extensions +ERROR: 0:41: 'assign' : l-value required "v" (can't modify shader input) +ERROR: 0:41: 'out' : Non-L-value cannot be passed for 'out' or 'inout' parameters. +ERROR: 0:56: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 9 compilation errors. No code generated. Shader version: 140 @@ -25,80 +26,80 @@ ERROR: node is still EOpNull! 0:12 'gl_ClipDistance' ( smooth in 5-element array of float ClipDistance) 0:12 Constant: 0:12 2 (const int) -0:22 Sequence -0:22 move second child to first child ( temp float) -0:22 'patch' ( global float) -0:22 Constant: -0:22 3.100000 -0:38 Function Definition: foo( ( global void) -0:38 Function Parameters: -0:40 Sequence -0:40 Sequence -0:40 move second child to first child ( temp 2-component vector of float) -0:40 'r1' ( temp 2-component vector of float) -0:40 modf ( global 2-component vector of float) -0:40 vector swizzle ( temp 2-component vector of float) -0:40 'v' ( smooth in 4-component vector of float) -0:40 Sequence -0:40 Constant: -0:40 0 (const int) -0:40 Constant: -0:40 1 (const int) -0:40 vector swizzle ( temp 2-component vector of float) -0:40 'v' ( smooth in 4-component vector of float) -0:40 Sequence -0:40 Constant: -0:40 2 (const int) -0:40 Constant: -0:40 3 (const int) +0:23 Sequence +0:23 move second child to first child ( temp float) +0:23 'patch' ( global float) +0:23 Constant: +0:23 3.100000 +0:39 Function Definition: foo( ( global void) +0:39 Function Parameters: +0:41 Sequence 0:41 Sequence 0:41 move second child to first child ( temp 2-component vector of float) -0:41 'r2' ( temp 2-component vector of float) +0:41 'r1' ( temp 2-component vector of float) 0:41 modf ( global 2-component vector of float) 0:41 vector swizzle ( temp 2-component vector of float) -0:41 'o' ( out 4-component vector of float) +0:41 'v' ( smooth in 4-component vector of float) 0:41 Sequence 0:41 Constant: 0:41 0 (const int) 0:41 Constant: 0:41 1 (const int) 0:41 vector swizzle ( temp 2-component vector of float) -0:41 'o' ( out 4-component vector of float) +0:41 'v' ( smooth in 4-component vector of float) 0:41 Sequence 0:41 Constant: 0:41 2 (const int) 0:41 Constant: 0:41 3 (const int) -0:42 move second child to first child ( temp float) -0:42 direct index ( temp float) -0:42 'o' ( out 4-component vector of float) -0:42 Constant: -0:42 2 (const int) -0:42 Function Call: fooi( ( global float) -0:47 Sequence -0:47 move second child to first child ( temp float) -0:47 'i1' ( global float) -0:47 Test condition and select ( temp float) -0:47 Condition -0:47 'gl_FrontFacing' ( gl_FrontFacing bool Face) -0:47 true case -0:47 Constant: -0:47 -2.000000 -0:47 false case -0:47 Constant: -0:47 2.000000 +0:42 Sequence +0:42 move second child to first child ( temp 2-component vector of float) +0:42 'r2' ( temp 2-component vector of float) +0:42 modf ( global 2-component vector of float) +0:42 vector swizzle ( temp 2-component vector of float) +0:42 'o' ( out 4-component vector of float) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 vector swizzle ( temp 2-component vector of float) +0:42 'o' ( out 4-component vector of float) +0:42 Sequence +0:42 Constant: +0:42 2 (const int) +0:42 Constant: +0:42 3 (const int) +0:43 move second child to first child ( temp float) +0:43 direct index ( temp float) +0:43 'o' ( out 4-component vector of float) +0:43 Constant: +0:43 2 (const int) +0:43 Function Call: fooi( ( global float) 0:48 Sequence 0:48 move second child to first child ( temp float) -0:48 'i2' ( global float) -0:48 Constant: -0:48 102.000000 -0:50 Function Definition: fooi( ( global float) -0:50 Function Parameters: -0:52 Sequence -0:52 Branch: Return with expression -0:52 add ( temp float) -0:52 'i1' ( global float) -0:52 'i2' ( global float) +0:48 'i1' ( global float) +0:48 Test condition and select ( temp float) +0:48 Condition +0:48 'gl_FrontFacing' ( gl_FrontFacing bool Face) +0:48 true case +0:48 Constant: +0:48 -2.000000 +0:48 false case +0:48 Constant: +0:48 2.000000 +0:49 Sequence +0:49 move second child to first child ( temp float) +0:49 'i2' ( global float) +0:49 Constant: +0:49 102.000000 +0:51 Function Definition: fooi( ( global float) +0:51 Function Parameters: +0:53 Sequence +0:53 Branch: Return with expression +0:53 add ( temp float) +0:53 'i1' ( global float) +0:53 'i2' ( global float) 0:? Linker Objects 0:? 'v' ( smooth in 4-component vector of float) 0:? 'i' ( smooth in 4-component vector of float) @@ -131,28 +132,28 @@ ERROR: node is still EOpNull! 0:12 'gl_ClipDistance' ( smooth in 5-element array of float ClipDistance) 0:12 Constant: 0:12 2 (const int) -0:22 Sequence -0:22 move second child to first child ( temp float) -0:22 'patch' ( global float) -0:22 Constant: -0:22 3.100000 -0:47 Sequence -0:47 move second child to first child ( temp float) -0:47 'i1' ( global float) -0:47 Test condition and select ( temp float) -0:47 Condition -0:47 'gl_FrontFacing' ( gl_FrontFacing bool Face) -0:47 true case -0:47 Constant: -0:47 -2.000000 -0:47 false case -0:47 Constant: -0:47 2.000000 +0:23 Sequence +0:23 move second child to first child ( temp float) +0:23 'patch' ( global float) +0:23 Constant: +0:23 3.100000 0:48 Sequence 0:48 move second child to first child ( temp float) -0:48 'i2' ( global float) -0:48 Constant: -0:48 102.000000 +0:48 'i1' ( global float) +0:48 Test condition and select ( temp float) +0:48 Condition +0:48 'gl_FrontFacing' ( gl_FrontFacing bool Face) +0:48 true case +0:48 Constant: +0:48 -2.000000 +0:48 false case +0:48 Constant: +0:48 2.000000 +0:49 Sequence +0:49 move second child to first child ( temp float) +0:49 'i2' ( global float) +0:49 Constant: +0:49 102.000000 0:? Linker Objects 0:? 'v' ( smooth in 4-component vector of float) 0:? 'i' ( smooth in 4-component vector of float) diff --git a/Test/baseResults/atomic_uint.frag.out b/Test/baseResults/atomic_uint.frag.out index c705a063..a0c6773b 100644 --- a/Test/baseResults/atomic_uint.frag.out +++ b/Test/baseResults/atomic_uint.frag.out @@ -1,64 +1,65 @@ atomic_uint.frag -ERROR: 0:10: 'atomic_uint' : samplers and atomic_uints cannot be output parameters -ERROR: 0:12: 'return' : type does not match, or is not convertible to, the function's return type -ERROR: 0:18: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: non_uniform_counter -ERROR: 0:23: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings -ERROR: 0:28: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( binding=0 offset=0) uniform atomic_uint' and a right operand of type 'layout( binding=0 offset=0) uniform atomic_uint' (or there is no acceptable conversion) -ERROR: 0:29: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( binding=0 offset=0) uniform atomic_uint (or there is no acceptable conversion) -ERROR: 0:31: '[]' : scalar integer expression required -ERROR: 0:34: 'assign' : l-value required "counter" (can't modify a uniform) -ERROR: 0:34: 'assign' : cannot convert from ' const int' to 'layout( binding=0 offset=0) uniform atomic_uint' -ERROR: 0:37: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: acin -ERROR: 0:38: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: acg -ERROR: 0:47: 'offset' : atomic counters sharing the same offset: 12 -ERROR: 0:48: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings -ERROR: 13 compilation errors. No code generated. +ERROR: 0:4: 'counter' : redefinition +ERROR: 0:11: 'atomic_uint' : samplers and atomic_uints cannot be output parameters +ERROR: 0:13: 'return' : type does not match, or is not convertible to, the function's return type +ERROR: 0:19: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: non_uniform_counter +ERROR: 0:24: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings +ERROR: 0:29: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( binding=0 offset=0) uniform atomic_uint' and a right operand of type 'layout( binding=0 offset=0) uniform atomic_uint' (or there is no acceptable conversion) +ERROR: 0:30: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( binding=0 offset=0) uniform atomic_uint (or there is no acceptable conversion) +ERROR: 0:32: '[]' : scalar integer expression required +ERROR: 0:35: 'assign' : l-value required "counter" (can't modify a uniform) +ERROR: 0:35: 'assign' : cannot convert from ' const int' to 'layout( binding=0 offset=0) uniform atomic_uint' +ERROR: 0:38: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: acin +ERROR: 0:39: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: acg +ERROR: 0:48: 'offset' : atomic counters sharing the same offset: 12 +ERROR: 0:49: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings +ERROR: 14 compilation errors. No code generated. Shader version: 420 ERROR: node is still EOpNull! -0:5 Function Definition: func(au1; ( global uint) -0:5 Function Parameters: -0:5 'c' ( in atomic_uint) -0:7 Sequence -0:7 Branch: Return with expression -0:7 AtomicCounterIncrement ( global uint) -0:7 'c' ( in atomic_uint) -0:10 Function Definition: func2(au1; ( global uint) -0:10 Function Parameters: -0:10 'c' ( out atomic_uint) -0:12 Sequence -0:12 Branch: Return with expression -0:12 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:6 Function Definition: func(au1; ( global uint) +0:6 Function Parameters: +0:6 'c' ( in atomic_uint) +0:8 Sequence +0:8 Branch: Return with expression +0:8 AtomicCounterIncrement ( global uint) +0:8 'c' ( in atomic_uint) +0:11 Function Definition: func2(au1; ( global uint) +0:11 Function Parameters: +0:11 'c' ( out atomic_uint) +0:13 Sequence 0:13 Branch: Return with expression -0:13 AtomicCounter ( global uint) -0:13 'counter' (layout( binding=0 offset=0) uniform atomic_uint) -0:16 Function Definition: main( ( global void) -0:16 Function Parameters: +0:13 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:14 Branch: Return with expression +0:14 AtomicCounter ( global uint) +0:14 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:17 Function Definition: main( ( global void) +0:17 Function Parameters: 0:? Sequence -0:19 Sequence -0:19 move second child to first child ( temp uint) -0:19 'val' ( temp uint) -0:19 AtomicCounter ( global uint) -0:19 'counter' (layout( binding=0 offset=0) uniform atomic_uint) -0:20 AtomicCounterDecrement ( global uint) -0:20 'counter' (layout( binding=0 offset=0) uniform atomic_uint) -0:26 Function Definition: opac( ( global void) -0:26 Function Parameters: -0:28 Sequence -0:28 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:20 Sequence +0:20 move second child to first child ( temp uint) +0:20 'val' ( temp uint) +0:20 AtomicCounter ( global uint) +0:20 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:21 AtomicCounterDecrement ( global uint) +0:21 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:27 Function Definition: opac( ( global void) +0:27 Function Parameters: +0:29 Sequence 0:29 'counter' (layout( binding=0 offset=0) uniform atomic_uint) -0:31 indirect index ( temp int) -0:31 'a' ( temp 3-element array of int) -0:31 'counter' (layout( binding=0 offset=0) uniform atomic_uint) -0:32 direct index (layout( binding=1 offset=3) temp atomic_uint) -0:32 'countArr' (layout( binding=1 offset=3) uniform 4-element array of atomic_uint) -0:32 Constant: -0:32 2 (const int) -0:33 indirect index (layout( binding=1 offset=3) temp atomic_uint) +0:30 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:32 indirect index ( temp int) +0:32 'a' ( temp 3-element array of int) +0:32 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:33 direct index (layout( binding=1 offset=3) temp atomic_uint) 0:33 'countArr' (layout( binding=1 offset=3) uniform 4-element array of atomic_uint) -0:33 'i' ( uniform int) -0:34 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:33 Constant: +0:33 2 (const int) +0:34 indirect index (layout( binding=1 offset=3) temp atomic_uint) +0:34 'countArr' (layout( binding=1 offset=3) uniform 4-element array of atomic_uint) +0:34 'i' ( uniform int) +0:35 'counter' (layout( binding=0 offset=0) uniform atomic_uint) 0:? Linker Objects 0:? 'counter' (layout( binding=0 offset=0) uniform atomic_uint) 0:? 'countArr' (layout( binding=1 offset=3) uniform 4-element array of atomic_uint) @@ -68,8 +69,8 @@ ERROR: node is still EOpNull! 0:? 'aNoBind' ( uniform atomic_uint) 0:? 'aOffset' (layout( binding=0 offset=32) uniform atomic_uint) 0:? 'bar3' (layout( binding=0 offset=4) uniform atomic_uint) -0:? 'ac' (layout( binding=0 offset=8) uniform 3-element array of atomic_uint) -0:? 'ad' (layout( binding=0 offset=20) uniform atomic_uint) +0:? 'ac' (layout( binding=0 offset=8) uniform 2-element array of atomic_uint) +0:? 'ad' (layout( binding=0 offset=16) uniform atomic_uint) 0:? 'bar4' (layout( offset=8) uniform atomic_uint) 0:? 'overlap' (layout( binding=0 offset=12) uniform atomic_uint) 0:? 'bigBind' (layout( binding=20) uniform atomic_uint) @@ -80,16 +81,16 @@ Linked fragment stage: Shader version: 420 ERROR: node is still EOpNull! -0:16 Function Definition: main( ( global void) -0:16 Function Parameters: +0:17 Function Definition: main( ( global void) +0:17 Function Parameters: 0:? Sequence -0:19 Sequence -0:19 move second child to first child ( temp uint) -0:19 'val' ( temp uint) -0:19 AtomicCounter ( global uint) -0:19 'counter' (layout( binding=0 offset=0) uniform atomic_uint) -0:20 AtomicCounterDecrement ( global uint) -0:20 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:20 Sequence +0:20 move second child to first child ( temp uint) +0:20 'val' ( temp uint) +0:20 AtomicCounter ( global uint) +0:20 'counter' (layout( binding=0 offset=0) uniform atomic_uint) +0:21 AtomicCounterDecrement ( global uint) +0:21 'counter' (layout( binding=0 offset=0) uniform atomic_uint) 0:? Linker Objects 0:? 'counter' (layout( binding=0 offset=0) uniform atomic_uint) 0:? 'countArr' (layout( binding=1 offset=3) uniform 4-element array of atomic_uint) @@ -99,8 +100,8 @@ ERROR: node is still EOpNull! 0:? 'aNoBind' ( uniform atomic_uint) 0:? 'aOffset' (layout( binding=0 offset=32) uniform atomic_uint) 0:? 'bar3' (layout( binding=0 offset=4) uniform atomic_uint) -0:? 'ac' (layout( binding=0 offset=8) uniform 3-element array of atomic_uint) -0:? 'ad' (layout( binding=0 offset=20) uniform atomic_uint) +0:? 'ac' (layout( binding=0 offset=8) uniform 2-element array of atomic_uint) +0:? 'ad' (layout( binding=0 offset=16) uniform atomic_uint) 0:? 'bar4' (layout( offset=8) uniform atomic_uint) 0:? 'overlap' (layout( binding=0 offset=12) uniform atomic_uint) 0:? 'bigBind' (layout( binding=20) uniform atomic_uint) diff --git a/Test/baseResults/hlsl.int.dot.frag.out b/Test/baseResults/hlsl.int.dot.frag.out index a691836f..7ea22a14 100644 --- a/Test/baseResults/hlsl.int.dot.frag.out +++ b/Test/baseResults/hlsl.int.dot.frag.out @@ -295,7 +295,7 @@ gl_FragCoord origin is upper left 39: 17(ivec2) Load 19(i3) 40: 17(ivec2) IMul 38 39 41: 11(int) CompositeExtract 40 0 - 42: 11(int) CompositeExtract 38 1 + 42: 11(int) CompositeExtract 40 1 43: 11(int) IAdd 41 42 44: 17(ivec2) CompositeConstruct 43 43 Store 19(i3) 44 @@ -303,9 +303,9 @@ gl_FragCoord origin is upper left 46: 22(ivec3) Load 24(i4) 47: 22(ivec3) IMul 45 46 48: 11(int) CompositeExtract 47 0 - 49: 11(int) CompositeExtract 45 1 + 49: 11(int) CompositeExtract 47 1 50: 11(int) IAdd 48 49 - 51: 11(int) CompositeExtract 45 2 + 51: 11(int) CompositeExtract 47 2 52: 11(int) IAdd 50 51 53: 22(ivec3) CompositeConstruct 52 52 52 Store 24(i4) 53 @@ -313,11 +313,11 @@ gl_FragCoord origin is upper left 55: 27(ivec4) Load 29(i5) 56: 27(ivec4) IMul 54 55 57: 11(int) CompositeExtract 56 0 - 58: 11(int) CompositeExtract 54 1 + 58: 11(int) CompositeExtract 56 1 59: 11(int) IAdd 57 58 - 60: 11(int) CompositeExtract 54 2 + 60: 11(int) CompositeExtract 56 2 61: 11(int) IAdd 59 60 - 62: 11(int) CompositeExtract 54 3 + 62: 11(int) CompositeExtract 56 3 63: 11(int) IAdd 61 62 64: 27(ivec4) CompositeConstruct 63 63 63 63 Store 29(i5) 64 diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index c14a039b..90106d92 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -5178,19 +5178,25 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "flat in int gl_PrimitiveID;" ); - if (version >= 400) { + if (version >= 130) { // ARB_sample_shading stageBuiltins[EShLangFragment].append( "flat in int gl_SampleID;" " in vec2 gl_SamplePosition;" - "flat in int gl_SampleMaskIn[];" " out int gl_SampleMask[];" ); - if (spvVersion.spv == 0) + + if (spvVersion.spv == 0) { stageBuiltins[EShLangFragment].append( "uniform int gl_NumSamples;" - ); + ); + } } + if (version >= 400) + stageBuiltins[EShLangFragment].append( + "flat in int gl_SampleMaskIn[];" + ); + if (version >= 430) stageBuiltins[EShLangFragment].append( "flat in int gl_Layer;" @@ -7422,18 +7428,29 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_FragStencilRefARB", EbvFragStencilRef, symbolTable); } - if ((profile != EEsProfile && version >= 400) || + if ((profile != EEsProfile && version >= 130) || (profile == EEsProfile && version >= 310)) { - BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable); - BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable); - BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable); - BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable); - if (profile == EEsProfile && version < 320) { - symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_OES_sample_variables); - symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_OES_sample_variables); + BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable); + BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable); + BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable); + + if (profile != EEsProfile && version < 400) { + BuiltInVariable("gl_NumSamples", EbvSampleMask, symbolTable); + + symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_ARB_sample_shading); + symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_ARB_sample_shading); + symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_ARB_sample_shading); + symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_ARB_sample_shading); + } else { + BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable); + + if (profile == EEsProfile && version < 320) { + symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables); + symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables); + symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables); + symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_OES_sample_variables); + symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_OES_sample_variables); + } } } diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index acdb9f78..b9ab5c82 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -6035,6 +6035,10 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) offset = qualifier.layoutOffset; else offset = atomicUintOffsets[qualifier.layoutBinding]; + + if (offset % 4 != 0) + error(loc, "atomic counters offset should align based on 4:", "offset", "%d", offset); + symbol.getWritableType().getQualifier().layoutOffset = offset; // Check for overlap diff --git a/glslang/MachineIndependent/Scan.cpp b/glslang/MachineIndependent/Scan.cpp index 75cc475e..710af4ab 100644 --- a/glslang/MachineIndependent/Scan.cpp +++ b/glslang/MachineIndependent/Scan.cpp @@ -1421,6 +1421,9 @@ int TScanContext::tokenizeIdentifier() afterType = true; if (parseContext.isEsProfile() && parseContext.version >= 310) return keyword; + if (!parseContext.isEsProfile() && (parseContext.version > 140 || + (parseContext.version == 140 && parseContext.extensionsTurnedOn(1, &E_GL_ARB_texture_multisample)))) + return keyword; return es30ReservedFromGLSL(150); case SAMPLER2DMSARRAY: @@ -1430,6 +1433,9 @@ int TScanContext::tokenizeIdentifier() if ((parseContext.isEsProfile() && parseContext.version >= 320) || parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array)) return keyword; + if (!parseContext.isEsProfile() && (parseContext.version > 140 || + (parseContext.version == 140 && parseContext.extensionsTurnedOn(1, &E_GL_ARB_texture_multisample)))) + return keyword; return es30ReservedFromGLSL(150); case SAMPLER1D: diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index e3be9377..23f74232 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -172,6 +172,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_tessellation_shader] = EBhDisable; extensionBehavior[E_GL_ARB_enhanced_layouts] = EBhDisable; extensionBehavior[E_GL_ARB_texture_cube_map_array] = EBhDisable; + extensionBehavior[E_GL_ARB_texture_multisample] = EBhDisable; extensionBehavior[E_GL_ARB_shader_texture_lod] = EBhDisable; extensionBehavior[E_GL_ARB_explicit_attrib_location] = EBhDisable; extensionBehavior[E_GL_ARB_explicit_uniform_location] = EBhDisable; @@ -193,6 +194,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_fragment_shader_interlock] = EBhDisable; extensionBehavior[E_GL_ARB_shader_clock] = EBhDisable; extensionBehavior[E_GL_ARB_uniform_buffer_object] = EBhDisable; + extensionBehavior[E_GL_ARB_sample_shading] = EBhDisable; extensionBehavior[E_GL_KHR_shader_subgroup_basic] = EBhDisable; extensionBehavior[E_GL_KHR_shader_subgroup_vote] = EBhDisable; @@ -380,6 +382,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_ARB_tessellation_shader 1\n" "#define GL_ARB_enhanced_layouts 1\n" "#define GL_ARB_texture_cube_map_array 1\n" + "#define GL_ARB_texture_multisample 1\n" "#define GL_ARB_shader_texture_lod 1\n" "#define GL_ARB_explicit_attrib_location 1\n" "#define GL_ARB_explicit_uniform_location 1\n" @@ -395,6 +398,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_ARB_sparse_texture2 1\n" "#define GL_ARB_sparse_texture_clamp 1\n" "#define GL_ARB_shader_stencil_export 1\n" + "#define GL_ARB_sample_shading 1\n" // "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members "#define GL_ARB_post_depth_coverage 1\n" "#define GL_ARB_fragment_shader_interlock 1\n" diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 4e189c1c..d319a2d5 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -124,6 +124,7 @@ const char* const E_GL_ARB_compute_shader = "GL_ARB_compute_shader const char* const E_GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader"; const char* const E_GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts"; const char* const E_GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array"; +const char* const E_GL_ARB_texture_multisample = "GL_ARB_texture_multisample"; const char* const E_GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod"; const char* const E_GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location"; const char* const E_GL_ARB_explicit_uniform_location = "GL_ARB_explicit_uniform_location"; @@ -145,6 +146,7 @@ const char* const E_GL_ARB_shader_viewport_layer_array = "GL_ARB_shader_viewpor const char* const E_GL_ARB_fragment_shader_interlock = "GL_ARB_fragment_shader_interlock"; const char* const E_GL_ARB_shader_clock = "GL_ARB_shader_clock"; const char* const E_GL_ARB_uniform_buffer_object = "GL_ARB_uniform_buffer_object"; +const char* const E_GL_ARB_sample_shading = "GL_ARB_sample_shading"; const char* const E_GL_KHR_shader_subgroup_basic = "GL_KHR_shader_subgroup_basic"; const char* const E_GL_KHR_shader_subgroup_vote = "GL_KHR_shader_subgroup_vote";