From 797fbcc181c3af2773819905abdd902c39aee7e3 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 9 May 2022 11:32:25 +0100 Subject: [PATCH] Fix friendly name of registers in cbuffer declarations in dxbc --- renderdoc/driver/shaders/dxbc/dxbc_bytecode_ops.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/shaders/dxbc/dxbc_bytecode_ops.cpp b/renderdoc/driver/shaders/dxbc/dxbc_bytecode_ops.cpp index 222b77b11..c0b3adbd5 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_bytecode_ops.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_bytecode_ops.cpp @@ -368,7 +368,16 @@ rdcstr Operand::toString(const DXBC::Reflection *reflection, ToString toStrFlags } } - if(cbuffer) + if(cbuffer && decl) + { + // for declarations don't look up the variable name. This actually lists the size in + // float4s of the constant buffer, and in the case of dead code elimination there could be + // variables past that point which have been removed which we'd find + + if(!cbuffer->name.empty()) + str += " (" + cbuffer->name + ")"; + } + else if(cbuffer) { // if the second index is constant then this is easy enough, we just find the matching // cbuffer variable and use its name, possibly rebasing the swizzle.