Spirv_intrinsics: Add support of type specifier to spirv_type

Previously, spirv_type doesn't accept type specifier as its parameter.
With this change, we can input non-array type specifier. This is because
some SPIR-V type definition intructions often need to reference other
SPIR-V types as its source operands. We add the support to facilitate
such usage.
This commit is contained in:
Rex Xu 2023-06-24 11:23:45 +08:00 committed by arcady-lunarg
parent eaa7057768
commit 051f18c0cc
10 changed files with 1468 additions and 1359 deletions

View file

@ -45,6 +45,15 @@
namespace glslang {
bool TSpirvTypeParameter::operator==(const TSpirvTypeParameter& rhs) const
{
if (constant != nullptr)
return constant->getConstArray() == rhs.constant->getConstArray();
assert(type != nullptr);
return *type == *rhs.type;
}
//
// Handle SPIR-V requirements
//
@ -283,14 +292,19 @@ TSpirvTypeParameters* TParseContext::makeSpirvTypeParameters(const TSourceLoc& l
constant->getBasicType() != EbtBool &&
constant->getBasicType() != EbtString)
error(loc, "this type not allowed", constant->getType().getBasicString(), "");
else {
assert(constant);
else
spirvTypeParams->push_back(TSpirvTypeParameter(constant));
}
return spirvTypeParams;
}
TSpirvTypeParameters* TParseContext::makeSpirvTypeParameters(const TSourceLoc& loc, const TPublicType& type)
{
TSpirvTypeParameters* spirvTypeParams = new TSpirvTypeParameters;
spirvTypeParams->push_back(TSpirvTypeParameter(new TType(type)));
return spirvTypeParams;
}
TSpirvTypeParameters* TParseContext::mergeSpirvTypeParameters(TSpirvTypeParameters* spirvTypeParams1, TSpirvTypeParameters* spirvTypeParams2)
{
// Merge SPIR-V type parameters of the second one to the first one