mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-15 02:11:22 +00:00
Make code more robust if indexed draw has unbound ibuffer. Closes #1085
This commit is contained in:
3 files changed
+10
-7
No files matched your search
@@ -2349,7 +2349,7 @@ void BufferViewer::configureMeshColumns()
|
||||
|
||||
// drawing more than this many indices will read off the end of the index buffer - which while
|
||||
// technically not invalid is certainly not intended, so serves as a good 'upper bound'
|
||||
numRowsUpperBound = bytesAvailable / draw->indexByteWidth;
|
||||
numRowsUpperBound = bytesAvailable / qMax(1U, draw->indexByteWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -371,8 +371,9 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
else // drawcall is indexed
|
||||
{
|
||||
bytebuf idxdata;
|
||||
GetBufferData(rs.ibuffer.buf, rs.ibuffer.offs + drawcall->indexOffset * rs.ibuffer.bytewidth,
|
||||
RDCMIN(drawcall->numIndices * rs.ibuffer.bytewidth, rs.ibuffer.size), idxdata);
|
||||
if(rs.ibuffer.buf != ResourceId())
|
||||
GetBufferData(rs.ibuffer.buf, rs.ibuffer.offs + drawcall->indexOffset * rs.ibuffer.bytewidth,
|
||||
RDCMIN(drawcall->numIndices * rs.ibuffer.bytewidth, rs.ibuffer.size), idxdata);
|
||||
|
||||
vector<uint32_t> indices;
|
||||
|
||||
@@ -381,7 +382,7 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
|
||||
// only read as many indices as were available in the buffer
|
||||
uint32_t numIndices =
|
||||
RDCMIN(uint32_t(idxdata.size() / rs.ibuffer.bytewidth), drawcall->numIndices);
|
||||
RDCMIN(uint32_t(idxdata.size() / RDCMAX(1, rs.ibuffer.bytewidth)), drawcall->numIndices);
|
||||
|
||||
uint32_t idxclamp = 0;
|
||||
if(drawcall->baseVertex < 0)
|
||||
|
||||
@@ -1197,8 +1197,9 @@ void VulkanReplay::InitPostVSBuffers(uint32_t eventId)
|
||||
uint32_t *idx32 = NULL;
|
||||
|
||||
// fetch ibuffer
|
||||
GetBufferData(state.ibuffer.buf, state.ibuffer.offs + drawcall->indexOffset * idxsize,
|
||||
uint64_t(drawcall->numIndices) * idxsize, idxdata);
|
||||
if(state.ibuffer.buf != ResourceId())
|
||||
GetBufferData(state.ibuffer.buf, state.ibuffer.offs + drawcall->indexOffset * idxsize,
|
||||
uint64_t(drawcall->numIndices) * idxsize, idxdata);
|
||||
|
||||
// figure out what the maximum index could be, so we can clamp our index buffer to something
|
||||
// sane
|
||||
@@ -1463,7 +1464,8 @@ void VulkanReplay::InitPostVSBuffers(uint32_t eventId)
|
||||
offs += drawcall->vertexOffset * vi->pVertexBindingDescriptions[vb].stride;
|
||||
}
|
||||
|
||||
GetBufferData(state.vbuffers[vb].buf, offs, len, origVBs[vb]);
|
||||
if(state.vbuffers[vb].buf != ResourceId())
|
||||
GetBufferData(state.vbuffers[vb].buf, offs, len, origVBs[vb]);
|
||||
}
|
||||
|
||||
for(uint32_t i = 0; i < vi->vertexAttributeDescriptionCount; i++)
|
||||
|
||||
Reference in new issue
Block a user