aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/bufferobj.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-08-29 14:48:31 +0200
committermarha <marha@users.sourceforge.net>2011-08-29 14:48:31 +0200
commit924a6ffc82a7af0ca311af711ea2cf973dc6ff15 (patch)
treef5ee6d0aaf321029a4abb12c3c051c0434dde308 /mesalib/src/mesa/main/bufferobj.c
parent8e57a7fcbf736b8e437baf0bbccb93095d97617f (diff)
parent01df5d59e56a1b060568f8cad2e89f7eea22fc70 (diff)
downloadvcxsrv-924a6ffc82a7af0ca311af711ea2cf973dc6ff15.tar.gz
vcxsrv-924a6ffc82a7af0ca311af711ea2cf973dc6ff15.tar.bz2
vcxsrv-924a6ffc82a7af0ca311af711ea2cf973dc6ff15.zip
Merge remote-tracking branch 'origin/released'
Conflicts: apps/xwininfo/configure.ac apps/xwininfo/xwininfo.c libX11/configure.ac libX11/specs/libX11/AppC.xml libX11/specs/libX11/AppD.xml libX11/specs/libX11/CH03.xml libX11/specs/libX11/CH04.xml libX11/specs/libX11/CH05.xml libX11/specs/libX11/CH06.xml libX11/specs/libX11/CH07.xml libX11/specs/libX11/CH08.xml libX11/specs/libX11/CH09.xml libX11/specs/libX11/CH11.xml libX11/specs/libX11/CH12.xml libX11/specs/libX11/CH13.xml libX11/specs/libX11/CH14.xml libX11/specs/libX11/CH15.xml libX11/specs/libX11/CH16.xml libxcb/configure.ac libxcb/src/c_client.py libxcb/src/xcb_auth.c libxcb/src/xcb_util.c mesalib/common.py mesalib/configs/linux-dri mesalib/docs/GL3.txt mesalib/docs/download.html mesalib/docs/install.html mesalib/include/GL/internal/dri_interface.h mesalib/scons/custom.py mesalib/scons/gallium.py mesalib/src/gallium/auxiliary/util/u_math.h mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.c mesalib/src/glsl/ast_function.cpp mesalib/src/glsl/ast_to_hir.cpp mesalib/src/glsl/glcpp/glcpp-parse.y mesalib/src/glsl/glsl_parser_extras.cpp mesalib/src/glsl/glsl_parser_extras.h mesalib/src/glsl/ir.cpp mesalib/src/glsl/ir.h mesalib/src/glsl/ir_clone.cpp mesalib/src/glsl/ir_print_visitor.cpp mesalib/src/glsl/ir_validate.cpp mesalib/src/glsl/linker.cpp mesalib/src/glsl/main.cpp mesalib/src/glsl/opt_tree_grafting.cpp mesalib/src/mapi/glapi/gen/Makefile mesalib/src/mapi/glapi/gen/gl_XML.py mesalib/src/mapi/glapi/gen/gl_table.py mesalib/src/mapi/glapi/glapi_mapi_tmp.h mesalib/src/mapi/glapi/glapi_sparc.S mesalib/src/mapi/glapi/glapi_x86-64.S mesalib/src/mapi/glapi/glapi_x86.S mesalib/src/mapi/glapi/glapitemp.h mesalib/src/mapi/glapi/glprocs.h mesalib/src/mapi/mapi/u_thread.c mesalib/src/mapi/mapi/u_thread.h mesalib/src/mesa/SConscript mesalib/src/mesa/drivers/common/driverfuncs.c mesalib/src/mesa/drivers/windows/gldirect/dglcontext.c mesalib/src/mesa/main/api_arrayelt.c mesalib/src/mesa/main/bufferobj.c mesalib/src/mesa/main/compiler.h mesalib/src/mesa/main/dd.h mesalib/src/mesa/main/dlist.c mesalib/src/mesa/main/enums.c mesalib/src/mesa/main/es_generator.py mesalib/src/mesa/main/fbobject.c mesalib/src/mesa/main/imports.h mesalib/src/mesa/main/mtypes.h mesalib/src/mesa/main/pbo.c mesalib/src/mesa/main/remap_helper.h mesalib/src/mesa/main/shared.c mesalib/src/mesa/main/texgetimage.c mesalib/src/mesa/main/teximage.c mesalib/src/mesa/main/uniforms.c mesalib/src/mesa/program/ir_to_mesa.cpp mesalib/src/mesa/program/prog_optimize.c mesalib/src/mesa/program/register_allocate.c mesalib/src/mesa/program/register_allocate.h mesalib/src/mesa/sources.mak mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c mesalib/src/mesa/state_tracker/st_cb_texture.c mesalib/src/mesa/state_tracker/st_texture.h mesalib/src/mesa/swrast/s_context.c mesalib/src/mesa/tnl/t_draw.c mesalib/src/mesa/vbo/vbo_exec_array.c mesalib/src/mesa/vbo/vbo_save_api.c pixman/pixman/pixman-arm-common.h pixman/pixman/pixman-fast-path.c pixman/pixman/pixman-inlines.h pixman/test/Makefile.am pixman/test/utils.c pixman/test/utils.h xorg-server/configure.ac xorg-server/fb/fbblt.c xorg-server/hw/xquartz/darwin.c xorg-server/xkeyboard-config/symbols/de
Diffstat (limited to 'mesalib/src/mesa/main/bufferobj.c')
-rw-r--r--mesalib/src/mesa/main/bufferobj.c84
1 files changed, 22 insertions, 62 deletions
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 07b678373..79ca91e04 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -386,11 +386,11 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
* \sa glBufferSubDataARB, dd_function_table::BufferSubData.
*/
void
-_mesa_buffer_subdata( struct gl_context *ctx, GLenum target, GLintptrARB offset,
+_mesa_buffer_subdata( struct gl_context *ctx, GLintptrARB offset,
GLsizeiptrARB size, const GLvoid * data,
struct gl_buffer_object * bufObj )
{
- (void) ctx; (void) target;
+ (void) ctx;
/* this should have been caught in _mesa_BufferSubData() */
ASSERT(size + offset <= bufObj->Size);
@@ -419,12 +419,11 @@ _mesa_buffer_subdata( struct gl_context *ctx, GLenum target, GLintptrARB offset,
* \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData.
*/
void
-_mesa_buffer_get_subdata( struct gl_context *ctx,
- GLenum target, GLintptrARB offset,
+_mesa_buffer_get_subdata( struct gl_context *ctx, GLintptrARB offset,
GLsizeiptrARB size, GLvoid * data,
struct gl_buffer_object * bufObj )
{
- (void) ctx; (void) target;
+ (void) ctx;
if (bufObj->Data && ((GLsizeiptrARB) (size + offset) <= bufObj->Size)) {
memcpy( data, (GLubyte *) bufObj->Data + offset, size );
@@ -433,49 +432,15 @@ _mesa_buffer_get_subdata( struct gl_context *ctx,
/**
- * 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
- */
-void *
-_mesa_buffer_map( struct gl_context *ctx, GLenum target, GLenum access,
- struct gl_buffer_object *bufObj )
-{
- (void) ctx;
- (void) target;
- (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().
* Called via glMapBufferRange().
*/
static void *
-_mesa_buffer_map_range( struct gl_context *ctx, GLenum target, GLintptr offset,
+_mesa_buffer_map_range( struct gl_context *ctx, GLintptr offset,
GLsizeiptr length, GLbitfield access,
struct gl_buffer_object *bufObj )
{
(void) ctx;
- (void) target;
assert(!_mesa_bufferobj_mapped(bufObj));
/* Just return a direct pointer to the data */
bufObj->Pointer = bufObj->Data + offset;
@@ -491,12 +456,11 @@ _mesa_buffer_map_range( struct gl_context *ctx, GLenum target, GLintptr offset,
* Called via glFlushMappedBufferRange().
*/
static void
-_mesa_buffer_flush_mapped_range( struct gl_context *ctx, GLenum target,
+_mesa_buffer_flush_mapped_range( struct gl_context *ctx,
GLintptr offset, GLsizeiptr length,
struct gl_buffer_object *obj )
{
(void) ctx;
- (void) target;
(void) offset;
(void) length;
(void) obj;
@@ -512,11 +476,9 @@ _mesa_buffer_flush_mapped_range( struct gl_context *ctx, GLenum target,
* \sa glUnmapBufferARB, dd_function_table::UnmapBuffer
*/
GLboolean
-_mesa_buffer_unmap( struct gl_context *ctx, GLenum target,
- struct gl_buffer_object *bufObj )
+_mesa_buffer_unmap( struct gl_context *ctx, struct gl_buffer_object *bufObj )
{
(void) ctx;
- (void) target;
/* XXX we might assert here that bufObj->Pointer is non-null */
bufObj->Pointer = NULL;
bufObj->Length = 0;
@@ -543,16 +505,16 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
assert(!_mesa_bufferobj_mapped(src));
assert(!_mesa_bufferobj_mapped(dst));
- srcPtr = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_COPY_READ_BUFFER,
- GL_READ_ONLY, src);
- dstPtr = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_COPY_WRITE_BUFFER,
- GL_WRITE_ONLY, dst);
+ srcPtr = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, src->Size,
+ GL_MAP_READ_BIT, src);
+ dstPtr = (GLubyte *) ctx->Driver.MapBufferRange(ctx, 0, dst->Size,
+ GL_MAP_WRITE_BIT, dst);
if (srcPtr && dstPtr)
memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
- ctx->Driver.UnmapBuffer(ctx, GL_COPY_READ_BUFFER, src);
- ctx->Driver.UnmapBuffer(ctx, GL_COPY_WRITE_BUFFER, dst);
+ ctx->Driver.UnmapBuffer(ctx, src);
+ ctx->Driver.UnmapBuffer(ctx, dst);
}
@@ -712,7 +674,6 @@ _mesa_init_buffer_object_functions(struct dd_function_table *driver)
driver->BufferData = _mesa_buffer_data;
driver->BufferSubData = _mesa_buffer_subdata;
driver->GetBufferSubData = _mesa_buffer_get_subdata;
- driver->MapBuffer = _mesa_buffer_map;
driver->UnmapBuffer = _mesa_buffer_unmap;
/* GL_ARB_map_buffer_range */
@@ -774,7 +735,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
if (_mesa_bufferobj_mapped(bufObj)) {
/* if mapped, unmap it now */
- ctx->Driver.UnmapBuffer(ctx, 0, bufObj);
+ ctx->Driver.UnmapBuffer(ctx, bufObj);
bufObj->AccessFlags = DEFAULT_ACCESS;
bufObj->Pointer = NULL;
}
@@ -934,7 +895,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
if (_mesa_bufferobj_mapped(bufObj)) {
/* Unmap the existing buffer. We'll replace it now. Not an error. */
- ctx->Driver.UnmapBuffer(ctx, target, bufObj);
+ ctx->Driver.UnmapBuffer(ctx, bufObj);
bufObj->AccessFlags = DEFAULT_ACCESS;
ASSERT(bufObj->Pointer == NULL);
}
@@ -980,7 +941,7 @@ _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset,
bufObj->Written = GL_TRUE;
ASSERT(ctx->Driver.BufferSubData);
- ctx->Driver.BufferSubData( ctx, target, offset, size, data, bufObj );
+ ctx->Driver.BufferSubData( ctx, offset, size, data, bufObj );
}
@@ -1000,7 +961,7 @@ _mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset,
}
ASSERT(ctx->Driver.GetBufferSubData);
- ctx->Driver.GetBufferSubData( ctx, target, offset, size, data, bufObj );
+ ctx->Driver.GetBufferSubData( ctx, offset, size, data, bufObj );
}
@@ -1043,8 +1004,8 @@ _mesa_MapBufferARB(GLenum target, GLenum access)
return NULL;
}
- ASSERT(ctx->Driver.MapBuffer);
- map = ctx->Driver.MapBuffer( ctx, target, access, bufObj );
+ ASSERT(ctx->Driver.MapBufferRange);
+ map = ctx->Driver.MapBufferRange(ctx, 0, bufObj->Size, accessFlags, bufObj);
if (!map) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
return NULL;
@@ -1147,7 +1108,7 @@ _mesa_UnmapBufferARB(GLenum target)
}
#endif
- status = ctx->Driver.UnmapBuffer( ctx, target, bufObj );
+ status = ctx->Driver.UnmapBuffer( ctx, bufObj );
bufObj->AccessFlags = DEFAULT_ACCESS;
ASSERT(bufObj->Pointer == NULL);
ASSERT(bufObj->Offset == 0);
@@ -1451,8 +1412,7 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
}
ASSERT(ctx->Driver.MapBufferRange);
- map = ctx->Driver.MapBufferRange(ctx, target, offset, length,
- access, bufObj);
+ map = ctx->Driver.MapBufferRange(ctx, offset, length, access, bufObj);
if (!map) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
}
@@ -1535,7 +1495,7 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
ASSERT(bufObj->AccessFlags & GL_MAP_WRITE_BIT);
if (ctx->Driver.FlushMappedBufferRange)
- ctx->Driver.FlushMappedBufferRange(ctx, target, offset, length, bufObj);
+ ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj);
}