From 9b79944258e56946ccc141e023fa5887fdb8f192 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Fri, 3 Apr 2026 16:44:36 +0100 Subject: [PATCH] Special handling in DXIL Debugger for i1 literals i.e. bools Match the debugger convention of true is 1, false is 0. --- renderdoc/driver/shaders/dxil/dxil_debug.cpp | 24 +++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/shaders/dxil/dxil_debug.cpp b/renderdoc/driver/shaders/dxil/dxil_debug.cpp index ef171357e..f446f3445 100644 --- a/renderdoc/driver/shaders/dxil/dxil_debug.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_debug.cpp @@ -945,9 +945,18 @@ static bool ConvertDXILConstantToShaderValue(const DXIL::Constant *c, const size else if(c->isLiteral()) { if(c->type->bitWidth == 64) + { value.u64v[index] = c->getU64(); + } + else if(c->type->bitWidth == 1) + { + // Special case for 1-bit types : which should be bool's : debugger convention is true is 1, false is 0 + value.u8v[0] = (c->getU32() != 0) ? 1 : 0; + } else + { value.u32v[index] = c->getU32(); + } return true; } else if(c->isNULL()) @@ -6329,7 +6338,20 @@ bool ThreadState::GetShaderVariableHelper(const DXIL::Value *dxilValue, DXIL::Op } else if(c->isLiteral()) { - var.value.u64v[0] = c->getU64(); + if(c->type->bitWidth == 64) + { + var.value.u64v[0] = c->getU64(); + } + else if(c->type->bitWidth == 1) + { + // Special case for 1-bit types : which should be bool's : debugger convention is true is 1, false is 0 + RDCASSERTEQUAL(var.type, VarType::Bool); + var.value.u8v[0] = (c->getU32() != 0) ? 1 : 0; + } + else + { + var.value.u32v[0] = c->getU32(); + } return true; } else if(c->isNULL())