summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-01-27 21:15:19 +0100
committerMarek Olšák <[email protected]>2014-02-25 16:04:22 +0100
commit7e548d05076c430f9c532add478080bea82515ba (patch)
treed94dad927288bfba0f61b5af041c40a551677d6a /src/mesa/main
parentaea4933287d6deff2ef1729febb5bfabdc88c21e (diff)
mesa: add storage flags parameter to Driver.BufferData
It will be used by glBufferStorage. The parameters are chosen according to ARB_buffer_storage. Reviewed-by: Fredrik Höglund <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/bufferobj.c9
-rw-r--r--src/mesa/main/dd.h2
-rw-r--r--src/mesa/main/mtypes.h1
3 files changed, 9 insertions, 3 deletions
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 */