1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Fixed index buffer overflow

Fixes a crash in Laghaim.
See issue #98.
This commit is contained in:
narzoul 2021-05-08 10:31:18 +02:00
parent af6cafd65e
commit dfbc27247a

View File

@ -7,7 +7,7 @@
namespace
{
const UINT INDEX_BUFFER_SIZE = 256 * 1024;
const UINT INDEX_BUFFER_SIZE = D3DMAXNUMPRIMITIVES * 3 * sizeof(UINT16);
const UINT VERTEX_BUFFER_SIZE = 1024 * 1024;
UINT getVertexCount(D3DPRIMITIVETYPE primitiveType, UINT primitiveCount)
@ -203,7 +203,7 @@ namespace D3dDdi
bool DrawPrimitive::appendPrimitives(D3DPRIMITIVETYPE primitiveType, INT baseVertexIndex, UINT primitiveCount,
const UINT16* indices, UINT minIndex, UINT maxIndex)
{
if ((m_batched.primitiveCount + primitiveCount) * 3 > D3DMAXNUMVERTICES)
if (m_batched.primitiveCount + primitiveCount > D3DMAXNUMPRIMITIVES)
{
return false;
}