SPV 1.4: Generate all globals on OpEntryPoint interface list.

This commit is contained in:
John Kessenich 2019-01-04 16:47:06 +07:00
parent 2dd4ab3a4a
commit 7c7731ecbb

View File

@ -1552,12 +1552,18 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol)
// Include all "static use" and "linkage only" interface variables on the OpEntryPoint instruction
if (builder.isPointer(id)) {
// Consider adding to the OpEntryPoint interface list.
// Only looking at structures if they have at least one member.
if (!symbol->getType().isStruct() || symbol->getType().getStruct()->size() > 0) {
spv::StorageClass sc = builder.getStorageClass(id);
if (sc == spv::StorageClassInput || sc == spv::StorageClassOutput) {
if (!symbol->getType().isStruct() || symbol->getType().getStruct()->size() > 0)
// Before SPIR-V 1.4, we only want to include Input and Output.
// Starting with SPIR-V 1.4, we want all globals.
if ((glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4 && sc != spv::StorageClassFunction) ||
(sc == spv::StorageClassInput || sc == spv::StorageClassOutput)) {
iOSet.insert(id);
}
}
}
// Only process non-linkage-only nodes for generating actual static uses
if (! linkageOnly || symbol->getQualifier().isSpecConstant()) {