diff options
| author | Yong He <yonghe@outlook.com> | 2024-02-29 18:02:53 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-29 18:02:53 -0800 |
| commit | 3ade07303783605ddef8c0f0c5237952c903798d (patch) | |
| tree | d41b82eae557d82ad642812bd84a8c434d2e1bb3 /source/slang/slang-ir-util.cpp | |
| parent | 458d66300f7180a0e5d432a203225305a83fc222 (diff) | |
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.
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
| -rw-r--r-- | source/slang/slang-ir-util.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
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<IRBasicType>(type)) + return true; + switch (type->getOp()) + { + case kIROp_StructType: + { + auto structType = as<IRStructType>(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<IRGeneric>(findOuterGeneric(value)); |
