From 19d8a064d62b69810e1382ce9e6d75e2a35f2675 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 3 Aug 2022 11:55:26 +0100 Subject: [PATCH] Fix invalid DXIL for clamping D3D12 bindless feedback --- .../driver/d3d12/d3d12_shader_feedback.cpp | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_shader_feedback.cpp b/renderdoc/driver/d3d12/d3d12_shader_feedback.cpp index bfd6ef69d..1c9408d5b 100644 --- a/renderdoc/driver/d3d12/d3d12_shader_feedback.cpp +++ b/renderdoc/driver/d3d12/d3d12_shader_feedback.cpp @@ -342,6 +342,33 @@ static bool AnnotateDXILShader(const DXBC::DXBCContainer *dxbc, uint32_t space, } } + // we haven't implemented adding attribute sets since their encoding is obtuse, so if we can't + // get the 'real' binop attributes try to get the next most conservative one + if(!binopFunc.attrs) + { + for(const DXIL::AttributeSet &attrs : editor.GetAttributeSets()) + { + if(attrs.functionSlot && + attrs.functionSlot->params == (DXIL::Attribute::NoUnwind | DXIL::Attribute::ReadOnly)) + { + binopFunc.attrs = &attrs; + break; + } + } + } + + if(!binopFunc.attrs) + { + for(const DXIL::AttributeSet &attrs : editor.GetAttributeSets()) + { + if(attrs.functionSlot && attrs.functionSlot->params == DXIL::Attribute::NoUnwind) + { + binopFunc.attrs = &attrs; + break; + } + } + } + if(!binopFunc.attrs) RDCWARN("Couldn't find existing nounwind readnone attr set"); @@ -943,8 +970,6 @@ static bool AnnotateDXILShader(const DXBC::DXBCContainer *dxbc, uint32_t space, op.args = { // dx.op.binOp.i32 UMin opcode DXIL::Value(editor.GetOrAddConstant(f, DXIL::Constant(i32, 40U))), - // operation OR - DXIL::Value(editor.GetOrAddConstant(f, DXIL::Constant(i32, 2U))), // slotPlusBase DXIL::Value(slotPlusBase), // max slot