mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-19 21:16:34 +00:00
Don't crash if vertex buffer stride is 0 when picking vertices
This commit is contained in:
@@ -1385,8 +1385,8 @@ static void ConfigureMeshColumns(ICaptureContext &ctx, PopulateBufferData *bufda
|
||||
BufferDescription *buf = ctx.GetBuffer(vb.resourceId);
|
||||
if(buf)
|
||||
{
|
||||
numRowsUpperBound =
|
||||
qMax(numRowsUpperBound, uint32_t(buf->length - vb.byteOffset) / vb.byteStride);
|
||||
numRowsUpperBound = qMax(numRowsUpperBound,
|
||||
uint32_t(buf->length - vb.byteOffset) / qMax(1U, vb.byteStride));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2941,7 +2941,7 @@ uint32_t D3D11Replay::PickVertex(uint32_t eventId, int32_t width, int32_t height
|
||||
GetDebugManager()->GetBufferData(vb, cfg.position.vertexByteOffset, 0, oldData);
|
||||
|
||||
// clamp maxIndex to upper bound in case we got invalid indices or primitive restart indices
|
||||
maxIndex = RDCMIN(maxIndex, uint32_t(oldData.size() / cfg.position.vertexByteStride));
|
||||
maxIndex = RDCMIN(maxIndex, uint32_t(oldData.size() / RDCMAX(1U, cfg.position.vertexByteStride)));
|
||||
|
||||
if(m_VertexPick.PickVBBuf == NULL || m_VertexPick.PickVBSize < (maxIndex + 1) * sizeof(Vec4f))
|
||||
{
|
||||
|
||||
@@ -2075,7 +2075,7 @@ uint32_t D3D12Replay::PickVertex(uint32_t eventId, int32_t width, int32_t height
|
||||
GetDebugManager()->GetBufferData(vb, cfg.position.vertexByteOffset, 0, oldData);
|
||||
|
||||
// clamp maxIndex to upper bound in case we got invalid indices or primitive restart indices
|
||||
maxIndex = RDCMIN(maxIndex, uint32_t(oldData.size() / cfg.position.vertexByteStride));
|
||||
maxIndex = RDCMIN(maxIndex, uint32_t(oldData.size() / RDCMAX(1U, cfg.position.vertexByteStride)));
|
||||
|
||||
if(vb)
|
||||
{
|
||||
|
||||
@@ -2128,7 +2128,7 @@ uint32_t GLReplay::PickVertex(uint32_t eventId, int32_t width, int32_t height,
|
||||
GetBufferData(cfg.position.vertexResourceId, cfg.position.vertexByteOffset, 0, oldData);
|
||||
|
||||
// clamp maxIndex to upper bound in case we got invalid indices or primitive restart indices
|
||||
maxIndex = RDCMIN(maxIndex, uint32_t(oldData.size() / cfg.position.vertexByteStride));
|
||||
maxIndex = RDCMIN(maxIndex, uint32_t(oldData.size() / RDCMAX(1U, cfg.position.vertexByteStride)));
|
||||
|
||||
if(DebugData.pickVBBuf == 0 || DebugData.pickVBSize < (maxIndex + 1) * sizeof(Vec4f))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user