1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-04 07:24:15 +01:00

[d3d9] Compress hazard state going into CS

This can potentially happen per-draw so make it as small as possible.
This commit is contained in:
Joshua Ashton 2023-06-22 14:59:37 +01:00 committed by Joshie
parent 3625c5d481
commit c768196251

View File

@ -5592,18 +5592,24 @@ namespace dxvk {
void D3D9DeviceEx::MarkRenderHazards() {
struct {
uint8_t RT : 1;
uint8_t DS : 1;
} hazardState;
hazardState.RT = m_activeHazardsRT != 0;
hazardState.DS = m_activeHazardsDS != 0;
EmitCs([
cActiveHazardsRT = m_activeHazardsRT,
cActiveHazardsDS = m_activeHazardsDS
cHazardState = hazardState
](DxvkContext* ctx) {
VkPipelineStageFlags srcStages = 0;
VkAccessFlags srcAccess = 0;
if (cActiveHazardsRT != 0) {
if (cHazardState.RT != 0) {
srcStages |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
srcAccess |= VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
}
if (cActiveHazardsDS != 0) {
if (cHazardState.DS != 0) {
srcStages |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
srcAccess |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
}