Merge pull request #94731 from RandomShaper/d3d12_no_null_barr_grps

D3D12: Avoid validation warnings about zero-sized barrier groups
This commit is contained in:
Rémi Verschelde 2024-08-16 10:34:42 +02:00
commit cddf321d30
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 25 additions and 10 deletions

View File

@ -2159,17 +2159,32 @@ void RenderingDeviceDriverD3D12::command_pipeline_barrier(CommandBufferID p_cmd_
} }
// Define the barrier groups and execute. // Define the barrier groups and execute.
D3D12_BARRIER_GROUP barrier_groups[3] = {}; D3D12_BARRIER_GROUP barrier_groups[3] = {};
barrier_groups[0].Type = D3D12_BARRIER_TYPE_GLOBAL; uint32_t barrier_groups_count = 0;
barrier_groups[1].Type = D3D12_BARRIER_TYPE_BUFFER;
barrier_groups[2].Type = D3D12_BARRIER_TYPE_TEXTURE; if (!global_barriers.is_empty()) {
barrier_groups[0].NumBarriers = global_barriers.size(); D3D12_BARRIER_GROUP &barrier_group = barrier_groups[barrier_groups_count++];
barrier_groups[1].NumBarriers = buffer_barriers.size(); barrier_group.Type = D3D12_BARRIER_TYPE_GLOBAL;
barrier_groups[2].NumBarriers = texture_barriers.size(); barrier_group.NumBarriers = global_barriers.size();
barrier_groups[0].pGlobalBarriers = global_barriers.ptr(); barrier_group.pGlobalBarriers = global_barriers.ptr();
barrier_groups[1].pBufferBarriers = buffer_barriers.ptr(); }
barrier_groups[2].pTextureBarriers = texture_barriers.ptr();
cmd_list_7->Barrier(ARRAY_SIZE(barrier_groups), barrier_groups); if (!buffer_barriers.is_empty()) {
D3D12_BARRIER_GROUP &barrier_group = barrier_groups[barrier_groups_count++];
barrier_group.Type = D3D12_BARRIER_TYPE_BUFFER;
barrier_group.NumBarriers = buffer_barriers.size();
barrier_group.pBufferBarriers = buffer_barriers.ptr();
}
if (!texture_barriers.is_empty()) {
D3D12_BARRIER_GROUP &barrier_group = barrier_groups[barrier_groups_count++];
barrier_group.Type = D3D12_BARRIER_TYPE_TEXTURE;
barrier_group.NumBarriers = texture_barriers.size();
barrier_group.pTextureBarriers = texture_barriers.ptr();
}
cmd_list_7->Barrier(barrier_groups_count, barrier_groups);
} }
/****************/ /****************/