Add support for GL_EXT_shared_memory_block

Uses SPV_KHR_workgroup_memory_explicit_layout.  Note that if
GL_EXT_scalar_block_layout is enabled, Workgroup blocks can also use
scalar layout.
This commit is contained in:
Caio Marcelo de Oliveira Filho 2020-06-02 16:58:51 -07:00
parent 3785ddd59a
commit 4bfbf62794
33 changed files with 822 additions and 8 deletions

View file

@ -653,6 +653,25 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
#endif
}
void TIntermediate::sharedBlockCheck(TInfoSink& infoSink)
{
bool has_shared_block = false;
bool has_shared_non_block = false;
TIntermSequence& linkObjects = findLinkerObjects()->getSequence();
for (size_t i = 0; i < linkObjects.size(); ++i) {
const TType& type = linkObjects[i]->getAsTyped()->getType();
const TQualifier& qualifier = type.getQualifier();
if (qualifier.storage == glslang::EvqShared) {
if (type.getBasicType() == glslang::EbtBlock)
has_shared_block = true;
else
has_shared_non_block = true;
}
}
if (has_shared_block && has_shared_non_block)
error(infoSink, "cannot mix use of shared variables inside and outside blocks");
}
//
// Do final link-time error checking of a complete (merged) intermediate representation.
// (Much error checking was done during merging).
@ -778,6 +797,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
error(infoSink, "post_depth_coverage requires early_fragment_tests");
break;
case EShLangCompute:
sharedBlockCheck(infoSink);
break;
case EShLangRayGen:
case EShLangIntersect:
@ -810,6 +830,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
case EShLangTaskNV:
if (numTaskNVBlocks > 1)
error(infoSink, "Only one taskNV interface block is allowed per shader");
sharedBlockCheck(infoSink);
break;
default:
error(infoSink, "Unknown Stage.");