summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-glsl.cpp
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2024-12-17 19:06:30 -0600
committerGitHub <noreply@github.com>2024-12-17 17:06:30 -0800
commit6f57e47a9e1675b011f023277b47cfc768d30da8 (patch)
treeed9d531c1e1e4f55650314956c485d5107130a21 /source/slang/slang-emit-glsl.cpp
parent49e912a9d0d6ca5f762ec11cd8cb918f182eb76e (diff)
Implement bitcast for 64-bit date type (#5895)
Close #5470 * implement bitcast for 64-bit date type * Move 'ensurePrelude' to base class to remove duplication * Assert on 'double' type for Metal target, as Metal doesn't have 'double' support
Diffstat (limited to 'source/slang/slang-emit-glsl.cpp')
-rw-r--r--source/slang/slang-emit-glsl.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index 2c2447c53..d6f3795e3 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -2030,6 +2030,32 @@ bool GLSLSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu
emitType(inst->getDataType());
}
break;
+ case BaseType::Int64:
+ if (fromType == BaseType::Double)
+ {
+ m_writer->emit("int64_t(doubleBitsToInt64(");
+ emitOperand(inst->getOperand(0), getInfo(EmitOp::General));
+ m_writer->emit("))");
+ return true;
+ }
+ else
+ {
+ emitType(inst->getDataType());
+ }
+ break;
+ case BaseType::UInt64:
+ if (fromType == BaseType::Double)
+ {
+ m_writer->emit("uint64_t(doubleBitsToUint64(");
+ emitOperand(inst->getOperand(0), getInfo(EmitOp::General));
+ m_writer->emit("))");
+ return true;
+ }
+ else
+ {
+ emitType(inst->getDataType());
+ }
+ break;
case BaseType::Half:
switch (fromType)
{