diff options
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_buffer_objects.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_buffer_objects.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 2 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.c | 9 | ||||
-rw-r--r-- | src/mesa/main/dd.h | 2 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_bufferobjects.c | 6 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_api.c | 6 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 8 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_api.c | 2 |
11 files changed, 39 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_buffer_objects.c b/src/mesa/drivers/dri/i915/intel_buffer_objects.c index 345db6dfe0f..f4fb9998cde 100644 --- a/src/mesa/drivers/dri/i915/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i915/intel_buffer_objects.c @@ -116,13 +116,16 @@ intel_bufferobj_data(struct gl_context * ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, - GLenum usage, struct gl_buffer_object *obj) + GLenum usage, + GLbitfield storageFlags, + struct gl_buffer_object *obj) { struct intel_context *intel = intel_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); intel_obj->Base.Size = size; intel_obj->Base.Usage = usage; + intel_obj->Base.StorageFlags = storageFlags; assert(!obj->Pointer); /* Mesa should have unmapped it */ diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c index d286a9fef60..c92ca2fcafe 100644 --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c @@ -182,7 +182,9 @@ intel_bufferobj_data(struct gl_context * ctx, GLenum target, GLsizeiptrARB size, const GLvoid * data, - GLenum usage, struct gl_buffer_object *obj) + GLenum usage, + GLbitfield storageFlags, + struct gl_buffer_object *obj) { struct brw_context *brw = brw_context(ctx); struct intel_buffer_object *intel_obj = intel_buffer_object(obj); @@ -193,6 +195,7 @@ intel_bufferobj_data(struct gl_context * ctx, intel_obj->Base.Size = size; intel_obj->Base.Usage = usage; + intel_obj->Base.StorageFlags = storageFlags; assert(!obj->Pointer); /* Mesa should have unmapped it */ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c index dc165853759..783a152955f 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c @@ -73,7 +73,7 @@ nouveau_bufferobj_del(struct gl_context *ctx, struct gl_buffer_object *obj) static GLboolean nouveau_bufferobj_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB size, - const GLvoid *data, GLenum usage, + const GLvoid *data, GLenum usage, GLbitfield storageFlags, struct gl_buffer_object *obj) { struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj); @@ -81,6 +81,7 @@ nouveau_bufferobj_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB size obj->Size = size; obj->Usage = usage; + obj->StorageFlags = storageFlags; /* Free previous storage */ nouveau_bo_ref(NULL, &nbo->bo); diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index ba7ab372790..7663178d63d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -86,6 +86,7 @@ radeonBufferData(struct gl_context * ctx, GLsizeiptrARB size, const GLvoid * data, GLenum usage, + GLbitfield storageFlags, struct gl_buffer_object *obj) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); @@ -93,6 +94,7 @@ radeonBufferData(struct gl_context * ctx, radeon_obj->Base.Size = size; radeon_obj->Base.Usage = usage; + radeon_obj->Base.StorageFlags = storageFlags; if (radeon_obj->bo != NULL) { radeon_bo_unref(radeon_obj->bo); diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 491b6501ed5..f4dea26c347 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -555,7 +555,7 @@ _mesa_total_buffer_object_memory(struct gl_context *ctx) */ static GLboolean _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, - const GLvoid * data, GLenum usage, + const GLvoid * data, GLenum usage, GLenum storageFlags, struct gl_buffer_object * bufObj ) { void * new_data; @@ -569,6 +569,7 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, bufObj->Data = (GLubyte *) new_data; bufObj->Size = size; bufObj->Usage = usage; + bufObj->StorageFlags = storageFlags; if (data) { memcpy( bufObj->Data, data, size ); @@ -1305,7 +1306,11 @@ _mesa_BufferData(GLenum target, GLsizeiptrARB size, #endif ASSERT(ctx->Driver.BufferData); - if (!ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj )) { + if (!ctx->Driver.BufferData(ctx, target, size, data, usage, + GL_MAP_READ_BIT | + GL_MAP_WRITE_BIT | + GL_DYNAMIC_STORAGE_BIT, + bufObj)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB()"); } } diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index b444b4cf504..f1ba6000d02 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -578,7 +578,7 @@ struct dd_function_table { GLboolean (*BufferData)(struct gl_context *ctx, GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage, - struct gl_buffer_object *obj); + GLenum storageFlags, struct gl_buffer_object *obj); void (*BufferSubData)( struct gl_context *ctx, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index fbbca5528d9..536ed314195 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1449,6 +1449,7 @@ struct gl_buffer_object GLuint Name; GLchar *Label; /**< GL_KHR_debug */ GLenum Usage; /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc. */ + GLbitfield StorageFlags; /**< GL_MAP_PERSISTENT_BIT, etc. */ GLsizeiptrARB Size; /**< Size of buffer storage in bytes */ GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ /** Fields describing a mapped buffer */ diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index c8f088dc82c..347dc90b269 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -176,6 +176,7 @@ st_bufferobj_data(struct gl_context *ctx, GLsizeiptrARB size, const GLvoid * data, GLenum usage, + GLbitfield storageFlags, struct gl_buffer_object *obj) { struct st_context *st = st_context(ctx); @@ -184,7 +185,9 @@ st_bufferobj_data(struct gl_context *ctx, unsigned bind, pipe_usage; if (size && data && st_obj->buffer && - st_obj->Base.Size == size && st_obj->Base.Usage == usage) { + st_obj->Base.Size == size && + st_obj->Base.Usage == usage && + st_obj->Base.StorageFlags == storageFlags) { /* Just discard the old contents and write new data. * This should be the same as creating a new buffer, but we avoid * a lot of validation in Mesa. @@ -200,6 +203,7 @@ st_bufferobj_data(struct gl_context *ctx, st_obj->Base.Size = size; st_obj->Base.Usage = usage; + st_obj->Base.StorageFlags = storageFlags; switch (target) { case GL_PIXEL_PACK_BUFFER_ARB: diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 81091364535..9858badebf1 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -998,7 +998,11 @@ void vbo_use_buffer_objects(struct gl_context *ctx) /* Allocate a real buffer object now */ _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); exec->vtx.bufferobj = ctx->Driver.NewBufferObject(ctx, bufName, target); - if (!ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj)) { + if (!ctx->Driver.BufferData(ctx, target, size, NULL, usage, + GL_MAP_WRITE_BIT | + GL_DYNAMIC_STORAGE_BIT | + GL_CLIENT_STORAGE_BIT, + exec->vtx.bufferobj)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "VBO allocation"); } } diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 75115ce6631..46be65fc010 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -325,8 +325,12 @@ vbo_exec_vtx_map( struct vbo_exec_context *exec ) exec->vtx.buffer_used = 0; if (ctx->Driver.BufferData(ctx, GL_ARRAY_BUFFER_ARB, - VBO_VERT_BUFFER_SIZE, - NULL, usage, exec->vtx.bufferobj)) { + VBO_VERT_BUFFER_SIZE, + NULL, usage, + GL_MAP_WRITE_BIT | + GL_DYNAMIC_STORAGE_BIT | + GL_CLIENT_STORAGE_BIT, + exec->vtx.bufferobj)) { /* buffer allocation worked, now map the buffer */ exec->vtx.buffer_map = (GLfloat *)ctx->Driver.MapBufferRange(ctx, diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 98ab68623b4..b86ced5bf89 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -200,6 +200,8 @@ alloc_vertex_store(struct gl_context *ctx) GL_ARRAY_BUFFER_ARB, VBO_SAVE_BUFFER_SIZE * sizeof(GLfloat), NULL, GL_STATIC_DRAW_ARB, + GL_MAP_WRITE_BIT | + GL_DYNAMIC_STORAGE_BIT, vertex_store->bufferobj); } else { |