From f96a3fea6704da866e96e453f722a951c214ba28 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 18 Mar 2024 16:41:40 -0700 Subject: 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. --- source/slang/slang-ir-util.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-ir-util.cpp') 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(findOuterGeneric(value)); @@ -582,14 +594,20 @@ void getTypeNameHint(StringBuilder& sb, IRInst* type) getTypeNameHint(sb, as(type)->getValueType()); break; case kIROp_VectorType: + sb << "vector<"; getTypeNameHint(sb, type->getOperand(0)); + sb << ","; getTypeNameHint(sb, as(type)->getElementCount()); + sb << ">"; break; case kIROp_MatrixType: + sb << "matrix<"; getTypeNameHint(sb, type->getOperand(0)); + sb << ","; getTypeNameHint(sb, as(type)->getRowCount()); - sb << "x"; + sb << ","; getTypeNameHint(sb, as(type)->getColumnCount()); + sb << ">"; break; case kIROp_IntLit: sb << as(type)->getValue(); -- cgit v1.2.3