mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 13:10:10 +01:00
radeon: Hack up an implementation of MapBufferRange
This doesn't implement any of the "cool" features of MapBufferRange. Adding this function is necessary for the next commit in the series. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Alex Deucher <alexdeucher@gmail.com> Cc: Maciej Cencora <m.cencora@gmail.com>
This commit is contained in:
parent
b2184da684
commit
cccc7412c2
1 changed files with 33 additions and 0 deletions
|
|
@ -197,6 +197,38 @@ radeonMapBuffer(struct gl_context * ctx,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via glMapBufferRange()
|
||||
*/
|
||||
static void *
|
||||
radeonMapBufferRange(struct gl_context * ctx,
|
||||
GLintptr offset, GLsizeiptr length,
|
||||
GLbitfield access, struct gl_buffer_object *obj)
|
||||
{
|
||||
struct radeon_buffer_object *radeon_obj = get_radeon_buffer_object(obj);
|
||||
const GLboolean write_only =
|
||||
(access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == GL_MAP_WRITE_BIT;
|
||||
|
||||
if (write_only) {
|
||||
ctx->Driver.Flush(ctx);
|
||||
}
|
||||
|
||||
if (radeon_obj->bo == NULL) {
|
||||
obj->Pointer = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
obj->Offset = offset;
|
||||
obj->Length = length;
|
||||
obj->AccessFlags = access;
|
||||
|
||||
radeon_bo_map(radeon_obj->bo, write_only);
|
||||
|
||||
obj->Pointer = radeon_obj->bo->ptr + offset;
|
||||
return obj->Pointer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via glUnmapBufferARB()
|
||||
*/
|
||||
|
|
@ -226,5 +258,6 @@ radeonInitBufferObjectFuncs(struct dd_function_table *functions)
|
|||
functions->BufferSubData = radeonBufferSubData;
|
||||
functions->GetBufferSubData = radeonGetBufferSubData;
|
||||
functions->MapBuffer = radeonMapBuffer;
|
||||
functions->MapBufferRange = radeonMapBufferRange;
|
||||
functions->UnmapBuffer = radeonUnmapBuffer;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue