GL_KHR_memory_scope_semantics

This commit is contained in:
Jeff Bolz 2018-09-05 10:11:41 -05:00
parent 97068d8b30
commit 36831c9bad
28 changed files with 5544 additions and 4242 deletions

View file

@ -462,6 +462,11 @@ public:
void clearMemory()
{
coherent = false;
devicecoherent = false;
queuefamilycoherent = false;
workgroupcoherent = false;
subgroupcoherent = false;
nonprivate = false;
volatil = false;
restrict = false;
readonly = false;
@ -499,6 +504,11 @@ public:
bool patch : 1;
bool sample : 1;
bool coherent : 1;
bool devicecoherent : 1;
bool queuefamilycoherent : 1;
bool workgroupcoherent : 1;
bool subgroupcoherent : 1;
bool nonprivate : 1;
bool volatil : 1;
bool restrict : 1;
bool readonly : 1;
@ -508,7 +518,11 @@ public:
bool isMemory() const
{
return coherent || volatil || restrict || readonly || writeonly;
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate;
}
bool isMemoryQualifierImageAndSSBOOnly() const
{
return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly;
}
bool isInterpolation() const
{
@ -1713,6 +1727,16 @@ public:
appendStr(" sample");
if (qualifier.coherent)
appendStr(" coherent");
if (qualifier.devicecoherent)
appendStr(" devicecoherent");
if (qualifier.queuefamilycoherent)
appendStr(" queuefamilycoherent");
if (qualifier.workgroupcoherent)
appendStr(" workgroupcoherent");
if (qualifier.subgroupcoherent)
appendStr(" subgroupcoherent");
if (qualifier.nonprivate)
appendStr(" nonprivate");
if (qualifier.volatil)
appendStr(" volatile");
if (qualifier.restrict)

View file

@ -592,6 +592,8 @@ enum TOperator {
EOpAtomicXor,
EOpAtomicExchange,
EOpAtomicCompSwap,
EOpAtomicLoad,
EOpAtomicStore,
EOpAtomicCounterIncrement, // results in pre-increment value
EOpAtomicCounterDecrement, // results in post-decrement value
@ -784,6 +786,8 @@ enum TOperator {
EOpImageAtomicXor,
EOpImageAtomicExchange,
EOpImageAtomicCompSwap,
EOpImageAtomicLoad,
EOpImageAtomicStore,
EOpSubpassLoad,
EOpSubpassLoadMS,

View file

@ -935,27 +935,49 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
commonBuiltins.append(
"uint atomicAdd(coherent volatile inout uint, uint);"
" int atomicAdd(coherent volatile inout int, int);"
"uint atomicAdd(coherent volatile inout uint, uint, int, int, int);"
" int atomicAdd(coherent volatile inout int, int, int, int, int);"
"uint atomicMin(coherent volatile inout uint, uint);"
" int atomicMin(coherent volatile inout int, int);"
"uint atomicMin(coherent volatile inout uint, uint, int, int, int);"
" int atomicMin(coherent volatile inout int, int, int, int, int);"
"uint atomicMax(coherent volatile inout uint, uint);"
" int atomicMax(coherent volatile inout int, int);"
"uint atomicMax(coherent volatile inout uint, uint, int, int, int);"
" int atomicMax(coherent volatile inout int, int, int, int, int);"
"uint atomicAnd(coherent volatile inout uint, uint);"
" int atomicAnd(coherent volatile inout int, int);"
"uint atomicAnd(coherent volatile inout uint, uint, int, int, int);"
" int atomicAnd(coherent volatile inout int, int, int, int, int);"
"uint atomicOr (coherent volatile inout uint, uint);"
" int atomicOr (coherent volatile inout int, int);"
"uint atomicOr (coherent volatile inout uint, uint, int, int, int);"
" int atomicOr (coherent volatile inout int, int, int, int, int);"
"uint atomicXor(coherent volatile inout uint, uint);"
" int atomicXor(coherent volatile inout int, int);"
"uint atomicXor(coherent volatile inout uint, uint, int, int, int);"
" int atomicXor(coherent volatile inout int, int, int, int, int);"
"uint atomicExchange(coherent volatile inout uint, uint);"
" int atomicExchange(coherent volatile inout int, int);"
"uint atomicExchange(coherent volatile inout uint, uint, int, int, int);"
" int atomicExchange(coherent volatile inout int, int, int, int, int);"
"uint atomicCompSwap(coherent volatile inout uint, uint, uint);"
" int atomicCompSwap(coherent volatile inout int, int, int);"
"uint atomicCompSwap(coherent volatile inout uint, uint, uint, int, int, int, int, int);"
" int atomicCompSwap(coherent volatile inout int, int, int, int, int, int, int, int);"
"uint atomicLoad(coherent volatile in uint, int, int, int);"
" int atomicLoad(coherent volatile in int, int, int, int);"
"void atomicStore(coherent volatile out uint, uint, int, int, int);"
"void atomicStore(coherent volatile out int, int, int, int, int);"
"\n");
}
@ -965,23 +987,49 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
commonBuiltins.append(
"uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t);"
" int64_t atomicMin(coherent volatile inout int64_t, int64_t);"
"uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t, int, int, int);"
" int64_t atomicMin(coherent volatile inout int64_t, int64_t, int, int, int);"
"uint64_t atomicMax(coherent volatile inout uint64_t, uint64_t);"
" int64_t atomicMax(coherent volatile inout int64_t, int64_t);"
"uint64_t atomicMax(coherent volatile inout uint64_t, uint64_t, int, int, int);"
" int64_t atomicMax(coherent volatile inout int64_t, int64_t, int, int, int);"
"uint64_t atomicAnd(coherent volatile inout uint64_t, uint64_t);"
" int64_t atomicAnd(coherent volatile inout int64_t, int64_t);"
"uint64_t atomicAnd(coherent volatile inout uint64_t, uint64_t, int, int, int);"
" int64_t atomicAnd(coherent volatile inout int64_t, int64_t, int, int, int);"
"uint64_t atomicOr (coherent volatile inout uint64_t, uint64_t);"
" int64_t atomicOr (coherent volatile inout int64_t, int64_t);"
"uint64_t atomicOr (coherent volatile inout uint64_t, uint64_t, int, int, int);"
" int64_t atomicOr (coherent volatile inout int64_t, int64_t, int, int, int);"
"uint64_t atomicXor(coherent volatile inout uint64_t, uint64_t);"
" int64_t atomicXor(coherent volatile inout int64_t, int64_t);"
"uint64_t atomicXor(coherent volatile inout uint64_t, uint64_t, int, int, int);"
" int64_t atomicXor(coherent volatile inout int64_t, int64_t, int, int, int);"
" int64_t atomicAdd(coherent volatile inout int64_t, int64_t);"
" int64_t atomicExchange(coherent volatile inout int64_t, int64_t);"
" int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t);"
"uint64_t atomicAdd(coherent volatile inout uint64_t, uint64_t);"
" int64_t atomicAdd(coherent volatile inout int64_t, int64_t);"
"uint64_t atomicAdd(coherent volatile inout uint64_t, uint64_t, int, int, int);"
" int64_t atomicAdd(coherent volatile inout int64_t, int64_t, int, int, int);"
"uint64_t atomicExchange(coherent volatile inout uint64_t, uint64_t);"
" int64_t atomicExchange(coherent volatile inout int64_t, int64_t);"
"uint64_t atomicExchange(coherent volatile inout uint64_t, uint64_t, int, int, int);"
" int64_t atomicExchange(coherent volatile inout int64_t, int64_t, int, int, int);"
"uint64_t atomicCompSwap(coherent volatile inout uint64_t, uint64_t, uint64_t);"
" int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t);"
"uint64_t atomicCompSwap(coherent volatile inout uint64_t, uint64_t, uint64_t, int, int, int, int, int);"
" int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t, int, int, int, int, int);"
"uint64_t atomicLoad(coherent volatile in uint64_t, int, int, int);"
" int64_t atomicLoad(coherent volatile in int64_t, int, int, int);"
"void atomicStore(coherent volatile out uint64_t, uint64_t, int, int, int);"
"void atomicStore(coherent volatile out int64_t, int64_t, int, int, int);"
"\n");
}
#endif
@ -4693,6 +4741,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
);
}
commonBuiltins.append("void controlBarrier(int, int, int, int);\n"
"void memoryBarrier(int, int, int);\n");
//============================================================================
//
// Prototypes for built-in functions seen by fragment shaders only.
@ -5807,6 +5858,28 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
if ((profile != EEsProfile && version >= 420) ||
(profile == EEsProfile && version >= 310)) {
commonBuiltins.append("const int gl_ScopeDevice = 1;\n");
commonBuiltins.append("const int gl_ScopeWorkgroup = 2;\n");
commonBuiltins.append("const int gl_ScopeSubgroup = 3;\n");
commonBuiltins.append("const int gl_ScopeInvocation = 4;\n");
commonBuiltins.append("const int gl_ScopeQueueFamily = 5;\n");
commonBuiltins.append("const int gl_SemanticsRelaxed = 0x0;\n");
commonBuiltins.append("const int gl_SemanticsAcquire = 0x2;\n");
commonBuiltins.append("const int gl_SemanticsRelease = 0x4;\n");
commonBuiltins.append("const int gl_SemanticsAcquireRelease = 0x8;\n");
commonBuiltins.append("const int gl_SemanticsMakeAvailable = 0x2000;\n");
commonBuiltins.append("const int gl_SemanticsMakeVisible = 0x4000;\n");
commonBuiltins.append("const int gl_StorageSemanticsNone = 0x0;\n");
commonBuiltins.append("const int gl_StorageSemanticsBuffer = 0x40;\n");
commonBuiltins.append("const int gl_StorageSemanticsShared = 0x100;\n");
commonBuiltins.append("const int gl_StorageSemanticsImage = 0x800;\n");
commonBuiltins.append("const int gl_StorageSemanticsOutput = 0x1000;\n");
}
// printf("%s\n", commonBuiltins.c_str());
// printf("%s\n", stageBuiltins[EShLangFragment].c_str());
}
@ -6106,23 +6179,44 @@ void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int
" imageAtomicExchange(volatile coherent "
};
for (size_t i = 0; i < numBuiltins; ++i) {
// Loop twice to add prototypes with/without scope/semantics
for (int j = 0; j < 2; ++j) {
for (size_t i = 0; i < numBuiltins; ++i) {
commonBuiltins.append(dataType);
commonBuiltins.append(atomicFunc[i]);
commonBuiltins.append(imageParams);
commonBuiltins.append(", ");
commonBuiltins.append(dataType);
if (j == 1) {
commonBuiltins.append(", int, int, int");
}
commonBuiltins.append(");\n");
}
commonBuiltins.append(dataType);
commonBuiltins.append(atomicFunc[i]);
commonBuiltins.append(" imageAtomicCompSwap(volatile coherent ");
commonBuiltins.append(imageParams);
commonBuiltins.append(", ");
commonBuiltins.append(dataType);
commonBuiltins.append(", ");
commonBuiltins.append(dataType);
if (j == 1) {
commonBuiltins.append(", int, int, int, int, int");
}
commonBuiltins.append(");\n");
}
commonBuiltins.append(dataType);
commonBuiltins.append(" imageAtomicCompSwap(volatile coherent ");
commonBuiltins.append(" imageAtomicLoad(volatile coherent ");
commonBuiltins.append(imageParams);
commonBuiltins.append(", int, int, int);\n");
commonBuiltins.append("void imageAtomicStore(volatile coherent ");
commonBuiltins.append(imageParams);
commonBuiltins.append(", ");
commonBuiltins.append(dataType);
commonBuiltins.append(", ");
commonBuiltins.append(dataType);
commonBuiltins.append(");\n");
commonBuiltins.append(", int, int, int);\n");
} else {
// not int or uint
// GL_ARB_ES3_1_compatibility
@ -7969,6 +8063,26 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);
}
if (spvVersion.vulkan > 0) {
symbolTable.setVariableExtensions("gl_ScopeDevice", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_ScopeWorkgroup", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_ScopeSubgroup", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_ScopeInvocation", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_SemanticsRelaxed", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_SemanticsAcquire", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_SemanticsRelease", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_SemanticsAcquireRelease", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_SemanticsMakeAvailable", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_SemanticsMakeVisible", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_StorageSemanticsNone", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_StorageSemanticsBuffer", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_StorageSemanticsShared", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_StorageSemanticsImage", 1, &E_GL_KHR_memory_scope_semantics);
symbolTable.setVariableExtensions("gl_StorageSemanticsOutput", 1, &E_GL_KHR_memory_scope_semantics);
}
break;
case EShLangCompute:
@ -8003,6 +8117,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_ARB_compute_shader);
}
symbolTable.setFunctionExtensions("controlBarrier", 1, &E_GL_KHR_memory_scope_semantics);
// GL_ARB_shader_ballot
if (profile != EEsProfile) {
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
@ -8213,6 +8329,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("all", EOpAll);
symbolTable.relateToOperator("barrier", EOpBarrier);
symbolTable.relateToOperator("controlBarrier", EOpBarrier);
symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier);
symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter);
symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
@ -8226,6 +8343,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("atomicXor", EOpAtomicXor);
symbolTable.relateToOperator("atomicExchange", EOpAtomicExchange);
symbolTable.relateToOperator("atomicCompSwap", EOpAtomicCompSwap);
symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad);
symbolTable.relateToOperator("atomicStore", EOpAtomicStore);
symbolTable.relateToOperator("atomicCounterIncrement", EOpAtomicCounterIncrement);
symbolTable.relateToOperator("atomicCounterDecrement", EOpAtomicCounterDecrement);
@ -8270,6 +8389,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("imageAtomicXor", EOpImageAtomicXor);
symbolTable.relateToOperator("imageAtomicExchange", EOpImageAtomicExchange);
symbolTable.relateToOperator("imageAtomicCompSwap", EOpImageAtomicCompSwap);
symbolTable.relateToOperator("imageAtomicLoad", EOpImageAtomicLoad);
symbolTable.relateToOperator("imageAtomicStore", EOpImageAtomicStore);
symbolTable.relateToOperator("subpassLoad", EOpSubpassLoad);
symbolTable.relateToOperator("subpassLoadMS", EOpSubpassLoadMS);

View file

@ -267,6 +267,10 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>&
if (tokens.size() != 1)
error(loc, "extra tokens", "#pragma", "");
intermediate.setUseStorageBuffer();
} else if (spvVersion.spv > 0 && tokens[0].compare("use_vulkan_memory_model") == 0) {
if (tokens.size() != 1)
error(loc, "extra tokens", "#pragma", "");
intermediate.setUseVulkanMemoryModel();
} else if (tokens[0].compare("once") == 0) {
warn(loc, "not implemented", "#pragma once", "");
} else if (tokens[0].compare("glslang_binary_double_output") == 0)
@ -1028,8 +1032,16 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
const char* message = "argument cannot drop memory qualifier when passed to formal parameter";
if (argQualifier.volatil && ! formalQualifier.volatil)
error(arguments->getLoc(), message, "volatile", "");
if (argQualifier.coherent && ! formalQualifier.coherent)
if (argQualifier.coherent && ! (formalQualifier.devicecoherent || formalQualifier.coherent))
error(arguments->getLoc(), message, "coherent", "");
if (argQualifier.devicecoherent && ! (formalQualifier.devicecoherent || formalQualifier.coherent))
error(arguments->getLoc(), message, "devicecoherent", "");
if (argQualifier.queuefamilycoherent && ! (formalQualifier.queuefamilycoherent || formalQualifier.devicecoherent || formalQualifier.coherent))
error(arguments->getLoc(), message, "queuefamilycoherent", "");
if (argQualifier.workgroupcoherent && ! (formalQualifier.workgroupcoherent || formalQualifier.queuefamilycoherent || formalQualifier.devicecoherent || formalQualifier.coherent))
error(arguments->getLoc(), message, "workgroupcoherent", "");
if (argQualifier.subgroupcoherent && ! (formalQualifier.subgroupcoherent || formalQualifier.workgroupcoherent || formalQualifier.queuefamilycoherent || formalQualifier.devicecoherent || formalQualifier.coherent))
error(arguments->getLoc(), message, "subgroupcoherent", "");
if (argQualifier.readonly && ! formalQualifier.readonly)
error(arguments->getLoc(), message, "readonly", "");
if (argQualifier.writeonly && ! formalQualifier.writeonly)
@ -1428,6 +1440,159 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct
return conversionTree;
}
void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& fnCandidate, const TIntermOperator& callNode)
{
const TIntermSequence* argp = &callNode.getAsAggregate()->getSequence();
const int gl_SemanticsRelaxed = 0x0;
const int gl_SemanticsAcquire = 0x2;
const int gl_SemanticsRelease = 0x4;
const int gl_SemanticsAcquireRelease = 0x8;
const int gl_SemanticsMakeAvailable = 0x2000;
const int gl_SemanticsMakeVisible = 0x4000;
const int gl_StorageSemanticsNone = 0x0;
const int gl_StorageSemanticsBuffer = 0x40;
const int gl_StorageSemanticsShared = 0x100;
const int gl_StorageSemanticsImage = 0x800;
const int gl_StorageSemanticsOutput = 0x1000;
unsigned int semantics = 0, storageClassSemantics = 0;
unsigned int semantics2 = 0, storageClassSemantics2 = 0;
// Grab the semantics and storage class semantics from the operands, based on opcode
switch (callNode.getOp()) {
case EOpAtomicAdd:
case EOpAtomicMin:
case EOpAtomicMax:
case EOpAtomicAnd:
case EOpAtomicOr:
case EOpAtomicXor:
case EOpAtomicExchange:
case EOpAtomicStore:
storageClassSemantics = (*argp)[3]->getAsConstantUnion()->getConstArray()[0].getIConst();
semantics = (*argp)[4]->getAsConstantUnion()->getConstArray()[0].getIConst();
break;
case EOpAtomicLoad:
storageClassSemantics = (*argp)[2]->getAsConstantUnion()->getConstArray()[0].getIConst();
semantics = (*argp)[3]->getAsConstantUnion()->getConstArray()[0].getIConst();
break;
case EOpAtomicCompSwap:
storageClassSemantics = (*argp)[4]->getAsConstantUnion()->getConstArray()[0].getIConst();
semantics = (*argp)[5]->getAsConstantUnion()->getConstArray()[0].getIConst();
storageClassSemantics2 = (*argp)[6]->getAsConstantUnion()->getConstArray()[0].getIConst();
semantics2 = (*argp)[7]->getAsConstantUnion()->getConstArray()[0].getIConst();
break;
case EOpImageAtomicAdd:
case EOpImageAtomicMin:
case EOpImageAtomicMax:
case EOpImageAtomicAnd:
case EOpImageAtomicOr:
case EOpImageAtomicXor:
case EOpImageAtomicExchange:
case EOpImageAtomicStore:
storageClassSemantics = (*argp)[4]->getAsConstantUnion()->getConstArray()[0].getIConst();
semantics = (*argp)[5]->getAsConstantUnion()->getConstArray()[0].getIConst();
break;
case EOpImageAtomicLoad:
storageClassSemantics = (*argp)[3]->getAsConstantUnion()->getConstArray()[0].getIConst();
semantics = (*argp)[4]->getAsConstantUnion()->getConstArray()[0].getIConst();
break;
case EOpImageAtomicCompSwap:
storageClassSemantics = (*argp)[5]->getAsConstantUnion()->getConstArray()[0].getIConst();
semantics = (*argp)[6]->getAsConstantUnion()->getConstArray()[0].getIConst();
storageClassSemantics2 = (*argp)[7]->getAsConstantUnion()->getConstArray()[0].getIConst();
semantics2 = (*argp)[8]->getAsConstantUnion()->getConstArray()[0].getIConst();
break;
case EOpBarrier:
storageClassSemantics = (*argp)[2]->getAsConstantUnion()->getConstArray()[0].getIConst();
semantics = (*argp)[3]->getAsConstantUnion()->getConstArray()[0].getIConst();
break;
case EOpMemoryBarrier:
storageClassSemantics = (*argp)[1]->getAsConstantUnion()->getConstArray()[0].getIConst();
semantics = (*argp)[2]->getAsConstantUnion()->getConstArray()[0].getIConst();
break;
}
if ((semantics & gl_SemanticsAcquire) &&
(callNode.getOp() == EOpAtomicStore || callNode.getOp() == EOpImageAtomicStore)) {
error(loc, "gl_SemanticsAcquire must not be used with (image) atomic store",
fnCandidate.getName().c_str(), "");
}
if ((semantics & gl_SemanticsRelease) &&
(callNode.getOp() == EOpAtomicLoad || callNode.getOp() == EOpImageAtomicLoad)) {
error(loc, "gl_SemanticsRelease must not be used with (image) atomic load",
fnCandidate.getName().c_str(), "");
}
if ((semantics & gl_SemanticsAcquireRelease) &&
(callNode.getOp() == EOpAtomicStore || callNode.getOp() == EOpImageAtomicStore ||
callNode.getOp() == EOpAtomicLoad || callNode.getOp() == EOpImageAtomicLoad)) {
error(loc, "gl_SemanticsAcquireRelease must not be used with (image) atomic load/store",
fnCandidate.getName().c_str(), "");
}
if (((semantics | semantics2) & ~(gl_SemanticsAcquire |
gl_SemanticsRelease |
gl_SemanticsAcquireRelease |
gl_SemanticsMakeAvailable |
gl_SemanticsMakeVisible))) {
error(loc, "Invalid semantics value", fnCandidate.getName().c_str(), "");
}
if (((storageClassSemantics | storageClassSemantics2) & ~(gl_StorageSemanticsBuffer |
gl_StorageSemanticsShared |
gl_StorageSemanticsImage |
gl_StorageSemanticsOutput))) {
error(loc, "Invalid storage class semantics value", fnCandidate.getName().c_str(), "");
}
if (callNode.getOp() == EOpMemoryBarrier) {
if (!IsPow2(semantics & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease))) {
error(loc, "Semantics must include exactly one of gl_SemanticsRelease, gl_SemanticsAcquire, or "
"gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), "");
}
} else {
if (semantics & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease)) {
if (!IsPow2(semantics & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease))) {
error(loc, "Semantics must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or "
"gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), "");
}
}
if (semantics2 & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease)) {
if (!IsPow2(semantics2 & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease))) {
error(loc, "semUnequal must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or "
"gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), "");
}
}
}
if (callNode.getOp() == EOpMemoryBarrier) {
if (storageClassSemantics == 0) {
error(loc, "Storage class semantics must not be zero", fnCandidate.getName().c_str(), "");
}
}
if (callNode.getOp() == EOpBarrier && semantics != 0 && storageClassSemantics == 0) {
error(loc, "Storage class semantics must not be zero", fnCandidate.getName().c_str(), "");
}
if ((callNode.getOp() == EOpAtomicCompSwap || callNode.getOp() == EOpImageAtomicCompSwap) &&
(semantics2 & (gl_SemanticsRelease | gl_SemanticsAcquireRelease))) {
error(loc, "semUnequal must not be gl_SemanticsRelease or gl_SemanticsAcquireRelease",
fnCandidate.getName().c_str(), "");
}
if ((semantics & gl_SemanticsMakeAvailable) &&
!(semantics & (gl_SemanticsRelease | gl_SemanticsAcquireRelease))) {
error(loc, "gl_SemanticsMakeAvailable requires gl_SemanticsRelease or gl_SemanticsAcquireRelease",
fnCandidate.getName().c_str(), "");
}
if ((semantics & gl_SemanticsMakeVisible) &&
!(semantics & (gl_SemanticsAcquire | gl_SemanticsAcquireRelease))) {
error(loc, "gl_SemanticsMakeVisible requires gl_SemanticsAcquire or gl_SemanticsAcquireRelease",
fnCandidate.getName().c_str(), "");
}
}
//
// Do additional checking of built-in function calls that is not caught
// by normal semantic checks on argument type, extension tagging, etc.
@ -1656,6 +1821,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
case EOpImageAtomicXor:
case EOpImageAtomicExchange:
case EOpImageAtomicCompSwap:
case EOpImageAtomicLoad:
case EOpImageAtomicStore:
{
// Make sure the image types have the correct layout() format and correct argument types
const TType& imageType = arg0->getType();
@ -1669,10 +1836,14 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
error(loc, "only supported on image with format r32f", fnCandidate.getName().c_str(), "");
}
if (argp->size() > 4) {
requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str());
memorySemanticsCheck(loc, fnCandidate, callNode);
}
break;
}
#ifdef NV_EXTENSIONS
case EOpAtomicAdd:
case EOpAtomicMin:
case EOpAtomicMax:
@ -1681,13 +1852,19 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
case EOpAtomicXor:
case EOpAtomicExchange:
case EOpAtomicCompSwap:
case EOpAtomicLoad:
case EOpAtomicStore:
{
if (arg0->getType().getBasicType() == EbtInt64 || arg0->getType().getBasicType() == EbtUint64)
if (argp->size() > 3) {
requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str());
memorySemanticsCheck(loc, fnCandidate, callNode);
}
#ifdef NV_EXTENSIONS
else if (arg0->getType().getBasicType() == EbtInt64 || arg0->getType().getBasicType() == EbtUint64)
requireExtensions(loc, 1, &E_GL_NV_shader_atomic_int64, fnCandidate.getName().c_str());
#endif
break;
}
#endif
case EOpInterpolateAtCentroid:
case EOpInterpolateAtSample:
@ -1751,6 +1928,14 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
}
break;
case EOpBarrier:
case EOpMemoryBarrier:
if (argp->size() > 0) {
requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str());
memorySemanticsCheck(loc, fnCandidate, callNode);
}
break;
default:
break;
}
@ -2806,8 +2991,11 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
if (! symbolTable.atGlobalLevel())
return;
if (qualifier.isMemory() && ! publicType.isImage() && publicType.qualifier.storage != EvqBuffer)
if (qualifier.isMemoryQualifierImageAndSSBOOnly() && ! publicType.isImage() && publicType.qualifier.storage != EvqBuffer) {
error(loc, "memory qualifiers cannot be used on this type", "", "");
} else if (qualifier.isMemory() && (publicType.basicType != EbtSampler) && !publicType.qualifier.isUniformOrBuffer()) {
error(loc, "memory qualifiers cannot be used on this type", "", "");
}
if (qualifier.storage == EvqBuffer && publicType.basicType != EbtBlock)
error(loc, "buffers can be declared only as blocks", "buffer", "");
@ -3020,6 +3208,13 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
if (dst.precision == EpqNone || (force && src.precision != EpqNone))
dst.precision = src.precision;
if (!force && ((src.coherent && (dst.devicecoherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent)) ||
(src.devicecoherent && (dst.coherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent)) ||
(src.queuefamilycoherent && (dst.coherent || dst.devicecoherent || dst.workgroupcoherent || dst.subgroupcoherent)) ||
(src.workgroupcoherent && (dst.coherent || dst.devicecoherent || dst.queuefamilycoherent || dst.subgroupcoherent)) ||
(src.subgroupcoherent && (dst.coherent || dst.devicecoherent || dst.queuefamilycoherent || dst.workgroupcoherent)))) {
error(loc, "only one coherent/devicecoherent/queuefamilycoherent/workgroupcoherent/subgroupcoherent qualifier allowed", GetPrecisionQualifierString(src.precision), "");
}
// Layout qualifiers
mergeObjectLayoutQualifiers(dst, src, false);
@ -3038,6 +3233,11 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
MERGE_SINGLETON(patch);
MERGE_SINGLETON(sample);
MERGE_SINGLETON(coherent);
MERGE_SINGLETON(devicecoherent);
MERGE_SINGLETON(queuefamilycoherent);
MERGE_SINGLETON(workgroupcoherent);
MERGE_SINGLETON(subgroupcoherent);
MERGE_SINGLETON(nonprivate);
MERGE_SINGLETON(volatil);
MERGE_SINGLETON(restrict);
MERGE_SINGLETON(readonly);
@ -3862,6 +4062,11 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali
if (qualifier.isMemory()) {
type.getQualifier().volatil = qualifier.volatil;
type.getQualifier().coherent = qualifier.coherent;
type.getQualifier().devicecoherent = qualifier.devicecoherent ;
type.getQualifier().queuefamilycoherent = qualifier.queuefamilycoherent;
type.getQualifier().workgroupcoherent = qualifier.workgroupcoherent;
type.getQualifier().subgroupcoherent = qualifier.subgroupcoherent;
type.getQualifier().nonprivate = qualifier.nonprivate;
type.getQualifier().readonly = qualifier.readonly;
type.getQualifier().writeonly = qualifier.writeonly;
type.getQualifier().restrict = qualifier.restrict;

View file

@ -323,6 +323,7 @@ public:
TFunction* handleConstructorCall(const TSourceLoc&, const TPublicType&);
void handlePrecisionQualifier(const TSourceLoc&, TQualifier&, TPrecisionQualifier);
void checkPrecisionQualifier(const TSourceLoc&, TPrecisionQualifier);
void memorySemanticsCheck(const TSourceLoc&, const TFunction&, const TIntermOperator& callNode);
void assignError(const TSourceLoc&, const char* op, TString left, TString right);
void unaryOpError(const TSourceLoc&, const char* op, TString operand);

View file

@ -380,6 +380,11 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["varying"] = VARYING;
(*KeywordMap)["buffer"] = BUFFER;
(*KeywordMap)["coherent"] = COHERENT;
(*KeywordMap)["devicecoherent"] = DEVICECOHERENT;
(*KeywordMap)["queuefamilycoherent"] = QUEUEFAMILYCOHERENT;
(*KeywordMap)["workgroupcoherent"] = WORKGROUPCOHERENT;
(*KeywordMap)["subgroupcoherent"] = SUBGROUPCOHERENT;
(*KeywordMap)["nonprivate"] = NONPRIVATE;
(*KeywordMap)["restrict"] = RESTRICT;
(*KeywordMap)["readonly"] = READONLY;
(*KeywordMap)["writeonly"] = WRITEONLY;
@ -937,6 +942,11 @@ int TScanContext::tokenizeIdentifier()
return es30ReservedFromGLSL(420);
case COHERENT:
case DEVICECOHERENT:
case QUEUEFAMILYCOHERENT:
case WORKGROUPCOHERENT:
case SUBGROUPCOHERENT:
case NONPRIVATE:
case RESTRICT:
case READONLY:
case WRITEONLY:

View file

@ -194,6 +194,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_KHR_shader_subgroup_shuffle_relative] = EBhDisable;
extensionBehavior[E_GL_KHR_shader_subgroup_clustered] = EBhDisable;
extensionBehavior[E_GL_KHR_shader_subgroup_quad] = EBhDisable;
extensionBehavior[E_GL_KHR_memory_scope_semantics] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_non_constant_global_initializers] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_image_load_formatted] = EBhDisable;

View file

@ -148,6 +148,7 @@ const char* const E_GL_KHR_shader_subgroup_shuffle = "GL_KHR_shader_sub
const char* const E_GL_KHR_shader_subgroup_shuffle_relative = "GL_KHR_shader_subgroup_shuffle_relative";
const char* const E_GL_KHR_shader_subgroup_clustered = "GL_KHR_shader_subgroup_clustered";
const char* const E_GL_KHR_shader_subgroup_quad = "GL_KHR_shader_subgroup_quad";
const char* const E_GL_KHR_memory_scope_semantics = "GL_KHR_memory_scope_semantics";
const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers";
const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_load_formatted";

View file

@ -141,7 +141,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> VEC2 VEC3 VEC4
%token <lex> MAT2 MAT3 MAT4 CENTROID IN OUT INOUT
%token <lex> UNIFORM PATCH SAMPLE BUFFER SHARED NONUNIFORM
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT SUBGROUPCOHERENT NONPRIVATE
%token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
%token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
%token <lex> F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4
@ -1317,6 +1317,31 @@ storage_qualifier
$$.init($1.loc);
$$.qualifier.coherent = true;
}
| DEVICECOHERENT {
$$.init($1.loc);
parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent");
$$.qualifier.devicecoherent = true;
}
| QUEUEFAMILYCOHERENT {
$$.init($1.loc);
parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent");
$$.qualifier.queuefamilycoherent = true;
}
| WORKGROUPCOHERENT {
$$.init($1.loc);
parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent");
$$.qualifier.workgroupcoherent = true;
}
| SUBGROUPCOHERENT {
$$.init($1.loc);
parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent");
$$.qualifier.subgroupcoherent = true;
}
| NONPRIVATE {
$$.init($1.loc);
parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate");
$$.qualifier.nonprivate = true;
}
| VOLATILE {
$$.init($1.loc);
$$.qualifier.volatil = true;

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 3.0. */
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -130,315 +130,320 @@ extern int yydebug;
RESTRICT = 340,
READONLY = 341,
WRITEONLY = 342,
DVEC2 = 343,
DVEC3 = 344,
DVEC4 = 345,
DMAT2 = 346,
DMAT3 = 347,
DMAT4 = 348,
F16VEC2 = 349,
F16VEC3 = 350,
F16VEC4 = 351,
F16MAT2 = 352,
F16MAT3 = 353,
F16MAT4 = 354,
F32VEC2 = 355,
F32VEC3 = 356,
F32VEC4 = 357,
F32MAT2 = 358,
F32MAT3 = 359,
F32MAT4 = 360,
F64VEC2 = 361,
F64VEC3 = 362,
F64VEC4 = 363,
F64MAT2 = 364,
F64MAT3 = 365,
F64MAT4 = 366,
NOPERSPECTIVE = 367,
FLAT = 368,
SMOOTH = 369,
LAYOUT = 370,
EXPLICITINTERPAMD = 371,
MAT2X2 = 372,
MAT2X3 = 373,
MAT2X4 = 374,
MAT3X2 = 375,
MAT3X3 = 376,
MAT3X4 = 377,
MAT4X2 = 378,
MAT4X3 = 379,
MAT4X4 = 380,
DMAT2X2 = 381,
DMAT2X3 = 382,
DMAT2X4 = 383,
DMAT3X2 = 384,
DMAT3X3 = 385,
DMAT3X4 = 386,
DMAT4X2 = 387,
DMAT4X3 = 388,
DMAT4X4 = 389,
F16MAT2X2 = 390,
F16MAT2X3 = 391,
F16MAT2X4 = 392,
F16MAT3X2 = 393,
F16MAT3X3 = 394,
F16MAT3X4 = 395,
F16MAT4X2 = 396,
F16MAT4X3 = 397,
F16MAT4X4 = 398,
F32MAT2X2 = 399,
F32MAT2X3 = 400,
F32MAT2X4 = 401,
F32MAT3X2 = 402,
F32MAT3X3 = 403,
F32MAT3X4 = 404,
F32MAT4X2 = 405,
F32MAT4X3 = 406,
F32MAT4X4 = 407,
F64MAT2X2 = 408,
F64MAT2X3 = 409,
F64MAT2X4 = 410,
F64MAT3X2 = 411,
F64MAT3X3 = 412,
F64MAT3X4 = 413,
F64MAT4X2 = 414,
F64MAT4X3 = 415,
F64MAT4X4 = 416,
ATOMIC_UINT = 417,
SAMPLER1D = 418,
SAMPLER2D = 419,
SAMPLER3D = 420,
SAMPLERCUBE = 421,
SAMPLER1DSHADOW = 422,
SAMPLER2DSHADOW = 423,
SAMPLERCUBESHADOW = 424,
SAMPLER1DARRAY = 425,
SAMPLER2DARRAY = 426,
SAMPLER1DARRAYSHADOW = 427,
SAMPLER2DARRAYSHADOW = 428,
ISAMPLER1D = 429,
ISAMPLER2D = 430,
ISAMPLER3D = 431,
ISAMPLERCUBE = 432,
ISAMPLER1DARRAY = 433,
ISAMPLER2DARRAY = 434,
USAMPLER1D = 435,
USAMPLER2D = 436,
USAMPLER3D = 437,
USAMPLERCUBE = 438,
USAMPLER1DARRAY = 439,
USAMPLER2DARRAY = 440,
SAMPLER2DRECT = 441,
SAMPLER2DRECTSHADOW = 442,
ISAMPLER2DRECT = 443,
USAMPLER2DRECT = 444,
SAMPLERBUFFER = 445,
ISAMPLERBUFFER = 446,
USAMPLERBUFFER = 447,
SAMPLERCUBEARRAY = 448,
SAMPLERCUBEARRAYSHADOW = 449,
ISAMPLERCUBEARRAY = 450,
USAMPLERCUBEARRAY = 451,
SAMPLER2DMS = 452,
ISAMPLER2DMS = 453,
USAMPLER2DMS = 454,
SAMPLER2DMSARRAY = 455,
ISAMPLER2DMSARRAY = 456,
USAMPLER2DMSARRAY = 457,
SAMPLEREXTERNALOES = 458,
F16SAMPLER1D = 459,
F16SAMPLER2D = 460,
F16SAMPLER3D = 461,
F16SAMPLER2DRECT = 462,
F16SAMPLERCUBE = 463,
F16SAMPLER1DARRAY = 464,
F16SAMPLER2DARRAY = 465,
F16SAMPLERCUBEARRAY = 466,
F16SAMPLERBUFFER = 467,
F16SAMPLER2DMS = 468,
F16SAMPLER2DMSARRAY = 469,
F16SAMPLER1DSHADOW = 470,
F16SAMPLER2DSHADOW = 471,
F16SAMPLER1DARRAYSHADOW = 472,
F16SAMPLER2DARRAYSHADOW = 473,
F16SAMPLER2DRECTSHADOW = 474,
F16SAMPLERCUBESHADOW = 475,
F16SAMPLERCUBEARRAYSHADOW = 476,
SAMPLER = 477,
SAMPLERSHADOW = 478,
TEXTURE1D = 479,
TEXTURE2D = 480,
TEXTURE3D = 481,
TEXTURECUBE = 482,
TEXTURE1DARRAY = 483,
TEXTURE2DARRAY = 484,
ITEXTURE1D = 485,
ITEXTURE2D = 486,
ITEXTURE3D = 487,
ITEXTURECUBE = 488,
ITEXTURE1DARRAY = 489,
ITEXTURE2DARRAY = 490,
UTEXTURE1D = 491,
UTEXTURE2D = 492,
UTEXTURE3D = 493,
UTEXTURECUBE = 494,
UTEXTURE1DARRAY = 495,
UTEXTURE2DARRAY = 496,
TEXTURE2DRECT = 497,
ITEXTURE2DRECT = 498,
UTEXTURE2DRECT = 499,
TEXTUREBUFFER = 500,
ITEXTUREBUFFER = 501,
UTEXTUREBUFFER = 502,
TEXTURECUBEARRAY = 503,
ITEXTURECUBEARRAY = 504,
UTEXTURECUBEARRAY = 505,
TEXTURE2DMS = 506,
ITEXTURE2DMS = 507,
UTEXTURE2DMS = 508,
TEXTURE2DMSARRAY = 509,
ITEXTURE2DMSARRAY = 510,
UTEXTURE2DMSARRAY = 511,
F16TEXTURE1D = 512,
F16TEXTURE2D = 513,
F16TEXTURE3D = 514,
F16TEXTURE2DRECT = 515,
F16TEXTURECUBE = 516,
F16TEXTURE1DARRAY = 517,
F16TEXTURE2DARRAY = 518,
F16TEXTURECUBEARRAY = 519,
F16TEXTUREBUFFER = 520,
F16TEXTURE2DMS = 521,
F16TEXTURE2DMSARRAY = 522,
SUBPASSINPUT = 523,
SUBPASSINPUTMS = 524,
ISUBPASSINPUT = 525,
ISUBPASSINPUTMS = 526,
USUBPASSINPUT = 527,
USUBPASSINPUTMS = 528,
F16SUBPASSINPUT = 529,
F16SUBPASSINPUTMS = 530,
IMAGE1D = 531,
IIMAGE1D = 532,
UIMAGE1D = 533,
IMAGE2D = 534,
IIMAGE2D = 535,
UIMAGE2D = 536,
IMAGE3D = 537,
IIMAGE3D = 538,
UIMAGE3D = 539,
IMAGE2DRECT = 540,
IIMAGE2DRECT = 541,
UIMAGE2DRECT = 542,
IMAGECUBE = 543,
IIMAGECUBE = 544,
UIMAGECUBE = 545,
IMAGEBUFFER = 546,
IIMAGEBUFFER = 547,
UIMAGEBUFFER = 548,
IMAGE1DARRAY = 549,
IIMAGE1DARRAY = 550,
UIMAGE1DARRAY = 551,
IMAGE2DARRAY = 552,
IIMAGE2DARRAY = 553,
UIMAGE2DARRAY = 554,
IMAGECUBEARRAY = 555,
IIMAGECUBEARRAY = 556,
UIMAGECUBEARRAY = 557,
IMAGE2DMS = 558,
IIMAGE2DMS = 559,
UIMAGE2DMS = 560,
IMAGE2DMSARRAY = 561,
IIMAGE2DMSARRAY = 562,
UIMAGE2DMSARRAY = 563,
F16IMAGE1D = 564,
F16IMAGE2D = 565,
F16IMAGE3D = 566,
F16IMAGE2DRECT = 567,
F16IMAGECUBE = 568,
F16IMAGE1DARRAY = 569,
F16IMAGE2DARRAY = 570,
F16IMAGECUBEARRAY = 571,
F16IMAGEBUFFER = 572,
F16IMAGE2DMS = 573,
F16IMAGE2DMSARRAY = 574,
STRUCT = 575,
VOID = 576,
WHILE = 577,
IDENTIFIER = 578,
TYPE_NAME = 579,
FLOATCONSTANT = 580,
DOUBLECONSTANT = 581,
INT16CONSTANT = 582,
UINT16CONSTANT = 583,
INT32CONSTANT = 584,
UINT32CONSTANT = 585,
INTCONSTANT = 586,
UINTCONSTANT = 587,
INT64CONSTANT = 588,
UINT64CONSTANT = 589,
BOOLCONSTANT = 590,
FLOAT16CONSTANT = 591,
LEFT_OP = 592,
RIGHT_OP = 593,
INC_OP = 594,
DEC_OP = 595,
LE_OP = 596,
GE_OP = 597,
EQ_OP = 598,
NE_OP = 599,
AND_OP = 600,
OR_OP = 601,
XOR_OP = 602,
MUL_ASSIGN = 603,
DIV_ASSIGN = 604,
ADD_ASSIGN = 605,
MOD_ASSIGN = 606,
LEFT_ASSIGN = 607,
RIGHT_ASSIGN = 608,
AND_ASSIGN = 609,
XOR_ASSIGN = 610,
OR_ASSIGN = 611,
SUB_ASSIGN = 612,
LEFT_PAREN = 613,
RIGHT_PAREN = 614,
LEFT_BRACKET = 615,
RIGHT_BRACKET = 616,
LEFT_BRACE = 617,
RIGHT_BRACE = 618,
DOT = 619,
COMMA = 620,
COLON = 621,
EQUAL = 622,
SEMICOLON = 623,
BANG = 624,
DASH = 625,
TILDE = 626,
PLUS = 627,
STAR = 628,
SLASH = 629,
PERCENT = 630,
LEFT_ANGLE = 631,
RIGHT_ANGLE = 632,
VERTICAL_BAR = 633,
CARET = 634,
AMPERSAND = 635,
QUESTION = 636,
INVARIANT = 637,
PRECISE = 638,
HIGH_PRECISION = 639,
MEDIUM_PRECISION = 640,
LOW_PRECISION = 641,
PRECISION = 642,
PACKED = 643,
RESOURCE = 644,
SUPERP = 645
DEVICECOHERENT = 343,
QUEUEFAMILYCOHERENT = 344,
WORKGROUPCOHERENT = 345,
SUBGROUPCOHERENT = 346,
NONPRIVATE = 347,
DVEC2 = 348,
DVEC3 = 349,
DVEC4 = 350,
DMAT2 = 351,
DMAT3 = 352,
DMAT4 = 353,
F16VEC2 = 354,
F16VEC3 = 355,
F16VEC4 = 356,
F16MAT2 = 357,
F16MAT3 = 358,
F16MAT4 = 359,
F32VEC2 = 360,
F32VEC3 = 361,
F32VEC4 = 362,
F32MAT2 = 363,
F32MAT3 = 364,
F32MAT4 = 365,
F64VEC2 = 366,
F64VEC3 = 367,
F64VEC4 = 368,
F64MAT2 = 369,
F64MAT3 = 370,
F64MAT4 = 371,
NOPERSPECTIVE = 372,
FLAT = 373,
SMOOTH = 374,
LAYOUT = 375,
EXPLICITINTERPAMD = 376,
MAT2X2 = 377,
MAT2X3 = 378,
MAT2X4 = 379,
MAT3X2 = 380,
MAT3X3 = 381,
MAT3X4 = 382,
MAT4X2 = 383,
MAT4X3 = 384,
MAT4X4 = 385,
DMAT2X2 = 386,
DMAT2X3 = 387,
DMAT2X4 = 388,
DMAT3X2 = 389,
DMAT3X3 = 390,
DMAT3X4 = 391,
DMAT4X2 = 392,
DMAT4X3 = 393,
DMAT4X4 = 394,
F16MAT2X2 = 395,
F16MAT2X3 = 396,
F16MAT2X4 = 397,
F16MAT3X2 = 398,
F16MAT3X3 = 399,
F16MAT3X4 = 400,
F16MAT4X2 = 401,
F16MAT4X3 = 402,
F16MAT4X4 = 403,
F32MAT2X2 = 404,
F32MAT2X3 = 405,
F32MAT2X4 = 406,
F32MAT3X2 = 407,
F32MAT3X3 = 408,
F32MAT3X4 = 409,
F32MAT4X2 = 410,
F32MAT4X3 = 411,
F32MAT4X4 = 412,
F64MAT2X2 = 413,
F64MAT2X3 = 414,
F64MAT2X4 = 415,
F64MAT3X2 = 416,
F64MAT3X3 = 417,
F64MAT3X4 = 418,
F64MAT4X2 = 419,
F64MAT4X3 = 420,
F64MAT4X4 = 421,
ATOMIC_UINT = 422,
SAMPLER1D = 423,
SAMPLER2D = 424,
SAMPLER3D = 425,
SAMPLERCUBE = 426,
SAMPLER1DSHADOW = 427,
SAMPLER2DSHADOW = 428,
SAMPLERCUBESHADOW = 429,
SAMPLER1DARRAY = 430,
SAMPLER2DARRAY = 431,
SAMPLER1DARRAYSHADOW = 432,
SAMPLER2DARRAYSHADOW = 433,
ISAMPLER1D = 434,
ISAMPLER2D = 435,
ISAMPLER3D = 436,
ISAMPLERCUBE = 437,
ISAMPLER1DARRAY = 438,
ISAMPLER2DARRAY = 439,
USAMPLER1D = 440,
USAMPLER2D = 441,
USAMPLER3D = 442,
USAMPLERCUBE = 443,
USAMPLER1DARRAY = 444,
USAMPLER2DARRAY = 445,
SAMPLER2DRECT = 446,
SAMPLER2DRECTSHADOW = 447,
ISAMPLER2DRECT = 448,
USAMPLER2DRECT = 449,
SAMPLERBUFFER = 450,
ISAMPLERBUFFER = 451,
USAMPLERBUFFER = 452,
SAMPLERCUBEARRAY = 453,
SAMPLERCUBEARRAYSHADOW = 454,
ISAMPLERCUBEARRAY = 455,
USAMPLERCUBEARRAY = 456,
SAMPLER2DMS = 457,
ISAMPLER2DMS = 458,
USAMPLER2DMS = 459,
SAMPLER2DMSARRAY = 460,
ISAMPLER2DMSARRAY = 461,
USAMPLER2DMSARRAY = 462,
SAMPLEREXTERNALOES = 463,
F16SAMPLER1D = 464,
F16SAMPLER2D = 465,
F16SAMPLER3D = 466,
F16SAMPLER2DRECT = 467,
F16SAMPLERCUBE = 468,
F16SAMPLER1DARRAY = 469,
F16SAMPLER2DARRAY = 470,
F16SAMPLERCUBEARRAY = 471,
F16SAMPLERBUFFER = 472,
F16SAMPLER2DMS = 473,
F16SAMPLER2DMSARRAY = 474,
F16SAMPLER1DSHADOW = 475,
F16SAMPLER2DSHADOW = 476,
F16SAMPLER1DARRAYSHADOW = 477,
F16SAMPLER2DARRAYSHADOW = 478,
F16SAMPLER2DRECTSHADOW = 479,
F16SAMPLERCUBESHADOW = 480,
F16SAMPLERCUBEARRAYSHADOW = 481,
SAMPLER = 482,
SAMPLERSHADOW = 483,
TEXTURE1D = 484,
TEXTURE2D = 485,
TEXTURE3D = 486,
TEXTURECUBE = 487,
TEXTURE1DARRAY = 488,
TEXTURE2DARRAY = 489,
ITEXTURE1D = 490,
ITEXTURE2D = 491,
ITEXTURE3D = 492,
ITEXTURECUBE = 493,
ITEXTURE1DARRAY = 494,
ITEXTURE2DARRAY = 495,
UTEXTURE1D = 496,
UTEXTURE2D = 497,
UTEXTURE3D = 498,
UTEXTURECUBE = 499,
UTEXTURE1DARRAY = 500,
UTEXTURE2DARRAY = 501,
TEXTURE2DRECT = 502,
ITEXTURE2DRECT = 503,
UTEXTURE2DRECT = 504,
TEXTUREBUFFER = 505,
ITEXTUREBUFFER = 506,
UTEXTUREBUFFER = 507,
TEXTURECUBEARRAY = 508,
ITEXTURECUBEARRAY = 509,
UTEXTURECUBEARRAY = 510,
TEXTURE2DMS = 511,
ITEXTURE2DMS = 512,
UTEXTURE2DMS = 513,
TEXTURE2DMSARRAY = 514,
ITEXTURE2DMSARRAY = 515,
UTEXTURE2DMSARRAY = 516,
F16TEXTURE1D = 517,
F16TEXTURE2D = 518,
F16TEXTURE3D = 519,
F16TEXTURE2DRECT = 520,
F16TEXTURECUBE = 521,
F16TEXTURE1DARRAY = 522,
F16TEXTURE2DARRAY = 523,
F16TEXTURECUBEARRAY = 524,
F16TEXTUREBUFFER = 525,
F16TEXTURE2DMS = 526,
F16TEXTURE2DMSARRAY = 527,
SUBPASSINPUT = 528,
SUBPASSINPUTMS = 529,
ISUBPASSINPUT = 530,
ISUBPASSINPUTMS = 531,
USUBPASSINPUT = 532,
USUBPASSINPUTMS = 533,
F16SUBPASSINPUT = 534,
F16SUBPASSINPUTMS = 535,
IMAGE1D = 536,
IIMAGE1D = 537,
UIMAGE1D = 538,
IMAGE2D = 539,
IIMAGE2D = 540,
UIMAGE2D = 541,
IMAGE3D = 542,
IIMAGE3D = 543,
UIMAGE3D = 544,
IMAGE2DRECT = 545,
IIMAGE2DRECT = 546,
UIMAGE2DRECT = 547,
IMAGECUBE = 548,
IIMAGECUBE = 549,
UIMAGECUBE = 550,
IMAGEBUFFER = 551,
IIMAGEBUFFER = 552,
UIMAGEBUFFER = 553,
IMAGE1DARRAY = 554,
IIMAGE1DARRAY = 555,
UIMAGE1DARRAY = 556,
IMAGE2DARRAY = 557,
IIMAGE2DARRAY = 558,
UIMAGE2DARRAY = 559,
IMAGECUBEARRAY = 560,
IIMAGECUBEARRAY = 561,
UIMAGECUBEARRAY = 562,
IMAGE2DMS = 563,
IIMAGE2DMS = 564,
UIMAGE2DMS = 565,
IMAGE2DMSARRAY = 566,
IIMAGE2DMSARRAY = 567,
UIMAGE2DMSARRAY = 568,
F16IMAGE1D = 569,
F16IMAGE2D = 570,
F16IMAGE3D = 571,
F16IMAGE2DRECT = 572,
F16IMAGECUBE = 573,
F16IMAGE1DARRAY = 574,
F16IMAGE2DARRAY = 575,
F16IMAGECUBEARRAY = 576,
F16IMAGEBUFFER = 577,
F16IMAGE2DMS = 578,
F16IMAGE2DMSARRAY = 579,
STRUCT = 580,
VOID = 581,
WHILE = 582,
IDENTIFIER = 583,
TYPE_NAME = 584,
FLOATCONSTANT = 585,
DOUBLECONSTANT = 586,
INT16CONSTANT = 587,
UINT16CONSTANT = 588,
INT32CONSTANT = 589,
UINT32CONSTANT = 590,
INTCONSTANT = 591,
UINTCONSTANT = 592,
INT64CONSTANT = 593,
UINT64CONSTANT = 594,
BOOLCONSTANT = 595,
FLOAT16CONSTANT = 596,
LEFT_OP = 597,
RIGHT_OP = 598,
INC_OP = 599,
DEC_OP = 600,
LE_OP = 601,
GE_OP = 602,
EQ_OP = 603,
NE_OP = 604,
AND_OP = 605,
OR_OP = 606,
XOR_OP = 607,
MUL_ASSIGN = 608,
DIV_ASSIGN = 609,
ADD_ASSIGN = 610,
MOD_ASSIGN = 611,
LEFT_ASSIGN = 612,
RIGHT_ASSIGN = 613,
AND_ASSIGN = 614,
XOR_ASSIGN = 615,
OR_ASSIGN = 616,
SUB_ASSIGN = 617,
LEFT_PAREN = 618,
RIGHT_PAREN = 619,
LEFT_BRACKET = 620,
RIGHT_BRACKET = 621,
LEFT_BRACE = 622,
RIGHT_BRACE = 623,
DOT = 624,
COMMA = 625,
COLON = 626,
EQUAL = 627,
SEMICOLON = 628,
BANG = 629,
DASH = 630,
TILDE = 631,
PLUS = 632,
STAR = 633,
SLASH = 634,
PERCENT = 635,
LEFT_ANGLE = 636,
RIGHT_ANGLE = 637,
VERTICAL_BAR = 638,
CARET = 639,
AMPERSAND = 640,
QUESTION = 641,
INVARIANT = 642,
PRECISE = 643,
HIGH_PRECISION = 644,
MEDIUM_PRECISION = 645,
LOW_PRECISION = 646,
PRECISION = 647,
PACKED = 648,
RESOURCE = 649,
SUPERP = 650
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
#line 70 "MachineIndependent/glslang.y" /* yacc.c:1909 */
@ -476,8 +481,10 @@ union YYSTYPE
};
} interm;
#line 480 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
#line 485 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif

View file

@ -871,6 +871,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpAtomicXor: out.debug << "AtomicXor"; break;
case EOpAtomicExchange: out.debug << "AtomicExchange"; break;
case EOpAtomicCompSwap: out.debug << "AtomicCompSwap"; break;
case EOpAtomicLoad: out.debug << "AtomicLoad"; break;
case EOpAtomicStore: out.debug << "AtomicStore"; break;
case EOpAtomicCounterAdd: out.debug << "AtomicCounterAdd"; break;
case EOpAtomicCounterSubtract: out.debug << "AtomicCounterSubtract"; break;
@ -894,6 +896,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
case EOpImageAtomicXor: out.debug << "imageAtomicXor"; break;
case EOpImageAtomicExchange: out.debug << "imageAtomicExchange"; break;
case EOpImageAtomicCompSwap: out.debug << "imageAtomicCompSwap"; break;
case EOpImageAtomicLoad: out.debug << "imageAtomicLoad"; break;
case EOpImageAtomicStore: out.debug << "imageAtomicStore"; break;
#ifdef AMD_EXTENSIONS
case EOpImageLoadLod: out.debug << "imageLoadLod"; break;
case EOpImageStoreLod: out.debug << "imageStoreLod"; break;

View file

@ -524,11 +524,16 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
}
// Memory...
if (symbol.getQualifier().coherent != unitSymbol.getQualifier().coherent ||
symbol.getQualifier().volatil != unitSymbol.getQualifier().volatil ||
symbol.getQualifier().restrict != unitSymbol.getQualifier().restrict ||
symbol.getQualifier().readonly != unitSymbol.getQualifier().readonly ||
symbol.getQualifier().writeonly != unitSymbol.getQualifier().writeonly) {
if (symbol.getQualifier().coherent != unitSymbol.getQualifier().coherent ||
symbol.getQualifier().devicecoherent != unitSymbol.getQualifier().devicecoherent ||
symbol.getQualifier().queuefamilycoherent != unitSymbol.getQualifier().queuefamilycoherent ||
symbol.getQualifier().workgroupcoherent != unitSymbol.getQualifier().workgroupcoherent ||
symbol.getQualifier().subgroupcoherent != unitSymbol.getQualifier().subgroupcoherent ||
symbol.getQualifier().nonprivate != unitSymbol.getQualifier().nonprivate ||
symbol.getQualifier().volatil != unitSymbol.getQualifier().volatil ||
symbol.getQualifier().restrict != unitSymbol.getQualifier().restrict ||
symbol.getQualifier().readonly != unitSymbol.getQualifier().readonly ||
symbol.getQualifier().writeonly != unitSymbol.getQualifier().writeonly) {
error(infoSink, "Memory qualifiers must match:");
writeTypeComparison = true;
}

View file

@ -233,6 +233,7 @@ public:
useUnknownFormat(false),
hlslOffsets(false),
useStorageBuffer(false),
useVulkanMemoryModel(false),
hlslIoMapping(false),
textureSamplerTransformMode(EShTexSampTransKeep),
needToLegalize(false),
@ -365,6 +366,12 @@ public:
processes.addProcess("hlsl-iomap");
}
bool usingHlslIoMapping() { return hlslIoMapping; }
void setUseVulkanMemoryModel()
{
useVulkanMemoryModel = true;
processes.addProcess("use-vulkan-memory-model");
}
bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; }
template<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; }
bool hasCounterBufferName(const TString& name) const {
@ -734,6 +741,7 @@ protected:
bool useUnknownFormat;
bool hlslOffsets;
bool useStorageBuffer;
bool useVulkanMemoryModel;
bool hlslIoMapping;
std::set<TString> ioAccessed; // set of names of statically read/written I/O that might need extra checking