SPV: Handle nested opaque types as function parameters.
This commit is contained in:
@@ -251,10 +251,10 @@ spv::StorageClass TranslateStorageClass(const glslang::TType& type)
|
||||
return spv::StorageClassInput;
|
||||
else if (type.getQualifier().isPipeOutput())
|
||||
return spv::StorageClassOutput;
|
||||
else if (type.getBasicType() == glslang::EbtSampler)
|
||||
return spv::StorageClassUniformConstant;
|
||||
else if (type.getBasicType() == glslang::EbtAtomicUint)
|
||||
return spv::StorageClassAtomicCounter;
|
||||
else if (type.containsOpaque())
|
||||
return spv::StorageClassUniformConstant;
|
||||
else if (type.getQualifier().isUniformOrBuffer()) {
|
||||
if (type.getQualifier().layoutPushConstant)
|
||||
return spv::StorageClassPushConstant;
|
||||
@@ -262,7 +262,6 @@ spv::StorageClass TranslateStorageClass(const glslang::TType& type)
|
||||
return spv::StorageClassUniform;
|
||||
else
|
||||
return spv::StorageClassUniformConstant;
|
||||
// TODO: how are we distinguishing between default and non-default non-writable uniforms? Do default uniforms even exist?
|
||||
} else {
|
||||
switch (type.getQualifier().storage) {
|
||||
case glslang::EvqShared: return spv::StorageClassWorkgroup; break;
|
||||
@@ -2731,7 +2730,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF
|
||||
for (int p = 0; p < (int)parameters.size(); ++p) {
|
||||
const glslang::TType& paramType = parameters[p]->getAsTyped()->getType();
|
||||
spv::Id typeId = convertGlslangToSpvType(paramType);
|
||||
if (paramType.isOpaque())
|
||||
if (paramType.containsOpaque())
|
||||
typeId = builder.makePointer(TranslateStorageClass(paramType), typeId);
|
||||
else if (paramType.getQualifier().storage != glslang::EvqConstReadOnly)
|
||||
typeId = builder.makePointer(spv::StorageClassFunction, typeId);
|
||||
@@ -3192,7 +3191,7 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
|
||||
glslangArgs[a]->traverse(this);
|
||||
argTypes.push_back(¶mType);
|
||||
// keep outputs and opaque objects as l-values, evaluate input-only as r-values
|
||||
if (qualifiers[a] != glslang::EvqConstReadOnly || paramType.isOpaque()) {
|
||||
if (qualifiers[a] != glslang::EvqConstReadOnly || paramType.containsOpaque()) {
|
||||
// save l-value
|
||||
lValues.push_back(builder.getAccessChain());
|
||||
} else {
|
||||
@@ -3211,7 +3210,7 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
|
||||
for (int a = 0; a < (int)glslangArgs.size(); ++a) {
|
||||
const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType();
|
||||
spv::Id arg;
|
||||
if (paramType.isOpaque()) {
|
||||
if (paramType.containsOpaque()) {
|
||||
builder.setAccessChain(lValues[lValueCount]);
|
||||
arg = builder.accessChainGetLValue();
|
||||
++lValueCount;
|
||||
|
||||
Reference in New Issue
Block a user