mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-22 21:55:52 +00:00
Fix case of buffer maps in idle writing state - don't generate chunks
* If we generate an unmap chunk on a buffer while idle, it contains
'dangerous' data set at that point - it means that if we fetch the buffer
initial contents at frame start, these are actually saved *before* the
unmap chunk, in the initialisation/creation chunk which contains the
shadow copy. Then the unmap overwrites with older data.
* When mapping buffers, we should always either update the initial chunk or
mark the buffer dirty so the initial chunk is refreshed on capture.
* This was changed in commit 99c6719928 and
was probably ok before then (although going into the serialise function
was unnecessary and did some redundant copies into a chunk we were going
to throw away). I'm not sure why I made that change, if it was to fix a
bug I can't understand how. I guess I'll see if anything breaks.
This commit is contained in:
@@ -1650,9 +1650,11 @@ GLboolean WrappedOpenGL::glUnmapNamedBufferEXT(GLuint buffer)
|
||||
}
|
||||
else
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(UNMAP);
|
||||
Serialise_glUnmapNamedBufferEXT(buffer);
|
||||
record->AddChunk(scope.Get());
|
||||
// if we are here for WRITING_IDLE, the app wrote directly into our backing
|
||||
// store memory. Just need to copy the data across to GL, no other work needed
|
||||
void *ptr = m_Real.glMapNamedBufferRangeEXT(buffer, (GLintptr)record->Map.offset, GLsizeiptr(record->Map.length), GL_MAP_WRITE_BIT);
|
||||
memcpy(ptr, record->Map.ptr, record->Map.length);
|
||||
m_Real.glUnmapNamedBufferEXT(buffer);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user