From ab3986a22c9278436ee92bf4a5a3b09ae09c8a15 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 8 Jul 2021 14:01:49 +0100 Subject: [PATCH] Only add the implicit ret if there isn't one already --- .../driver/shaders/dxbc/dxbc_bytecode_ops.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/renderdoc/driver/shaders/dxbc/dxbc_bytecode_ops.cpp b/renderdoc/driver/shaders/dxbc/dxbc_bytecode_ops.cpp index 0b69d7f38..86ba02ee6 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_bytecode_ops.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_bytecode_ops.cpp @@ -728,13 +728,16 @@ void Program::DecodeProgram() RDCASSERT(m_Declarations.size() <= numDecls); - Operation implicitRet; - implicitRet.length = 1; - implicitRet.offset = (end - begin) * sizeof(uint32_t); - implicitRet.operation = OPCODE_RET; - implicitRet.str = "ret"; + if(m_Instructions.empty() || m_Instructions.back().operation != OPCODE_RET) + { + Operation implicitRet; + implicitRet.length = 1; + implicitRet.offset = (end - begin) * sizeof(uint32_t); + implicitRet.operation = OPCODE_RET; + implicitRet.str = "ret"; - m_Instructions.push_back(implicitRet); + m_Instructions.push_back(implicitRet); + } if(DXBC_Disassembly_ProcessVendorShaderExts() && m_ShaderExt.second != ~0U) PostprocessVendorExtensions();