mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-24 15:36:33 +00:00
Fix DXIL patching for quad overdraw
* Also tweak the test output to be more organised
This commit is contained in:
@@ -459,22 +459,44 @@ void D3D12Replay::PatchQuadWritePS(D3D12_EXPANDED_PIPELINE_STATE_STREAM_DESC &pi
|
||||
|
||||
RDCASSERT(quadPSsigs->children.size() > 0);
|
||||
|
||||
// just repoint input signature list to rast out sig
|
||||
quadPSsigs->children[0] = (Metadata *)rastOutSig;
|
||||
// create new input signature list
|
||||
Metadata *newInSig = quadPSsigs->children[0] = editor.CreateMetadata();
|
||||
|
||||
uint32_t posID = ~0U;
|
||||
|
||||
// process signature to get string table & index table for semantics
|
||||
for(size_t i = 0; i < rastOutSig->children.size(); i++)
|
||||
{
|
||||
const Metadata *sigEl = rastOutSig->children[i];
|
||||
const Metadata *inSigEl = rastOutSig->children[i];
|
||||
|
||||
Metadata *outSigEl = editor.CreateMetadata();
|
||||
newInSig->children.push_back(outSigEl);
|
||||
|
||||
outSigEl->children = {
|
||||
editor.CreateConstantMetadata(cast<Constant>(inSigEl->children[0]->value)->getU32()),
|
||||
editor.CreateConstantMetadata(inSigEl->children[1]->str),
|
||||
editor.CreateConstantMetadata(
|
||||
(uint8_t)cast<Constant>(inSigEl->children[2]->value)->getU32()),
|
||||
editor.CreateConstantMetadata(
|
||||
(uint8_t)cast<Constant>(inSigEl->children[3]->value)->getU32()),
|
||||
editor.CreateMetadata(),
|
||||
editor.CreateConstantMetadata(
|
||||
(uint8_t)cast<Constant>(inSigEl->children[5]->value)->getU32()),
|
||||
editor.CreateConstantMetadata(cast<Constant>(inSigEl->children[6]->value)->getU32()),
|
||||
editor.CreateConstantMetadata(
|
||||
(uint8_t)cast<Constant>(inSigEl->children[7]->value)->getU32()),
|
||||
editor.CreateConstantMetadata(cast<Constant>(inSigEl->children[8]->value)->getU32()),
|
||||
editor.CreateConstantMetadata(
|
||||
(uint8_t)cast<Constant>(inSigEl->children[9]->value)->getU32()),
|
||||
editor.CreateMetadata(),
|
||||
};
|
||||
|
||||
// only append non-system values to the string table
|
||||
uint32_t systemValue = cast<Constant>(sigEl->children[3]->value)->getU32();
|
||||
uint32_t systemValue = cast<Constant>(inSigEl->children[3]->value)->getU32();
|
||||
if(systemValue == 0)
|
||||
{
|
||||
stringTableOffsets.push_back((uint32_t)stringTable.size());
|
||||
stringTable.append(sigEl->children[1]->str);
|
||||
stringTable.append(inSigEl->children[1]->str);
|
||||
stringTable.push_back('\0');
|
||||
}
|
||||
else
|
||||
@@ -483,17 +505,28 @@ void D3D12Replay::PatchQuadWritePS(D3D12_EXPANDED_PIPELINE_STATE_STREAM_DESC &pi
|
||||
|
||||
// SV_Position is 3
|
||||
if(systemValue == 3)
|
||||
posID = cast<Constant>(sigEl->children[0]->value)->getU32();
|
||||
posID = cast<Constant>(inSigEl->children[0]->value)->getU32();
|
||||
}
|
||||
|
||||
rdcarray<uint32_t> semIndexValues;
|
||||
|
||||
// semantic indices
|
||||
if(const Metadata *semIdxs = sigEl->children[4])
|
||||
if(const Metadata *semIdxs = inSigEl->children[4])
|
||||
{
|
||||
// the semantic index node is a list of constants
|
||||
for(size_t sidx = 0; sidx < semIdxs->children.size(); sidx++)
|
||||
{
|
||||
semIndexValues.push_back(cast<Constant>(semIdxs->children[sidx]->value)->getU32());
|
||||
outSigEl->children[4]->children.push_back(
|
||||
editor.CreateConstantMetadata(semIndexValues.back()));
|
||||
}
|
||||
}
|
||||
|
||||
if(const Metadata *props = inSigEl->children[10])
|
||||
{
|
||||
for(size_t sidx = 0; sidx < props->children.size(); sidx++)
|
||||
outSigEl->children[10]->children.push_back(editor.CreateConstantMetadata(
|
||||
cast<Constant>(props->children[sidx]->value)->getU32()));
|
||||
}
|
||||
|
||||
size_t tableOffset = ~0U;
|
||||
|
||||
@@ -7,6 +7,9 @@ class Overlay_Test(rdtest.TestCase):
|
||||
internal = True
|
||||
|
||||
def check_capture(self, base_event=0):
|
||||
if base_event != 0:
|
||||
rdtest.log.print("Checking overlays from base event {}".format(base_event))
|
||||
|
||||
out: rd.ReplayOutput = self.controller.CreateOutput(rd.CreateHeadlessWindowingData(100, 100), rd.ReplayOutputType.Texture)
|
||||
|
||||
self.check(out is not None)
|
||||
@@ -17,23 +20,25 @@ class Overlay_Test(rdtest.TestCase):
|
||||
|
||||
# Check the actual output is as expected first.
|
||||
for fmt in fmts:
|
||||
marker_name = "Normal Test " + fmt;
|
||||
marker_name = "Normal Test " + fmt
|
||||
test_marker: rd.ActionDescription = self.find_action(marker_name, base_event)
|
||||
if test_marker == None:
|
||||
rdtest.log.print("Skipping format {} marker {} not found".format(fmt, marker_name))
|
||||
continue;
|
||||
rdtest.log.print("Checking format {}".format(fmt))
|
||||
continue
|
||||
rdtest.log.begin_section("Checking format {}".format(fmt))
|
||||
has_stencil = fmt.endswith("_S8")
|
||||
for is_msaa in [False, True]:
|
||||
if is_msaa:
|
||||
marker_name = "MSAA Test ";
|
||||
marker_name = "MSAA Test "
|
||||
else:
|
||||
marker_name = "Normal Test ";
|
||||
marker_name += fmt;
|
||||
marker_name = "Normal Test "
|
||||
marker_name += fmt
|
||||
test_marker: rd.ActionDescription = self.find_action(marker_name, base_event)
|
||||
|
||||
self.controller.SetFrameEvent(test_marker.next.eventId, True)
|
||||
|
||||
rdtest.log.print("Checking overlays at event {}: {}".format(test_marker.next.eventId, marker_name))
|
||||
|
||||
pipe: rd.PipeState = self.controller.GetPipelineState()
|
||||
|
||||
col_tex: rd.ResourceId = pipe.GetOutputTargets()[0].resourceId
|
||||
@@ -688,6 +693,10 @@ class Overlay_Test(rdtest.TestCase):
|
||||
|
||||
rdtest.log.success("All overlays as expected for main action Format {}".format(fmt))
|
||||
|
||||
rdtest.log.end_section("Checking format {}".format(fmt))
|
||||
|
||||
rdtest.log.begin_section("Checking mip/slice rendering")
|
||||
|
||||
# Now test overlays on a render-to-slice/mip case
|
||||
for mip in [2, 3]:
|
||||
sub_marker: rd.ActionDescription = self.find_action("Subresources mip {}".format(mip), base_event)
|
||||
@@ -805,4 +814,6 @@ class Overlay_Test(rdtest.TestCase):
|
||||
|
||||
rdtest.log.success("Picked values are correct for mip {} overlay {}".format(sub.mip, str(overlay)))
|
||||
|
||||
rdtest.log.end_section("Checking mip/slice rendering")
|
||||
|
||||
out.Shutdown()
|
||||
|
||||
Reference in New Issue
Block a user