From 3363b298832045b03fecc1521de3a7a9850b3ad1 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Thu, 4 Jan 2024 15:47:04 +0000 Subject: [PATCH] SPIR-V Debugger fix Bitcast from vector to scalar --- renderdoc/driver/shaders/spirv/spirv_debug.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/shaders/spirv/spirv_debug.cpp b/renderdoc/driver/shaders/spirv/spirv_debug.cpp index db0c4ad47..75ba75c66 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_debug.cpp @@ -1297,16 +1297,17 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray srcByteCount = 1; uint32_t dstByteCount = type.scalar().width / 8; + uint32_t dstColumns = (type.type == DataType::ScalarType) ? 1 : type.vector().count; // must be identical bit count - RDCASSERT(dstByteCount * type.vector().count == srcByteCount * var.columns); + RDCASSERT(dstByteCount * dstColumns == srcByteCount * var.columns); // because this is a bitcast, we leave var.value entirely alone. There is the same number of // bytes so the union handles it. E.g. uv[0], uv[1] being bitcast to a single 64-bit // corresponds exactly to the LSB and MSB of u64v[0] var.type = type.scalar().Type(); - var.columns = type.vector().count & 0xff; + var.columns = dstColumns & 0xff; } SetDst(cast.result, var);