From 96f5641a7ea1ac661bfb26f166a3725cb21ce28d Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 30 Jun 2021 03:01:34 +0200 Subject: [PATCH] [d3d9] Ensure that the bound UP vertex buffer region is large enough If the buffer size is less than (vertexCount * stride), the last vertex may be considered out-of-bounds, even if all attributes are included in the vertex. Fixes #2131. --- src/d3d9/d3d9_device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d3d9/d3d9_device.h b/src/d3d9/d3d9_device.h index 0a318a2a0..719721134 100644 --- a/src/d3d9/d3d9_device.h +++ b/src/d3d9/d3d9_device.h @@ -1090,7 +1090,7 @@ namespace dxvk { } inline uint32_t GetUPBufferSize(uint32_t vertexCount, uint32_t stride) { - return (vertexCount - 1) * stride + m_state.vertexDecl->GetSize(); + return (vertexCount - 1) * stride + std::max(m_state.vertexDecl->GetSize(), stride); } inline void FillUPVertexBuffer(void* buffer, const void* userData, uint32_t dataSize, uint32_t bufferSize) {