Commit 3dd1ce5b by John Kessenich

Web: Add SSBOs and a few other missing compute features.

parent 51ed01c8
388096 ../build/install/bin/glslangValidator.exe 399360 ../build/install/bin/glslangValidator.exe
; SPIR-V ; SPIR-V
; Version: 1.0 ; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7 ; Generator: Khronos Glslang Reference Front End; 7
; Bound: 55 ; Bound: 91
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450" %1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" OpEntryPoint GLCompute %main "main" %gl_NumWorkGroups %gl_WorkGroupID %gl_LocalInvocationID %gl_GlobalInvocationID %gl_LocalInvocationIndex
OpExecutionMode %main LocalSize 2 5 7 OpExecutionMode %main LocalSize 2 5 7
OpSource ESSL 310 OpSource ESSL 310
OpName %main "main" OpName %main "main"
OpName %bName "bName"
OpMemberName %bName 0 "size"
OpMemberName %bName 1 "count"
OpMemberName %bName 2 "data"
OpName %bInst "bInst"
OpName %s "s" OpName %s "s"
OpName %arrX "arrX" OpName %arrX "arrX"
OpName %arrY "arrY" OpName %arrY "arrY"
OpName %arrZ "arrZ" OpName %arrZ "arrZ"
OpDecorate %19 SpecId 18 OpName %gl_NumWorkGroups "gl_NumWorkGroups"
OpDecorate %21 SpecId 19 OpName %gl_WorkGroupID "gl_WorkGroupID"
OpName %gl_LocalInvocationID "gl_LocalInvocationID"
OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex"
OpDecorate %_runtimearr_v4float ArrayStride 16
OpMemberDecorate %bName 0 Offset 0
OpMemberDecorate %bName 1 Offset 16
OpMemberDecorate %bName 2 Offset 32
OpDecorate %bName BufferBlock
OpDecorate %bInst DescriptorSet 0
OpDecorate %bInst Binding 0
OpDecorate %39 SpecId 18
OpDecorate %41 SpecId 19
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
OpDecorate %gl_NumWorkGroups BuiltIn NumWorkgroups
OpDecorate %gl_WorkGroupID BuiltIn WorkgroupId
OpDecorate %gl_LocalInvocationID BuiltIn LocalInvocationId
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
%void = OpTypeVoid %void = OpTypeVoid
%3 = OpTypeFunction %void %3 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%int = OpTypeInt 32 1
%v3uint = OpTypeVector %uint 3
%float = OpTypeFloat 32 %float = OpTypeFloat 32
%v4float = OpTypeVector %float 4 %v4float = OpTypeVector %float 4
%uint = OpTypeInt 32 0 %_runtimearr_v4float = OpTypeRuntimeArray %v4float
%bName = OpTypeStruct %int %v3uint %_runtimearr_v4float
%_ptr_Uniform_bName = OpTypePointer Uniform %bName
%bInst = OpVariable %_ptr_Uniform_bName Uniform
%int_2 = OpConstant %int 2
%int_0 = OpConstant %int 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%float_7 = OpConstant %float 7
%24 = OpConstantComposite %v4float %float_7 %float_7 %float_7 %float_7
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%uint_1 = OpConstant %uint 1
%uint_3400 = OpConstant %uint 3400
%uint_72 = OpConstant %uint 72
%uint_197645 = OpConstant %uint 197645 %uint_197645 = OpConstant %uint 197645
%_arr_v4float_uint_197645 = OpTypeArray %v4float %uint_197645 %_arr_v4float_uint_197645 = OpTypeArray %v4float %uint_197645
%_ptr_Function__arr_v4float_uint_197645 = OpTypePointer Function %_arr_v4float_uint_197645 %_ptr_Workgroup__arr_v4float_uint_197645 = OpTypePointer Workgroup %_arr_v4float_uint_197645
%int = OpTypeInt 32 1 %s = OpVariable %_ptr_Workgroup__arr_v4float_uint_197645 Workgroup
%int_3 = OpConstant %int 3 %int_3 = OpConstant %int 3
%float_1 = OpConstant %float 1 %float_0 = OpConstant %float 0
%16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 %39 = OpSpecConstant %uint 2
%_ptr_Function_v4float = OpTypePointer Function %v4float
%19 = OpSpecConstant %uint 2
%uint_5 = OpConstant %uint 5 %uint_5 = OpConstant %uint 5
%21 = OpSpecConstant %uint 7 %41 = OpSpecConstant %uint 7
%v3uint = OpTypeVector %uint 3 %gl_WorkGroupSize = OpSpecConstantComposite %v3uint %39 %uint_5 %41
%23 = OpSpecConstantComposite %v3uint %19 %uint_5 %21
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_arr_int_25 = OpTypeArray %int %25 %_arr_int_44 = OpTypeArray %int %44
%_ptr_Private__arr_int_25 = OpTypePointer Private %_arr_int_25 %_ptr_Private__arr_int_44 = OpTypePointer Private %_arr_int_44
%arrX = OpVariable %_ptr_Private__arr_int_25 Private %arrX = OpVariable %_ptr_Private__arr_int_44 Private
%int_0 = OpConstant %int 0
%_ptr_Private_int = OpTypePointer Private %int %_ptr_Private_int = OpTypePointer Private %int
%uint_1 = OpConstant %uint 1 %_arr_int_52 = OpTypeArray %int %52
%_arr_int_34 = OpTypeArray %int %34 %_ptr_Private__arr_int_52 = OpTypePointer Private %_arr_int_52
%_ptr_Private__arr_int_34 = OpTypePointer Private %_arr_int_34 %arrY = OpVariable %_ptr_Private__arr_int_52 Private
%arrY = OpVariable %_ptr_Private__arr_int_34 Private %_arr_int_59 = OpTypeArray %int %59
%uint_2 = OpConstant %uint 2 %_ptr_Private__arr_int_59 = OpTypePointer Private %_arr_int_59
%_arr_int_42 = OpTypeArray %int %42 %arrZ = OpVariable %_ptr_Private__arr_int_59 Private
%_ptr_Private__arr_int_42 = OpTypePointer Private %_arr_int_42 %_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float
%arrZ = OpVariable %_ptr_Private__arr_int_42 Private %int_1 = OpConstant %int 1
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%gl_NumWorkGroups = OpVariable %_ptr_Input_v3uint Input
%gl_WorkGroupID = OpVariable %_ptr_Input_v3uint Input
%gl_LocalInvocationID = OpVariable %_ptr_Input_v3uint Input
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%_ptr_Input_uint = OpTypePointer Input %uint
%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input
%_ptr_Uniform_v3uint = OpTypePointer Uniform %v3uint
%int_197645 = OpConstant %int 197645 %int_197645 = OpConstant %int 197645
%main = OpFunction %void None %3 %main = OpFunction %void None %3
%5 = OpLabel %5 = OpLabel
%s = OpVariable %_ptr_Function__arr_v4float_uint_197645 Function OpControlBarrier %uint_2 %uint_2 %uint_264
%18 = OpAccessChain %_ptr_Function_v4float %s %int_3 %20 = OpAccessChain %_ptr_Uniform_int %bInst %int_0
OpStore %18 %16 %21 = OpLoad %int %20
%25 = OpCompositeExtract %uint %23 0 %22 = OpSDiv %int %21 %int_2
%31 = OpAccessChain %_ptr_Private_int %arrX %int_0 %26 = OpAccessChain %_ptr_Uniform_v4float %bInst %int_2 %22
%32 = OpLoad %int %31 %27 = OpLoad %v4float %26
%34 = OpCompositeExtract %uint %23 1 %28 = OpFMul %v4float %27 %24
%38 = OpAccessChain %_ptr_Private_int %arrY %int_0 %29 = OpAccessChain %_ptr_Uniform_v4float %bInst %int_2 %22
%39 = OpLoad %int %38 OpStore %29 %28
%40 = OpIMul %int %32 %39 OpMemoryBarrier %uint_1 %uint_3400
%42 = OpCompositeExtract %uint %23 2 OpMemoryBarrier %uint_2 %uint_3400
%46 = OpAccessChain %_ptr_Private_int %arrZ %int_0 OpMemoryBarrier %uint_1 %uint_264
%47 = OpLoad %int %46 OpMemoryBarrier %uint_1 %uint_72
%48 = OpIMul %int %40 %47 %44 = OpCompositeExtract %uint %gl_WorkGroupSize 0
%49 = OpConvertSToF %float %48 %49 = OpAccessChain %_ptr_Private_int %arrX %int_0
%50 = OpAccessChain %_ptr_Function_v4float %s %int_3 %50 = OpLoad %int %49
%51 = OpLoad %v4float %50 %51 = OpConvertSToF %float %50
%52 = OpVectorTimesScalar %v4float %51 %49 %52 = OpCompositeExtract %uint %gl_WorkGroupSize 1
%53 = OpAccessChain %_ptr_Function_v4float %s %int_3 %56 = OpAccessChain %_ptr_Private_int %arrY %int_0
OpStore %53 %52 %57 = OpLoad %int %56
%58 = OpConvertSToF %float %57
%59 = OpCompositeExtract %uint %gl_WorkGroupSize 2
%63 = OpAccessChain %_ptr_Private_int %arrZ %int_0
%64 = OpLoad %int %63
%65 = OpConvertSToF %float %64
%66 = OpCompositeConstruct %v4float %float_0 %51 %58 %65
%68 = OpAccessChain %_ptr_Workgroup_v4float %s %int_3
OpStore %68 %66
%72 = OpLoad %v3uint %gl_NumWorkGroups
%73 = OpIAdd %v3uint %72 %gl_WorkGroupSize
%75 = OpLoad %v3uint %gl_WorkGroupID
%76 = OpIAdd %v3uint %73 %75
%78 = OpLoad %v3uint %gl_LocalInvocationID
%79 = OpIAdd %v3uint %76 %78
%81 = OpLoad %v3uint %gl_GlobalInvocationID
%84 = OpLoad %uint %gl_LocalInvocationIndex
%85 = OpCompositeConstruct %v3uint %84 %84 %84
%86 = OpIMul %v3uint %81 %85
%87 = OpIAdd %v3uint %79 %86
%89 = OpAccessChain %_ptr_Uniform_v3uint %bInst %int_1
OpStore %89 %87
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
...@@ -5,6 +5,7 @@ layout(local_size_x_id = 18, local_size_z_id = 19) in; ...@@ -5,6 +5,7 @@ layout(local_size_x_id = 18, local_size_z_id = 19) in;
layout(local_size_x = 2) in; layout(local_size_x = 2) in;
layout(local_size_y = 5) in; layout(local_size_y = 5) in;
layout(local_size_z = 7) in; layout(local_size_z = 7) in;
const int total = gl_MaxComputeWorkGroupCount.x const int total = gl_MaxComputeWorkGroupCount.x
+ gl_MaxComputeWorkGroupCount.y + gl_MaxComputeWorkGroupCount.y
+ gl_MaxComputeWorkGroupCount.z + gl_MaxComputeWorkGroupCount.z
...@@ -17,12 +18,24 @@ int arrX[gl_WorkGroupSize.x]; ...@@ -17,12 +18,24 @@ int arrX[gl_WorkGroupSize.x];
int arrY[gl_WorkGroupSize.y]; int arrY[gl_WorkGroupSize.y];
int arrZ[gl_WorkGroupSize.z]; int arrZ[gl_WorkGroupSize.z];
layout(binding = 0, set = 0) buffer bName {
int size;
uvec3 count;
vec4 data[];
} bInst;
void main() void main()
{ {
barrier(); barrier();
bInst.data[bInst.size / 2] *= vec4(7.0);
memoryBarrier(); memoryBarrier();
memoryBarrierShared();
groupMemoryBarrier(); groupMemoryBarrier();
s[3] = vec4(1.0); memoryBarrierShared();
s[3] *= arrX[0] * arrY[0] * arrZ[0]; memoryBarrierBuffer();
s[3] = vec4(0, arrX[0], arrY[0], arrZ[0]);
bInst.count = gl_NumWorkGroups + gl_WorkGroupSize + gl_WorkGroupID + gl_LocalInvocationID +
gl_GlobalInvocationID * gl_LocalInvocationIndex;
} }
...@@ -3819,13 +3819,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV ...@@ -3819,13 +3819,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
stageBuiltins[EShLangCompute].append( stageBuiltins[EShLangCompute].append(
"void memoryBarrierShared();" "void memoryBarrierShared();"
"void groupMemoryBarrier();" "void groupMemoryBarrier();"
"void memoryBarrierBuffer();"
); );
} }
#ifndef GLSLANG_WEB #ifndef GLSLANG_WEB
if ((profile != EEsProfile && version >= 420) || esBarrier) { if ((profile != EEsProfile && version >= 420) || esBarrier) {
commonBuiltins.append( commonBuiltins.append(
"void memoryBarrierAtomicCounter();" "void memoryBarrierAtomicCounter();"
"void memoryBarrierBuffer();"
"void memoryBarrierImage();" "void memoryBarrierImage();"
); );
} }
...@@ -7692,8 +7692,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -7692,8 +7692,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives); symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives); symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives);
} }
#endif
break; break;
#ifndef GLSLANG_WEB
case EShLangRayGenNV: case EShLangRayGenNV:
case EShLangIntersectNV: case EShLangIntersectNV:
case EShLangAnyHitNV: case EShLangAnyHitNV:
...@@ -8108,6 +8110,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -8108,6 +8110,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("barrier", EOpBarrier); symbolTable.relateToOperator("barrier", EOpBarrier);
symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier); symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier);
symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
#ifndef GLSLANG_WEB #ifndef GLSLANG_WEB
symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16); symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16);
...@@ -8132,7 +8135,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -8132,7 +8135,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("controlBarrier", EOpBarrier); symbolTable.relateToOperator("controlBarrier", EOpBarrier);
symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter); symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter);
symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage); symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage);
symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad); symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad);
......
...@@ -3813,10 +3813,6 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua ...@@ -3813,10 +3813,6 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
// for ES, if size isn't coming from an initializer, it has to be explicitly declared now, // for ES, if size isn't coming from an initializer, it has to be explicitly declared now,
// with very few exceptions // with very few exceptions
// last member of ssbo block exception:
if (qualifier.storage == EvqBuffer && lastMember)
return;
// implicitly-sized io exceptions: // implicitly-sized io exceptions:
switch (language) { switch (language) {
case EShLangGeometry: case EShLangGeometry:
...@@ -3851,6 +3847,10 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua ...@@ -3851,6 +3847,10 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
#endif #endif
// last member of ssbo block exception:
if (qualifier.storage == EvqBuffer && lastMember)
return;
arraySizeRequiredCheck(loc, *arraySizes); arraySizeRequiredCheck(loc, *arraySizes);
} }
...@@ -5384,6 +5384,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi ...@@ -5384,6 +5384,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
#endif #endif
case EShLangCompute: case EShLangCompute:
if (id.compare(0, 11, "local_size_") == 0) { if (id.compare(0, 11, "local_size_") == 0) {
#ifndef GLSLANG_WEB
if (language == EShLangMeshNV || language == EShLangTaskNV) { if (language == EShLangMeshNV || language == EShLangTaskNV) {
requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "gl_WorkGroupSize"); requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "gl_WorkGroupSize");
} }
...@@ -5392,6 +5393,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi ...@@ -5392,6 +5393,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize"); profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize");
profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize"); profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize");
} }
#endif
if (nonLiteral) if (nonLiteral)
error(loc, "needs a literal integer", "local_size", ""); error(loc, "needs a literal integer", "local_size", "");
if (id.size() == 12 && value == 0) { if (id.size() == 12 && value == 0) {
...@@ -8017,7 +8019,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con ...@@ -8017,7 +8019,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
} }
if (intermediate.getLocalSize(i) > (unsigned int)max) if (intermediate.getLocalSize(i) > (unsigned int)max)
error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", ""); error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", "");
} else if (language == EShLangMeshNV) { }
#ifndef GLSLANG_WEB
else if (language == EShLangMeshNV) {
switch (i) { switch (i) {
case 0: max = resources.maxMeshWorkGroupSizeX_NV; break; case 0: max = resources.maxMeshWorkGroupSizeX_NV; break;
case 1: max = resources.maxMeshWorkGroupSizeY_NV; break; case 1: max = resources.maxMeshWorkGroupSizeY_NV; break;
...@@ -8035,7 +8039,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con ...@@ -8035,7 +8039,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
} }
if (intermediate.getLocalSize(i) > (unsigned int)max) if (intermediate.getLocalSize(i) > (unsigned int)max)
error(loc, "too large; see gl_MaxTaskWorkGroupSizeNV", "local_size", ""); error(loc, "too large; see gl_MaxTaskWorkGroupSizeNV", "local_size", "");
} else { }
#endif
else {
assert(0); assert(0);
} }
......
...@@ -343,6 +343,7 @@ void TScanContext::fillInKeywordMap() ...@@ -343,6 +343,7 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["const"] = CONST; (*KeywordMap)["const"] = CONST;
(*KeywordMap)["uniform"] = UNIFORM; (*KeywordMap)["uniform"] = UNIFORM;
(*KeywordMap)["buffer"] = BUFFER;
(*KeywordMap)["in"] = IN; (*KeywordMap)["in"] = IN;
(*KeywordMap)["out"] = OUT; (*KeywordMap)["out"] = OUT;
(*KeywordMap)["smooth"] = SMOOTH; (*KeywordMap)["smooth"] = SMOOTH;
...@@ -410,7 +411,6 @@ void TScanContext::fillInKeywordMap() ...@@ -410,7 +411,6 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["attribute"] = ATTRIBUTE; (*KeywordMap)["attribute"] = ATTRIBUTE;
(*KeywordMap)["varying"] = VARYING; (*KeywordMap)["varying"] = VARYING;
(*KeywordMap)["noperspective"] = NOPERSPECTIVE; (*KeywordMap)["noperspective"] = NOPERSPECTIVE;
(*KeywordMap)["buffer"] = BUFFER;
(*KeywordMap)["coherent"] = COHERENT; (*KeywordMap)["coherent"] = COHERENT;
(*KeywordMap)["devicecoherent"] = DEVICECOHERENT; (*KeywordMap)["devicecoherent"] = DEVICECOHERENT;
(*KeywordMap)["queuefamilycoherent"] = QUEUEFAMILYCOHERENT; (*KeywordMap)["queuefamilycoherent"] = QUEUEFAMILYCOHERENT;
...@@ -905,6 +905,13 @@ int TScanContext::tokenizeIdentifier() ...@@ -905,6 +905,13 @@ int TScanContext::tokenizeIdentifier()
case CASE: case CASE:
return keyword; return keyword;
case BUFFER:
afterBuffer = true;
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
(!parseContext.isEsProfile() && parseContext.version < 430))
return identifierOrType();
return keyword;
case STRUCT: case STRUCT:
afterStruct = true; afterStruct = true;
return keyword; return keyword;
...@@ -998,12 +1005,6 @@ int TScanContext::tokenizeIdentifier() ...@@ -998,12 +1005,6 @@ int TScanContext::tokenizeIdentifier()
if (parseContext.isEsProfile() && parseContext.version >= 300) if (parseContext.isEsProfile() && parseContext.version >= 300)
reservedWord(); reservedWord();
return keyword; return keyword;
case BUFFER:
afterBuffer = true;
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
(!parseContext.isEsProfile() && parseContext.version < 430))
return identifierOrType();
return keyword;
case PAYLOADNV: case PAYLOADNV:
case PAYLOADINNV: case PAYLOADINNV:
case HITATTRNV: case HITATTRNV:
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
// //
// Do not edit the .y file, only edit the .m4 file. // Do not edit the .y file, only edit the .m4 file.
// The .y bison file is not a source file, it is a derivitive of the .m4 file. // The .y bison file is not a source file, it is a derivative of the .m4 file.
// The m4 file needs to be processed by m4 to generate the .y bison file. // The m4 file needs to be processed by m4 to generate the .y bison file.
// //
// Code sandwiched between a pair: // Code sandwiched between a pair:
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
// ... // ...
// GLSLANG_WEB_EXCLUDE_OFF // GLSLANG_WEB_EXCLUDE_OFF
// //
// Will be exluded from the grammar when m4 is executed as: // Will be excluded from the grammar when m4 is executed as:
// //
// m4 -P -DGLSLANG_WEB // m4 -P -DGLSLANG_WEB
// //
...@@ -277,7 +277,7 @@ GLSLANG_WEB_EXCLUDE_OFF ...@@ -277,7 +277,7 @@ GLSLANG_WEB_EXCLUDE_OFF
%token <lex> CENTROID IN OUT INOUT %token <lex> CENTROID IN OUT INOUT
%token <lex> STRUCT VOID WHILE %token <lex> STRUCT VOID WHILE
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT %token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
%token <lex> UNIFORM SHARED %token <lex> UNIFORM SHARED BUFFER
%token <lex> FLAT SMOOTH LAYOUT %token <lex> FLAT SMOOTH LAYOUT
GLSLANG_WEB_EXCLUDE_ON GLSLANG_WEB_EXCLUDE_ON
...@@ -285,7 +285,7 @@ GLSLANG_WEB_EXCLUDE_ON ...@@ -285,7 +285,7 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> INT64CONSTANT UINT64CONSTANT %token <lex> INT64CONSTANT UINT64CONSTANT
%token <lex> SUBROUTINE DEMOTE %token <lex> SUBROUTINE DEMOTE
%token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV %token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV
%token <lex> PATCH SAMPLE BUFFER NONUNIFORM %token <lex> PATCH SAMPLE NONUNIFORM
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT %token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
%token <lex> SUBGROUPCOHERENT NONPRIVATE %token <lex> SUBGROUPCOHERENT NONPRIVATE
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV %token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
...@@ -1368,12 +1368,12 @@ storage_qualifier ...@@ -1368,12 +1368,12 @@ storage_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.storage = EvqShared; $$.qualifier.storage = EvqShared;
} }
GLSLANG_WEB_EXCLUDE_ON
| BUFFER { | BUFFER {
parseContext.globalCheck($1.loc, "buffer"); parseContext.globalCheck($1.loc, "buffer");
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.storage = EvqBuffer; $$.qualifier.storage = EvqBuffer;
} }
GLSLANG_WEB_EXCLUDE_ON
| ATTRIBUTE { | ATTRIBUTE {
parseContext.requireStage($1.loc, EShLangVertex, "attribute"); parseContext.requireStage($1.loc, EShLangVertex, "attribute");
parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute"); parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
// //
// Do not edit the .y file, only edit the .m4 file. // Do not edit the .y file, only edit the .m4 file.
// The .y bison file is not a source file, it is a derivitive of the .m4 file. // The .y bison file is not a source file, it is a derivative of the .m4 file.
// The m4 file needs to be processed by m4 to generate the .y bison file. // The m4 file needs to be processed by m4 to generate the .y bison file.
// //
// Code sandwiched between a pair: // Code sandwiched between a pair:
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
// ... // ...
// GLSLANG_WEB_EXCLUDE_OFF // GLSLANG_WEB_EXCLUDE_OFF
// //
// Will be exluded from the grammar when m4 is executed as: // Will be excluded from the grammar when m4 is executed as:
// //
// m4 -P -DGLSLANG_WEB // m4 -P -DGLSLANG_WEB
// //
...@@ -194,7 +194,7 @@ extern int yylex(YYSTYPE*, TParseContext&); ...@@ -194,7 +194,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> CENTROID IN OUT INOUT %token <lex> CENTROID IN OUT INOUT
%token <lex> STRUCT VOID WHILE %token <lex> STRUCT VOID WHILE
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT %token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
%token <lex> UNIFORM SHARED %token <lex> UNIFORM SHARED BUFFER
%token <lex> FLAT SMOOTH LAYOUT %token <lex> FLAT SMOOTH LAYOUT
...@@ -1164,6 +1164,11 @@ storage_qualifier ...@@ -1164,6 +1164,11 @@ storage_qualifier
$$.init($1.loc); $$.init($1.loc);
$$.qualifier.storage = EvqShared; $$.qualifier.storage = EvqShared;
} }
| BUFFER {
parseContext.globalCheck($1.loc, "buffer");
$$.init($1.loc);
$$.qualifier.storage = EvqBuffer;
}
; ;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -182,9 +182,10 @@ extern int yydebug; ...@@ -182,9 +182,10 @@ extern int yydebug;
DEFAULT = 392, DEFAULT = 392,
UNIFORM = 393, UNIFORM = 393,
SHARED = 394, SHARED = 394,
FLAT = 395, BUFFER = 395,
SMOOTH = 396, FLAT = 396,
LAYOUT = 397 SMOOTH = 397,
LAYOUT = 398
}; };
#endif #endif
...@@ -229,7 +230,7 @@ union YYSTYPE ...@@ -229,7 +230,7 @@ union YYSTYPE
glslang::TArraySizes* typeParameters; glslang::TArraySizes* typeParameters;
} interm; } interm;
#line 233 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */ #line 234 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
}; };
typedef union YYSTYPE YYSTYPE; typedef union YYSTYPE YYSTYPE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment