From 10313415d95b54ac70db3ac5849548bae96e4e42 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 27 Nov 2015 01:18:45 +0100 Subject: [PATCH] Don't combine load/stores for non-function variables --- renderdoc/driver/shaders/spirv/spirv_disassemble.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp b/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp index 969427c84..ff9a3251b 100644 --- a/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp @@ -1574,11 +1574,13 @@ void SPVModule::Disassemble() // - The Load is preceeded by precisely one Store - not 0 or 2+ // - The previous store is 'pure', ie. does not depend on any mutated variables // so it is safe to re-order to where the Load is. + // - The variable in question is a function variable // // If those conditions are met then we can remove the previous store, inline it as the load // function argument (instead of the variable), and remove the variable. - if(instr->opcode == spv::OpLoad && funcops.size() > 1) + if(instr->opcode == spv::OpLoad && funcops.size() > 1 && + instr->op->arguments[0]->var && instr->op->arguments[0]->var->storage == spv::StorageClassFunction) { SPVInstruction *prevstore = NULL; int storecount = 0;