From f0c1e89443436a55f43b907a570a9c6bb8c55566 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 1 May 2021 10:00:53 +0100 Subject: [PATCH] [d3d9] Handle zero-sized draws These return S_OK, because ofc they do. --- src/d3d9/d3d9_device.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index f7723723..242e6f3f 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -2333,6 +2333,9 @@ namespace dxvk { D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { + if (unlikely(!PrimitiveCount)) + return S_OK; + D3D9DeviceLock lock = LockDevice(); PrepareDraw(PrimitiveType); @@ -2363,6 +2366,9 @@ namespace dxvk { UINT NumVertices, UINT StartIndex, UINT PrimitiveCount) { + if (unlikely(!PrimitiveCount)) + return S_OK; + D3D9DeviceLock lock = LockDevice(); PrepareDraw(PrimitiveType); @@ -2393,6 +2399,9 @@ namespace dxvk { UINT PrimitiveCount, const void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { + if (unlikely(!PrimitiveCount)) + return S_OK; + D3D9DeviceLock lock = LockDevice(); PrepareDraw(PrimitiveType); @@ -2440,6 +2449,9 @@ namespace dxvk { D3DFORMAT IndexDataFormat, const void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { + if (unlikely(!PrimitiveCount)) + return S_OK; + D3D9DeviceLock lock = LockDevice(); PrepareDraw(PrimitiveType);