diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 1cd825574..b15632d37 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -2369,11 +2369,14 @@ namespace dxvk { D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { - if (unlikely(!PrimitiveCount)) - return S_OK; - D3D9DeviceLock lock = LockDevice(); + if (unlikely(m_state.vertexDecl == nullptr)) + return D3DERR_INVALIDCALL; + + if (unlikely(!PrimitiveCount)) + return S_OK; + PrepareDraw(PrimitiveType); EmitCs([this, @@ -2402,11 +2405,14 @@ namespace dxvk { UINT NumVertices, UINT StartIndex, UINT PrimitiveCount) { - if (unlikely(!PrimitiveCount)) - return S_OK; - D3D9DeviceLock lock = LockDevice(); + if (unlikely(m_state.vertexDecl == nullptr)) + return D3DERR_INVALIDCALL; + + if (unlikely(!PrimitiveCount)) + return S_OK; + PrepareDraw(PrimitiveType); EmitCs([this, @@ -2435,11 +2441,14 @@ namespace dxvk { UINT PrimitiveCount, const void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { - if (unlikely(!PrimitiveCount)) - return S_OK; - D3D9DeviceLock lock = LockDevice(); + if (unlikely(m_state.vertexDecl == nullptr)) + return D3DERR_INVALIDCALL; + + if (unlikely(!PrimitiveCount)) + return S_OK; + PrepareDraw(PrimitiveType); auto drawInfo = GenerateDrawInfo(PrimitiveType, PrimitiveCount, 0); @@ -2485,11 +2494,14 @@ namespace dxvk { D3DFORMAT IndexDataFormat, const void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { - if (unlikely(!PrimitiveCount)) - return S_OK; - D3D9DeviceLock lock = LockDevice(); + if (unlikely(m_state.vertexDecl == nullptr)) + return D3DERR_INVALIDCALL; + + if (unlikely(!PrimitiveCount)) + return S_OK; + PrepareDraw(PrimitiveType); auto drawInfo = GenerateDrawInfo(PrimitiveType, PrimitiveCount, 0);