[d3d11] Skip empty draws

Watch Dogs 2 likes to do this with graphics UAVs bound, which
introduces quite a bit of unnecessary GPU synchronization.
This commit is contained in:
Philip Rebohle 2025-03-01 11:26:43 +01:00
parent 11dc0e7ce8
commit b35e69b467

View file

@ -1037,6 +1037,9 @@ namespace dxvk {
UINT StartVertexLocation) {
D3D10DeviceLock lock = LockContext();
if (unlikely(!VertexCount))
return;
VkDrawIndirectCommand draw = { };
draw.vertexCount = VertexCount;
draw.instanceCount = 1u;
@ -1054,6 +1057,9 @@ namespace dxvk {
INT BaseVertexLocation) {
D3D10DeviceLock lock = LockContext();
if (unlikely(!IndexCount))
return;
VkDrawIndexedIndirectCommand draw = { };
draw.indexCount = IndexCount;
draw.instanceCount = 1u;
@ -1073,6 +1079,9 @@ namespace dxvk {
UINT StartInstanceLocation) {
D3D10DeviceLock lock = LockContext();
if (unlikely(!VertexCountPerInstance || !InstanceCount))
return;
VkDrawIndirectCommand draw = { };
draw.vertexCount = VertexCountPerInstance;
draw.instanceCount = InstanceCount;
@ -1092,6 +1101,9 @@ namespace dxvk {
UINT StartInstanceLocation) {
D3D10DeviceLock lock = LockContext();
if (unlikely(!IndexCountPerInstance || !InstanceCount))
return;
VkDrawIndexedIndirectCommand draw = { };
draw.indexCount = IndexCountPerInstance;
draw.instanceCount = InstanceCount;
@ -1186,6 +1198,9 @@ namespace dxvk {
UINT ThreadGroupCountZ) {
D3D10DeviceLock lock = LockContext();
if (unlikely(!ThreadGroupCountX || !ThreadGroupCountY || !ThreadGroupCountZ))
return;
if (unlikely(HasDirtyComputeBindings()))
ApplyDirtyComputeBindings();