Fix crash on 32-bit index buffers that are less than 4 bytes in size

This commit is contained in:
baldurk
2021-04-29 10:25:18 +01:00
parent f9054ffdf4
commit 93f0997c12
+2 -1
View File
@@ -1693,7 +1693,8 @@ static void RT_FetchMeshData(IReplayController *r, ICaptureContext &ctx, Populat
if(draw && ib.byteStride != 0 && !idata.isEmpty())
data->vsinConfig.indices->storage.resize(
sizeof(uint32_t) * qMin(numIndices, ((uint32_t)idata.size() / ib.byteStride)));
sizeof(uint32_t) *
qMin(numIndices, (((uint32_t)idata.size() + ib.byteStride - 1) / ib.byteStride)));
else if(draw && (draw->flags & DrawFlags::Indexed))
data->vsinConfig.indices->storage.resize(sizeof(uint32_t));