Front-end: Complete GL_ARB_compute_shader implementation.

Core compute shaders were working, but the extension wasn't implemented.
This commit is contained in:
John Kessenich 2016-05-30 19:29:40 -06:00
parent 0f5e3ad23c
commit d94c003fb7
8 changed files with 116 additions and 17 deletions

View file

@ -3421,7 +3421,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
// compute
if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 430)) {
if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX,
resources.maxComputeWorkGroupCountY,
resources.maxComputeWorkGroupCountZ);
@ -3904,6 +3904,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, int spv, int vul
symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_ARB_compute_shader);
symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_ARB_compute_shader);
symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_ARB_compute_shader);
symbolTable.setVariableExtensions("gl_MaxComputeWorkGroupCount", 1, &E_GL_ARB_compute_shader);
symbolTable.setVariableExtensions("gl_MaxComputeWorkGroupSize", 1, &E_GL_ARB_compute_shader);
symbolTable.setVariableExtensions("gl_MaxComputeUniformComponents", 1, &E_GL_ARB_compute_shader);
symbolTable.setVariableExtensions("gl_MaxComputeTextureImageUnits", 1, &E_GL_ARB_compute_shader);
symbolTable.setVariableExtensions("gl_MaxComputeImageUniforms", 1, &E_GL_ARB_compute_shader);
symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounters", 1, &E_GL_ARB_compute_shader);
symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounterBuffers", 1, &E_GL_ARB_compute_shader);
}
break;

View file

@ -4232,8 +4232,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
case EShLangCompute:
if (id.compare(0, 11, "local_size_") == 0) {
profileRequires(loc, EEsProfile, 310, 0, "gl_WorkgroupSize");
profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkgroupSize");
profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize");
profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize");
if (id == "local_size_x") {
publicType.shaderQualifiers.localSize[0] = value;
return;

View file

@ -162,7 +162,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_ARB_texture_gather] = EBhDisable;
extensionBehavior[E_GL_ARB_gpu_shader5] = EBhDisablePartial;
extensionBehavior[E_GL_ARB_separate_shader_objects] = EBhDisable;
extensionBehavior[E_GL_ARB_compute_shader] = EBhDisablePartial;
extensionBehavior[E_GL_ARB_compute_shader] = EBhDisable;
extensionBehavior[E_GL_ARB_tessellation_shader] = EBhDisable;
extensionBehavior[E_GL_ARB_enhanced_layouts] = EBhDisable;
extensionBehavior[E_GL_ARB_texture_cube_map_array] = EBhDisable;

View file

@ -1208,7 +1208,7 @@ storage_qualifier
$$.qualifier.storage = EvqBuffer;
}
| SHARED {
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, 0, "shared");
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared");
parseContext.requireStage($1.loc, EShLangCompute, "shared");
$$.init($1.loc);

View file

@ -4737,7 +4737,7 @@ yyreduce:
case 155:
#line 1210 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{
parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, 0, "shared");
parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 310, 0, "shared");
parseContext.requireStage((yyvsp[0].lex).loc, EShLangCompute, "shared");
(yyval.interm.type).init((yyvsp[0].lex).loc);