From b61b82182fbf83daea7dbd3d0379483020ed3673 Mon Sep 17 00:00:00 2001 From: John Kessenich <cepheus@frii.com> Date: Tue, 23 Jun 2015 04:14:00 +0000 Subject: [PATCH] glslang front-end: Implement AEP *_point_size extensions. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31560 e7fa87d3-cd2b-0410-9028-fcbf551c1848 --- Test/310.geom | 15 ++- Test/310.tesc | 12 ++- Test/310.tese | 12 ++- Test/baseResults/310.geom.out | 110 ++++++++++++++++----- Test/baseResults/310.tesc.out | 54 +++++++++- Test/baseResults/310.tese.out | 30 +++++- glslang/MachineIndependent/Initialize.cpp | 12 +++ glslang/MachineIndependent/ParseHelper.cpp | 20 +++- glslang/MachineIndependent/ParseHelper.h | 7 +- glslang/MachineIndependent/Versions.cpp | 8 +- glslang/MachineIndependent/Versions.h | 8 ++ 11 files changed, 248 insertions(+), 40 deletions(-) diff --git a/Test/310.geom b/Test/310.geom index 0bb813b52..bf0b1ae04 100644 --- a/Test/310.geom +++ b/Test/310.geom @@ -47,7 +47,7 @@ void main() gl_ClipDistance[3] = // ERROR, no ClipDistance gl_in[1].gl_ClipDistance[2]; // ERROR, no ClipDistance gl_Position = gl_in[0].gl_Position; - gl_PointSize = gl_in[3].gl_PointSize; + gl_PrimitiveID = gl_PrimitiveIDIn; gl_Layer = 2; } @@ -137,3 +137,16 @@ void notHere() gl_VerticesIn; // ERROR, not in ES } +void pointSize1() +{ + highp float ps = gl_in[3].gl_PointSize; // ERROR, need point_size extension + gl_PointSize = ps; // ERROR, need point_size extension +} + +#extension GL_OES_geometry_point_size : enable + +void pointSize2() +{ + highp float ps = gl_in[3].gl_PointSize; + gl_PointSize = ps; +} diff --git a/Test/310.tesc b/Test/310.tesc index d35014a3c..236afde44 100644 --- a/Test/310.tesc +++ b/Test/310.tesc @@ -23,7 +23,7 @@ void main() gl_MaxTessControlTotalOutputComponents; vec4 p = gl_in[1].gl_Position; - float ps = gl_in[1].gl_PointSize; + float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES int pvi = gl_PatchVerticesIn; @@ -31,7 +31,7 @@ void main() int iid = gl_InvocationID; gl_out[1].gl_Position = p; - gl_out[1].gl_PointSize = ps; + gl_out[1].gl_PointSize = ps; // ERROR, need point_size extension gl_out[1].gl_ClipDistance[1] = cd; // ERROR, not in ES gl_TessLevelOuter[3] = 3.2; @@ -107,6 +107,14 @@ layout(vertices = 4) out float badlay[]; // ERROR, not on a variable out float misSized[5]; // ERROR, size doesn't match out float okaySize[4]; +#extension GL_OES_tessellation_point_size : enable + +void pointSize2() +{ + float ps = gl_in[1].gl_PointSize; + gl_out[1].gl_PointSize = ps; +} + // for testing with gpu_shader5 //precise vec3 pv3; // diff --git a/Test/310.tese b/Test/310.tese index c0ac6e9bb..739ead253 100644 --- a/Test/310.tese +++ b/Test/310.tese @@ -34,7 +34,7 @@ void main() gl_MaxTessGenLevel; vec4 p = gl_in[1].gl_Position; - float ps = gl_in[1].gl_PointSize; + float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES int pvi = gl_PatchVerticesIn; @@ -44,7 +44,7 @@ void main() float tli = gl_TessLevelInner[1]; gl_Position = p; - gl_PointSize = ps; + gl_PointSize = ps; // ERROR, need point_size extension gl_ClipDistance[2] = cd; // ERROR, not in ES } @@ -111,3 +111,11 @@ patch in pinbn { centroid out vec3 myColor2; centroid in vec3 centr[]; sample out vec4 perSampleColor; // ERROR without sample extensions + +#extension GL_OES_tessellation_point_size : enable + +void pointSize2() +{ + float ps = gl_in[1].gl_PointSize; // ERROR, not in the redeclaration, but no error on use of gl_PointSize + gl_PointSize = ps; +} diff --git a/Test/baseResults/310.geom.out b/Test/baseResults/310.geom.out index d00cce083..7b2654733 100644 --- a/Test/baseResults/310.geom.out +++ b/Test/baseResults/310.geom.out @@ -35,12 +35,19 @@ ERROR: 0:128: 'sample' : Reserved word. ERROR: 0:132: 'component' : not supported with this profile: es ERROR: 0:136: 'gl_MaxGeometryVaryingComponents' : undeclared identifier ERROR: 0:137: 'gl_VerticesIn' : undeclared identifier -ERROR: 35 compilation errors. No code generated. +ERROR: 0:142: 'gl_PointSize' : required extension not requested: Possible extensions include: +GL_EXT_geometry_point_size +GL_OES_geometry_point_size +ERROR: 0:143: 'gl_PointSize' : required extension not requested: Possible extensions include: +GL_EXT_geometry_point_size +GL_OES_geometry_point_size +ERROR: 37 compilation errors. No code generated. Shader version: 310 Requested GL_EXT_geometry_shader Requested GL_EXT_shader_io_blocks +Requested GL_OES_geometry_point_size invocations = 4 max_vertices = 200 input primitive = lines_adjacency @@ -84,18 +91,6 @@ ERROR: node is still EOpNull! 0:49 0 (const int) 0:49 Constant: 0:49 0 (const int) -0:50 move second child to first child (temp highp float) -0:50 gl_PointSize: direct index for structure (layout(stream=0 ) gl_PointSize highp float PointSize) -0:50 'anon@1' (layout(stream=0 ) out block{layout(stream=0 ) gl_Position highp 4-component vector of float Position gl_Position, layout(stream=0 ) gl_PointSize highp float PointSize gl_PointSize}) -0:50 Constant: -0:50 1 (const uint) -0:50 gl_PointSize: direct index for structure (in highp float PointSize) -0:50 direct index (temp block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) -0:50 'gl_in' (in 4-element array of block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) -0:50 Constant: -0:50 3 (const int) -0:50 Constant: -0:50 1 (const int) 0:51 move second child to first child (temp highp int) 0:51 'gl_PrimitiveID' (layout(stream=0 ) out highp int PrimitiveID) 0:51 'gl_PrimitiveIDIn' (in highp int PrimitiveID) @@ -133,6 +128,44 @@ ERROR: node is still EOpNull! 0:136 Sequence 0:136 'gl_MaxGeometryVaryingComponents' (temp float) 0:137 'gl_VerticesIn' (temp float) +0:140 Function Definition: pointSize1( (global void) +0:140 Function Parameters: +0:142 Sequence +0:142 Sequence +0:142 move second child to first child (temp highp float) +0:142 'ps' (temp highp float) +0:142 gl_PointSize: direct index for structure (in highp float PointSize) +0:142 direct index (temp block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) +0:142 'gl_in' (in 4-element array of block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) +0:142 Constant: +0:142 3 (const int) +0:142 Constant: +0:142 1 (const int) +0:143 move second child to first child (temp highp float) +0:143 gl_PointSize: direct index for structure (layout(stream=0 ) gl_PointSize highp float PointSize) +0:143 'anon@1' (layout(stream=0 ) out block{layout(stream=0 ) gl_Position highp 4-component vector of float Position gl_Position, layout(stream=0 ) gl_PointSize highp float PointSize gl_PointSize}) +0:143 Constant: +0:143 1 (const uint) +0:143 'ps' (temp highp float) +0:148 Function Definition: pointSize2( (global void) +0:148 Function Parameters: +0:150 Sequence +0:150 Sequence +0:150 move second child to first child (temp highp float) +0:150 'ps' (temp highp float) +0:150 gl_PointSize: direct index for structure (in highp float PointSize) +0:150 direct index (temp block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) +0:150 'gl_in' (in 4-element array of block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) +0:150 Constant: +0:150 3 (const int) +0:150 Constant: +0:150 1 (const int) +0:151 move second child to first child (temp highp float) +0:151 gl_PointSize: direct index for structure (layout(stream=0 ) gl_PointSize highp float PointSize) +0:151 'anon@1' (layout(stream=0 ) out block{layout(stream=0 ) gl_Position highp 4-component vector of float Position gl_Position, layout(stream=0 ) gl_PointSize highp float PointSize gl_PointSize}) +0:151 Constant: +0:151 1 (const uint) +0:151 'ps' (temp highp float) 0:? Linker Objects 0:? 'fromV' (in 4-element array of block{in mediump 3-component vector of float color}) 0:? 'nonBlockUnsized' (in 4-element array of mediump 4-component vector of float) @@ -166,6 +199,7 @@ Linked geometry stage: Shader version: 310 Requested GL_EXT_geometry_shader Requested GL_EXT_shader_io_blocks +Requested GL_OES_geometry_point_size invocations = 4 max_vertices = 200 input primitive = lines_adjacency @@ -209,18 +243,6 @@ ERROR: node is still EOpNull! 0:49 0 (const int) 0:49 Constant: 0:49 0 (const int) -0:50 move second child to first child (temp highp float) -0:50 gl_PointSize: direct index for structure (layout(stream=0 ) gl_PointSize highp float PointSize) -0:50 'anon@1' (layout(stream=0 ) out block{layout(stream=0 ) gl_Position highp 4-component vector of float Position gl_Position, layout(stream=0 ) gl_PointSize highp float PointSize gl_PointSize}) -0:50 Constant: -0:50 1 (const uint) -0:50 gl_PointSize: direct index for structure (in highp float PointSize) -0:50 direct index (temp block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) -0:50 'gl_in' (in 4-element array of block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) -0:50 Constant: -0:50 3 (const int) -0:50 Constant: -0:50 1 (const int) 0:51 move second child to first child (temp highp int) 0:51 'gl_PrimitiveID' (layout(stream=0 ) out highp int PrimitiveID) 0:51 'gl_PrimitiveIDIn' (in highp int PrimitiveID) @@ -258,6 +280,44 @@ ERROR: node is still EOpNull! 0:136 Sequence 0:136 'gl_MaxGeometryVaryingComponents' (temp float) 0:137 'gl_VerticesIn' (temp float) +0:140 Function Definition: pointSize1( (global void) +0:140 Function Parameters: +0:142 Sequence +0:142 Sequence +0:142 move second child to first child (temp highp float) +0:142 'ps' (temp highp float) +0:142 gl_PointSize: direct index for structure (in highp float PointSize) +0:142 direct index (temp block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) +0:142 'gl_in' (in 4-element array of block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) +0:142 Constant: +0:142 3 (const int) +0:142 Constant: +0:142 1 (const int) +0:143 move second child to first child (temp highp float) +0:143 gl_PointSize: direct index for structure (layout(stream=0 ) gl_PointSize highp float PointSize) +0:143 'anon@1' (layout(stream=0 ) out block{layout(stream=0 ) gl_Position highp 4-component vector of float Position gl_Position, layout(stream=0 ) gl_PointSize highp float PointSize gl_PointSize}) +0:143 Constant: +0:143 1 (const uint) +0:143 'ps' (temp highp float) +0:148 Function Definition: pointSize2( (global void) +0:148 Function Parameters: +0:150 Sequence +0:150 Sequence +0:150 move second child to first child (temp highp float) +0:150 'ps' (temp highp float) +0:150 gl_PointSize: direct index for structure (in highp float PointSize) +0:150 direct index (temp block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) +0:150 'gl_in' (in 4-element array of block{in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize}) +0:150 Constant: +0:150 3 (const int) +0:150 Constant: +0:150 1 (const int) +0:151 move second child to first child (temp highp float) +0:151 gl_PointSize: direct index for structure (layout(stream=0 ) gl_PointSize highp float PointSize) +0:151 'anon@1' (layout(stream=0 ) out block{layout(stream=0 ) gl_Position highp 4-component vector of float Position gl_Position, layout(stream=0 ) gl_PointSize highp float PointSize gl_PointSize}) +0:151 Constant: +0:151 1 (const uint) +0:151 'ps' (temp highp float) 0:? Linker Objects 0:? 'fromV' (in 4-element array of block{in mediump 3-component vector of float color}) 0:? 'nonBlockUnsized' (in 4-element array of mediump 4-component vector of float) diff --git a/Test/baseResults/310.tesc.out b/Test/baseResults/310.tesc.out index b1b2633b7..c5f31aba9 100644 --- a/Test/baseResults/310.tesc.out +++ b/Test/baseResults/310.tesc.out @@ -4,8 +4,14 @@ ERROR: 0:8: 'quads' : unrecognized layout identifier, or qualifier requires assi ERROR: 0:9: 'ccw' : unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4) ERROR: 0:10: 'fractional_even_spacing' : unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4) ERROR: 0:12: 'patch' : can only use on output in tessellation-control shader +ERROR: 0:26: 'gl_PointSize' : required extension not requested: Possible extensions include: +GL_EXT_tessellation_point_size +GL_OES_tessellation_point_size ERROR: 0:27: 'gl_ClipDistance' : no such field in structure ERROR: 0:27: 'expression' : left of '[' is not of type array, matrix, or vector +ERROR: 0:34: 'gl_PointSize' : required extension not requested: Possible extensions include: +GL_EXT_tessellation_point_size +GL_OES_tessellation_point_size ERROR: 0:35: 'gl_ClipDistance' : no such field in structure ERROR: 0:35: 'expression' : left of '[' is not of type array, matrix, or vector ERROR: 0:35: 'assign' : l-value required (can't modify a const) @@ -29,12 +35,13 @@ ERROR: 0:95: 'fma' : no matching overloaded function found 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 -ERROR: 29 compilation errors. No code generated. +ERROR: 31 compilation errors. No code generated. Shader version: 310 Requested GL_ARB_separate_shader_objects Requested GL_OES_shader_io_blocks +Requested GL_OES_tessellation_point_size Requested GL_OES_tessellation_shader vertices = 4 ERROR: node is still EOpNull! @@ -183,6 +190,28 @@ ERROR: node is still EOpNull! 0:95 'd' (temp highp float) 0:95 Constant: 0:95 0.000000 +0:112 Function Definition: pointSize2( (global void) +0:112 Function Parameters: +0:114 Sequence +0:114 Sequence +0:114 move second child to first child (temp highp float) +0:114 'ps' (temp highp float) +0:114 gl_PointSize: direct index for structure (in highp float) +0:114 direct index (temp block{in highp 4-component vector of float gl_Position, in highp float gl_PointSize}) +0:114 'gl_in' (in 32-element array of block{in highp 4-component vector of float gl_Position, in highp float gl_PointSize}) +0:114 Constant: +0:114 1 (const int) +0:114 Constant: +0:114 1 (const int) +0:115 move second child to first child (temp highp float) +0:115 gl_PointSize: direct index for structure (out highp float PointSize) +0:115 direct index (temp block{out highp 4-component vector of float Position gl_Position, out highp float PointSize gl_PointSize}) +0:115 'gl_out' (out 4-element array of block{out highp 4-component vector of float Position gl_Position, out highp float PointSize gl_PointSize}) +0:115 Constant: +0:115 1 (const int) +0:115 Constant: +0:115 1 (const int) +0:115 'ps' (temp highp float) 0:? Linker Objects 0:? 'gl_out' (out 4-element array of block{out highp 4-component vector of float Position gl_Position, out highp float PointSize gl_PointSize}) 0:? 'outa' (global 4-element array of highp int) @@ -214,6 +243,7 @@ Linked tessellation control stage: Shader version: 310 Requested GL_ARB_separate_shader_objects Requested GL_OES_shader_io_blocks +Requested GL_OES_tessellation_point_size Requested GL_OES_tessellation_shader vertices = 4 ERROR: node is still EOpNull! @@ -362,6 +392,28 @@ ERROR: node is still EOpNull! 0:95 'd' (temp highp float) 0:95 Constant: 0:95 0.000000 +0:112 Function Definition: pointSize2( (global void) +0:112 Function Parameters: +0:114 Sequence +0:114 Sequence +0:114 move second child to first child (temp highp float) +0:114 'ps' (temp highp float) +0:114 gl_PointSize: direct index for structure (in highp float) +0:114 direct index (temp block{in highp 4-component vector of float gl_Position, in highp float gl_PointSize}) +0:114 'gl_in' (in 32-element array of block{in highp 4-component vector of float gl_Position, in highp float gl_PointSize}) +0:114 Constant: +0:114 1 (const int) +0:114 Constant: +0:114 1 (const int) +0:115 move second child to first child (temp highp float) +0:115 gl_PointSize: direct index for structure (out highp float PointSize) +0:115 direct index (temp block{out highp 4-component vector of float Position gl_Position, out highp float PointSize gl_PointSize}) +0:115 'gl_out' (out 4-element array of block{out highp 4-component vector of float Position gl_Position, out highp float PointSize gl_PointSize}) +0:115 Constant: +0:115 1 (const int) +0:115 Constant: +0:115 1 (const int) +0:115 'ps' (temp highp float) 0:? Linker Objects 0:? 'gl_out' (out 4-element array of block{out highp 4-component vector of float Position gl_Position, out highp float PointSize gl_PointSize}) 0:? 'outa' (global 4-element array of highp int) diff --git a/Test/baseResults/310.tese.out b/Test/baseResults/310.tese.out index 76e5ea10f..d7424362b 100644 --- a/Test/baseResults/310.tese.out +++ b/Test/baseResults/310.tese.out @@ -8,8 +8,14 @@ ERROR: 0:16: 'equal_spacing' : cannot change previously set vertex spacing ERROR: 0:17: 'fractional_even_spacing' : cannot change previously set vertex spacing ERROR: 0:22: 'patch' : can only use on input in tessellation-evaluation shader ERROR: 0:26: 'barrier' : no matching overloaded function found +ERROR: 0:37: 'gl_PointSize' : required extension not requested: Possible extensions include: +GL_EXT_tessellation_point_size +GL_OES_tessellation_point_size ERROR: 0:38: 'gl_ClipDistance' : no such field in structure ERROR: 0:38: 'expression' : left of '[' is not of type array, matrix, or vector +ERROR: 0:47: 'gl_PointSize' : required extension not requested: Possible extensions include: +GL_EXT_tessellation_point_size +GL_OES_tessellation_point_size ERROR: 0:48: 'gl_ClipDistance' : undeclared identifier ERROR: 0:48: 'gl_ClipDistance' : left of '[' is not of type array, matrix, or vector ERROR: 0:48: 'assign' : l-value required (can't modify a const) @@ -39,7 +45,9 @@ ERROR: 0:100: 'location' : overlapping use of location 24 ERROR: 0:103: 'location' : overlapping use of location 24 ERROR: 0:105: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved ERROR: 0:113: 'sample' : Reserved word. -ERROR: 39 compilation errors. No code generated. +ERROR: 0:119: 'gl_PointSize' : no such field in structure +ERROR: 0:119: '=' : cannot convert from 'temp block{in highp 4-component vector of float gl_Position}' to 'temp highp float' +ERROR: 43 compilation errors. No code generated. Shader version: 310 @@ -47,6 +55,7 @@ Requested GL_ARB_separate_shader_objects Requested GL_EXT_shader_io_blocks Requested GL_EXT_tessellation_shader Requested GL_OES_shader_io_blocks +Requested GL_OES_tessellation_point_size Requested GL_OES_tessellation_shader input primitive = quads vertex spacing = fractional_odd_spacing @@ -130,6 +139,15 @@ ERROR: node is still EOpNull! 0:48 Constant: 0:48 0.000000 0:48 'cd' (temp highp float) +0:117 Function Definition: pointSize2( (global void) +0:117 Function Parameters: +0:? Sequence +0:120 move second child to first child (temp highp float) +0:120 gl_PointSize: direct index for structure (gl_PointSize highp float PointSize) +0:120 'anon@1' (out block{gl_Position highp 4-component vector of float Position gl_Position, gl_PointSize highp float PointSize gl_PointSize}) +0:120 Constant: +0:120 1 (const uint) +0:120 'ps' (temp highp float) 0:? Linker Objects 0:? 'patchIn' (patch in highp 4-component vector of float) 0:? 'patchOut' (patch out highp 4-component vector of float) @@ -165,6 +183,7 @@ Requested GL_ARB_separate_shader_objects Requested GL_EXT_shader_io_blocks Requested GL_EXT_tessellation_shader Requested GL_OES_shader_io_blocks +Requested GL_OES_tessellation_point_size Requested GL_OES_tessellation_shader input primitive = quads vertex spacing = fractional_odd_spacing @@ -248,6 +267,15 @@ ERROR: node is still EOpNull! 0:48 Constant: 0:48 0.000000 0:48 'cd' (temp highp float) +0:117 Function Definition: pointSize2( (global void) +0:117 Function Parameters: +0:? Sequence +0:120 move second child to first child (temp highp float) +0:120 gl_PointSize: direct index for structure (gl_PointSize highp float PointSize) +0:120 'anon@1' (out block{gl_Position highp 4-component vector of float Position gl_Position, gl_PointSize highp float PointSize gl_PointSize}) +0:120 Constant: +0:120 1 (const uint) +0:120 'ps' (temp highp float) 0:? Linker Objects 0:? 'patchIn' (patch in highp 4-component vector of float) 0:? 'patchOut' (patch out highp 4-component vector of float) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 636b44259..554868baf 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -2884,6 +2884,18 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb BuiltInVariable("gl_TexCoord", EbvTexCoord, symbolTable); BuiltInVariable("gl_FogFragCoord", EbvFogFragCoord, symbolTable); + // gl_PointSize, when it needs to be tied to an extension, is always a member of a block. + // (Sometimes with an instance name, sometimes anonymous). + // However, the current automatic extension scheme does not work per block member, + // so for now check when parsing. + // + //if (profile == EEsProfile) { + // if (language == EShLangGeometry) + // symbolTable.setVariableExtensions("gl_PointSize", Num_AEP_geometry_point_size, AEP_geometry_point_size); + // else if (language == EShLangTessEvaluation || language == EShLangTessControl) + // symbolTable.setVariableExtensions("gl_PointSize", Num_AEP_tessellation_point_size, AEP_tessellation_point_size); + //} + break; case EShLangFragment: diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index aab573c9f..0e76adf09 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -385,11 +385,11 @@ void C_DECL TParseContext::warn(TSourceLoc loc, const char* szReason, const char // // Handle seeing a variable identifier in the grammar. // -TIntermTyped* TParseContext::handleVariable(TSourceLoc loc, TSymbol* symbol, TString* string) +TIntermTyped* TParseContext::handleVariable(TSourceLoc loc, TSymbol* symbol, const TString* string) { TIntermTyped* node = 0; - // Error check for function requiring specific extensions present. + // Error check for requiring specific extensions present. if (symbol && symbol->getNumExtensions()) requireExtensions(loc, symbol->getNumExtensions(), symbol->getExtensions(), symbol->getName().c_str()); @@ -411,6 +411,9 @@ TIntermTyped* TParseContext::handleVariable(TSourceLoc loc, TSymbol* symbol, TSt if (anon) { // It was a member of an anonymous container. + // The "getNumExtensions()" mechanism above doesn't yet work for block members + blockMemberExtensionCheck(loc, 0, *string); + // Create a subtree for its dereference. variable = anon->getAnonContainer().getAsVariable(); TIntermTyped* container = intermediate.addSymbol(*variable, loc); @@ -716,7 +719,7 @@ TIntermTyped* TParseContext::handleUnaryMath(TSourceLoc loc, const char* str, TO // // Handle seeing a base.field dereference in the grammar. // -TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped* base, TString& field) +TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped* base, const TString& field) { variableCheck(base); @@ -804,6 +807,7 @@ TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped* if (base->getType().getQualifier().storage == EvqConst) result = intermediate.foldDereference(base, member, loc); else { + blockMemberExtensionCheck(loc, base, field); TIntermTyped* index = intermediate.addConstantUnion(member, loc); result = intermediate.addIndex(EOpIndexDirectStruct, base, index, loc); result->setType(*(*fields)[member].type); @@ -816,6 +820,16 @@ TIntermTyped* TParseContext::handleDotDereference(TSourceLoc loc, TIntermTyped* return result; } +void TParseContext::blockMemberExtensionCheck(TSourceLoc loc, const TIntermTyped* /*base*/, const TString& field) +{ + if (profile == EEsProfile && field == "gl_PointSize") { + if (language == EShLangGeometry) + requireExtensions(loc, Num_AEP_geometry_point_size, AEP_geometry_point_size, "gl_PointSize"); + else if (language == EShLangTessControl || language == EShLangTessEvaluation) + requireExtensions(loc, Num_AEP_tessellation_point_size, AEP_tessellation_point_size, "gl_PointSize"); + } +} + // // Handle seeing a function declarator in the grammar. This is the precursor // to recognizing a function prototype or function definition. diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index f27d5a563..7035b2022 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -84,7 +84,7 @@ public: bool builtInName(const TString&); void handlePragma(TSourceLoc, const TVector<TString>&); - TIntermTyped* handleVariable(TSourceLoc, TSymbol* symbol, TString* string); + TIntermTyped* handleVariable(TSourceLoc, TSymbol* symbol, const TString* string); TIntermTyped* handleBracketDereference(TSourceLoc, TIntermTyped* base, TIntermTyped* index); void checkIndex(TSourceLoc, const TType&, int& index); void handleIndexLimits(TSourceLoc, TIntermTyped* base, TIntermTyped* index); @@ -100,8 +100,9 @@ public: TIntermTyped* handleBinaryMath(TSourceLoc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right); TIntermTyped* handleUnaryMath(TSourceLoc, const char* str, TOperator op, TIntermTyped* childNode); - TIntermTyped* handleDotDereference(TSourceLoc, TIntermTyped* base, TString& field); - TFunction* handleFunctionDeclarator(TSourceLoc loc, TFunction& function, bool prototype); + TIntermTyped* handleDotDereference(TSourceLoc, TIntermTyped* base, const TString& field); + void blockMemberExtensionCheck(TSourceLoc, const TIntermTyped* base, const TString& field); + TFunction* handleFunctionDeclarator(TSourceLoc, TFunction& function, bool prototype); TIntermAggregate* handleFunctionDefinition(TSourceLoc, TFunction&); TIntermTyped* handleFunctionCall(TSourceLoc, TFunction*, TIntermNode*); void checkLocation(TSourceLoc, TOperator); diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index 21777ae58..5deef3585 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -182,21 +182,23 @@ void TParseContext::initializeExtensionBehavior() extensionBehavior[GL_OES_shader_multisample_interpolation] = EBhDisablePartial; extensionBehavior[GL_OES_texture_storage_multisample_2d_array] = EBhDisablePartial; extensionBehavior[GL_EXT_geometry_shader] = EBhDisable; - extensionBehavior[GL_EXT_geometry_point_size] = EBhDisablePartial; + extensionBehavior[GL_EXT_geometry_point_size] = EBhDisable; extensionBehavior[GL_EXT_gpu_shader5] = EBhDisablePartial; extensionBehavior[GL_EXT_primitive_bounding_box] = EBhDisablePartial; extensionBehavior[GL_EXT_shader_io_blocks] = EBhDisable; extensionBehavior[GL_EXT_tessellation_shader] = EBhDisable; - extensionBehavior[GL_EXT_tessellation_point_size] = EBhDisablePartial; + extensionBehavior[GL_EXT_tessellation_point_size] = EBhDisable; extensionBehavior[GL_EXT_texture_buffer] = EBhDisablePartial; extensionBehavior[GL_EXT_texture_cube_map_array] = EBhDisablePartial; // OES matching AEP extensionBehavior[GL_OES_geometry_shader] = EBhDisable; + extensionBehavior[GL_OES_geometry_point_size] = EBhDisable; extensionBehavior[GL_OES_gpu_shader5] = EBhDisablePartial; extensionBehavior[GL_OES_primitive_bounding_box] = EBhDisablePartial; extensionBehavior[GL_OES_shader_io_blocks] = EBhDisable; extensionBehavior[GL_OES_tessellation_shader] = EBhDisable; + extensionBehavior[GL_OES_tessellation_point_size] = EBhDisable; extensionBehavior[GL_OES_texture_buffer] = EBhDisablePartial; extensionBehavior[GL_OES_texture_cube_map_array] = EBhDisablePartial; } @@ -234,10 +236,12 @@ const char* TParseContext::getPreamble() // OES matching AEP "#define GL_OES_geometry_shader 1\n" + "#define GL_OES_geometry_point_size 1\n" "#define GL_OES_gpu_shader5 1\n" "#define GL_OES_primitive_bounding_box 1\n" "#define GL_OES_shader_io_blocks 1\n" "#define GL_OES_tessellation_shader 1\n" + "#define GL_OES_tessellation_point_size 1\n" "#define GL_OES_texture_buffer 1\n" "#define GL_OES_texture_cube_map_array 1\n" ; diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index ee673d381..dcf969ebc 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -131,10 +131,12 @@ const char* const GL_EXT_texture_cube_map_array = "GL_EXT_texture_ // OES matching AEP const char* const GL_OES_geometry_shader = "GL_OES_geometry_shader"; +const char* const GL_OES_geometry_point_size = "GL_OES_geometry_point_size"; const char* const GL_OES_gpu_shader5 = "GL_OES_gpu_shader5"; const char* const GL_OES_primitive_bounding_box = "GL_OES_primitive_bounding_box"; const char* const GL_OES_shader_io_blocks = "GL_OES_shader_io_blocks"; const char* const GL_OES_tessellation_shader = "GL_OES_tessellation_shader"; +const char* const GL_OES_tessellation_point_size = "GL_OES_tessellation_point_size"; const char* const GL_OES_texture_buffer = "GL_OES_texture_buffer"; const char* const GL_OES_texture_cube_map_array = "GL_OES_texture_cube_map_array"; @@ -143,6 +145,9 @@ const char* const GL_OES_texture_cube_map_array = "GL_OES_texture_ const char* const AEP_geometry_shader[] = { GL_EXT_geometry_shader, GL_OES_geometry_shader }; const int Num_AEP_geometry_shader = sizeof(AEP_geometry_shader)/sizeof(AEP_geometry_shader[0]); +const char* const AEP_geometry_point_size[] = { GL_EXT_geometry_point_size, GL_OES_geometry_point_size }; +const int Num_AEP_geometry_point_size = sizeof(AEP_geometry_point_size)/sizeof(AEP_geometry_point_size[0]); + const char* const AEP_gpu_shader5[] = { GL_EXT_gpu_shader5, GL_OES_gpu_shader5 }; const int Num_AEP_gpu_shader5 = sizeof(AEP_gpu_shader5)/sizeof(AEP_gpu_shader5[0]); @@ -155,6 +160,9 @@ const int Num_AEP_shader_io_blocks = sizeof(AEP_shader_io_blocks)/sizeof(AEP_sha const char* const AEP_tessellation_shader[] = { GL_EXT_tessellation_shader, GL_OES_tessellation_shader }; const int Num_AEP_tessellation_shader = sizeof(AEP_tessellation_shader)/sizeof(AEP_tessellation_shader[0]); +const char* const AEP_tessellation_point_size[] = { GL_EXT_tessellation_point_size, GL_OES_tessellation_point_size }; +const int Num_AEP_tessellation_point_size = sizeof(AEP_tessellation_point_size)/sizeof(AEP_tessellation_point_size[0]); + const char* const AEP_texture_buffer[] = { GL_EXT_texture_buffer, GL_OES_texture_buffer }; const int Num_AEP_texture_buffer = sizeof(AEP_texture_buffer)/sizeof(AEP_texture_buffer[0]); -- GitLab