summaryrefslogtreecommitdiffstats
path: root/source/slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-09-14 11:36:44 -0700
committerGitHub <noreply@github.com>2021-09-14 14:36:44 -0400
commit11d43642008905ac69a3832eb8a9b2ae7b785f86 (patch)
tree0d51bc6d16fbbb7a37148230f3bd37cc861830d4 /source/slang
parent502aa3812a82cf0d091cff0c67804e4ee448ac78 (diff)
Avoid upcasting to f32 in 16bit float-uint bit cast. (#1938)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/slang-emit-hlsl.cpp4
-rw-r--r--source/slang/slang-ir-any-value-marshalling.cpp3
2 files changed, 2 insertions, 5 deletions
diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp
index dc58b7507..9ebf204ac 100644
--- a/source/slang/slang-emit-hlsl.cpp
+++ b/source/slang/slang-emit-hlsl.cpp
@@ -480,7 +480,7 @@ bool HLSLSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu
m_writer->emit(")");
break;
case BaseType::Half:
- m_writer->emit("f16tof32");
+ m_writer->emit("asfloat16");
break;
case BaseType::Float:
// Note: at present HLSL only supports
@@ -522,7 +522,7 @@ bool HLSLSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu
break;
case BaseType::Half:
- m_writer->emit("f32tof16(");
+ m_writer->emit("asuint16(");
closeCount++;
break;
}
diff --git a/source/slang/slang-ir-any-value-marshalling.cpp b/source/slang/slang-ir-any-value-marshalling.cpp
index b88dd79d1..c7f40efc0 100644
--- a/source/slang/slang-ir-any-value-marshalling.cpp
+++ b/source/slang/slang-ir-any-value-marshalling.cpp
@@ -284,9 +284,6 @@ namespace Slang
auto dstVal = builder->emitLoad(dstAddr);
if (intraFieldOffset == 0)
{
- srcVal = builder->emitBitAnd(
- srcVal->getFullType(), srcVal,
- builder->getIntValue(builder->getUIntType(), 0xFFFF));
dstVal = builder->emitBitAnd(
dstVal->getFullType(), dstVal,
builder->getIntValue(builder->getUIntType(), 0xFFFF0000));