From e085d834279352a85e0b284a840461d7334e2a8c Mon Sep 17 00:00:00 2001 From: Rex Xu Date: Sat, 6 Jul 2019 23:40:10 +0800 Subject: [PATCH] Change implementation of gl_SIMDGroupSizeAMD --- glslang/MachineIndependent/Initialize.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 0498b487..2ddcae40 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -3838,12 +3838,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV } // GL_AMD_gcn_shader - if (profile != EEsProfile && version >= 450) { + if (profile != EEsProfile && version >= 440) { commonBuiltins.append( "float cubeFaceIndexAMD(vec3);" "vec2 cubeFaceCoordAMD(vec3);" "uint64_t timeAMD();" + "in int gl_SIMDGroupSizeAMD;" "\n"); } @@ -7734,14 +7735,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf s.append(builtInConstant); } -#ifdef AMD_EXTENSIONS - // GL_AMD_gcn_shader - if (profile != EEsProfile && version >= 450) { - snprintf(builtInConstant, maxSize, "const int gl_SIMDGroupSizeAMD = 64;"); - s.append(builtInConstant); - } -#endif - #ifdef NV_EXTENSIONS // SPV_NV_mesh_shader if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { @@ -7906,6 +7899,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } } + #ifdef AMD_EXTENSIONS if (profile != EEsProfile) { symbolTable.setFunctionExtensions("minInvocationsAMD", 1, &E_GL_AMD_shader_ballot); @@ -7940,6 +7934,9 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } if (profile != EEsProfile) { + symbolTable.setVariableExtensions("gl_SIMDGroupSizeAMD", 1, &E_GL_AMD_gcn_shader); + SpecialQualifier("gl_SIMDGroupSizeAMD", EvqVaryingIn, EbvSubGroupSize, symbolTable); + symbolTable.setFunctionExtensions("cubeFaceIndexAMD", 1, &E_GL_AMD_gcn_shader); symbolTable.setFunctionExtensions("cubeFaceCoordAMD", 1, &E_GL_AMD_gcn_shader); symbolTable.setFunctionExtensions("timeAMD", 1, &E_GL_AMD_gcn_shader);