Fix buffer map diff comparison, and skip it for range maps

* For range maps, similar to glFlushMappedBufferRange, we assume the
  user selected the range deliberately and we upload it all. We only
  find a difference range for whole-buffer maps (of large enough
  buffers). This includes glMapBuffer(), by definition.
* Also, the comparison point is between the map pointer, so we have to
  offset the shadow pointer to compare it against to get accurate
  results.
This commit is contained in:
baldurk
2015-02-26 14:25:40 +00:00
parent 5892899729
commit c69389864e
@@ -1841,9 +1841,17 @@ bool WrappedOpenGL::Serialise_glUnmapNamedBufferEXT(GLuint buffer)
size_t diffStart = 0;
size_t diffEnd = (size_t)len;
if(m_State == WRITING_CAPFRAME && len > 512 && !record->Map.invalidate)
if(m_State == WRITING_CAPFRAME &&
// don't bother checking diff range for tiny buffers
len > 512 &&
// if the map has a sub-range specified, trust the user to have specified
// a minimal range, similar to glFlushMappedBufferRange, so don't find diff
// range.
record->Map.offset == 0 && record->Map.length == record->Length &&
// similarly for invalidate maps, we want to update the whole buffer
!record->Map.invalidate)
{
bool found = FindDiffRange(record->Map.ptr, record->GetShadowPtr(1), (size_t)len, diffStart, diffEnd);
bool found = FindDiffRange(record->Map.ptr, record->GetShadowPtr(1)+offs, (size_t)len, diffStart, diffEnd);
if(found)
{
static size_t saved = 0;