Fix a couple of bugs in the buffer map API

This commit is contained in:
Kovid Goyal
2017-09-08 17:42:29 +05:30
parent 2089d2bfdf
commit f324d8ec4f
2 changed files with 6 additions and 5 deletions

View File

@@ -100,7 +100,7 @@ class BufferManager: # {{{
self.unbind(buf_id)
@contextmanager
def mapped_buffer(self, buf_sz, buf_id, usage=GL_STREAM_DRAW, access=GL_WRITE_ONLY):
def mapped_buffer(self, buf_id, buf_sz, usage=GL_STREAM_DRAW, access=GL_WRITE_ONLY):
prev_sz = self.sizes.get(buf_id, 0)
buf_type = self.types[buf_id]
if prev_sz != buf_sz:
@@ -315,6 +315,10 @@ class ShaderProgram: # {{{
bufid = self.vertex_arrays[vao_id][bufnum]
buffer_manager.set_data(bufid, data, usage=usage)
def mapped_vertex_data(self, vao_id, buf_sz, usage=GL_STREAM_DRAW, bufnum=0, access=GL_WRITE_ONLY):
bufid = self.vertex_arrays[vao_id][bufnum]
return buffer_manager.mapped_buffer(bufid, buf_sz, usage=usage, access=access)
def get_vertex_data(self, vao_id, bufnum=0):
bufid = self.vertex_arrays[vao_id][bufnum]
return buffer_manager.get_data(bufid)