Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dual source pixel history vulkan tests #3012

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions renderdoc/api/replay/data_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2100,12 +2100,13 @@ struct PixelModification
{
return eventId == o.eventId && directShaderWrite == o.directShaderWrite &&
unboundPS == o.unboundPS && fragIndex == o.fragIndex && primitiveID == o.primitiveID &&
preMod == o.preMod && shaderOut == o.shaderOut && postMod == o.postMod &&
sampleMasked == o.sampleMasked && backfaceCulled == o.backfaceCulled &&
depthClipped == o.depthClipped && depthBoundsFailed == o.depthBoundsFailed &&
viewClipped == o.viewClipped && scissorClipped == o.scissorClipped &&
shaderDiscarded == o.shaderDiscarded && depthTestFailed == o.depthTestFailed &&
stencilTestFailed == o.stencilTestFailed;
preMod == o.preMod && shaderOut == o.shaderOut &&
shaderOutDualSrc == o.shaderOutDualSrc && blendSrc == o.blendSrc &&
blendDst == o.blendDst && postMod == o.postMod && sampleMasked == o.sampleMasked &&
backfaceCulled == o.backfaceCulled && depthClipped == o.depthClipped &&
depthBoundsFailed == o.depthBoundsFailed && viewClipped == o.viewClipped &&
scissorClipped == o.scissorClipped && shaderDiscarded == o.shaderDiscarded &&
depthTestFailed == o.depthTestFailed && stencilTestFailed == o.stencilTestFailed;
}
bool operator<(const PixelModification &o) const
{
Expand All @@ -2123,6 +2124,12 @@ struct PixelModification
return preMod < o.preMod;
if(!(shaderOut == o.shaderOut))
return shaderOut < o.shaderOut;
if(!(shaderOutDualSrc == o.shaderOutDualSrc))
return shaderOutDualSrc < o.shaderOutDualSrc;
if(!(blendSrc == o.blendSrc))
return blendSrc < o.blendSrc;
if(!(blendDst == o.blendDst))
return blendDst < o.blendDst;
if(!(postMod == o.postMod))
return postMod < o.postMod;
if(!(sampleMasked == o.sampleMasked))
Expand Down Expand Up @@ -2175,6 +2182,21 @@ pixel.
:type: ModificationValue
)");
ModificationValue shaderOut;
DOCUMENT(R"(The value that this fragment wrote from the pixel shader to the second output.

:type: ModificationValue
)");
ModificationValue shaderOutDualSrc;
DOCUMENT(R"(The source component in the blend equation for this fragment.

:type: ModificationValue
)");
ModificationValue blendSrc;
DOCUMENT(R"(The destination component in the blend equation for this fragment.

:type: ModificationValue
)");
ModificationValue blendDst;
DOCUMENT(R"(The value of the texture after this fragment ran.

:type: ModificationValue
Expand Down
6 changes: 6 additions & 0 deletions renderdoc/driver/d3d11/d3d11_pixelhistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,9 @@ rdcarray<PixelModification> D3D11Replay::PixelHistory(rdcarray<EventUsage> event
// data[3].x (depth) unused
// fragments writing to the pixel in this event with original shader
mod.shaderOut.col.intValue[1] = int32_t(data[3].y);
mod.shaderOutDualSrc.SetInvalid();
mod.blendSrc.SetInvalid();
mod.blendDst.SetInvalid();
}
}

Expand Down Expand Up @@ -2316,6 +2319,9 @@ rdcarray<PixelModification> D3D11Replay::PixelHistory(rdcarray<EventUsage> event
byte *data = shadoutStoreData + sizeof(Vec4f) * pixstoreStride * offsettedSlot;

memcpy(&history[h].shaderOut.col.uintValue[0], data, 4 * sizeof(float));
history[h].shaderOutDualSrc.SetInvalid();
history[h].blendSrc.SetInvalid();
history[h].blendDst.SetInvalid();

// primitive ID is in the next slot after that
memcpy(&history[h].primitiveID, data + sizeof(Vec4f), sizeof(uint32_t));
Expand Down
6 changes: 6 additions & 0 deletions renderdoc/driver/gl/gl_pixelhistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,9 @@ std::map<uint32_t, uint32_t> QueryNumFragmentsByEvent(
numFragments = history[i].shaderOut.stencil;
history[i].shaderOut.stencil = history[i].postMod.stencil;
}
history[i].shaderOutDualSrc.SetInvalid();
history[i].blendSrc.SetInvalid();
history[i].blendDst.SetInvalid();

eventFragments.emplace(modEvents[i].eventId, numFragments);

Expand Down Expand Up @@ -1587,6 +1590,9 @@ void QueryShaderOutPerFragment(WrappedOpenGL *driver, GLReplay *replay,
int(historyIndex - history.begin()));
historyIndex->shaderOut.stencil = oldStencil;
}
historyIndex->shaderOutDualSrc.SetInvalid();
historyIndex->blendSrc.SetInvalid();
historyIndex->blendDst.SetInvalid();
historyIndex++;
}

Expand Down
11 changes: 11 additions & 0 deletions renderdoc/driver/vulkan/vk_pixelhistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3972,6 +3972,9 @@ rdcarray<PixelModification> VulkanReplay::PixelHistory(rdcarray<EventUsage> even
mod.preMod.SetInvalid();
mod.postMod.SetInvalid();
mod.shaderOut.SetInvalid();
mod.shaderOutDualSrc.SetInvalid();
mod.blendSrc.SetInvalid();
mod.blendDst.SetInvalid();
h++;
continue;
}
Expand Down Expand Up @@ -3999,6 +4002,9 @@ rdcarray<PixelModification> VulkanReplay::PixelHistory(rdcarray<EventUsage> even
int32_t fragsClipped = int32_t(ei.dsWithShaderDiscard[4]);
mod.shaderOut.col.intValue[0] = frags;
mod.shaderOut.col.intValue[1] = fragsClipped;
mod.shaderOutDualSrc.SetInvalid();
mod.blendSrc.SetInvalid();
mod.blendDst.SetInvalid();
bool someFragsClipped = (fragsClipped < frags);
mod.primitiveID = someFragsClipped;
// Draws in secondary command buffers will fail this check,
Expand Down Expand Up @@ -4145,6 +4151,11 @@ rdcarray<PixelModification> VulkanReplay::PixelHistory(rdcarray<EventUsage> even
{
history[h].preMod = history[h - 1].postMod;
}

history[h].shaderOutDualSrc.SetInvalid();

history[h].blendSrc.SetInvalid();
history[h].blendDst.SetInvalid();
}

// check the depth value between premod/shaderout against the known test if we have valid
Expand Down
5 changes: 4 additions & 1 deletion renderdoc/replay/renderdoc_serialise.inl
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,9 @@ void DoSerialise(SerialiserType &ser, PixelModification &el)

SERIALISE_MEMBER(preMod);
SERIALISE_MEMBER(shaderOut);
SERIALISE_MEMBER(shaderOutDualSrc);
SERIALISE_MEMBER(blendSrc);
SERIALISE_MEMBER(blendDst);
SERIALISE_MEMBER(postMod);

SERIALISE_MEMBER(sampleMasked);
Expand All @@ -906,7 +909,7 @@ void DoSerialise(SerialiserType &ser, PixelModification &el)
SERIALISE_MEMBER(stencilTestFailed);
SERIALISE_MEMBER(predicationSkipped);

SIZE_CHECK(100);
SIZE_CHECK(172);
}

template <typename SerialiserType>
Expand Down
2 changes: 2 additions & 0 deletions util/test/demos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ set(VULKAN_SRC
vk/vk_test.cpp
vk/vk_test.h
vk/vk_adv_cbuffer_zoo.cpp
vk/vk_blend.cpp
vk/vk_buffer_truncation.cpp
vk/vk_cbuffer_zoo.cpp
vk/vk_compute_only.cpp
Expand All @@ -98,6 +99,7 @@ set(VULKAN_SRC
vk/vk_discard_rects.cpp
vk/vk_discard_zoo.cpp
vk/vk_draw_zoo.cpp
vk/vk_dual_source.cpp
vk/vk_dynamic_rendering.cpp
vk/vk_empty_capture.cpp
vk/vk_ext_buffer_address.cpp
Expand Down
2 changes: 2 additions & 0 deletions util/test/demos/demos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,14 @@
<ClCompile Include="main.cpp" />
<ClCompile Include="test_common.cpp" />
<ClCompile Include="texture_zoo.cpp" />
<ClCompile Include="vk\vk_blend.cpp" />
<ClCompile Include="vk\vk_compute_only.cpp" />
<ClCompile Include="vk\vk_custom_border_color.cpp" />
<ClCompile Include="vk\vk_dedicated_allocation.cpp" />
<ClCompile Include="vk\vk_descriptor_reuse.cpp" />
<ClCompile Include="vk\vk_descriptor_variable_count.cpp" />
<ClCompile Include="vk\vk_discard_zoo.cpp" />
<ClCompile Include="vk\vk_dual_source.cpp" />
<ClCompile Include="vk\vk_dynamic_rendering.cpp" />
<ClCompile Include="vk\vk_empty_capture.cpp" />
<ClCompile Include="vk\vk_extended_dyn_state.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions util/test/demos/demos.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,12 @@
<ClCompile Include="d3d12\d3d12_template.cpp">
<Filter>D3D12\demos</Filter>
</ClCompile>
<ClCompile Include="vk\vk_dual_source.cpp">
<Filter>Vulkan\demos</Filter>
</ClCompile>
<ClCompile Include="vk\vk_blend.cpp">
<Filter>Vulkan\demos</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="D3D11">
Expand Down
Loading