From e3933d684d1ba9ace006fe4693a5688e90cec804 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Wed, 15 Jul 2015 19:42:59 -0600 Subject: [PATCH] Front-end: Implement GL_OES_gpu_shader5. --- Test/310.frag | 33 +- Test/310.vert | 42 +++ Test/baseResults/300.frag.out | 2 +- Test/baseResults/300block.frag.out | 2 +- Test/baseResults/310.frag.out | 246 +++++++++++- Test/baseResults/310.tesc.out | 16 +- Test/baseResults/310.vert.out | 350 +++++++++++++++++- .../preprocessor.extensions.vert.err | 1 - Test/baseResults/preprocessor.line.frag.err | 4 +- Test/baseResults/preprocessor.line.frag.out | 10 +- Test/baseResults/preprocessor.line.vert.out | 78 ++-- glslang/MachineIndependent/Initialize.cpp | 66 ++-- glslang/MachineIndependent/ParseHelper.cpp | 17 +- glslang/MachineIndependent/Scan.cpp | 12 +- glslang/MachineIndependent/SymbolTable.h | 6 +- glslang/MachineIndependent/Versions.cpp | 4 +- 16 files changed, 785 insertions(+), 104 deletions(-) diff --git a/Test/310.frag b/Test/310.frag index d33de94b..83aa8b03 100644 --- a/Test/310.frag +++ b/Test/310.frag @@ -30,11 +30,11 @@ void main() iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), i); // ERROR, last argument not const iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 4); // ERROR, last argument out of range iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 1+2); - iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i)); + iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(0.5)); + iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i)); // ERROR, offset not constant } out vec4 outp; - void foo23() { const ivec2[3] offsets = ivec2[3](ivec2(1,2), ivec2(3,4), ivec2(15,16)); @@ -193,3 +193,32 @@ void foo_GS() highp int l = gl_Layer; highp int p = gl_PrimitiveID; } + +in vec2 inf, ing; +uniform ivec2 offsets[4]; +uniform sampler2D sArray[4]; +uniform int sIndex; +layout(binding = 0) uniform atomic_uint auArray[2]; +uniform ubName { int i; } ubInst[4]; +buffer bbName { int i; } bbInst[4]; +uniform writeonly image2D iArray[5]; +const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4)); + +void pfooBad() +{ + precise vec2 h; // ERROR reserved + h = fma(inf, ing, h); // ERROR, not available + textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); // ERROR, offset not constant + textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); // ERROR, not available +} + +#extension GL_OES_gpu_shader5 : enable + +void pfoo() +{ + precise vec2 h; + h = fma(inf, ing, h); + textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); + textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); + textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant +} diff --git a/Test/310.vert b/Test/310.vert index 647d6709..d1bfc48f 100644 --- a/Test/310.vert +++ b/Test/310.vert @@ -139,3 +139,45 @@ centroid out cmo { // ERROR, no centroid on a block invariant out imo { // ERROR, no invariant on a block int i; } imon; + +in vec2 inf, ing; +uniform ivec2 offsets[4]; +uniform sampler2D sArray[4]; +uniform int sIndex; +layout(binding = 0) uniform atomic_uint auArray[2]; +uniform ubName { int i; } ubInst[4]; +buffer bbName { int i; } bbInst[4]; +uniform writeonly image2D iArray[5]; +const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4)); + +void pfooBad() +{ + precise vec2 h; // ERROR reserved + h = fma(inf, ing, h); // ERROR, not available + sArray[sIndex + 1]; // ERRRO, not supported + auArray[sIndex + 1]; + ubInst[1]; + bbInst[2]; + ubInst[sIndex + 1]; // ERRRO, not supported + bbInst[sIndex]; // ERRRO, not supported + iArray[2]; + iArray[sIndex * 2]; // ERRRO, not supported + textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); // ERROR, offset not constant + textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); // ERROR, not available +} + +#extension GL_OES_gpu_shader5 : enable + +void pfoo() +{ + precise vec2 h; + h = fma(inf, ing, h); + sArray[sIndex + 1]; + ubInst[sIndex + 1]; + bbInst[sIndex - 2]; // ERROR, still not supported + iArray[2]; + iArray[sIndex - 2]; + textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf)); + textureGatherOffsets(sArray[0], vec2(0.1), constOffsets); + textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant +} diff --git a/Test/baseResults/300.frag.out b/Test/baseResults/300.frag.out index cfe171ba..1d1d533b 100644 --- a/Test/baseResults/300.frag.out +++ b/Test/baseResults/300.frag.out @@ -10,7 +10,7 @@ ERROR: 0:63: 'texel offset' : argument must be compile-time constant ERROR: 0:64: 'texel offset' : argument must be compile-time constant ERROR: 0:66: 'texel offset' : argument must be compile-time constant ERROR: 0:68: 'texel offset' : argument must be compile-time constant -ERROR: 0:69: 'variable indexing sampler array' : not supported with this profile: es +ERROR: 0:69: 'variable indexing sampler array' : not supported for this version or the enabled extensions ERROR: 0:73: 'texel offset' : argument must be compile-time constant ERROR: 0:83: 'double' : Reserved word. ERROR: 0:83: 'double' : not supported with this profile: es diff --git a/Test/baseResults/300block.frag.out b/Test/baseResults/300block.frag.out index e8aa6bc3..b787964c 100644 --- a/Test/baseResults/300block.frag.out +++ b/Test/baseResults/300block.frag.out @@ -2,7 +2,7 @@ ERROR: 0:10: '' : cannot nest a structure definition inside a structure or block ERROR: 0:21: '' : cannot nest a structure definition inside a structure or block ERROR: 0:20: 'sampler' : member of block cannot be a sampler type -ERROR: 0:45: 'variable indexing block array' : not supported with this profile: es +ERROR: 0:45: 'variable indexing uniform block array' : not supported for this version or the enabled extensions ERROR: 4 compilation errors. No code generated. diff --git a/Test/baseResults/310.frag.out b/Test/baseResults/310.frag.out index 0764d550..7676e706 100644 --- a/Test/baseResults/310.frag.out +++ b/Test/baseResults/310.frag.out @@ -7,11 +7,12 @@ ERROR: 0:8: 'gl_FragCoord' : identifiers starting with "gl_" are reserved ERROR: 0:11: 'location' : overlapping use of location 2 ERROR: 0:15: 'usampler2DRect' : Reserved word. ERROR: 0:15: 'sampler/image' : type requires declaration of default precision qualifier -ERROR: 0:23: 'variable indexing sampler array' : not supported with this profile: es +ERROR: 0:23: 'variable indexing sampler array' : not supported for this version or the enabled extensions ERROR: 0:27: 'textureGatherOffsets' : no matching overloaded function found ERROR: 0:27: '=' : cannot convert from 'const float' to 'temp mediump 4-component vector of uint' ERROR: 0:30: 'textureGatherOffset(...)' : must be a compile-time constant: component argument ERROR: 0:31: 'textureGatherOffset(...)' : must be 0, 1, 2, or 3: component argument +ERROR: 0:34: 'non-constant offset argument' : not supported for this version or the enabled extensions ERROR: 0:42: 'texel offset' : argument must be compile-time constant ERROR: 0:44: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset] ERROR: 0:44: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset] @@ -49,7 +50,7 @@ ERROR: 0:148: 'inbname2' : Cannot reuse block name within the same interface: in ERROR: 0:153: 'badmember' : nameless block contains a member that already has a name at global scope ERROR: 0:157: 'inbname' : redefinition ERROR: 0:159: 'vAnon' : redefinition -ERROR: 0:169: 'variable indexing block array' : not supported with this profile: es +ERROR: 0:169: 'variable indexing in/out block array' : not supported with this profile: es ERROR: 0:173: 'origin_upper_left' : not supported with this profile: es ERROR: 0:173: 'pixel_center_integer' : not supported with this profile: es ERROR: 0:173: 'redeclaration' : cannot redeclare with different qualification: gl_FragCoord @@ -61,12 +62,22 @@ GL_OES_geometry_shader ERROR: 0:183: 'gl_PrimitiveID' : required extension not requested: Possible extensions include: GL_EXT_geometry_shader GL_OES_geometry_shader -ERROR: 56 compilation errors. No code generated. +ERROR: 0:209: 'precise' : Reserved word. +ERROR: 0:210: 'fma' : required extension not requested: Possible extensions include: +GL_EXT_gpu_shader5 +GL_OES_gpu_shader5 +ERROR: 0:211: 'non-constant offset argument' : not supported for this version or the enabled extensions +ERROR: 0:212: 'textureGatherOffsets' : required extension not requested: Possible extensions include: +GL_EXT_gpu_shader5 +GL_OES_gpu_shader5 +ERROR: 0:223: 'textureGatherOffsets(...)' : must be a compile-time constant: offsets argument +ERROR: 62 compilation errors. No code generated. Shader version: 310 Requested GL_EXT_shader_io_blocks Requested GL_OES_geometry_shader +Requested GL_OES_gpu_shader5 Requested GL_OES_shader_io_blocks gl_FragCoord pixel center is integer gl_FragCoord origin is upper left @@ -153,8 +164,19 @@ ERROR: node is still EOpNull! 0:33 0.100000 0:33 0.100000 0:33 0.100000 -0:33 Construct ivec2 (temp 2-component vector of int) -0:33 'i' (uniform mediump int) +0:33 Constant: +0:33 0 (const int) +0:33 0 (const int) +0:34 move second child to first child (temp mediump 4-component vector of int) +0:34 'iv4' (temp mediump 4-component vector of int) +0:34 Function Call: textureGatherOffset(isA21;vf3;vi2; (global mediump 4-component vector of int) +0:34 'isamp2DA' (uniform highp isampler2DArray) +0:34 Constant: +0:34 0.100000 +0:34 0.100000 +0:34 0.100000 +0:34 Construct ivec2 (temp 2-component vector of int) +0:34 'i' (uniform mediump int) 0:38 Function Definition: foo23( (global void) 0:38 Function Parameters: 0:? Sequence @@ -341,6 +363,87 @@ ERROR: node is still EOpNull! 0:194 move second child to first child (temp highp int) 0:194 'p' (temp highp int) 0:194 'gl_PrimitiveID' (flat in highp int PrimitiveID) +0:207 Function Definition: pfooBad( (global void) +0:207 Function Parameters: +0:? Sequence +0:210 move second child to first child (temp mediump 2-component vector of float) +0:210 'h' (temp mediump 2-component vector of float) +0:210 Function Call: fma(vf2;vf2;vf2; (global mediump 2-component vector of float) +0:210 'inf' (smooth in mediump 2-component vector of float) +0:210 'ing' (smooth in mediump 2-component vector of float) +0:210 'h' (temp mediump 2-component vector of float) +0:211 Function Call: textureGatherOffset(s21;vf2;vi2; (global highp 4-component vector of float) +0:211 direct index (temp highp sampler2D) +0:211 'sArray' (uniform 4-element array of highp sampler2D) +0:211 Constant: +0:211 0 (const int) +0:211 Constant: +0:211 0.100000 +0:211 0.100000 +0:211 Convert float to int (temp 2-component vector of int) +0:211 'inf' (smooth in mediump 2-component vector of float) +0:212 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:212 direct index (temp highp sampler2D) +0:212 'sArray' (uniform 4-element array of highp sampler2D) +0:212 Constant: +0:212 0 (const int) +0:212 Constant: +0:212 0.100000 +0:212 0.100000 +0:212 Constant: +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:217 Function Definition: pfoo( (global void) +0:217 Function Parameters: +0:? Sequence +0:220 move second child to first child (temp mediump 2-component vector of float) +0:220 'h' (temp mediump 2-component vector of float) +0:220 Function Call: fma(vf2;vf2;vf2; (global mediump 2-component vector of float) +0:220 'inf' (smooth in mediump 2-component vector of float) +0:220 'ing' (smooth in mediump 2-component vector of float) +0:220 'h' (temp mediump 2-component vector of float) +0:221 Function Call: textureGatherOffset(s21;vf2;vi2; (global highp 4-component vector of float) +0:221 direct index (temp highp sampler2D) +0:221 'sArray' (uniform 4-element array of highp sampler2D) +0:221 Constant: +0:221 0 (const int) +0:221 Constant: +0:221 0.100000 +0:221 0.100000 +0:221 Convert float to int (temp 2-component vector of int) +0:221 'inf' (smooth in mediump 2-component vector of float) +0:222 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:222 direct index (temp highp sampler2D) +0:222 'sArray' (uniform 4-element array of highp sampler2D) +0:222 Constant: +0:222 0 (const int) +0:222 Constant: +0:222 0.100000 +0:222 0.100000 +0:222 Constant: +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:223 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:223 direct index (temp highp sampler2D) +0:223 'sArray' (uniform 4-element array of highp sampler2D) +0:223 Constant: +0:223 0 (const int) +0:223 Constant: +0:223 0.100000 +0:223 0.100000 +0:223 'offsets' (uniform 4-element array of mediump 2-component vector of int) 0:? Linker Objects 0:? 'gl_FragCoord' (smooth in mediump 4-component vector of float) 0:? 'v3' (layout(location=2 ) smooth in mediump 3-component vector of float) @@ -389,6 +492,24 @@ ERROR: node is still EOpNull! 0:? 'arrayedInst' (in 4-element array of block{in mediump float f}) 0:? 'gl_FragDepth' (gl_FragDepth highp float FragDepth) 0:? 'gl_FragDepth' (gl_FragDepth highp float FragDepth) +0:? 'inf' (smooth in mediump 2-component vector of float) +0:? 'ing' (smooth in mediump 2-component vector of float) +0:? 'offsets' (uniform 4-element array of mediump 2-component vector of int) +0:? 'sArray' (uniform 4-element array of highp sampler2D) +0:? 'sIndex' (uniform mediump int) +0:? 'auArray' (layout(binding=0 offset=0 ) uniform 2-element array of highp atomic_uint) +0:? 'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform mediump int i}) +0:? 'bbInst' (layout(column_major shared ) buffer 4-element array of block{layout(column_major shared ) buffer mediump int i}) +0:? 'iArray' (writeonly uniform 5-element array of highp image2D) +0:? 'constOffsets' (const 4-element array of mediump 2-component vector of int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) Linked fragment stage: @@ -398,6 +519,7 @@ ERROR: Linking fragment stage: when more than one fragment shader output, all mu Shader version: 310 Requested GL_EXT_shader_io_blocks Requested GL_OES_geometry_shader +Requested GL_OES_gpu_shader5 Requested GL_OES_shader_io_blocks gl_FragCoord pixel center is integer gl_FragCoord origin is upper left @@ -484,8 +606,19 @@ ERROR: node is still EOpNull! 0:33 0.100000 0:33 0.100000 0:33 0.100000 -0:33 Construct ivec2 (temp 2-component vector of int) -0:33 'i' (uniform mediump int) +0:33 Constant: +0:33 0 (const int) +0:33 0 (const int) +0:34 move second child to first child (temp mediump 4-component vector of int) +0:34 'iv4' (temp mediump 4-component vector of int) +0:34 Function Call: textureGatherOffset(isA21;vf3;vi2; (global mediump 4-component vector of int) +0:34 'isamp2DA' (uniform highp isampler2DArray) +0:34 Constant: +0:34 0.100000 +0:34 0.100000 +0:34 0.100000 +0:34 Construct ivec2 (temp 2-component vector of int) +0:34 'i' (uniform mediump int) 0:38 Function Definition: foo23( (global void) 0:38 Function Parameters: 0:? Sequence @@ -672,6 +805,87 @@ ERROR: node is still EOpNull! 0:194 move second child to first child (temp highp int) 0:194 'p' (temp highp int) 0:194 'gl_PrimitiveID' (flat in highp int PrimitiveID) +0:207 Function Definition: pfooBad( (global void) +0:207 Function Parameters: +0:? Sequence +0:210 move second child to first child (temp mediump 2-component vector of float) +0:210 'h' (temp mediump 2-component vector of float) +0:210 Function Call: fma(vf2;vf2;vf2; (global mediump 2-component vector of float) +0:210 'inf' (smooth in mediump 2-component vector of float) +0:210 'ing' (smooth in mediump 2-component vector of float) +0:210 'h' (temp mediump 2-component vector of float) +0:211 Function Call: textureGatherOffset(s21;vf2;vi2; (global highp 4-component vector of float) +0:211 direct index (temp highp sampler2D) +0:211 'sArray' (uniform 4-element array of highp sampler2D) +0:211 Constant: +0:211 0 (const int) +0:211 Constant: +0:211 0.100000 +0:211 0.100000 +0:211 Convert float to int (temp 2-component vector of int) +0:211 'inf' (smooth in mediump 2-component vector of float) +0:212 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:212 direct index (temp highp sampler2D) +0:212 'sArray' (uniform 4-element array of highp sampler2D) +0:212 Constant: +0:212 0 (const int) +0:212 Constant: +0:212 0.100000 +0:212 0.100000 +0:212 Constant: +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:212 0 (const int) +0:217 Function Definition: pfoo( (global void) +0:217 Function Parameters: +0:? Sequence +0:220 move second child to first child (temp mediump 2-component vector of float) +0:220 'h' (temp mediump 2-component vector of float) +0:220 Function Call: fma(vf2;vf2;vf2; (global mediump 2-component vector of float) +0:220 'inf' (smooth in mediump 2-component vector of float) +0:220 'ing' (smooth in mediump 2-component vector of float) +0:220 'h' (temp mediump 2-component vector of float) +0:221 Function Call: textureGatherOffset(s21;vf2;vi2; (global highp 4-component vector of float) +0:221 direct index (temp highp sampler2D) +0:221 'sArray' (uniform 4-element array of highp sampler2D) +0:221 Constant: +0:221 0 (const int) +0:221 Constant: +0:221 0.100000 +0:221 0.100000 +0:221 Convert float to int (temp 2-component vector of int) +0:221 'inf' (smooth in mediump 2-component vector of float) +0:222 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:222 direct index (temp highp sampler2D) +0:222 'sArray' (uniform 4-element array of highp sampler2D) +0:222 Constant: +0:222 0 (const int) +0:222 Constant: +0:222 0.100000 +0:222 0.100000 +0:222 Constant: +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:222 0 (const int) +0:223 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:223 direct index (temp highp sampler2D) +0:223 'sArray' (uniform 4-element array of highp sampler2D) +0:223 Constant: +0:223 0 (const int) +0:223 Constant: +0:223 0.100000 +0:223 0.100000 +0:223 'offsets' (uniform 4-element array of mediump 2-component vector of int) 0:? Linker Objects 0:? 'gl_FragCoord' (smooth in mediump 4-component vector of float) 0:? 'v3' (layout(location=2 ) smooth in mediump 3-component vector of float) @@ -720,4 +934,22 @@ ERROR: node is still EOpNull! 0:? 'arrayedInst' (in 4-element array of block{in mediump float f}) 0:? 'gl_FragDepth' (gl_FragDepth highp float FragDepth) 0:? 'gl_FragDepth' (gl_FragDepth highp float FragDepth) +0:? 'inf' (smooth in mediump 2-component vector of float) +0:? 'ing' (smooth in mediump 2-component vector of float) +0:? 'offsets' (uniform 4-element array of mediump 2-component vector of int) +0:? 'sArray' (uniform 4-element array of highp sampler2D) +0:? 'sIndex' (uniform mediump int) +0:? 'auArray' (layout(binding=0 offset=0 ) uniform 2-element array of highp atomic_uint) +0:? 'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform mediump int i}) +0:? 'bbInst' (layout(column_major shared ) buffer 4-element array of block{layout(column_major shared ) buffer mediump int i}) +0:? 'iArray' (writeonly uniform 5-element array of highp image2D) +0:? 'constOffsets' (const 4-element array of mediump 2-component vector of int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) diff --git a/Test/baseResults/310.tesc.out b/Test/baseResults/310.tesc.out index c5f31aba..9082e8bf 100644 --- a/Test/baseResults/310.tesc.out +++ b/Test/baseResults/310.tesc.out @@ -31,7 +31,9 @@ ERROR: 0:80: '' : array size required ERROR: 0:86: 'location' : overlapping use of location 4 ERROR: 0:90: 'location' : overlapping use of location 4 ERROR: 0:94: 'precise' : Reserved word. -ERROR: 0:95: 'fma' : no matching overloaded function found +ERROR: 0:95: 'fma' : required extension not requested: Possible extensions include: +GL_EXT_gpu_shader5 +GL_OES_gpu_shader5 ERROR: 0:104: 'sample' : Reserved word. ERROR: 0:106: 'vertices' : can only apply to a standalone qualifier ERROR: 0:107: 'vertices' : inconsistent output number of vertices for array size of misSized @@ -188,8 +190,10 @@ ERROR: node is still EOpNull! 0:? Sequence 0:95 move second child to first child (temp highp float) 0:95 'd' (temp highp float) -0:95 Constant: -0:95 0.000000 +0:95 Function Call: fma(f1;f1;f1; (global highp float) +0:95 'd' (temp highp float) +0:95 'd' (temp highp float) +0:95 'd' (temp highp float) 0:112 Function Definition: pointSize2( (global void) 0:112 Function Parameters: 0:114 Sequence @@ -390,8 +394,10 @@ ERROR: node is still EOpNull! 0:? Sequence 0:95 move second child to first child (temp highp float) 0:95 'd' (temp highp float) -0:95 Constant: -0:95 0.000000 +0:95 Function Call: fma(f1;f1;f1; (global highp float) +0:95 'd' (temp highp float) +0:95 'd' (temp highp float) +0:95 'd' (temp highp float) 0:112 Function Definition: pointSize2( (global void) 0:112 Function Parameters: 0:114 Sequence diff --git a/Test/baseResults/310.vert.out b/Test/baseResults/310.vert.out index 1f12a19d..82a1311d 100644 --- a/Test/baseResults/310.vert.out +++ b/Test/baseResults/310.vert.out @@ -27,10 +27,25 @@ ERROR: 0:127: 'flat/smooth/noperspective' : cannot use interpolation qualifiers ERROR: 0:131: 'flat/smooth/noperspective' : cannot use interpolation qualifiers on an interface block ERROR: 0:135: 'centroid' : cannot use centroid qualifier on an interface block ERROR: 0:139: 'invariant' : cannot use invariant qualifier on an interface block -ERROR: 26 compilation errors. No code generated. +ERROR: 0:155: 'precise' : Reserved word. +ERROR: 0:156: 'fma' : required extension not requested: Possible extensions include: +GL_EXT_gpu_shader5 +GL_OES_gpu_shader5 +ERROR: 0:157: 'variable indexing sampler array' : not supported for this version or the enabled extensions +ERROR: 0:161: 'variable indexing uniform block array' : not supported for this version or the enabled extensions +ERROR: 0:162: 'variable indexing buffer block array' : not supported with this profile: es +ERROR: 0:164: 'variable indexing sampler array' : not supported for this version or the enabled extensions +ERROR: 0:165: 'non-constant offset argument' : not supported for this version or the enabled extensions +ERROR: 0:166: 'textureGatherOffsets' : required extension not requested: Possible extensions include: +GL_EXT_gpu_shader5 +GL_OES_gpu_shader5 +ERROR: 0:177: 'variable indexing buffer block array' : not supported with this profile: es +ERROR: 0:182: 'textureGatherOffsets(...)' : must be a compile-time constant: offsets argument +ERROR: 36 compilation errors. No code generated. Shader version: 310 +Requested GL_OES_gpu_shader5 Requested GL_OES_shader_io_blocks ERROR: node is still EOpNull! 0:12 Function Definition: main( (global void) @@ -202,6 +217,154 @@ ERROR: node is still EOpNull! 0:119 'anon@1' (out block{gl_Position highp 4-component vector of float Position gl_Position, }) 0:119 Constant: 0:119 1 (const uint) +0:153 Function Definition: pfooBad( (global void) +0:153 Function Parameters: +0:? Sequence +0:156 move second child to first child (temp highp 2-component vector of float) +0:156 'h' (temp highp 2-component vector of float) +0:156 Function Call: fma(vf2;vf2;vf2; (global highp 2-component vector of float) +0:156 'inf' (in highp 2-component vector of float) +0:156 'ing' (in highp 2-component vector of float) +0:156 'h' (temp highp 2-component vector of float) +0:157 indirect index (temp highp sampler2D) +0:157 'sArray' (uniform 4-element array of highp sampler2D) +0:157 add (temp highp int) +0:157 'sIndex' (uniform highp int) +0:157 Constant: +0:157 1 (const int) +0:158 indirect index (layout(binding=0 offset=0 ) temp highp atomic_uint) +0:158 'auArray' (layout(binding=0 offset=0 ) uniform 2-element array of highp atomic_uint) +0:158 add (temp highp int) +0:158 'sIndex' (uniform highp int) +0:158 Constant: +0:158 1 (const int) +0:159 direct index (layout(column_major shared ) temp block{layout(column_major shared ) uniform highp int i}) +0:159 'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform highp int i}) +0:159 Constant: +0:159 1 (const int) +0:160 direct index (layout(column_major shared ) temp block{layout(column_major shared ) buffer highp int i}) +0:160 'bbInst' (layout(column_major shared ) buffer 4-element array of block{layout(column_major shared ) buffer highp int i}) +0:160 Constant: +0:160 2 (const int) +0:161 indirect index (layout(column_major shared ) temp block{layout(column_major shared ) uniform highp int i}) +0:161 'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform highp int i}) +0:161 add (temp highp int) +0:161 'sIndex' (uniform highp int) +0:161 Constant: +0:161 1 (const int) +0:162 indirect index (layout(column_major shared ) temp block{layout(column_major shared ) buffer highp int i}) +0:162 'bbInst' (layout(column_major shared ) buffer 4-element array of block{layout(column_major shared ) buffer highp int i}) +0:162 'sIndex' (uniform highp int) +0:163 direct index (writeonly temp highp image2D) +0:163 'iArray' (writeonly uniform 5-element array of highp image2D) +0:163 Constant: +0:163 2 (const int) +0:164 indirect index (writeonly temp highp image2D) +0:164 'iArray' (writeonly uniform 5-element array of highp image2D) +0:164 component-wise multiply (temp highp int) +0:164 'sIndex' (uniform highp int) +0:164 Constant: +0:164 2 (const int) +0:165 Function Call: textureGatherOffset(s21;vf2;vi2; (global highp 4-component vector of float) +0:165 direct index (temp highp sampler2D) +0:165 'sArray' (uniform 4-element array of highp sampler2D) +0:165 Constant: +0:165 0 (const int) +0:165 Constant: +0:165 0.100000 +0:165 0.100000 +0:165 Convert float to int (temp 2-component vector of int) +0:165 'inf' (in highp 2-component vector of float) +0:166 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:166 direct index (temp highp sampler2D) +0:166 'sArray' (uniform 4-element array of highp sampler2D) +0:166 Constant: +0:166 0 (const int) +0:166 Constant: +0:166 0.100000 +0:166 0.100000 +0:166 Constant: +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:171 Function Definition: pfoo( (global void) +0:171 Function Parameters: +0:? Sequence +0:174 move second child to first child (temp highp 2-component vector of float) +0:174 'h' (temp highp 2-component vector of float) +0:174 Function Call: fma(vf2;vf2;vf2; (global highp 2-component vector of float) +0:174 'inf' (in highp 2-component vector of float) +0:174 'ing' (in highp 2-component vector of float) +0:174 'h' (temp highp 2-component vector of float) +0:175 indirect index (temp highp sampler2D) +0:175 'sArray' (uniform 4-element array of highp sampler2D) +0:175 add (temp highp int) +0:175 'sIndex' (uniform highp int) +0:175 Constant: +0:175 1 (const int) +0:176 indirect index (layout(column_major shared ) temp block{layout(column_major shared ) uniform highp int i}) +0:176 'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform highp int i}) +0:176 add (temp highp int) +0:176 'sIndex' (uniform highp int) +0:176 Constant: +0:176 1 (const int) +0:177 indirect index (layout(column_major shared ) temp block{layout(column_major shared ) buffer highp int i}) +0:177 'bbInst' (layout(column_major shared ) buffer 4-element array of block{layout(column_major shared ) buffer highp int i}) +0:177 subtract (temp highp int) +0:177 'sIndex' (uniform highp int) +0:177 Constant: +0:177 2 (const int) +0:178 direct index (writeonly temp highp image2D) +0:178 'iArray' (writeonly uniform 5-element array of highp image2D) +0:178 Constant: +0:178 2 (const int) +0:179 indirect index (writeonly temp highp image2D) +0:179 'iArray' (writeonly uniform 5-element array of highp image2D) +0:179 subtract (temp highp int) +0:179 'sIndex' (uniform highp int) +0:179 Constant: +0:179 2 (const int) +0:180 Function Call: textureGatherOffset(s21;vf2;vi2; (global highp 4-component vector of float) +0:180 direct index (temp highp sampler2D) +0:180 'sArray' (uniform 4-element array of highp sampler2D) +0:180 Constant: +0:180 0 (const int) +0:180 Constant: +0:180 0.100000 +0:180 0.100000 +0:180 Convert float to int (temp 2-component vector of int) +0:180 'inf' (in highp 2-component vector of float) +0:181 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:181 direct index (temp highp sampler2D) +0:181 'sArray' (uniform 4-element array of highp sampler2D) +0:181 Constant: +0:181 0 (const int) +0:181 Constant: +0:181 0.100000 +0:181 0.100000 +0:181 Constant: +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:182 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:182 direct index (temp highp sampler2D) +0:182 'sArray' (uniform 4-element array of highp sampler2D) +0:182 Constant: +0:182 0 (const int) +0:182 Constant: +0:182 0.100000 +0:182 0.100000 +0:182 'offsets' (uniform 4-element array of highp 2-component vector of int) 0:? Linker Objects 0:? 's' (shared highp 4-component vector of float) 0:? 'v' (buffer highp 4-component vector of float) @@ -233,6 +396,24 @@ ERROR: node is still EOpNull! 0:? 'fmon' (flat out block{out highp int i}) 0:? 'cmon' (centroid out block{out highp int i}) 0:? 'imon' (invariant out block{out highp int i}) +0:? 'inf' (in highp 2-component vector of float) +0:? 'ing' (in highp 2-component vector of float) +0:? 'offsets' (uniform 4-element array of highp 2-component vector of int) +0:? 'sArray' (uniform 4-element array of highp sampler2D) +0:? 'sIndex' (uniform highp int) +0:? 'auArray' (layout(binding=0 offset=0 ) uniform 2-element array of highp atomic_uint) +0:? 'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform highp int i}) +0:? 'bbInst' (layout(column_major shared ) buffer 4-element array of block{layout(column_major shared ) buffer highp int i}) +0:? 'iArray' (writeonly uniform 5-element array of highp image2D) +0:? 'constOffsets' (const 4-element array of highp 2-component vector of int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) 0:? 'gl_VertexID' (gl_VertexId highp int VertexId) 0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId) @@ -241,6 +422,7 @@ Linked vertex stage: Shader version: 310 +Requested GL_OES_gpu_shader5 Requested GL_OES_shader_io_blocks ERROR: node is still EOpNull! 0:12 Function Definition: main( (global void) @@ -412,6 +594,154 @@ ERROR: node is still EOpNull! 0:119 'anon@1' (out block{gl_Position highp 4-component vector of float Position gl_Position, }) 0:119 Constant: 0:119 1 (const uint) +0:153 Function Definition: pfooBad( (global void) +0:153 Function Parameters: +0:? Sequence +0:156 move second child to first child (temp highp 2-component vector of float) +0:156 'h' (temp highp 2-component vector of float) +0:156 Function Call: fma(vf2;vf2;vf2; (global highp 2-component vector of float) +0:156 'inf' (in highp 2-component vector of float) +0:156 'ing' (in highp 2-component vector of float) +0:156 'h' (temp highp 2-component vector of float) +0:157 indirect index (temp highp sampler2D) +0:157 'sArray' (uniform 4-element array of highp sampler2D) +0:157 add (temp highp int) +0:157 'sIndex' (uniform highp int) +0:157 Constant: +0:157 1 (const int) +0:158 indirect index (layout(binding=0 offset=0 ) temp highp atomic_uint) +0:158 'auArray' (layout(binding=0 offset=0 ) uniform 2-element array of highp atomic_uint) +0:158 add (temp highp int) +0:158 'sIndex' (uniform highp int) +0:158 Constant: +0:158 1 (const int) +0:159 direct index (layout(column_major shared ) temp block{layout(column_major shared ) uniform highp int i}) +0:159 'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform highp int i}) +0:159 Constant: +0:159 1 (const int) +0:160 direct index (layout(column_major shared ) temp block{layout(column_major shared ) buffer highp int i}) +0:160 'bbInst' (layout(column_major shared ) buffer 4-element array of block{layout(column_major shared ) buffer highp int i}) +0:160 Constant: +0:160 2 (const int) +0:161 indirect index (layout(column_major shared ) temp block{layout(column_major shared ) uniform highp int i}) +0:161 'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform highp int i}) +0:161 add (temp highp int) +0:161 'sIndex' (uniform highp int) +0:161 Constant: +0:161 1 (const int) +0:162 indirect index (layout(column_major shared ) temp block{layout(column_major shared ) buffer highp int i}) +0:162 'bbInst' (layout(column_major shared ) buffer 4-element array of block{layout(column_major shared ) buffer highp int i}) +0:162 'sIndex' (uniform highp int) +0:163 direct index (writeonly temp highp image2D) +0:163 'iArray' (writeonly uniform 5-element array of highp image2D) +0:163 Constant: +0:163 2 (const int) +0:164 indirect index (writeonly temp highp image2D) +0:164 'iArray' (writeonly uniform 5-element array of highp image2D) +0:164 component-wise multiply (temp highp int) +0:164 'sIndex' (uniform highp int) +0:164 Constant: +0:164 2 (const int) +0:165 Function Call: textureGatherOffset(s21;vf2;vi2; (global highp 4-component vector of float) +0:165 direct index (temp highp sampler2D) +0:165 'sArray' (uniform 4-element array of highp sampler2D) +0:165 Constant: +0:165 0 (const int) +0:165 Constant: +0:165 0.100000 +0:165 0.100000 +0:165 Convert float to int (temp 2-component vector of int) +0:165 'inf' (in highp 2-component vector of float) +0:166 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:166 direct index (temp highp sampler2D) +0:166 'sArray' (uniform 4-element array of highp sampler2D) +0:166 Constant: +0:166 0 (const int) +0:166 Constant: +0:166 0.100000 +0:166 0.100000 +0:166 Constant: +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:166 0 (const int) +0:171 Function Definition: pfoo( (global void) +0:171 Function Parameters: +0:? Sequence +0:174 move second child to first child (temp highp 2-component vector of float) +0:174 'h' (temp highp 2-component vector of float) +0:174 Function Call: fma(vf2;vf2;vf2; (global highp 2-component vector of float) +0:174 'inf' (in highp 2-component vector of float) +0:174 'ing' (in highp 2-component vector of float) +0:174 'h' (temp highp 2-component vector of float) +0:175 indirect index (temp highp sampler2D) +0:175 'sArray' (uniform 4-element array of highp sampler2D) +0:175 add (temp highp int) +0:175 'sIndex' (uniform highp int) +0:175 Constant: +0:175 1 (const int) +0:176 indirect index (layout(column_major shared ) temp block{layout(column_major shared ) uniform highp int i}) +0:176 'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform highp int i}) +0:176 add (temp highp int) +0:176 'sIndex' (uniform highp int) +0:176 Constant: +0:176 1 (const int) +0:177 indirect index (layout(column_major shared ) temp block{layout(column_major shared ) buffer highp int i}) +0:177 'bbInst' (layout(column_major shared ) buffer 4-element array of block{layout(column_major shared ) buffer highp int i}) +0:177 subtract (temp highp int) +0:177 'sIndex' (uniform highp int) +0:177 Constant: +0:177 2 (const int) +0:178 direct index (writeonly temp highp image2D) +0:178 'iArray' (writeonly uniform 5-element array of highp image2D) +0:178 Constant: +0:178 2 (const int) +0:179 indirect index (writeonly temp highp image2D) +0:179 'iArray' (writeonly uniform 5-element array of highp image2D) +0:179 subtract (temp highp int) +0:179 'sIndex' (uniform highp int) +0:179 Constant: +0:179 2 (const int) +0:180 Function Call: textureGatherOffset(s21;vf2;vi2; (global highp 4-component vector of float) +0:180 direct index (temp highp sampler2D) +0:180 'sArray' (uniform 4-element array of highp sampler2D) +0:180 Constant: +0:180 0 (const int) +0:180 Constant: +0:180 0.100000 +0:180 0.100000 +0:180 Convert float to int (temp 2-component vector of int) +0:180 'inf' (in highp 2-component vector of float) +0:181 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:181 direct index (temp highp sampler2D) +0:181 'sArray' (uniform 4-element array of highp sampler2D) +0:181 Constant: +0:181 0 (const int) +0:181 Constant: +0:181 0.100000 +0:181 0.100000 +0:181 Constant: +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:181 0 (const int) +0:182 Function Call: textureGatherOffsets(s21;vf2;vi2[4]; (global highp 4-component vector of float) +0:182 direct index (temp highp sampler2D) +0:182 'sArray' (uniform 4-element array of highp sampler2D) +0:182 Constant: +0:182 0 (const int) +0:182 Constant: +0:182 0.100000 +0:182 0.100000 +0:182 'offsets' (uniform 4-element array of highp 2-component vector of int) 0:? Linker Objects 0:? 's' (shared highp 4-component vector of float) 0:? 'v' (buffer highp 4-component vector of float) @@ -443,6 +773,24 @@ ERROR: node is still EOpNull! 0:? 'fmon' (flat out block{out highp int i}) 0:? 'cmon' (centroid out block{out highp int i}) 0:? 'imon' (invariant out block{out highp int i}) +0:? 'inf' (in highp 2-component vector of float) +0:? 'ing' (in highp 2-component vector of float) +0:? 'offsets' (uniform 4-element array of highp 2-component vector of int) +0:? 'sArray' (uniform 4-element array of highp sampler2D) +0:? 'sIndex' (uniform highp int) +0:? 'auArray' (layout(binding=0 offset=0 ) uniform 2-element array of highp atomic_uint) +0:? 'ubInst' (layout(column_major shared ) uniform 4-element array of block{layout(column_major shared ) uniform highp int i}) +0:? 'bbInst' (layout(column_major shared ) buffer 4-element array of block{layout(column_major shared ) buffer highp int i}) +0:? 'iArray' (writeonly uniform 5-element array of highp image2D) +0:? 'constOffsets' (const 4-element array of highp 2-component vector of int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) +0:? 0 (const int) 0:? 'gl_VertexID' (gl_VertexId highp int VertexId) 0:? 'gl_InstanceID' (gl_InstanceId highp int InstanceId) diff --git a/Test/baseResults/preprocessor.extensions.vert.err b/Test/baseResults/preprocessor.extensions.vert.err index 03b9ff9c..114bd96a 100644 --- a/Test/baseResults/preprocessor.extensions.vert.err +++ b/Test/baseResults/preprocessor.extensions.vert.err @@ -1,4 +1,3 @@ Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. -WARNING: 0:5: '#extension' : extension is only partially supported: GL_EXT_gpu_shader5 WARNING: 0:6: '#extension' : extension not supported: GL_EXT_shader_texture_image_samples diff --git a/Test/baseResults/preprocessor.line.frag.err b/Test/baseResults/preprocessor.line.frag.err index 5f177e6c..59674286 100644 --- a/Test/baseResults/preprocessor.line.frag.err +++ b/Test/baseResults/preprocessor.line.frag.err @@ -1,2 +1,2 @@ -Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. - +Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. + diff --git a/Test/baseResults/preprocessor.line.frag.out b/Test/baseResults/preprocessor.line.frag.out index 3e2206f8..74991b7f 100644 --- a/Test/baseResults/preprocessor.line.frag.out +++ b/Test/baseResults/preprocessor.line.frag.out @@ -1,5 +1,5 @@ -#version 310 es -#line 1 2 -#pragma something -void main(){ } - +#version 310 es +#line 1 2 +#pragma something +void main(){ } + diff --git a/Test/baseResults/preprocessor.line.vert.out b/Test/baseResults/preprocessor.line.vert.out index 2bf09032..4dab9cb4 100644 --- a/Test/baseResults/preprocessor.line.vert.out +++ b/Test/baseResults/preprocessor.line.vert.out @@ -1,39 +1,39 @@ -#line 300 - -#line 2 - - - - - -#line 10 - - -#line 2 - -#line 0 - - - -#line 4 - - - - - -#line 8 - -void main(){ - gl_Position = vec4(10); -} - -#line 8 4 - - - - -#line 12 3 - -#line 1 - - +#line 300 + +#line 2 + + + + + +#line 10 + + +#line 2 + +#line 0 + + + +#line 4 + + + + + +#line 8 + +void main(){ + gl_Position = vec4(10); +} + +#line 8 4 + + + + +#line 12 3 + +#line 1 + + diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 52e19893..22e87823 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -493,19 +493,24 @@ void TBuiltIns::initialize(int version, EProfile profile) "\n"); } - if (profile != EEsProfile && version >= 400) { + if ((profile != EEsProfile && version >= 400) || + (profile == EEsProfile && version >= 310)) { // GL_OES_gpu_shader5 + commonBuiltins.append( "float fma(float, float, float );" "vec2 fma(vec2, vec2, vec2 );" "vec3 fma(vec3, vec3, vec3 );" "vec4 fma(vec4, vec4, vec4 );" - - "double fma(double, double, double);" - "dvec2 fma(dvec2, dvec2, dvec2 );" - "dvec3 fma(dvec3, dvec3, dvec3 );" - "dvec4 fma(dvec4, dvec4, dvec4 );" - "\n"); + + if (profile != EEsProfile) { + commonBuiltins.append( + "double fma(double, double, double);" + "dvec2 fma(dvec2, dvec2, dvec2 );" + "dvec3 fma(dvec3, dvec3, dvec3 );" + "dvec4 fma(dvec4, dvec4, dvec4 );" + "\n"); + } } if ((profile == EEsProfile && version >= 310) || @@ -2221,9 +2226,6 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, TString& typeName, int vers for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets - if (profile == EEsProfile && offset == 2) - continue; - for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument if (comp > 0 && sampler.shadow) @@ -2802,8 +2804,11 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb // // N.B.: a symbol should only be tagged once, and this function is called multiple times, once - // per stage that's used for this profile. So, stick common ones in the fragment stage to - // ensure they are tagged exactly once. + // per stage that's used for this profile. So + // - generally, stick common ones in the fragment stage to ensure they are tagged exactly once + // - for ES, which has different precisions for different stages, the coarsest-grained tagging + // for a built-in used in many stages needs to be once for the fragment stage and once for + // the vertex stage switch(language) { case EShLangVertex: @@ -2822,6 +2827,15 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb BuiltInVariable("gl_MultiTexCoord7", EbvMultiTexCoord7, symbolTable); BuiltInVariable("gl_FogCoord", EbvFogFragCoord, symbolTable); + if (profile == EEsProfile) { + symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5); + if (version >= 310) + symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5); + } + // Fall through case EShLangTessControl: @@ -2931,15 +2945,21 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb // built-in functions - if (version == 100) { - symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_OES_standard_derivatives); - symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_OES_standard_derivatives); - symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_OES_standard_derivatives); - } if (profile == EEsProfile) { - symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &E_GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &E_GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &E_GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &E_GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod); + symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5); + if (version == 100) { + symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_OES_standard_derivatives); + symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_OES_standard_derivatives); + symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_OES_standard_derivatives); + } + if (version >= 310) + symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5); } else if (version < 130) { symbolTable.setFunctionExtensions("texture1DLod", 1, &E_GL_ARB_shader_texture_lod); symbolTable.setFunctionExtensions("texture2DLod", 1, &E_GL_ARB_shader_texture_lod); @@ -2973,12 +2993,6 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb symbolTable.setFunctionExtensions("shadow2DRectProjGradARB", 1, &E_GL_ARB_shader_texture_lod); } - if (profile == EEsProfile) { - symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod); - symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod); - } - // E_GL_ARB_shader_image_load_store if (profile != EEsProfile && version < 420) symbolTable.setFunctionExtensions("memoryBarrier", 1, &E_GL_ARB_shader_image_load_store); diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 0657cf12..9db85c1d 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -505,13 +505,19 @@ TIntermTyped* TParseContext::handleBracketDereference(TSourceLoc loc, TIntermTyp else error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable"); } - if (base->getBasicType() == EbtBlock) - requireProfile(base->getLoc(), ~EEsProfile, "variable indexing block array"); - else if (language == EShLangFragment && base->getQualifier().isPipeOutput()) + if (base->getBasicType() == EbtBlock) { + if (base->getQualifier().storage == EvqBuffer) + requireProfile(base->getLoc(), ~EEsProfile, "variable indexing buffer block array"); + else if (base->getQualifier().storage == EvqUniform) + profileRequires(base->getLoc(), EEsProfile, 0, Num_AEP_gpu_shader5, AEP_gpu_shader5, "variable indexing uniform block array"); + else + requireProfile(base->getLoc(), ~EEsProfile, "variable indexing in/out block array"); + } else if (language == EShLangFragment && base->getQualifier().isPipeOutput()) requireProfile(base->getLoc(), ~EEsProfile, "variable indexing fragment shader ouput array"); else if (base->getBasicType() == EbtSampler && version >= 130) { const char* explanation = "variable indexing sampler array"; - requireProfile(base->getLoc(), ECoreProfile | ECompatibilityProfile, explanation); + requireProfile(base->getLoc(), EEsProfile | ECoreProfile | ECompatibilityProfile, explanation); + profileRequires(base->getLoc(), EEsProfile, 0, Num_AEP_gpu_shader5, AEP_gpu_shader5, explanation); profileRequires(base->getLoc(), ECoreProfile | ECompatibilityProfile, 400, nullptr, explanation); } @@ -1332,6 +1338,9 @@ void TParseContext::nonOpBuiltInCheck(TSourceLoc loc, const TFunction& fnCandida profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_texture_gather, feature); else profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature); + int offsetArg = fnCandidate[0].type->getSampler().shadow ? 3 : 2; + if (! callNode.getSequence()[offsetArg]->getAsConstantUnion()) + profileRequires(loc, EEsProfile, 0, Num_AEP_gpu_shader5, AEP_gpu_shader5, "non-constant offset argument"); if (! fnCandidate[0].type->getSampler().shadow) compArg = 3; } else if (fnCandidate.getName().compare("textureGatherOffsets") == 0) { diff --git a/glslang/MachineIndependent/Scan.cpp b/glslang/MachineIndependent/Scan.cpp index f0f133cb..34f35ae8 100644 --- a/glslang/MachineIndependent/Scan.cpp +++ b/glslang/MachineIndependent/Scan.cpp @@ -941,12 +941,14 @@ int TScanContext::tokenizeIdentifier() return keyword; case PRECISE: - if (parseContext.profile == EEsProfile && parseContext.version >= 310) + if ((parseContext.profile == EEsProfile && parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5)) || + (parseContext.profile != EEsProfile && parseContext.version >= 400)) + return keyword; + if (parseContext.profile == EEsProfile && parseContext.version == 310) { reservedWord(); - else if (parseContext.profile == EEsProfile || - (parseContext.profile != EEsProfile && parseContext.version < 400)) - return identifierOrType(); - return keyword; + return keyword; + } + return identifierOrType(); case INVARIANT: if (parseContext.profile != EEsProfile && parseContext.version < 120) diff --git a/glslang/MachineIndependent/SymbolTable.h b/glslang/MachineIndependent/SymbolTable.h index 415b6146..ad73b3b5 100644 --- a/glslang/MachineIndependent/SymbolTable.h +++ b/glslang/MachineIndependent/SymbolTable.h @@ -200,7 +200,7 @@ public: TSymbol(name), mangledName(*name + '('), op(tOp), - defined(false), prototyped(false) { returnType.shallowCopy(retType); } + defined(false), prototyped(false) { returnType.shallowCopy(retType); } virtual TFunction* clone() const; virtual ~TFunction(); @@ -486,8 +486,8 @@ public: // protected: static const int globalLevel = 3; - bool isSharedLevel(int level) { return level <= 1; } // exclude all per-compile levels - bool isBuiltInLevel(int level) { return level <= 2; } // exclude user globals + bool isSharedLevel(int level) { return level <= 1; } // exclude all per-compile levels + bool isBuiltInLevel(int level) { return level <= 2; } // exclude user globals bool isGlobalLevel(int level) { return level <= globalLevel; } // include user globals public: bool isEmpty() { return table.size() == 0; } diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 7b2299a2..6f5b9c88 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -183,7 +183,7 @@ void TParseContext::initializeExtensionBehavior() extensionBehavior[E_GL_OES_texture_storage_multisample_2d_array] = EBhDisablePartial; extensionBehavior[E_GL_EXT_geometry_shader] = EBhDisable; extensionBehavior[E_GL_EXT_geometry_point_size] = EBhDisable; - extensionBehavior[E_GL_EXT_gpu_shader5] = EBhDisablePartial; + extensionBehavior[E_GL_EXT_gpu_shader5] = EBhDisable; extensionBehavior[E_GL_EXT_primitive_bounding_box] = EBhDisablePartial; extensionBehavior[E_GL_EXT_shader_io_blocks] = EBhDisable; extensionBehavior[E_GL_EXT_tessellation_shader] = EBhDisable; @@ -194,7 +194,7 @@ void TParseContext::initializeExtensionBehavior() // OES matching AEP extensionBehavior[E_GL_OES_geometry_shader] = EBhDisable; extensionBehavior[E_GL_OES_geometry_point_size] = EBhDisable; - extensionBehavior[E_GL_OES_gpu_shader5] = EBhDisablePartial; + extensionBehavior[E_GL_OES_gpu_shader5] = EBhDisable; extensionBehavior[E_GL_OES_primitive_bounding_box] = EBhDisablePartial; extensionBehavior[E_GL_OES_shader_io_blocks] = EBhDisable; extensionBehavior[E_GL_OES_tessellation_shader] = EBhDisable;