print ' }'
# Emit a fake memcpy on buffer uploads
- if function.name in ('glUnmapBuffer', 'glUnmapBufferARB', ):
+ if function.name in ('glUnmapBuffer', 'glUnmapBufferARB', 'glUnmapBufferOES'):
print ' struct buffer_mapping *mapping = get_buffer_mapping(target);'
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) {'
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
Tracer.invokeFunction(self, function)
- def emit_memcpy(self, dest, src, length):
- print ' unsigned __call = trace::localWriter.beginEnter(&trace::memcpy_sig);'
- print ' trace::localWriter.beginArg(0);'
- print ' trace::localWriter.writeOpaque(%s);' % dest
- print ' trace::localWriter.endArg();'
- print ' trace::localWriter.beginArg(1);'
- print ' trace::localWriter.writeBlob(%s, %s);' % (src, length)
- print ' trace::localWriter.endArg();'
- print ' trace::localWriter.beginArg(2);'
- print ' trace::localWriter.writeUInt(%s);' % length
- print ' trace::localWriter.endArg();'
- print ' trace::localWriter.endEnter();'
- print ' trace::localWriter.beginLeave(__call);'
- print ' trace::localWriter.endLeave();'
-
buffer_targets = [
'ARRAY_BUFFER',
'ELEMENT_ARRAY_BUFFER',
Tracer.wrapRet(self, function, instance)
- if function.name in ('glMapBuffer', 'glMapBufferARB'):
+ if function.name in ('glMapBuffer', 'glMapBufferARB', 'glMapBufferOES'):
print ' struct buffer_mapping *mapping = get_buffer_mapping(target);'
print ' if (mapping) {'
print ' mapping->map = %s;' % (instance)