From 88fdd4a2e9c39c0fea0315afb4a1511394b2256e Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 6 Nov 2024 07:34:44 +0000 Subject: [PATCH] Apply SampleBias bias correctly when debugging D3D12 Shaders --- renderdoc/driver/d3d12/d3d12_shaderdebug.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp index cadafa278..5490fa0d9 100644 --- a/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp +++ b/renderdoc/driver/d3d12/d3d12_shaderdebug.cpp @@ -321,6 +321,13 @@ bool D3D12ShaderDebug::CalculateSampleGather( sampleOp == DEBUG_SAMPLE_TEX_GATHER4_CMP || sampleOp == DEBUG_SAMPLE_TEX_GATHER4_PO_CMP) samp.ptr += sizeof(D3D12Descriptor); + if((sampleOp == DEBUG_SAMPLE_TEX_SAMPLE_BIAS || sampleOp == DEBUG_SAMPLE_TEX_SAMPLE_CMP_BIAS) && + samplerData.bias != 0.0f) + { + D3D12_SAMPLER_DESC2 desc = descriptor.GetSampler(); + desc.MipLODBias = RDCCLAMP(desc.MipLODBias + samplerData.bias, -15.99f, 15.99f); + descriptor.Init(&desc); + } descriptor.Create(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, device, samp); }