mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-09 03:20:30 +00:00
Fix GLES display of wireframe overlay for non-indexed draws
This commit is contained in:
@@ -373,26 +373,48 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, CompType typeHint, DebugOve
|
||||
|
||||
const DrawcallDescription *draw = m_pDriver->GetDrawcall(eventId);
|
||||
|
||||
// readback the index buffer data
|
||||
std::vector<byte> idxs;
|
||||
uint32_t offset = draw->indexOffset * draw->indexByteWidth;
|
||||
uint32_t length = 1;
|
||||
drv.glGetNamedBufferParameterivEXT(idxbuf, eGL_BUFFER_SIZE, (GLint *)&length);
|
||||
|
||||
idxs.resize(length);
|
||||
drv.glGetBufferSubData(eGL_ELEMENT_ARRAY_BUFFER, offset,
|
||||
RDCMIN(GLsizeiptr(length - offset),
|
||||
GLsizeiptr(draw->numIndices) * GLsizeiptr(draw->indexByteWidth)),
|
||||
&idxs[0]);
|
||||
|
||||
// unbind the real index buffer
|
||||
drv.glBindBuffer(eGL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
std::vector<uint32_t> patchedIndices;
|
||||
PatchLineStripIndexBuffer(
|
||||
draw, draw->indexByteWidth == 1 ? (uint8_t *)idxs.data() : (uint8_t *)NULL,
|
||||
draw->indexByteWidth == 2 ? (uint16_t *)idxs.data() : (uint16_t *)NULL,
|
||||
draw->indexByteWidth == 4 ? (uint32_t *)idxs.data() : (uint32_t *)NULL, patchedIndices);
|
||||
|
||||
// readback the index buffer data
|
||||
if(idxbuf)
|
||||
{
|
||||
std::vector<byte> idxs;
|
||||
uint32_t offset = draw->indexOffset * draw->indexByteWidth;
|
||||
uint32_t length = 1;
|
||||
drv.glGetNamedBufferParameterivEXT(idxbuf, eGL_BUFFER_SIZE, (GLint *)&length);
|
||||
|
||||
idxs.resize(length);
|
||||
drv.glGetBufferSubData(
|
||||
eGL_ELEMENT_ARRAY_BUFFER, offset,
|
||||
RDCMIN(GLsizeiptr(length - offset),
|
||||
GLsizeiptr(draw->numIndices) * GLsizeiptr(draw->indexByteWidth)),
|
||||
&idxs[0]);
|
||||
|
||||
// unbind the real index buffer
|
||||
drv.glBindBuffer(eGL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
uint32_t expectedSize = draw->numIndices * draw->indexByteWidth;
|
||||
|
||||
if(idxs.size() < expectedSize)
|
||||
{
|
||||
RDCERR("Index buffer is as large as expected");
|
||||
idxs.resize(expectedSize);
|
||||
}
|
||||
|
||||
PatchLineStripIndexBuffer(
|
||||
draw, draw->indexByteWidth == 1 ? (uint8_t *)idxs.data() : (uint8_t *)NULL,
|
||||
draw->indexByteWidth == 2 ? (uint16_t *)idxs.data() : (uint16_t *)NULL,
|
||||
draw->indexByteWidth == 4 ? (uint32_t *)idxs.data() : (uint32_t *)NULL, patchedIndices);
|
||||
}
|
||||
else
|
||||
{
|
||||
// generate 'index' list
|
||||
std::vector<uint32_t> idxs;
|
||||
idxs.resize(draw->numIndices);
|
||||
for(uint32_t i = 0; i < draw->numIndices; i++)
|
||||
idxs[i] = i;
|
||||
PatchLineStripIndexBuffer(draw, NULL, NULL, idxs.data(), patchedIndices);
|
||||
}
|
||||
|
||||
GLboolean primRestart = drv.glIsEnabled(eGL_PRIMITIVE_RESTART_FIXED_INDEX);
|
||||
drv.glEnable(eGL_PRIMITIVE_RESTART_FIXED_INDEX);
|
||||
|
||||
Reference in New Issue
Block a user