From a10f67f26a45d06b5626f66ee45f4ccd7507af4e Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 22 Jul 2020 20:04:58 +0100 Subject: [PATCH] Skip OpLine/OpNoLine that appears before function variable declarations --- .../driver/shaders/spirv/spirv_debug.cpp | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/shaders/spirv/spirv_debug.cpp b/renderdoc/driver/shaders/spirv/spirv_debug.cpp index 0cd6ee6f3..09fae0c97 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_debug.cpp @@ -118,8 +118,15 @@ void ThreadState::EnterFunction(const rdcarray &arguments) it++; size_t arg = 0; - while(OpDecoder(it).op == Op::FunctionParameter) + while(OpDecoder(it).op == Op::FunctionParameter || OpDecoder(it).op == Op::Line || + OpDecoder(it).op == Op::NoLine) { + if(OpDecoder(it).op == Op::Line || OpDecoder(it).op == Op::NoLine) + { + it++; + continue; + } + OpFunctionParameter param(it); if(arg <= arguments.size()) @@ -140,6 +147,9 @@ void ThreadState::EnterFunction(const rdcarray &arguments) it++; } + while(OpDecoder(it).op == Op::Line || OpDecoder(it).op == Op::NoLine) + it++; + // next should be the start of the first function block RDCASSERT(OpDecoder(it).op == Op::Label); frame->lastBlock = frame->curBlock = OpLabel(it).result; @@ -147,9 +157,13 @@ void ThreadState::EnterFunction(const rdcarray &arguments) size_t numVars = 0; Iter varCounter = it; - while(OpDecoder(varCounter).op == Op::Variable) + while(OpDecoder(varCounter).op == Op::Variable || OpDecoder(varCounter).op == Op::Line || + OpDecoder(varCounter).op == Op::NoLine) { varCounter++; + if(OpDecoder(varCounter).op == Op::Line || OpDecoder(varCounter).op == Op::NoLine) + continue; + numVars++; } @@ -161,8 +175,15 @@ void ThreadState::EnterFunction(const rdcarray &arguments) size_t i = 0; // handle any variable declarations - while(OpDecoder(it).op == Op::Variable) + while(OpDecoder(it).op == Op::Variable || OpDecoder(it).op == Op::Line || + OpDecoder(it).op == Op::NoLine) { + if(OpDecoder(it).op == Op::Line || OpDecoder(it).op == Op::NoLine) + { + it++; + continue; + } + OpVariable decl(it); ShaderVariable &stackvar = frame->locals[i];