mesa: Massage the interface to more closely resemble ARB_map_buffer_range
This commit is contained in:
@@ -218,6 +218,7 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target,
|
|||||||
struct pipe_context *pipe = st_context(ctx)->pipe;
|
struct pipe_context *pipe = st_context(ctx)->pipe;
|
||||||
struct st_buffer_object *st_obj = st_buffer_object(obj);
|
struct st_buffer_object *st_obj = st_buffer_object(obj);
|
||||||
GLuint flags = 0;
|
GLuint flags = 0;
|
||||||
|
char *map;
|
||||||
|
|
||||||
if (access & GL_MAP_WRITE_BIT)
|
if (access & GL_MAP_WRITE_BIT)
|
||||||
flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
|
flags |= PIPE_BUFFER_USAGE_CPU_WRITE;
|
||||||
@@ -231,8 +232,12 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target,
|
|||||||
if (access & MESA_MAP_NOWAIT_BIT)
|
if (access & MESA_MAP_NOWAIT_BIT)
|
||||||
flags |= PIPE_BUFFER_USAGE_DONTBLOCK;
|
flags |= PIPE_BUFFER_USAGE_DONTBLOCK;
|
||||||
|
|
||||||
obj->Pointer = pipe_buffer_map(pipe->screen, st_obj->buffer, flags);
|
map = pipe_buffer_map_range(pipe->screen, st_obj->buffer, offset, length, flags);
|
||||||
return obj->Pointer;
|
/* FIXME: some code expects this to point to the buffer start, which means that
|
||||||
|
* the range might not be respected in all circumstances
|
||||||
|
*/
|
||||||
|
obj->Pointer = map ? map - offset : NULL;
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -282,10 +282,7 @@ void vbo_exec_vtx_map( struct vbo_exec_context *exec )
|
|||||||
exec->vtx.bufferobj);
|
exec->vtx.bufferobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exec->vtx.buffer_map) {
|
if (!exec->vtx.buffer_map) {
|
||||||
exec->vtx.buffer_map += exec->vtx.buffer_used / sizeof(float);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
exec->vtx.buffer_used = 0;
|
exec->vtx.buffer_used = 0;
|
||||||
|
|
||||||
ctx->Driver.BufferData(ctx, target,
|
ctx->Driver.BufferData(ctx, target,
|
||||||
|
Reference in New Issue
Block a user