Web: Add SSBOs and a few other missing compute features.
This commit is contained in:
parent
51ed01c877
commit
3dd1ce5b54
11 changed files with 1612 additions and 1502 deletions
|
|
@ -3819,13 +3819,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
|||
stageBuiltins[EShLangCompute].append(
|
||||
"void memoryBarrierShared();"
|
||||
"void groupMemoryBarrier();"
|
||||
"void memoryBarrierBuffer();"
|
||||
);
|
||||
}
|
||||
#ifndef GLSLANG_WEB
|
||||
if ((profile != EEsProfile && version >= 420) || esBarrier) {
|
||||
commonBuiltins.append(
|
||||
"void memoryBarrierAtomicCounter();"
|
||||
"void memoryBarrierBuffer();"
|
||||
"void memoryBarrierImage();"
|
||||
);
|
||||
}
|
||||
|
|
@ -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("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives);
|
||||
}
|
||||
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
case EShLangRayGenNV:
|
||||
case EShLangIntersectNV:
|
||||
case EShLangAnyHitNV:
|
||||
|
|
@ -8108,6 +8110,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
|
||||
symbolTable.relateToOperator("barrier", EOpBarrier);
|
||||
symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier);
|
||||
symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16);
|
||||
|
|
@ -8132,7 +8135,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
|||
|
||||
symbolTable.relateToOperator("controlBarrier", EOpBarrier);
|
||||
symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter);
|
||||
symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
|
||||
symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage);
|
||||
|
||||
symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
// with very few exceptions
|
||||
|
||||
// last member of ssbo block exception:
|
||||
if (qualifier.storage == EvqBuffer && lastMember)
|
||||
return;
|
||||
|
||||
// implicitly-sized io exceptions:
|
||||
switch (language) {
|
||||
case EShLangGeometry:
|
||||
|
|
@ -3851,6 +3847,10 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
|
|||
|
||||
#endif
|
||||
|
||||
// last member of ssbo block exception:
|
||||
if (qualifier.storage == EvqBuffer && lastMember)
|
||||
return;
|
||||
|
||||
arraySizeRequiredCheck(loc, *arraySizes);
|
||||
}
|
||||
|
||||
|
|
@ -5384,6 +5384,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
|||
#endif
|
||||
case EShLangCompute:
|
||||
if (id.compare(0, 11, "local_size_") == 0) {
|
||||
#ifndef GLSLANG_WEB
|
||||
if (language == EShLangMeshNV || language == EShLangTaskNV) {
|
||||
requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "gl_WorkGroupSize");
|
||||
}
|
||||
|
|
@ -5392,6 +5393,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
|||
profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize");
|
||||
profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize");
|
||||
}
|
||||
#endif
|
||||
if (nonLiteral)
|
||||
error(loc, "needs a literal integer", "local_size", "");
|
||||
if (id.size() == 12 && value == 0) {
|
||||
|
|
@ -8017,7 +8019,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
|||
}
|
||||
if (intermediate.getLocalSize(i) > (unsigned int)max)
|
||||
error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", "");
|
||||
} else if (language == EShLangMeshNV) {
|
||||
}
|
||||
#ifndef GLSLANG_WEB
|
||||
else if (language == EShLangMeshNV) {
|
||||
switch (i) {
|
||||
case 0: max = resources.maxMeshWorkGroupSizeX_NV; break;
|
||||
case 1: max = resources.maxMeshWorkGroupSizeY_NV; break;
|
||||
|
|
@ -8035,7 +8039,9 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
|||
}
|
||||
if (intermediate.getLocalSize(i) > (unsigned int)max)
|
||||
error(loc, "too large; see gl_MaxTaskWorkGroupSizeNV", "local_size", "");
|
||||
} else {
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
assert(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -343,6 +343,7 @@ void TScanContext::fillInKeywordMap()
|
|||
|
||||
(*KeywordMap)["const"] = CONST;
|
||||
(*KeywordMap)["uniform"] = UNIFORM;
|
||||
(*KeywordMap)["buffer"] = BUFFER;
|
||||
(*KeywordMap)["in"] = IN;
|
||||
(*KeywordMap)["out"] = OUT;
|
||||
(*KeywordMap)["smooth"] = SMOOTH;
|
||||
|
|
@ -410,7 +411,6 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["attribute"] = ATTRIBUTE;
|
||||
(*KeywordMap)["varying"] = VARYING;
|
||||
(*KeywordMap)["noperspective"] = NOPERSPECTIVE;
|
||||
(*KeywordMap)["buffer"] = BUFFER;
|
||||
(*KeywordMap)["coherent"] = COHERENT;
|
||||
(*KeywordMap)["devicecoherent"] = DEVICECOHERENT;
|
||||
(*KeywordMap)["queuefamilycoherent"] = QUEUEFAMILYCOHERENT;
|
||||
|
|
@ -905,6 +905,13 @@ int TScanContext::tokenizeIdentifier()
|
|||
case CASE:
|
||||
return keyword;
|
||||
|
||||
case BUFFER:
|
||||
afterBuffer = true;
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 430))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
|
||||
case STRUCT:
|
||||
afterStruct = true;
|
||||
return keyword;
|
||||
|
|
@ -998,12 +1005,6 @@ int TScanContext::tokenizeIdentifier()
|
|||
if (parseContext.isEsProfile() && parseContext.version >= 300)
|
||||
reservedWord();
|
||||
return keyword;
|
||||
case BUFFER:
|
||||
afterBuffer = true;
|
||||
if ((parseContext.isEsProfile() && parseContext.version < 310) ||
|
||||
(!parseContext.isEsProfile() && parseContext.version < 430))
|
||||
return identifierOrType();
|
||||
return keyword;
|
||||
case PAYLOADNV:
|
||||
case PAYLOADINNV:
|
||||
case HITATTRNV:
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Code sandwiched between a pair:
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
// ...
|
||||
// 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
|
||||
//
|
||||
|
|
@ -277,7 +277,7 @@ GLSLANG_WEB_EXCLUDE_OFF
|
|||
%token <lex> CENTROID IN OUT INOUT
|
||||
%token <lex> STRUCT VOID WHILE
|
||||
%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
|
||||
|
||||
GLSLANG_WEB_EXCLUDE_ON
|
||||
|
|
@ -285,7 +285,7 @@ GLSLANG_WEB_EXCLUDE_ON
|
|||
%token <lex> INT64CONSTANT UINT64CONSTANT
|
||||
%token <lex> SUBROUTINE DEMOTE
|
||||
%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> SUBGROUPCOHERENT NONPRIVATE
|
||||
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
|
||||
|
|
@ -1368,12 +1368,12 @@ storage_qualifier
|
|||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqShared;
|
||||
}
|
||||
GLSLANG_WEB_EXCLUDE_ON
|
||||
| BUFFER {
|
||||
parseContext.globalCheck($1.loc, "buffer");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqBuffer;
|
||||
}
|
||||
GLSLANG_WEB_EXCLUDE_ON
|
||||
| ATTRIBUTE {
|
||||
parseContext.requireStage($1.loc, EShLangVertex, "attribute");
|
||||
parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Code sandwiched between a pair:
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
// ...
|
||||
// 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
|
||||
//
|
||||
|
|
@ -194,7 +194,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> CENTROID IN OUT INOUT
|
||||
%token <lex> STRUCT VOID WHILE
|
||||
%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
|
||||
|
||||
|
||||
|
|
@ -1164,6 +1164,11 @@ storage_qualifier
|
|||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqShared;
|
||||
}
|
||||
| BUFFER {
|
||||
parseContext.globalCheck($1.loc, "buffer");
|
||||
$$.init($1.loc);
|
||||
$$.qualifier.storage = EvqBuffer;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -182,9 +182,10 @@ extern int yydebug;
|
|||
DEFAULT = 392,
|
||||
UNIFORM = 393,
|
||||
SHARED = 394,
|
||||
FLAT = 395,
|
||||
SMOOTH = 396,
|
||||
LAYOUT = 397
|
||||
BUFFER = 395,
|
||||
FLAT = 396,
|
||||
SMOOTH = 397,
|
||||
LAYOUT = 398
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -229,7 +230,7 @@ union YYSTYPE
|
|||
glslang::TArraySizes* typeParameters;
|
||||
} 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue