From 5a174dfab4ae0852cb96df5f48bae474949cc017 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Mon, 8 Jul 2024 21:34:51 -0700 Subject: Fix the issue in emitFloatCast (#4559) * Fix the issue in emitFloatCast In emitFloatCast function, we only considered the input type is float scalar or float vector, so if the input type is a float matrix type, it will crash. We should also handle the float matrix type. Also, we add some diagnose info to point out the source location where there is error happened, so in the future it's easier to tell us what happens. * Add a unit test * Disable the test for metal Metal doesn't support 'double'. " metal 32023.35: /tmp/unknown-YgHAsJ.metal(15): error : 'double' is not supported in Metal matrix b_0 = matrix (a_0); " --- source/slang/slang-ir-util.cpp | 7 +++++++ 1 file changed, 7 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 10c7bfea6..8294cd533 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -23,6 +23,13 @@ IRType* getVectorElementType(IRType* type) return type; } +IRType* getMatrixElementType(IRType* type) +{ + if (auto matrixType = as(type)) + return matrixType->getElementType(); + return type; +} + Dictionary buildInterfaceRequirementDict(IRInterfaceType* interfaceType) { Dictionary result; -- cgit v1.2.3