From c2e180ea28c0f81f3b87a7e70a22b3e170f8fa3e Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 6 Feb 2020 15:07:28 +0000 Subject: [PATCH] Skip pixel debugging comparison in Iter_Test when writes are masked out --- renderdoc/api/replay/pipestate.h | 14 ++++++++ renderdoc/api/replay/pipestate.inl | 54 ++++++++++++++++++++++++++++++ util/test/tests/Iter_Test.py | 10 ++++-- 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/renderdoc/api/replay/pipestate.h b/renderdoc/api/replay/pipestate.h index 2ae246072..d3d6ccaa9 100644 --- a/renderdoc/api/replay/pipestate.h +++ b/renderdoc/api/replay/pipestate.h @@ -329,6 +329,20 @@ For some APIs that don't distinguish by entry point, this may be empty. )"); rdcarray GetOutputTargets() const; + DOCUMENT(R"(Retrieves the current color blending states, per target. + +:return: The currently color blend states. +:rtype: ``list`` of :class:`ColorBlend`. +)"); + rdcarray GetColorBlends() const; + + DOCUMENT(R"(Determines whether or not independent blending is enabled. + +:return: A boolean indicating if independent blending is enabled. +:rtype: ``bool`` +)"); + bool IsIndependentBlendingEnabled() const; + private: const D3D11Pipe::State *m_D3D11 = NULL; const D3D12Pipe::State *m_D3D12 = NULL; diff --git a/renderdoc/api/replay/pipestate.inl b/renderdoc/api/replay/pipestate.inl index 6352bce23..d685d7e9d 100644 --- a/renderdoc/api/replay/pipestate.inl +++ b/renderdoc/api/replay/pipestate.inl @@ -1420,3 +1420,57 @@ rdcarray PipeState::GetOutputTargets() const return ret; } + +rdcarray PipeState::GetColorBlends() const +{ + if(IsCaptureLoaded()) + { + if(IsCaptureD3D11()) + { + return m_D3D11->outputMerger.blendState.blends; + } + else if(IsCaptureD3D12()) + { + return m_D3D12->outputMerger.blendState.blends; + } + else if(IsCaptureGL()) + { + return m_GL->framebuffer.blendState.blends; + } + else if(IsCaptureVK()) + { + return m_Vulkan->colorBlend.blends; + } + } + + return {}; +} + +bool PipeState::IsIndependentBlendingEnabled() const +{ + if(IsCaptureLoaded()) + { + if(IsCaptureD3D11()) + { + return m_D3D11->outputMerger.blendState.independentBlend; + } + else if(IsCaptureD3D12()) + { + return m_D3D12->outputMerger.blendState.independentBlend; + } + else if(IsCaptureGL()) + { + // GL is always implicitly independent blending, just that if you set it in a non-independent + // way it sets all states at once + return true; + } + else if(IsCaptureVK()) + { + // similarly for vulkan, there's a physical device feature but it just requires that all + // states must be identical + return true; + } + } + + return {}; +} diff --git a/util/test/tests/Iter_Test.py b/util/test/tests/Iter_Test.py index 8fc9681fa..3d2fd2fca 100644 --- a/util/test/tests/Iter_Test.py +++ b/util/test/tests/Iter_Test.py @@ -171,7 +171,7 @@ class Iter_Test(rdtest.TestCase): rdtest.log.print("Got a hit on a drawcall at event %d" % lastmod.eventId) - if mod.sampleMasked or mod.backfaceCulled or mod.depthClipped or mod.viewClipped or mod.scissorClipped or mod.depthTestFailed or mod.stencilTestFailed: + if mod.sampleMasked or mod.backfaceCulled or mod.depthClipped or mod.viewClipped or mod.scissorClipped or mod.shaderDiscarded or mod.depthTestFailed or mod.stencilTestFailed: rdtest.log.print("This hit failed, looking for one that passed....") lastmod = None continue @@ -182,6 +182,8 @@ class Iter_Test(rdtest.TestCase): rdtest.log.print("Debugging pixel {},{} @ {}, primitive {}".format(x, y, lastmod.eventId, lastmod.primitiveID)) self.controller.SetFrameEvent(lastmod.eventId, True) + pipe: rd.PipeState = self.controller.GetPipelineState() + trace = self.controller.DebugPixel(x, y, 0, lastmod.primitiveID) if trace.debugger is None: @@ -194,14 +196,18 @@ class Iter_Test(rdtest.TestCase): cycles, variables = self.process_trace(trace) + output_index = [o.resourceId for o in self.controller.GetPipelineState().GetOutputTargets()].index(target) + if draw.outputs[0] == rd.ResourceId.Null(): rdtest.log.success('Successfully debugged pixel in {} cycles, skipping result check due to no output'.format(cycles)) self.controller.FreeTrace(trace) elif (draw.flags & rd.DrawFlags.Instanced) and draw.numInstances > 1: rdtest.log.success('Successfully debugged pixel in {} cycles, skipping result check due to instancing'.format(cycles)) self.controller.FreeTrace(trace) + elif pipe.GetColorBlends()[output_index].writeMask == 0: + rdtest.log.success('Successfully debugged pixel in {} cycles, skipping result check due to write mask'.format(cycles)) + self.controller.FreeTrace(trace) else: - output_index = [o.resourceId for o in self.controller.GetPipelineState().GetOutputTargets()].index(target) rdtest.log.print("At event {} the target is index {}".format(lastmod.eventId, output_index)) output = \