From: José Fonseca Date: Sun, 15 Jan 2012 13:56:28 +0000 (+0000) Subject: Handle EXT_direct_state_access buffer mappings properly. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=fb3bd60273e8657ba0eff6b0fa1a322167c2d2f6;p=apitrace Handle EXT_direct_state_access buffer mappings properly. --- diff --git a/gltrace.py b/gltrace.py index eb7bbc2..bb821b9 100644 --- a/gltrace.py +++ b/gltrace.py @@ -478,6 +478,16 @@ class GlTracer(Tracer): print ' if (mapping && mapping->write && !mapping->explicit_flush) {' self.emit_memcpy('mapping->map', 'mapping->map', 'mapping->length') print ' }' + if function.name == 'glUnmapNamedBufferEXT': + print ' GLint access = 0;' + print ' glGetNamedBufferParameterivEXT(buffer, GL_BUFFER_ACCESS, &access);' + print ' if ((access & GL_MAP_WRITE_BIT) & !(access & GL_MAP_FLUSH_EXPLICIT_BIT)) {' + print ' GLvoid *map = NULL;' + print ' glGetNamedBufferPointervEXT(buffer, GL_BUFFER_MAP_POINTER, &map);' + print ' GLint length = 0;' + print ' glGetNamedBufferParameterivEXT(buffer, GL_BUFFER_MAP_LENGTH, &length);' + self.emit_memcpy('map', 'map', 'length') + print ' }' if function.name in ('glFlushMappedBufferRange', 'glFlushMappedBufferRangeAPPLE'): print ' struct buffer_mapping *mapping = get_buffer_mapping(target);' print ' if (mapping) {' @@ -487,7 +497,12 @@ class GlTracer(Tracer): print ' //assert(offset + length <= mapping->length);' self.emit_memcpy('(char *)mapping->map + offset', '(const char *)mapping->map + offset', 'length') print ' }' - # FIXME: glFlushMappedNamedBufferRangeEXT + if function.name == 'glFlushMappedNamedBufferRangeEXT': + print ' GLvoid *map = NULL;' + print ' glGetNamedBufferPointervEXT(buffer, GL_BUFFER_MAP_POINTER, &map);' + print ' if (map) {' + self.emit_memcpy('(char *)map + offset', '(const char *)map + offset', 'length') + print ' }' # Don't leave vertex attrib locations to chance. Instead emit fake # glBindAttribLocation calls to ensure that the same locations will be