From 6ace4822663c5be9eeb5f8e7486b4479d0b9e88c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 30 May 2019 13:31:01 +0200 Subject: [PATCH] - fixed fillSimplePoly for indexed data. On OpenGL this merely caused some visual glitches on the cheat automap - but the bad data in the buffer can make Vulkan abort entirely. --- src/rendering/2d/v_2ddrawer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rendering/2d/v_2ddrawer.cpp b/src/rendering/2d/v_2ddrawer.cpp index 162d72c38..1744f12a0 100644 --- a/src/rendering/2d/v_2ddrawer.cpp +++ b/src/rendering/2d/v_2ddrawer.cpp @@ -485,10 +485,10 @@ void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints, mVertices[poly.mVertIndex+i].Set(points[i].X, points[i].Y, 0, u*uscale, v*vscale, color0); } poly.mIndexIndex = mIndices.Size(); - poly.mIndexCount += (npoints - 2) * 3; if (indices == nullptr || indexcount == 0) { + poly.mIndexCount += (npoints - 2) * 3; for (int i = 2; i < npoints; ++i) { AddIndices(poly.mVertIndex, 3, 0, i - 1, i); @@ -496,10 +496,11 @@ void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints, } else { + poly.mIndexCount += (int)indexcount; int addr = mIndices.Reserve(indexcount); for (size_t i = 0; i < indexcount; i++) { - mIndices[addr + i] = addr + indices[i]; + mIndices[addr + i] = poly.mVertIndex + indices[i]; } }