Web: Add compute stage.

This commit is contained in:
John Kessenich 2019-10-10 11:40:11 -06:00
parent 61c22e255d
commit 51ed01c877
13 changed files with 1526 additions and 1380 deletions

View File

@ -292,8 +292,8 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage)
switch (stage) {
case EShLangVertex: return spv::ExecutionModelVertex;
case EShLangFragment: return spv::ExecutionModelFragment;
#ifndef GLSLANG_WEB
case EShLangCompute: return spv::ExecutionModelGLCompute;
#ifndef GLSLANG_WEB
case EShLangTessControl: return spv::ExecutionModelTessellationControl;
case EShLangTessEvaluation: return spv::ExecutionModelTessellationEvaluation;
case EShLangGeometry: return spv::ExecutionModelGeometry;
@ -1489,12 +1489,12 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
#endif
break;
#ifndef GLSLANG_WEB
case EShLangCompute:
builder.addCapability(spv::CapabilityShader);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
glslangIntermediate->getLocalSize(1),
glslangIntermediate->getLocalSize(2));
#ifndef GLSLANG_WEB
if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupQuads) {
builder.addCapability(spv::CapabilityComputeDerivativeGroupQuadsNV);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupQuadsNV);
@ -1504,7 +1504,9 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupLinearNV);
builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives);
}
#endif
break;
#ifndef GLSLANG_WEB
case EShLangTessEvaluation:
case EShLangTessControl:
builder.addCapability(spv::CapabilityTessellation);
@ -7826,7 +7828,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n
// We now know we have a specialization constant to build
#ifndef GLSLANG_WEB
// gl_WorkGroupSize is a special case until the front-end handles hierarchical specialization constants,
// even then, it's specialization ids are handled by special case syntax in GLSL: layout(local_size_x = ...
if (node.getType().getQualifier().builtIn == glslang::EbvWorkGroupSize) {
@ -7841,7 +7842,6 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n
}
return builder.makeCompositeConstant(builder.makeVectorType(builder.makeUintType(32), 3), dimConstId, true);
}
#endif
// An AST node labelled as specialization constant should be a symbol node.
// Its initializer should either be a sub tree with constant nodes, or a constant union array.

View File

@ -0,0 +1,75 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 55
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 2 5 7
OpSource ESSL 310
OpName %main "main"
OpName %s "s"
OpName %arrX "arrX"
OpName %arrY "arrY"
OpName %arrZ "arrZ"
OpDecorate %19 SpecId 18
OpDecorate %21 SpecId 19
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%uint = OpTypeInt 32 0
%uint_197645 = OpConstant %uint 197645
%_arr_v4float_uint_197645 = OpTypeArray %v4float %uint_197645
%_ptr_Function__arr_v4float_uint_197645 = OpTypePointer Function %_arr_v4float_uint_197645
%int = OpTypeInt 32 1
%int_3 = OpConstant %int 3
%float_1 = OpConstant %float 1
%16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%19 = OpSpecConstant %uint 2
%uint_5 = OpConstant %uint 5
%21 = OpSpecConstant %uint 7
%v3uint = OpTypeVector %uint 3
%23 = OpSpecConstantComposite %v3uint %19 %uint_5 %21
%uint_0 = OpConstant %uint 0
%_arr_int_25 = OpTypeArray %int %25
%_ptr_Private__arr_int_25 = OpTypePointer Private %_arr_int_25
%arrX = OpVariable %_ptr_Private__arr_int_25 Private
%int_0 = OpConstant %int 0
%_ptr_Private_int = OpTypePointer Private %int
%uint_1 = OpConstant %uint 1
%_arr_int_34 = OpTypeArray %int %34
%_ptr_Private__arr_int_34 = OpTypePointer Private %_arr_int_34
%arrY = OpVariable %_ptr_Private__arr_int_34 Private
%uint_2 = OpConstant %uint 2
%_arr_int_42 = OpTypeArray %int %42
%_ptr_Private__arr_int_42 = OpTypePointer Private %_arr_int_42
%arrZ = OpVariable %_ptr_Private__arr_int_42 Private
%int_197645 = OpConstant %int 197645
%main = OpFunction %void None %3
%5 = OpLabel
%s = OpVariable %_ptr_Function__arr_v4float_uint_197645 Function
%18 = OpAccessChain %_ptr_Function_v4float %s %int_3
OpStore %18 %16
%25 = OpCompositeExtract %uint %23 0
%31 = OpAccessChain %_ptr_Private_int %arrX %int_0
%32 = OpLoad %int %31
%34 = OpCompositeExtract %uint %23 1
%38 = OpAccessChain %_ptr_Private_int %arrY %int_0
%39 = OpLoad %int %38
%40 = OpIMul %int %32 %39
%42 = OpCompositeExtract %uint %23 2
%46 = OpAccessChain %_ptr_Private_int %arrZ %int_0
%47 = OpLoad %int %46
%48 = OpIMul %int %40 %47
%49 = OpConvertSToF %float %48
%50 = OpAccessChain %_ptr_Function_v4float %s %int_3
%51 = OpLoad %v4float %50
%52 = OpVectorTimesScalar %v4float %51 %49
%53 = OpAccessChain %_ptr_Function_v4float %s %int_3
OpStore %53 %52
OpReturn
OpFunctionEnd

28
Test/web.comp Normal file
View File

@ -0,0 +1,28 @@
#version 310 es
layout(local_size_x_id = 18, local_size_z_id = 19) in;
layout(local_size_x = 2) in;
layout(local_size_y = 5) in;
layout(local_size_z = 7) in;
const int total = gl_MaxComputeWorkGroupCount.x
+ gl_MaxComputeWorkGroupCount.y
+ gl_MaxComputeWorkGroupCount.z
+ gl_MaxComputeUniformComponents
+ gl_MaxComputeTextureImageUnits;
shared vec4 s[total];
int arrX[gl_WorkGroupSize.x];
int arrY[gl_WorkGroupSize.y];
int arrZ[gl_WorkGroupSize.z];
void main()
{
barrier();
memoryBarrier();
memoryBarrierShared();
groupMemoryBarrier();
s[3] = vec4(1.0);
s[3] *= arrX[0] * arrY[0] * arrZ[0];
}

View File

@ -6,3 +6,4 @@ web.operations.frag
web.texture.frag
web.array.frag
web.separate.frag
web.comp

View File

@ -3795,21 +3795,44 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void EndPrimitive();"
"\n");
}
#endif
//============================================================================
//
// Prototypes for all control functions.
//
//============================================================================
#ifdef GLSLANG_WEB
bool esBarrier = true;
#else
bool esBarrier = (profile == EEsProfile && version >= 310);
if ((profile != EEsProfile && version >= 150) || esBarrier)
stageBuiltins[EShLangTessControl].append(
"void barrier();"
);
#endif
if ((profile != EEsProfile && version >= 420) || esBarrier)
stageBuiltins[EShLangCompute].append(
"void barrier();"
);
if ((profile != EEsProfile && version >= 130) || esBarrier)
commonBuiltins.append(
"void memoryBarrier();"
);
if ((profile != EEsProfile && version >= 420) || esBarrier) {
stageBuiltins[EShLangCompute].append(
"void memoryBarrierShared();"
"void groupMemoryBarrier();"
);
}
#ifndef GLSLANG_WEB
if ((profile != EEsProfile && version >= 420) || esBarrier) {
commonBuiltins.append(
"void memoryBarrierAtomicCounter();"
"void memoryBarrierBuffer();"
"void memoryBarrierImage();"
);
}
if ((profile != EEsProfile && version >= 150) || esBarrier)
stageBuiltins[EShLangTessControl].append(
"void barrier();"
);
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
stageBuiltins[EShLangMeshNV].append(
"void barrier();"
@ -3818,21 +3841,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void barrier();"
);
}
if ((profile != EEsProfile && version >= 130) || esBarrier)
commonBuiltins.append(
"void memoryBarrier();"
);
if ((profile != EEsProfile && version >= 420) || esBarrier) {
commonBuiltins.append(
"void memoryBarrierAtomicCounter();"
"void memoryBarrierBuffer();"
"void memoryBarrierImage();"
);
stageBuiltins[EShLangCompute].append(
"void memoryBarrierShared();"
"void groupMemoryBarrier();"
);
}
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
stageBuiltins[EShLangMeshNV].append(
"void memoryBarrierShared();"
@ -4279,6 +4287,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
#endif
//============================================================================
//
@ -4308,6 +4317,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
#ifndef GLSLANG_WEB
//============================================================================
//
// Define the interface to the mesh/task shader.
@ -6300,9 +6310,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append(builtInConstant);
}
#ifdef GLSLANG_WEB
}
#else
#ifndef GLSLANG_WEB
if (version >= 310) {
// geometry
@ -6584,8 +6592,29 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents);
s.append(builtInConstant);
}
#endif
}
// compute
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);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX,
resources.maxComputeWorkGroupSizeY,
resources.maxComputeWorkGroupSizeZ);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits);
s.append(builtInConstant);
s.append("\n");
}
#ifndef GLSLANG_WEB
// images (some in compute below)
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 130)) {
@ -6601,6 +6630,18 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append(builtInConstant);
}
// compute
if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers);
s.append(builtInConstant);
s.append("\n");
}
// atomic counters (some in compute below)
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 420)) {
@ -6638,31 +6679,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append("\n");
}
// compute
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);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX,
resources.maxComputeWorkGroupSizeY,
resources.maxComputeWorkGroupSizeZ);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters);
s.append(builtInConstant);
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers);
s.append(builtInConstant);
s.append("\n");
}
// GL_ARB_cull_distance
if (profile != EEsProfile && version >= 450) {
snprintf(builtInConstant, maxSize, "const int gl_MaxCullDistances = %d;", resources.maxCullDistances);
@ -7547,7 +7563,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
#endif
break;
#ifndef GLSLANG_WEB
case EShLangCompute:
BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable);
BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);
@ -7556,6 +7571,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);
BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);
#ifndef GLSLANG_WEB
if (profile != EEsProfile && version < 430) {
symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_ARB_compute_shader);
symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_ARB_compute_shader);
@ -7635,6 +7651,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
}
#endif
if ((profile != EEsProfile && version >= 140) ||
(profile == EEsProfile && version >= 310)) {
@ -7644,6 +7661,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
}
#ifndef GLSLANG_WEB
// GL_KHR_shader_subgroup
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
@ -8088,6 +8106,9 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32);
symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32);
symbolTable.relateToOperator("barrier", EOpBarrier);
symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier);
#ifndef GLSLANG_WEB
symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16);
symbolTable.relateToOperator("unpackInt2x16", EOpUnpackInt2x16);
@ -8109,9 +8130,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("unpack16", EOpUnpack16);
symbolTable.relateToOperator("unpack8", EOpUnpack8);
symbolTable.relateToOperator("barrier", EOpBarrier);
symbolTable.relateToOperator("controlBarrier", EOpBarrier);
symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier);
symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter);
symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage);
@ -8443,8 +8462,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
#endif
}
#ifndef GLSLANG_WEB
switch(language) {
#ifndef GLSLANG_WEB
case EShLangVertex:
break;
@ -8479,10 +8498,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("endInvocationInterlockARB", EOpEndInvocationInterlock);
break;
#endif
case EShLangCompute:
symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);
symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier);
#ifndef GLSLANG_WEB
symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared);
if ((profile != EEsProfile && version >= 450) ||
(profile == EEsProfile && version >= 320)) {
@ -8499,8 +8520,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("coopMatLoadNV", EOpCooperativeMatrixLoad);
symbolTable.relateToOperator("coopMatStoreNV", EOpCooperativeMatrixStore);
symbolTable.relateToOperator("coopMatMulAddNV", EOpCooperativeMatrixMulAdd);
#endif
break;
#ifndef GLSLANG_WEB
case EShLangRayGenNV:
case EShLangClosestHitNV:
case EShLangMissNV:
@ -8539,8 +8562,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
default:
assert(false && "Language not supported");
}
#endif
}
}
//

View File

@ -3387,11 +3387,11 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
requireProfile(loc, ~EEsProfile, "fragment-shader struct input containing an array");
}
break;
#ifndef GLSLANG_WEB
case EShLangCompute:
if (! symbolTable.atBuiltInLevel())
error(loc, "global storage input qualifier cannot be used in a compute shader", "in", "");
break;
#ifndef GLSLANG_WEB
case EShLangTessControl:
if (qualifier.patch)
error(loc, "can only use on output in tessellation-control shader", "patch", "");
@ -3432,10 +3432,10 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
error(loc, "cannot contain a double, int64, or uint64", GetStorageQualifierString(qualifier.storage), "");
break;
#ifndef GLSLANG_WEB
case EShLangCompute:
error(loc, "global storage output qualifier cannot be used in a compute shader", "out", "");
break;
#ifndef GLSLANG_WEB
case EShLangTessEvaluation:
if (qualifier.patch)
error(loc, "can only use on input in tessellation-evaluation shader", "patch", "");
@ -5293,11 +5293,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
error(loc, "needs a literal integer", "buffer_reference_align", "");
return;
}
#endif
switch (language) {
case EShLangVertex:
break;
#ifndef GLSLANG_WEB
case EShLangTessControl:
if (id == "vertices") {
if (value == 0)
@ -5310,9 +5309,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
}
break;
case EShLangTessEvaluation:
break;
case EShLangGeometry:
if (id == "invocations") {
profileRequires(loc, ECompatibilityProfile | ECoreProfile, 400, nullptr, "invocations");
@ -5385,6 +5381,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
case EShLangTaskNV:
// Fall through
#endif
case EShLangCompute:
if (id.compare(0, 11, "local_size_") == 0) {
if (language == EShLangMeshNV || language == EShLangTaskNV) {
@ -5432,12 +5429,11 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
}
}
break;
default:
break;
}
#endif // GLSLANG_WEB
error(loc, "there is no such layout identifier for this stage taking an assigned value", id.c_str(), "");
}
@ -8004,6 +8000,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
else
error(loc, "can only apply to 'in'", "point_mode", "");
}
#endif
for (int i = 0; i < 3; ++i) {
if (publicType.shaderQualifiers.localSizeNotDefault[i]) {
if (publicType.qualifier.storage == EvqVaryingIn) {
@ -8063,6 +8060,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
}
}
#ifndef GLSLANG_WEB
if (publicType.shaderQualifiers.earlyFragmentTests) {
if (publicType.qualifier.storage == EvqVaryingIn)
intermediate.setEarlyFragmentTests();

View File

@ -1058,13 +1058,12 @@ int TScanContext::tokenizeIdentifier()
case SUBROUTINE:
return es30ReservedFromGLSL(400);
#endif
case SHARED:
if ((parseContext.isEsProfile() && parseContext.version < 300) ||
(!parseContext.isEsProfile() && parseContext.version < 140))
return identifierOrType();
return keyword;
#endif
case LAYOUT:
{
const int numLayoutExts = 2;

View File

@ -341,6 +341,7 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
(profile == EEsProfile && version >= 310))
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangGeometry, source,
infoSink, commonTable, symbolTables);
#endif
// check for compute
if ((profile != EEsProfile && version >= 420) ||
@ -348,6 +349,7 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source,
infoSink, commonTable, symbolTables);
#ifndef GLSLANG_WEB
// check for ray tracing stages
if (profile != EEsProfile && version >= 450) {
InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangRayGenNV, source,

View File

@ -527,11 +527,11 @@ const char* StageName(EShLanguage stage)
switch(stage) {
case EShLangVertex: return "vertex";
case EShLangFragment: return "fragment";
case EShLangCompute: return "compute";
#ifndef GLSLANG_WEB
case EShLangTessControl: return "tessellation control";
case EShLangTessEvaluation: return "tessellation evaluation";
case EShLangGeometry: return "geometry";
case EShLangCompute: return "compute";
case EShLangRayGenNV: return "ray-generation";
case EShLangIntersectNV: return "intersection";
case EShLangAnyHitNV: return "any-hit";

View File

@ -1360,7 +1360,6 @@ storage_qualifier
$$.init($1.loc);
$$.qualifier.storage = EvqUniform;
}
GLSLANG_WEB_EXCLUDE_ON
| SHARED {
parseContext.globalCheck($1.loc, "shared");
parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
@ -1369,6 +1368,7 @@ GLSLANG_WEB_EXCLUDE_ON
$$.init($1.loc);
$$.qualifier.storage = EvqShared;
}
GLSLANG_WEB_EXCLUDE_ON
| BUFFER {
parseContext.globalCheck($1.loc, "buffer");
$$.init($1.loc);

View File

@ -1156,6 +1156,14 @@ storage_qualifier
$$.init($1.loc);
$$.qualifier.storage = EvqUniform;
}
| SHARED {
parseContext.globalCheck($1.loc, "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, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared");
$$.init($1.loc);
$$.qualifier.storage = EvqShared;
}
;

File diff suppressed because it is too large Load Diff

View File

@ -267,7 +267,6 @@ public:
uniformLocationBase(0)
#endif
{
#ifndef GLSLANG_WEB
localSize[0] = 1;
localSize[1] = 1;
localSize[2] = 1;
@ -277,6 +276,7 @@ public:
localSizeSpecId[0] = TQualifier::layoutNotSet;
localSizeSpecId[1] = TQualifier::layoutNotSet;
localSizeSpecId[2] = TQualifier::layoutNotSet;
#ifndef GLSLANG_WEB
xfbBuffers.resize(TQualifier::layoutXfbBufferEnd);
shiftBinding.fill(0);
#endif
@ -492,6 +492,23 @@ public:
bool usingVariablePointers() const { return false; }
unsigned getXfbStride(int buffer) const { return 0; }
bool hasLayoutDerivativeModeNone() const { return false; }
bool setLocalSize(int dim, int size)
{
if (localSizeNotDefault[dim])
return size == localSize[dim];
localSizeNotDefault[dim] = true;
localSize[dim] = size;
return true;
}
unsigned int getLocalSize(int dim) const { return localSize[dim]; }
bool setLocalSizeSpecId(int dim, int id)
{
if (localSizeSpecId[dim] != TQualifier::layoutNotSet)
return id == localSizeSpecId[dim];
localSizeSpecId[dim] = id;
return true;
}
int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
#else
void output(TInfoSink&, bool tree);
@ -655,24 +672,6 @@ public:
}
TInterlockOrdering getInterlockOrdering() const { return interlockOrdering; }
bool setLocalSize(int dim, int size)
{
if (localSizeNotDefault[dim])
return size == localSize[dim];
localSizeNotDefault[dim] = true;
localSize[dim] = size;
return true;
}
unsigned int getLocalSize(int dim) const { return localSize[dim]; }
bool setLocalSizeSpecId(int dim, int id)
{
if (localSizeSpecId[dim] != TQualifier::layoutNotSet)
return id == localSizeSpecId[dim];
localSizeSpecId[dim] = id;
return true;
}
int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
void setXfbMode() { xfbMode = true; }
bool getXfbMode() const { return xfbMode; }
void setMultiStream() { multiStream = true; }
@ -920,6 +919,9 @@ protected:
bool useStorageBuffer;
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN
bool depthReplacing;
int localSize[3];
bool localSizeNotDefault[3];
int localSizeSpecId[3];
#ifndef GLSLANG_WEB
bool useVulkanMemoryModel;
int invocations;
@ -932,9 +934,6 @@ protected:
TVertexOrder vertexOrder;
TInterlockOrdering interlockOrdering;
bool pointMode;
int localSize[3];
bool localSizeNotDefault[3];
int localSizeSpecId[3];
bool earlyFragmentTests;
bool postDepthCoverage;
TLayoutDepth depthLayout;