mesa: Eliminate dd_function_table::MapBuffer
Replace all calls to dd_function_table::MapBuffer with appropriate calls to dd_function_table::MapBufferRange, then remove all the cruft. 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>
This commit is contained in:
@@ -689,7 +689,11 @@ static void brw_prepare_indices(struct brw_context *brw)
|
|||||||
* rebase it into a temporary.
|
* rebase it into a temporary.
|
||||||
*/
|
*/
|
||||||
if ((get_size(index_buffer->type) - 1) & offset) {
|
if ((get_size(index_buffer->type) - 1) & offset) {
|
||||||
GLubyte *map = ctx->Driver.MapBuffer(ctx, GL_WRITE_ONLY, bufferobj);
|
GLubyte *map = ctx->Driver.MapBufferRange(ctx,
|
||||||
|
0,
|
||||||
|
bufferobj->Size,
|
||||||
|
GL_MAP_WRITE_BIT,
|
||||||
|
bufferobj);
|
||||||
map += offset;
|
map += offset;
|
||||||
|
|
||||||
intel_upload_data(&brw->intel, map, ib_size, ib_type_size,
|
intel_upload_data(&brw->intel, map, ib_size, ib_type_size,
|
||||||
|
@@ -295,64 +295,7 @@ intel_bufferobj_get_subdata(struct gl_context * ctx,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called via glMapBufferARB().
|
* Called via glMapBufferRange and glMapBuffer
|
||||||
*/
|
|
||||||
static void *
|
|
||||||
intel_bufferobj_map(struct gl_context * ctx,
|
|
||||||
GLenum access, struct gl_buffer_object *obj)
|
|
||||||
{
|
|
||||||
struct intel_context *intel = intel_context(ctx);
|
|
||||||
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
|
|
||||||
GLboolean read_only = (access == GL_READ_ONLY_ARB);
|
|
||||||
GLboolean write_only = (access == GL_WRITE_ONLY_ARB);
|
|
||||||
|
|
||||||
assert(intel_obj);
|
|
||||||
|
|
||||||
if (intel_obj->sys_buffer) {
|
|
||||||
if (!read_only && intel_obj->source) {
|
|
||||||
release_buffer(intel_obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!intel_obj->buffer || intel_obj->source) {
|
|
||||||
obj->Pointer = intel_obj->sys_buffer;
|
|
||||||
obj->Length = obj->Size;
|
|
||||||
obj->Offset = 0;
|
|
||||||
return obj->Pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(intel_obj->sys_buffer);
|
|
||||||
intel_obj->sys_buffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Flush any existing batchbuffer that might reference this data. */
|
|
||||||
if (drm_intel_bo_references(intel->batch.bo, intel_obj->buffer))
|
|
||||||
intel_flush(ctx);
|
|
||||||
|
|
||||||
if (intel_obj->region)
|
|
||||||
intel_bufferobj_cow(intel, intel_obj);
|
|
||||||
|
|
||||||
if (intel_obj->buffer == NULL) {
|
|
||||||
obj->Pointer = NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (write_only) {
|
|
||||||
drm_intel_gem_bo_map_gtt(intel_obj->buffer);
|
|
||||||
intel_obj->mapped_gtt = GL_TRUE;
|
|
||||||
} else {
|
|
||||||
drm_intel_bo_map(intel_obj->buffer, !read_only);
|
|
||||||
intel_obj->mapped_gtt = GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
obj->Pointer = intel_obj->buffer->virtual;
|
|
||||||
obj->Length = obj->Size;
|
|
||||||
obj->Offset = 0;
|
|
||||||
|
|
||||||
return obj->Pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called via glMapBufferRange().
|
|
||||||
*
|
*
|
||||||
* The goal of this extension is to allow apps to accumulate their rendering
|
* The goal of this extension is to allow apps to accumulate their rendering
|
||||||
* at the same time as they accumulate their buffer object. Without it,
|
* at the same time as they accumulate their buffer object. Without it,
|
||||||
@@ -760,15 +703,18 @@ intel_bufferobj_copy_subdata(struct gl_context *ctx,
|
|||||||
* not overlap.
|
* not overlap.
|
||||||
*/
|
*/
|
||||||
if (src == dst) {
|
if (src == dst) {
|
||||||
char *ptr = intel_bufferobj_map(ctx, GL_READ_WRITE, dst);
|
char *ptr = intel_bufferobj_map_range(ctx, 0, dst->Size,
|
||||||
|
GL_MAP_READ_BIT, dst);
|
||||||
memmove(ptr + write_offset, ptr + read_offset, size);
|
memmove(ptr + write_offset, ptr + read_offset, size);
|
||||||
intel_bufferobj_unmap(ctx, dst);
|
intel_bufferobj_unmap(ctx, dst);
|
||||||
} else {
|
} else {
|
||||||
const char *src_ptr;
|
const char *src_ptr;
|
||||||
char *dst_ptr;
|
char *dst_ptr;
|
||||||
|
|
||||||
src_ptr = intel_bufferobj_map(ctx, GL_READ_ONLY, src);
|
src_ptr = intel_bufferobj_map_range(ctx, 0, src->Size,
|
||||||
dst_ptr = intel_bufferobj_map(ctx, GL_WRITE_ONLY, dst);
|
GL_MAP_READ_BIT, src);
|
||||||
|
dst_ptr = intel_bufferobj_map_range(ctx, 0, dst->Size,
|
||||||
|
GL_MAP_WRITE_BIT, dst);
|
||||||
|
|
||||||
memcpy(dst_ptr + write_offset, src_ptr + read_offset, size);
|
memcpy(dst_ptr + write_offset, src_ptr + read_offset, size);
|
||||||
|
|
||||||
@@ -923,7 +869,6 @@ intelInitBufferObjectFuncs(struct dd_function_table *functions)
|
|||||||
functions->BufferData = intel_bufferobj_data;
|
functions->BufferData = intel_bufferobj_data;
|
||||||
functions->BufferSubData = intel_bufferobj_subdata;
|
functions->BufferSubData = intel_bufferobj_subdata;
|
||||||
functions->GetBufferSubData = intel_bufferobj_get_subdata;
|
functions->GetBufferSubData = intel_bufferobj_get_subdata;
|
||||||
functions->MapBuffer = intel_bufferobj_map;
|
|
||||||
functions->MapBufferRange = intel_bufferobj_map_range;
|
functions->MapBufferRange = intel_bufferobj_map_range;
|
||||||
functions->FlushMappedBufferRange = intel_bufferobj_flush_mapped_range;
|
functions->FlushMappedBufferRange = intel_bufferobj_flush_mapped_range;
|
||||||
functions->UnmapBuffer = intel_bufferobj_unmap;
|
functions->UnmapBuffer = intel_bufferobj_unmap;
|
||||||
|
@@ -74,9 +74,9 @@ static const GLubyte *map_pbo( struct gl_context *ctx,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = (GLubyte *) ctx->Driver.MapBuffer(ctx,
|
buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
|
||||||
GL_READ_ONLY_ARB,
|
GL_MAP_READ_BIT,
|
||||||
unpack->BufferObj);
|
unpack->BufferObj);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap(PBO is mapped)");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -122,22 +122,6 @@ nouveau_bufferobj_get_subdata(struct gl_context *ctx, GLintptrARB offset,
|
|||||||
memcpy(data, get_bufferobj_map(obj, NOUVEAU_BO_RD) + offset, size);
|
memcpy(data, get_bufferobj_map(obj, NOUVEAU_BO_RD) + offset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
|
||||||
nouveau_bufferobj_map(struct gl_context *ctx, GLenum access,
|
|
||||||
struct gl_buffer_object *obj)
|
|
||||||
{
|
|
||||||
unsigned flags = 0;
|
|
||||||
|
|
||||||
if (access == GL_READ_ONLY_ARB ||
|
|
||||||
access == GL_READ_WRITE_ARB)
|
|
||||||
flags |= GL_MAP_READ_BIT;
|
|
||||||
if (access == GL_WRITE_ONLY_ARB ||
|
|
||||||
access == GL_READ_WRITE_ARB)
|
|
||||||
flags |= GL_MAP_WRITE_BIT;
|
|
||||||
|
|
||||||
return ctx->Driver.MapBufferRange(ctx, 0, obj->Size, flags, obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
nouveau_bufferobj_map_range(struct gl_context *ctx, GLenum target, GLintptr offset,
|
nouveau_bufferobj_map_range(struct gl_context *ctx, GLenum target, GLintptr offset,
|
||||||
GLsizeiptr length, GLbitfield access,
|
GLsizeiptr length, GLbitfield access,
|
||||||
@@ -188,7 +172,6 @@ nouveau_bufferobj_functions_init(struct dd_function_table *functions)
|
|||||||
functions->BufferData = nouveau_bufferobj_data;
|
functions->BufferData = nouveau_bufferobj_data;
|
||||||
functions->BufferSubData = nouveau_bufferobj_subdata;
|
functions->BufferSubData = nouveau_bufferobj_subdata;
|
||||||
functions->GetBufferSubData = nouveau_bufferobj_get_subdata;
|
functions->GetBufferSubData = nouveau_bufferobj_get_subdata;
|
||||||
functions->MapBuffer = nouveau_bufferobj_map;
|
|
||||||
functions->MapBufferRange = nouveau_bufferobj_map_range;
|
functions->MapBufferRange = nouveau_bufferobj_map_range;
|
||||||
functions->UnmapBuffer = nouveau_bufferobj_unmap;
|
functions->UnmapBuffer = nouveau_bufferobj_unmap;
|
||||||
}
|
}
|
||||||
|
@@ -84,7 +84,8 @@ static void r300FixupIndexBuffer(struct gl_context *ctx, const struct _mesa_inde
|
|||||||
GLboolean mapped_named_bo = GL_FALSE;
|
GLboolean mapped_named_bo = GL_FALSE;
|
||||||
|
|
||||||
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) {
|
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) {
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, mesa_ind_buf->obj);
|
ctx->Driver.MapBufferRange(ctx, 0, mesa_ind_buf->obj->Size,
|
||||||
|
GL_MAP_READ_BIT, mesa_ind_buf->obj);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
assert(mesa_ind_buf->obj->Pointer != NULL);
|
assert(mesa_ind_buf->obj->Pointer != NULL);
|
||||||
}
|
}
|
||||||
@@ -163,7 +164,10 @@ static void r300SetupIndexBuffer(struct gl_context *ctx, const struct _mesa_inde
|
|||||||
GLboolean mapped_named_bo = GL_FALSE;
|
GLboolean mapped_named_bo = GL_FALSE;
|
||||||
|
|
||||||
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) {
|
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) {
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, mesa_ind_buf->obj);
|
ctx->Driver.MapBufferRange(ctx, 0,
|
||||||
|
mesa_ind_buf->obj->Size,
|
||||||
|
GL_MAP_READ_BIT,
|
||||||
|
mesa_ind_buf->obj);
|
||||||
assert(mesa_ind_buf->obj->Pointer != NULL);
|
assert(mesa_ind_buf->obj->Pointer != NULL);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
}
|
}
|
||||||
@@ -235,7 +239,8 @@ static void r300ConvertAttrib(struct gl_context *ctx, int count, const struct gl
|
|||||||
|
|
||||||
if (input->BufferObj->Name) {
|
if (input->BufferObj->Name) {
|
||||||
if (!input->BufferObj->Pointer) {
|
if (!input->BufferObj->Pointer) {
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, input->BufferObj);
|
ctx->Driver.MapBufferRange(ctx, 0, input->BufferObj->Size,
|
||||||
|
GL_MAP_READ_BIT, input->BufferObj);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +307,8 @@ static void r300AlignDataToDword(struct gl_context *ctx, const struct gl_client_
|
|||||||
radeon_bo_map(attr->bo, 1);
|
radeon_bo_map(attr->bo, 1);
|
||||||
|
|
||||||
if (!input->BufferObj->Pointer) {
|
if (!input->BufferObj->Pointer) {
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, input->BufferObj);
|
ctx->Driver.MapBufferRange(ctx, 0, input->BufferObj->Size,
|
||||||
|
GL_MAP_READ_BIT, input->BufferObj);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -403,7 +403,8 @@ static void evergreenConvertAttrib(struct gl_context *ctx, int count,
|
|||||||
{
|
{
|
||||||
if (!input->BufferObj->Pointer)
|
if (!input->BufferObj->Pointer)
|
||||||
{
|
{
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, input->BufferObj);
|
ctx->Driver.MapBufferRange(ctx, 0, input->BufferObj->Size,
|
||||||
|
GL_MAP_READ_BIT, input->BufferObj);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,7 +471,8 @@ static void evergreenFixupIndexBuffer(struct gl_context *ctx, const struct _mesa
|
|||||||
|
|
||||||
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer)
|
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer)
|
||||||
{
|
{
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, mesa_ind_buf->obj);
|
ctx->Driver.MapBufferRange(ctx, 0, mesa_ind_buf->obj->Size,
|
||||||
|
GL_MAP_READ_BIT, mesa_ind_buf->obj);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
assert(mesa_ind_buf->obj->Pointer != NULL);
|
assert(mesa_ind_buf->obj->Pointer != NULL);
|
||||||
}
|
}
|
||||||
@@ -606,7 +608,8 @@ static void evergreenSetupIndexBuffer(struct gl_context *ctx, const struct _mesa
|
|||||||
|
|
||||||
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer)
|
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer)
|
||||||
{
|
{
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, mesa_ind_buf->obj);
|
ctx->Driver.MapBufferRange(ctx, 0, mesa_ind_buf->obj->Size,
|
||||||
|
GL_MAP_READ_BIT, mesa_ind_buf->obj);
|
||||||
assert(mesa_ind_buf->obj->Pointer != NULL);
|
assert(mesa_ind_buf->obj->Pointer != NULL);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
}
|
}
|
||||||
@@ -655,7 +658,8 @@ static void evergreenAlignDataToDword(struct gl_context *ctx,
|
|||||||
|
|
||||||
if (!input->BufferObj->Pointer)
|
if (!input->BufferObj->Pointer)
|
||||||
{
|
{
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, input->BufferObj);
|
ctx->Driver.MapBufferRange(ctx, 0, input->BufferObj->Size,
|
||||||
|
GL_MAP_READ_BIT, input->BufferObj->obj);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -490,7 +490,8 @@ static void r700ConvertAttrib(struct gl_context *ctx, int count,
|
|||||||
{
|
{
|
||||||
if (!input->BufferObj->Pointer)
|
if (!input->BufferObj->Pointer)
|
||||||
{
|
{
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, input->BufferObj);
|
ctx->Driver.MapBufferRange(ctx, 0, input->BufferObj->Size,
|
||||||
|
GL_MAP_READ_BIT, input->BufferObj);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,7 +565,8 @@ static void r700AlignDataToDword(struct gl_context *ctx,
|
|||||||
|
|
||||||
if (!input->BufferObj->Pointer)
|
if (!input->BufferObj->Pointer)
|
||||||
{
|
{
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, input->BufferObj);
|
ctx->Driver.MapBufferRange(ctx, 0, input->BufferObj->Size,
|
||||||
|
GL_MAP_READ_BIT, input->BufferObj);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,7 +729,8 @@ static void r700FixupIndexBuffer(struct gl_context *ctx, const struct _mesa_inde
|
|||||||
|
|
||||||
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer)
|
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer)
|
||||||
{
|
{
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, mesa_ind_buf->obj);
|
ctx->Driver.MapBufferRange(ctx, 0, mesa_ind_buf->obj->Size,
|
||||||
|
GL_MAP_READ_BIT, mesa_ind_buf->obj);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
assert(mesa_ind_buf->obj->Pointer != NULL);
|
assert(mesa_ind_buf->obj->Pointer != NULL);
|
||||||
}
|
}
|
||||||
@@ -813,7 +816,8 @@ static void r700SetupIndexBuffer(struct gl_context *ctx, const struct _mesa_inde
|
|||||||
|
|
||||||
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer)
|
if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer)
|
||||||
{
|
{
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, mesa_ind_buf->obj);
|
ctx->Driver.MapBufferRange(ctx, 0, mesa_ind_buf->obj->Size,
|
||||||
|
GL_MAP_READ_BIT, mesa_ind_buf->obj);
|
||||||
assert(mesa_ind_buf->obj->Pointer != NULL);
|
assert(mesa_ind_buf->obj->Pointer != NULL);
|
||||||
mapped_named_bo = GL_TRUE;
|
mapped_named_bo = GL_TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -169,36 +169,7 @@ radeonGetBufferSubData(struct gl_context * ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called via glMapBufferARB()
|
* Called via glMapBuffer() and glMapBufferRange()
|
||||||
*/
|
|
||||||
static void *
|
|
||||||
radeonMapBuffer(struct gl_context * ctx,
|
|
||||||
GLenum access,
|
|
||||||
struct gl_buffer_object *obj)
|
|
||||||
{
|
|
||||||
struct radeon_buffer_object *radeon_obj = get_radeon_buffer_object(obj);
|
|
||||||
|
|
||||||
if (access == GL_WRITE_ONLY_ARB) {
|
|
||||||
ctx->Driver.Flush(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (radeon_obj->bo == NULL) {
|
|
||||||
obj->Pointer = NULL;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
radeon_bo_map(radeon_obj->bo, access == GL_WRITE_ONLY_ARB);
|
|
||||||
|
|
||||||
obj->Pointer = radeon_obj->bo->ptr;
|
|
||||||
obj->Length = obj->Size;
|
|
||||||
obj->Offset = 0;
|
|
||||||
|
|
||||||
return obj->Pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called via glMapBufferRange()
|
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
radeonMapBufferRange(struct gl_context * ctx,
|
radeonMapBufferRange(struct gl_context * ctx,
|
||||||
@@ -257,7 +228,6 @@ radeonInitBufferObjectFuncs(struct dd_function_table *functions)
|
|||||||
functions->BufferData = radeonBufferData;
|
functions->BufferData = radeonBufferData;
|
||||||
functions->BufferSubData = radeonBufferSubData;
|
functions->BufferSubData = radeonBufferSubData;
|
||||||
functions->GetBufferSubData = radeonGetBufferSubData;
|
functions->GetBufferSubData = radeonGetBufferSubData;
|
||||||
functions->MapBuffer = radeonMapBuffer;
|
|
||||||
functions->MapBufferRange = radeonMapBufferRange;
|
functions->MapBufferRange = radeonMapBufferRange;
|
||||||
functions->UnmapBuffer = radeonUnmapBuffer;
|
functions->UnmapBuffer = radeonUnmapBuffer;
|
||||||
}
|
}
|
||||||
|
@@ -454,9 +454,10 @@ xmesa_DrawPixels_8R8G8B( struct gl_context *ctx,
|
|||||||
"glDrawPixels(invalid PBO access)");
|
"glDrawPixels(invalid PBO access)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buf = (GLubyte *) ctx->Driver.MapBuffer(ctx,
|
buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0,
|
||||||
GL_READ_ONLY_ARB,
|
unpack->BufferObj->Size,
|
||||||
unpack->BufferObj);
|
GL_MAP_READ_BIT,
|
||||||
|
unpack->BufferObj);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
/* buffer is already mapped - that's an error */
|
/* buffer is already mapped - that's an error */
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
@@ -587,10 +588,10 @@ xmesa_DrawPixels_5R6G5B( struct gl_context *ctx,
|
|||||||
"glDrawPixels(invalid PBO access)");
|
"glDrawPixels(invalid PBO access)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buf = (GLubyte *) ctx->Driver.MapBuffer(ctx,
|
buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0
|
||||||
GL_PIXEL_UNPACK_BUFFER_EXT,
|
unpack->BufferObj->Size,
|
||||||
GL_READ_ONLY_ARB,
|
GL_MAP_READ_BIT,
|
||||||
unpack->BufferObj);
|
unpack->BufferObj);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
/* buffer is already mapped - that's an error */
|
/* buffer is already mapped - that's an error */
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||||
|
@@ -1602,7 +1602,10 @@ void _ae_map_vbos( struct gl_context *ctx )
|
|||||||
_ae_update_state(ctx);
|
_ae_update_state(ctx);
|
||||||
|
|
||||||
for (i = 0; i < actx->nr_vbos; i++)
|
for (i = 0; i < actx->nr_vbos; i++)
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY, actx->vbo[i]);
|
ctx->Driver.MapBufferRange(ctx, 0,
|
||||||
|
actx->vbo[i]->Size,
|
||||||
|
GL_MAP_READ_BIT,
|
||||||
|
actx->vbo[i]);
|
||||||
|
|
||||||
if (actx->nr_vbos)
|
if (actx->nr_vbos)
|
||||||
actx->mapped_vbos = GL_TRUE;
|
actx->mapped_vbos = GL_TRUE;
|
||||||
|
@@ -65,7 +65,8 @@ _mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type,
|
|||||||
|
|
||||||
if (_mesa_is_bufferobj(elementBuf)) {
|
if (_mesa_is_bufferobj(elementBuf)) {
|
||||||
/* elements are in a user-defined buffer object. need to map it */
|
/* elements are in a user-defined buffer object. need to map it */
|
||||||
map = ctx->Driver.MapBuffer(ctx, GL_READ_ONLY, elementBuf);
|
map = ctx->Driver.MapBufferRange(ctx, 0, elementBuf->Size,
|
||||||
|
GL_MAP_READ_BIT, elementBuf);
|
||||||
/* Actual address is the sum of pointers */
|
/* Actual address is the sum of pointers */
|
||||||
indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices);
|
indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices);
|
||||||
}
|
}
|
||||||
|
@@ -431,38 +431,6 @@ _mesa_buffer_get_subdata( struct gl_context *ctx, GLintptrARB offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default callback for \c dd_function_tabel::MapBuffer().
|
|
||||||
*
|
|
||||||
* The function parameters will have been already tested for errors.
|
|
||||||
*
|
|
||||||
* \param ctx GL context.
|
|
||||||
* \param target Buffer object target on which to operate.
|
|
||||||
* \param access Information about how the buffer will be accessed.
|
|
||||||
* \param bufObj Object to be mapped.
|
|
||||||
* \return A pointer to the object's internal data store that can be accessed
|
|
||||||
* by the processor
|
|
||||||
*
|
|
||||||
* \sa glMapBufferARB, dd_function_table::MapBuffer
|
|
||||||
*/
|
|
||||||
static void *
|
|
||||||
_mesa_buffer_map( struct gl_context *ctx, GLenum access,
|
|
||||||
struct gl_buffer_object *bufObj )
|
|
||||||
{
|
|
||||||
(void) ctx;
|
|
||||||
(void) access;
|
|
||||||
/* Just return a direct pointer to the data */
|
|
||||||
if (_mesa_bufferobj_mapped(bufObj)) {
|
|
||||||
/* already mapped! */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
bufObj->Pointer = bufObj->Data;
|
|
||||||
bufObj->Length = bufObj->Size;
|
|
||||||
bufObj->Offset = 0;
|
|
||||||
return bufObj->Pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default fallback for \c dd_function_table::MapBufferRange().
|
* Default fallback for \c dd_function_table::MapBufferRange().
|
||||||
* Called via glMapBufferRange().
|
* Called via glMapBufferRange().
|
||||||
@@ -537,8 +505,10 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
|
|||||||
assert(!_mesa_bufferobj_mapped(src));
|
assert(!_mesa_bufferobj_mapped(src));
|
||||||
assert(!_mesa_bufferobj_mapped(dst));
|
assert(!_mesa_bufferobj_mapped(dst));
|
||||||
|
|
||||||
srcPtr = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_READ_ONLY, src);
|
srcPtr = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, src->Size,
|
||||||
dstPtr = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_WRITE_ONLY, dst);
|
GL_MAP_READ_BIT, src);
|
||||||
|
dstPtr = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, dst->Size,
|
||||||
|
GL_MAP_WRITE_BIT, dst);
|
||||||
|
|
||||||
if (srcPtr && dstPtr)
|
if (srcPtr && dstPtr)
|
||||||
memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
|
memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
|
||||||
@@ -704,7 +674,6 @@ _mesa_init_buffer_object_functions(struct dd_function_table *driver)
|
|||||||
driver->BufferData = _mesa_buffer_data;
|
driver->BufferData = _mesa_buffer_data;
|
||||||
driver->BufferSubData = _mesa_buffer_subdata;
|
driver->BufferSubData = _mesa_buffer_subdata;
|
||||||
driver->GetBufferSubData = _mesa_buffer_get_subdata;
|
driver->GetBufferSubData = _mesa_buffer_get_subdata;
|
||||||
driver->MapBuffer = _mesa_buffer_map;
|
|
||||||
driver->UnmapBuffer = _mesa_buffer_unmap;
|
driver->UnmapBuffer = _mesa_buffer_unmap;
|
||||||
|
|
||||||
/* GL_ARB_map_buffer_range */
|
/* GL_ARB_map_buffer_range */
|
||||||
@@ -1035,8 +1004,8 @@ _mesa_MapBufferARB(GLenum target, GLenum access)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(ctx->Driver.MapBuffer);
|
ASSERT(ctx->Driver.MapBufferRange);
|
||||||
map = ctx->Driver.MapBuffer( ctx, access, bufObj );
|
map = ctx->Driver.MapBufferRange(ctx, 0, bufObj->Size, accessFlags, bufObj);
|
||||||
if (!map) {
|
if (!map) {
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -706,9 +706,6 @@ struct dd_function_table {
|
|||||||
GLintptrARB offset, GLsizeiptrARB size,
|
GLintptrARB offset, GLsizeiptrARB size,
|
||||||
GLvoid *data, struct gl_buffer_object *obj );
|
GLvoid *data, struct gl_buffer_object *obj );
|
||||||
|
|
||||||
void * (*MapBuffer)( struct gl_context *ctx, GLenum access,
|
|
||||||
struct gl_buffer_object *obj );
|
|
||||||
|
|
||||||
void (*CopyBufferSubData)( struct gl_context *ctx,
|
void (*CopyBufferSubData)( struct gl_context *ctx,
|
||||||
struct gl_buffer_object *src,
|
struct gl_buffer_object *src,
|
||||||
struct gl_buffer_object *dst,
|
struct gl_buffer_object *dst,
|
||||||
|
@@ -894,7 +894,8 @@ unpack_image(struct gl_context *ctx, GLuint dimensions,
|
|||||||
GLvoid *image;
|
GLvoid *image;
|
||||||
|
|
||||||
map = (GLubyte *)
|
map = (GLubyte *)
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, unpack->BufferObj);
|
ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
|
||||||
|
GL_MAP_READ_BIT, unpack->BufferObj);
|
||||||
if (!map) {
|
if (!map) {
|
||||||
/* unable to map src buffer! */
|
/* unable to map src buffer! */
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
|
_mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
|
||||||
|
@@ -128,9 +128,10 @@ _mesa_map_pbo_source(struct gl_context *ctx,
|
|||||||
|
|
||||||
if (_mesa_is_bufferobj(unpack->BufferObj)) {
|
if (_mesa_is_bufferobj(unpack->BufferObj)) {
|
||||||
/* unpack from PBO */
|
/* unpack from PBO */
|
||||||
buf = (GLubyte *) ctx->Driver.MapBuffer(ctx,
|
buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0,
|
||||||
GL_READ_ONLY_ARB,
|
unpack->BufferObj->Size,
|
||||||
unpack->BufferObj);
|
GL_MAP_READ_BIT,
|
||||||
|
unpack->BufferObj);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -223,9 +224,10 @@ _mesa_map_pbo_dest(struct gl_context *ctx,
|
|||||||
|
|
||||||
if (_mesa_is_bufferobj(pack->BufferObj)) {
|
if (_mesa_is_bufferobj(pack->BufferObj)) {
|
||||||
/* pack into PBO */
|
/* pack into PBO */
|
||||||
buf = (GLubyte *) ctx->Driver.MapBuffer(ctx,
|
buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0,
|
||||||
GL_WRITE_ONLY_ARB,
|
pack->BufferObj->Size,
|
||||||
pack->BufferObj);
|
GL_MAP_WRITE_BIT,
|
||||||
|
pack->BufferObj);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -326,8 +328,9 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB,
|
buf = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, unpack->BufferObj->Size,
|
||||||
unpack->BufferObj);
|
GL_MAP_READ_BIT,
|
||||||
|
unpack->BufferObj);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped)");
|
_mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped)");
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -363,7 +366,10 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = (GLubyte*) ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, packing->BufferObj);
|
buf = (GLubyte*) ctx->Driver.MapBufferRange(ctx, 0,
|
||||||
|
packing->BufferObj->Size,
|
||||||
|
GL_MAP_READ_BIT,
|
||||||
|
packing->BufferObj);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
_mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped");
|
_mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -441,7 +441,8 @@ _mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
|||||||
* texture data to the PBO if the PBO is in VRAM along with the texture.
|
* texture data to the PBO if the PBO is in VRAM along with the texture.
|
||||||
*/
|
*/
|
||||||
GLubyte *buf = (GLubyte *)
|
GLubyte *buf = (GLubyte *)
|
||||||
ctx->Driver.MapBuffer(ctx, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
|
ctx->Driver.MapBufferRange(ctx, 0, ctx->Pack.BufferObj->Size,
|
||||||
|
GL_MAP_WRITE_BIT, ctx->Pack.BufferObj);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
/* out of memory or other unexpected error */
|
/* out of memory or other unexpected error */
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)");
|
||||||
@@ -498,7 +499,8 @@ _mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level
|
|||||||
if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
|
if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
|
||||||
/* pack texture image into a PBO */
|
/* pack texture image into a PBO */
|
||||||
GLubyte *buf = (GLubyte *)
|
GLubyte *buf = (GLubyte *)
|
||||||
ctx->Driver.MapBuffer(ctx, GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
|
ctx->Driver.MapBufferRange(ctx, 0, ctx->Pack.BufferObj->Size,
|
||||||
|
GL_MAP_WRITE_BIT, ctx->Pack.BufferObj);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
/* out of memory or other unexpected error */
|
/* out of memory or other unexpected error */
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY,
|
_mesa_error(ctx, GL_OUT_OF_MEMORY,
|
||||||
|
@@ -235,48 +235,6 @@ static long st_bufferobj_zero_length = 0;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called via glMapBufferARB().
|
|
||||||
*/
|
|
||||||
static void *
|
|
||||||
st_bufferobj_map(struct gl_context *ctx, GLenum access,
|
|
||||||
struct gl_buffer_object *obj)
|
|
||||||
{
|
|
||||||
struct st_buffer_object *st_obj = st_buffer_object(obj);
|
|
||||||
uint flags;
|
|
||||||
|
|
||||||
switch (access) {
|
|
||||||
case GL_WRITE_ONLY:
|
|
||||||
flags = PIPE_TRANSFER_WRITE;
|
|
||||||
break;
|
|
||||||
case GL_READ_ONLY:
|
|
||||||
flags = PIPE_TRANSFER_READ;
|
|
||||||
break;
|
|
||||||
case GL_READ_WRITE:
|
|
||||||
default:
|
|
||||||
flags = PIPE_TRANSFER_READ_WRITE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle zero-size buffers here rather than in drivers */
|
|
||||||
if (obj->Size == 0) {
|
|
||||||
obj->Pointer = &st_bufferobj_zero_length;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
obj->Pointer = pipe_buffer_map(st_context(ctx)->pipe,
|
|
||||||
st_obj->buffer,
|
|
||||||
flags,
|
|
||||||
&st_obj->transfer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj->Pointer) {
|
|
||||||
obj->Offset = 0;
|
|
||||||
obj->Length = obj->Size;
|
|
||||||
}
|
|
||||||
return obj->Pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called via glMapBufferRange().
|
* Called via glMapBufferRange().
|
||||||
*/
|
*/
|
||||||
@@ -442,7 +400,6 @@ st_init_bufferobject_functions(struct dd_function_table *functions)
|
|||||||
functions->BufferData = st_bufferobj_data;
|
functions->BufferData = st_bufferobj_data;
|
||||||
functions->BufferSubData = st_bufferobj_subdata;
|
functions->BufferSubData = st_bufferobj_subdata;
|
||||||
functions->GetBufferSubData = st_bufferobj_get_subdata;
|
functions->GetBufferSubData = st_bufferobj_get_subdata;
|
||||||
functions->MapBuffer = st_bufferobj_map;
|
|
||||||
functions->MapBufferRange = st_bufferobj_map_range;
|
functions->MapBufferRange = st_bufferobj_map_range;
|
||||||
functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range;
|
functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range;
|
||||||
functions->UnmapBuffer = st_bufferobj_unmap;
|
functions->UnmapBuffer = st_bufferobj_unmap;
|
||||||
|
@@ -280,9 +280,9 @@ static void bind_inputs( struct gl_context *ctx,
|
|||||||
if (!inputs[i]->BufferObj->Pointer) {
|
if (!inputs[i]->BufferObj->Pointer) {
|
||||||
bo[*nr_bo] = inputs[i]->BufferObj;
|
bo[*nr_bo] = inputs[i]->BufferObj;
|
||||||
(*nr_bo)++;
|
(*nr_bo)++;
|
||||||
ctx->Driver.MapBuffer(ctx,
|
ctx->Driver.MapBufferRange(ctx, 0, inputs[i]->BufferObj->Size,
|
||||||
GL_READ_ONLY_ARB,
|
GL_MAP_READ_BIT,
|
||||||
inputs[i]->BufferObj);
|
inputs[i]->BufferObj);
|
||||||
|
|
||||||
assert(inputs[i]->BufferObj->Pointer);
|
assert(inputs[i]->BufferObj->Pointer);
|
||||||
}
|
}
|
||||||
@@ -349,9 +349,8 @@ static void bind_indices( struct gl_context *ctx,
|
|||||||
if (ib->obj->Name && !ib->obj->Pointer) {
|
if (ib->obj->Name && !ib->obj->Pointer) {
|
||||||
bo[*nr_bo] = ib->obj;
|
bo[*nr_bo] = ib->obj;
|
||||||
(*nr_bo)++;
|
(*nr_bo)++;
|
||||||
ctx->Driver.MapBuffer(ctx,
|
ctx->Driver.MapBufferRange(ctx, 0, ib->obj->Size, GL_MAP_READ_BIT,
|
||||||
GL_READ_ONLY_ARB,
|
ib->obj);
|
||||||
ib->obj);
|
|
||||||
|
|
||||||
assert(ib->obj->Pointer);
|
assert(ib->obj->Pointer);
|
||||||
}
|
}
|
||||||
|
@@ -96,7 +96,8 @@ vbo_get_minmax_index(struct gl_context *ctx,
|
|||||||
|
|
||||||
if (_mesa_is_bufferobj(ib->obj)) {
|
if (_mesa_is_bufferobj(ib->obj)) {
|
||||||
const GLvoid *map =
|
const GLvoid *map =
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY, ib->obj);
|
ctx->Driver.MapBufferRange(ctx, 0, ib->obj->Size, GL_MAP_READ_BIT,
|
||||||
|
ib->obj);
|
||||||
indices = ADD_POINTERS(map, ib->ptr);
|
indices = ADD_POINTERS(map, ib->ptr);
|
||||||
} else {
|
} else {
|
||||||
indices = ib->ptr;
|
indices = ib->ptr;
|
||||||
@@ -195,7 +196,8 @@ check_array_data(struct gl_context *ctx, struct gl_client_array *array,
|
|||||||
if (!array->BufferObj->Pointer) {
|
if (!array->BufferObj->Pointer) {
|
||||||
/* need to map now */
|
/* need to map now */
|
||||||
array->BufferObj->Pointer =
|
array->BufferObj->Pointer =
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY, array->BufferObj);
|
ctx->Driver.MapBufferRange(ctx, 0, array->BufferObj->Size,
|
||||||
|
GL_MAP_READ_BIT, array->BufferObj);
|
||||||
}
|
}
|
||||||
data = ADD_POINTERS(data, array->BufferObj->Pointer);
|
data = ADD_POINTERS(data, array->BufferObj->Pointer);
|
||||||
}
|
}
|
||||||
@@ -254,9 +256,10 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
|
|||||||
GLint i, k;
|
GLint i, k;
|
||||||
|
|
||||||
if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
|
if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
|
||||||
elemMap = ctx->Driver.MapBuffer(ctx,
|
elemMap = ctx->Driver.MapBufferRange(ctx, 0,
|
||||||
GL_READ_ONLY,
|
ctx->Array.ElementArrayBufferObj->Size,
|
||||||
ctx->Array.ElementArrayBufferObj);
|
GL_MAP_READ_BIT,
|
||||||
|
ctx->Array.ElementArrayBufferObj);
|
||||||
elements = ADD_POINTERS(elements, elemMap);
|
elements = ADD_POINTERS(elements, elemMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,7 +350,8 @@ print_draw_arrays(struct gl_context *ctx,
|
|||||||
bufName);
|
bufName);
|
||||||
|
|
||||||
if (bufName) {
|
if (bufName) {
|
||||||
GLubyte *p = ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, bufObj);
|
GLubyte *p = ctx->Driver.MapBufferRange(ctx, 0, bufObj->Size,
|
||||||
|
GL_MAP_READ_BIT, bufObj);
|
||||||
int offset = (int) (GLintptr) exec->array.inputs[i]->Ptr;
|
int offset = (int) (GLintptr) exec->array.inputs[i]->Ptr;
|
||||||
float *f = (float *) (p + offset);
|
float *f = (float *) (p + offset);
|
||||||
int *k = (int *) f;
|
int *k = (int *) f;
|
||||||
@@ -710,9 +714,11 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
|
|||||||
static void
|
static void
|
||||||
dump_element_buffer(struct gl_context *ctx, GLenum type)
|
dump_element_buffer(struct gl_context *ctx, GLenum type)
|
||||||
{
|
{
|
||||||
const GLvoid *map = ctx->Driver.MapBuffer(ctx,
|
const GLvoid *map =
|
||||||
GL_READ_ONLY,
|
ctx->Driver.MapBufferRange(ctx, 0,
|
||||||
ctx->Array.ElementArrayBufferObj);
|
ctx->Array.ElementArrayBufferObj->Size,
|
||||||
|
GL_MAP_READ_BIT,
|
||||||
|
ctx->Array.ElementArrayBufferObj);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GL_UNSIGNED_BYTE:
|
case GL_UNSIGNED_BYTE:
|
||||||
{
|
{
|
||||||
|
@@ -296,7 +296,6 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec )
|
|||||||
{
|
{
|
||||||
struct gl_context *ctx = exec->ctx;
|
struct gl_context *ctx = exec->ctx;
|
||||||
const GLenum target = GL_ARRAY_BUFFER_ARB;
|
const GLenum target = GL_ARRAY_BUFFER_ARB;
|
||||||
const GLenum access = GL_READ_WRITE_ARB; /* for MapBuffer */
|
|
||||||
const GLenum accessRange = GL_MAP_WRITE_BIT | /* for MapBufferRange */
|
const GLenum accessRange = GL_MAP_WRITE_BIT | /* for MapBufferRange */
|
||||||
GL_MAP_INVALIDATE_RANGE_BIT |
|
GL_MAP_INVALIDATE_RANGE_BIT |
|
||||||
GL_MAP_UNSYNCHRONIZED_BIT |
|
GL_MAP_UNSYNCHRONIZED_BIT |
|
||||||
@@ -310,8 +309,7 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec )
|
|||||||
assert(!exec->vtx.buffer_map);
|
assert(!exec->vtx.buffer_map);
|
||||||
assert(!exec->vtx.buffer_ptr);
|
assert(!exec->vtx.buffer_ptr);
|
||||||
|
|
||||||
if (VBO_VERT_BUFFER_SIZE > exec->vtx.buffer_used + 1024 &&
|
if (VBO_VERT_BUFFER_SIZE > exec->vtx.buffer_used + 1024) {
|
||||||
ctx->Driver.MapBufferRange) {
|
|
||||||
/* The VBO exists and there's room for more */
|
/* The VBO exists and there's room for more */
|
||||||
exec->vtx.buffer_map =
|
exec->vtx.buffer_map =
|
||||||
(GLfloat *)ctx->Driver.MapBufferRange(ctx,
|
(GLfloat *)ctx->Driver.MapBufferRange(ctx,
|
||||||
@@ -332,15 +330,11 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec )
|
|||||||
NULL, usage, exec->vtx.bufferobj);
|
NULL, usage, exec->vtx.bufferobj);
|
||||||
|
|
||||||
|
|
||||||
if (ctx->Driver.MapBufferRange)
|
exec->vtx.buffer_map =
|
||||||
exec->vtx.buffer_map =
|
(GLfloat *)ctx->Driver.MapBufferRange(ctx,
|
||||||
(GLfloat *)ctx->Driver.MapBufferRange(ctx,
|
0, VBO_VERT_BUFFER_SIZE,
|
||||||
0, VBO_VERT_BUFFER_SIZE,
|
accessRange,
|
||||||
accessRange,
|
exec->vtx.bufferobj);
|
||||||
exec->vtx.bufferobj);
|
|
||||||
if (!exec->vtx.buffer_map)
|
|
||||||
exec->vtx.buffer_map =
|
|
||||||
(GLfloat *)ctx->Driver.MapBuffer(ctx, access, exec->vtx.bufferobj);
|
|
||||||
assert(exec->vtx.buffer_map);
|
assert(exec->vtx.buffer_map);
|
||||||
exec->vtx.buffer_ptr = exec->vtx.buffer_map;
|
exec->vtx.buffer_ptr = exec->vtx.buffer_map;
|
||||||
}
|
}
|
||||||
|
@@ -159,7 +159,8 @@ void vbo_rebase_prims( struct gl_context *ctx,
|
|||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
if (map_ib)
|
if (map_ib)
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY_ARB, ib->obj);
|
ctx->Driver.MapBufferRange(ctx, 0, ib->obj->Size, GL_MAP_READ_BIT,
|
||||||
|
ib->obj);
|
||||||
|
|
||||||
|
|
||||||
ptr = ADD_POINTERS(ib->obj->Pointer, ib->ptr);
|
ptr = ADD_POINTERS(ib->obj->Pointer, ib->ptr);
|
||||||
|
@@ -232,10 +232,10 @@ map_vertex_store(struct gl_context *ctx,
|
|||||||
assert(vertex_store->bufferobj);
|
assert(vertex_store->bufferobj);
|
||||||
assert(!vertex_store->buffer);
|
assert(!vertex_store->buffer);
|
||||||
vertex_store->buffer =
|
vertex_store->buffer =
|
||||||
(GLfloat *) ctx->Driver.MapBuffer(ctx,
|
(GLfloat *) ctx->Driver.MapBufferRange(ctx, 0,
|
||||||
GL_WRITE_ONLY, /* not used */
|
vertex_store->bufferobj->Size,
|
||||||
vertex_store->
|
GL_MAP_WRITE_BIT, /* not used */
|
||||||
bufferobj);
|
vertex_store->bufferobj);
|
||||||
|
|
||||||
assert(vertex_store->buffer);
|
assert(vertex_store->buffer);
|
||||||
return vertex_store->buffer + vertex_store->used;
|
return vertex_store->buffer + vertex_store->used;
|
||||||
|
@@ -217,9 +217,11 @@ static void
|
|||||||
vbo_save_loopback_vertex_list(struct gl_context *ctx,
|
vbo_save_loopback_vertex_list(struct gl_context *ctx,
|
||||||
const struct vbo_save_vertex_list *list)
|
const struct vbo_save_vertex_list *list)
|
||||||
{
|
{
|
||||||
const char *buffer = ctx->Driver.MapBuffer(ctx,
|
const char *buffer =
|
||||||
GL_READ_ONLY, /* ? */
|
ctx->Driver.MapBufferRange(ctx, 0,
|
||||||
list->vertex_store->bufferobj);
|
list->vertex_store->bufferobj->Size,
|
||||||
|
GL_MAP_READ_BIT, /* ? */
|
||||||
|
list->vertex_store->bufferobj);
|
||||||
|
|
||||||
vbo_loopback_vertex_list(ctx,
|
vbo_loopback_vertex_list(ctx,
|
||||||
(const GLfloat *)(buffer + list->buffer_offset),
|
(const GLfloat *)(buffer + list->buffer_offset),
|
||||||
|
@@ -444,7 +444,7 @@ replay_init( struct copy_context *copy )
|
|||||||
copy->vertex_size += attr_size(copy->array[i]);
|
copy->vertex_size += attr_size(copy->array[i]);
|
||||||
|
|
||||||
if (_mesa_is_bufferobj(vbo) && !_mesa_bufferobj_mapped(vbo))
|
if (_mesa_is_bufferobj(vbo) && !_mesa_bufferobj_mapped(vbo))
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY, vbo);
|
ctx->Driver.MapBufferRange(ctx, 0, vbo->Size, GL_MAP_READ_BIT, vbo);
|
||||||
|
|
||||||
copy->varying[j].src_ptr = ADD_POINTERS(vbo->Pointer,
|
copy->varying[j].src_ptr = ADD_POINTERS(vbo->Pointer,
|
||||||
copy->array[i]->Ptr);
|
copy->array[i]->Ptr);
|
||||||
@@ -459,7 +459,8 @@ replay_init( struct copy_context *copy )
|
|||||||
*/
|
*/
|
||||||
if (_mesa_is_bufferobj(copy->ib->obj) &&
|
if (_mesa_is_bufferobj(copy->ib->obj) &&
|
||||||
!_mesa_bufferobj_mapped(copy->ib->obj))
|
!_mesa_bufferobj_mapped(copy->ib->obj))
|
||||||
ctx->Driver.MapBuffer(ctx, GL_READ_ONLY, copy->ib->obj);
|
ctx->Driver.MapBufferRange(ctx, 0, copy->ib->obj->Size, GL_MAP_READ_BIT,
|
||||||
|
copy->ib->obj);
|
||||||
|
|
||||||
srcptr = (const GLubyte *) ADD_POINTERS(copy->ib->obj->Pointer,
|
srcptr = (const GLubyte *) ADD_POINTERS(copy->ib->obj->Pointer,
|
||||||
copy->ib->ptr);
|
copy->ib->ptr);
|
||||||
|
Reference in New Issue
Block a user