Enable GL_KHR_shader_subgroup properly

(and GL_NV_shader_subgroup_partitioned) based on GL/ES version
instead of predicating it on vulkan SPV generation

Also add AST testing.
The glsl.450.subgroup* files are largely the same as the spv.subgroup*
The glsl.es320.subgroup* files are the same as the 450 versions, but modified to be ES compatible.
This commit is contained in:
Daniel Koch 2019-03-26 13:45:33 -04:00
parent 5efb004d59
commit 83170e3f7a
66 changed files with 95051 additions and 10 deletions

View file

@ -1873,7 +1873,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan > 0) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
commonBuiltins.append(
"void subgroupBarrier();"
"void subgroupMemoryBarrier();"
@ -6126,7 +6127,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan > 0) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
const char* ballotDecls =
"in mediump uint gl_SubgroupSize;"
"in mediump uint gl_SubgroupInvocationID;"
@ -8160,7 +8162,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan > 0) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
@ -8479,7 +8482,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan > 0) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
@ -8663,7 +8667,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan > 0) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
@ -8690,7 +8695,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan > 0) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);
@ -8859,7 +8865,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan > 0) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
@ -8948,7 +8955,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan > 0) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
@ -9365,7 +9373,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
}
// GL_KHR_shader_subgroup
if (spvVersion.vulkan > 0) {
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
symbolTable.relateToOperator("subgroupBarrier", EOpSubgroupBarrier);
symbolTable.relateToOperator("subgroupMemoryBarrier", EOpSubgroupMemoryBarrier);
symbolTable.relateToOperator("subgroupMemoryBarrierBuffer", EOpSubgroupMemoryBarrierBuffer);