From 3ade07303783605ddef8c0f0c5237952c903798d Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 29 Feb 2024 18:02:53 -0800 Subject: Fix various crashes when generating debug info. (#3650) * Fix crash when generating debug info for geometry shaders. * Fix. * Fix source language field in DebugCompilationUnit. * Fix. * Emit DebugEntryPoint inst. * Add trivial test. * Cleanup. * More cleanup. --- source/slang/slang-ir-util.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (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 8b39e8b45..5b29d23a8 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -196,6 +196,39 @@ bool isValueType(IRInst* dataType) } } +bool isSimpleDataType(IRType* type) +{ + type = (IRType*)unwrapAttributedType(type); + if (as(type)) + return true; + switch (type->getOp()) + { + case kIROp_StructType: + { + auto structType = as(type); + for (auto field : structType->getFields()) + { + if (!isSimpleDataType(field->getFieldType())) + return false; + } + return true; + break; + } + case kIROp_Param: + case kIROp_VectorType: + case kIROp_MatrixType: + case kIROp_InterfaceType: + case kIROp_AnyValueType: + return true; + case kIROp_ArrayType: + case kIROp_UnsizedArrayType: + case kIROp_PtrType: + return isSimpleDataType((IRType*)type->getOperand(0)); + default: + return false; + } +} + IRInst* hoistValueFromGeneric(IRBuilder& inBuilder, IRInst* value, IRInst*& outSpecializedVal, bool replaceExistingValue) { auto outerGeneric = as(findOuterGeneric(value)); -- cgit v1.2.3