From f1de1817ca10e34ec6a844100f10f0de3340c9f2 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 23 Apr 2024 12:14:21 -0700 Subject: Switch to direct-to-spirv backend as default. (#4002) * Switch to direct-to-spirv backend as default. * Fix slang-test. * Fix. * Fix. --- source/slang/slang-ir-util.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 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 eaf254190..f7a93dca6 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -1544,6 +1544,27 @@ void hoistInstOutOfASMBlocks(IRBlock* block) } } +IRType* getSPIRVSampledElementType(IRInst* sampledType) +{ + auto sampledElementType = getVectorElementType((IRType*)sampledType); + if (sampledElementType->getOp() == kIROp_HalfType) + { + IRBuilder builder(sampledType); + sampledElementType = builder.getBasicType(BaseType::Float); + } + return sampledElementType; +} + +IRType* replaceVectorElementType(IRType* originalVectorType, IRType* t) +{ + if (auto orignalVectorType = as(originalVectorType)) + { + IRBuilder builder(originalVectorType); + return builder.getVectorType(t, orignalVectorType->getElementCount()); + } + return t; +} + IRParam* getParamAt(IRBlock* block, UIndex ii) { UIndex index = 0; -- cgit v1.2.3