From 458ad0dd4cb84a84b7daabafe8b9385eca98b347 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sun, 4 Oct 2015 15:56:39 +0200 Subject: [PATCH] Tweak inlining for composite extract/construct --- renderdoc/driver/shaders/spirv/spirv_disassemble.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp b/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp index 9768c7f02..87766977b 100644 --- a/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_disassemble.cpp @@ -1337,10 +1337,15 @@ void SPVModule::Disassemble() if(arg->op) { + // allow less inlining in composite constructs + int maxAllowedComplexity = NO_INLINE_COMPLEXITY; + if(instr->opcode == spv::OpCompositeConstruct) + maxAllowedComplexity = RDCMIN(2, maxAllowedComplexity); + // don't fold up too complex an operation // allow some ops to have multiple arguments, others with many // arguments should not be inlined - if(arg->op->complexity >= NO_INLINE_COMPLEXITY || + if(arg->op->complexity >= maxAllowedComplexity || (arg->op->arguments.size() > 2 && arg->opcode != spv::OpAccessChain && arg->opcode != spv::OpSelect && @@ -1357,7 +1362,10 @@ void SPVModule::Disassemble() instr->op->complexity = maxcomplex; - if(instr->opcode != spv::OpStore && instr->opcode != spv::OpLoad && instr->op->inlineArgs) + if(instr->opcode != spv::OpStore && + instr->opcode != spv::OpLoad && + instr->opcode != spv::OpCompositeExtract && + instr->op->inlineArgs) instr->op->complexity++; // TODO this should be more sophisticated but need a 'pure' check to make sure