diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 4a4d31cad6e..7634848a723 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -2467,15 +2467,16 @@ namespace dxvk { EmitCs([this, cPrimType = PrimitiveType, cPrimCount = PrimitiveCount, - cStartVertex = StartVertex, - cInstanceCount = GetInstanceCount() + cStartVertex = StartVertex ](DxvkContext* ctx) { - auto drawInfo = GenerateDrawInfo(cPrimType, cPrimCount, cInstanceCount); + uint32_t vertexCount = GetVertexCount(cPrimType, cPrimCount); ApplyPrimitiveType(ctx, cPrimType); + // Tests on Windows show that D3D9 does not do non-indexed instanced draws. + ctx->draw( - drawInfo.vertexCount, drawInfo.instanceCount, + vertexCount, 1, cStartVertex, 0); }); @@ -2547,17 +2548,16 @@ namespace dxvk { EmitCs([this, cBufferSlice = std::move(upSlice.slice), cPrimType = PrimitiveType, - cPrimCount = PrimitiveCount, - cInstanceCount = GetInstanceCount(), - cStride = VertexStreamZeroStride + cStride = VertexStreamZeroStride, + cVertexCount = vertexCount ](DxvkContext* ctx) mutable { - auto drawInfo = GenerateDrawInfo(cPrimType, cPrimCount, cInstanceCount); - ApplyPrimitiveType(ctx, cPrimType); + // Tests on Windows show that D3D9 does not do non-indexed instanced draws. + ctx->bindVertexBuffer(0, std::move(cBufferSlice), cStride); ctx->draw( - drawInfo.vertexCount, drawInfo.instanceCount, + cVertexCount, 1, 0, 0); ctx->bindVertexBuffer(0, DxvkBufferSlice(), 0); }); @@ -2699,8 +2699,7 @@ namespace dxvk { cVertexCount = VertexCount, cStartIndex = SrcStartIndex, cInstanceCount = GetInstanceCount(), - cBufferSlice = slice, - cIndexed = m_state.indices != nullptr + cBufferSlice = slice ](DxvkContext* ctx) mutable { Rc shader = m_swvpEmulator.GetShaderModule(this, cDecl);