summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-util.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-18 16:41:40 -0700
committerGitHub <noreply@github.com>2024-03-18 16:41:40 -0700
commitf96a3fea6704da866e96e453f722a951c214ba28 (patch)
treee14aafe59eca98992593803db19cc3dff0ae1fe1 /source/slang/slang-ir-util.cpp
parent7f6e95917bb1929115b4cffa2ed9035aa8710ee4 (diff)
Fix SPIRV for mesh shaders, checks for invalid target code&recursion. (#3788)
* Fix #3780. * Fixers #3781. * Add test for #3781. * Diagnose error on unsupported builtin intrinsic types. * Add check for recursion. * Fix. * Fix. * Fix recursion detection. * Fix. * Fix. * Fix recursion logic. * More fix.
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
-rw-r--r--source/slang/slang-ir-util.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp
index 2f059d308..e1eb86508 100644
--- a/source/slang/slang-ir-util.cpp
+++ b/source/slang/slang-ir-util.cpp
@@ -230,6 +230,18 @@ bool isSimpleDataType(IRType* type)
}
}
+SourceLoc findFirstUseLoc(IRInst* inst)
+{
+ for (auto use = inst->firstUse; use; use = use->nextUse)
+ {
+ if (use->getUser()->sourceLoc.isValid())
+ {
+ return use->getUser()->sourceLoc;
+ }
+ }
+ return inst->sourceLoc;
+}
+
IRInst* hoistValueFromGeneric(IRBuilder& inBuilder, IRInst* value, IRInst*& outSpecializedVal, bool replaceExistingValue)
{
auto outerGeneric = as<IRGeneric>(findOuterGeneric(value));
@@ -582,14 +594,20 @@ void getTypeNameHint(StringBuilder& sb, IRInst* type)
getTypeNameHint(sb, as<IRRateQualifiedType>(type)->getValueType());
break;
case kIROp_VectorType:
+ sb << "vector<";
getTypeNameHint(sb, type->getOperand(0));
+ sb << ",";
getTypeNameHint(sb, as<IRVectorType>(type)->getElementCount());
+ sb << ">";
break;
case kIROp_MatrixType:
+ sb << "matrix<";
getTypeNameHint(sb, type->getOperand(0));
+ sb << ",";
getTypeNameHint(sb, as<IRMatrixType>(type)->getRowCount());
- sb << "x";
+ sb << ",";
getTypeNameHint(sb, as<IRMatrixType>(type)->getColumnCount());
+ sb << ">";
break;
case kIROp_IntLit:
sb << as<IRIntLit>(type)->getValue();