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 */
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);
intel_obj->Base.Size = size;
intel_obj->Base.Usage = usage;
+ intel_obj->Base.StorageFlags = storageFlags;
assert(!obj->Pointer); /* Mesa should have unmapped it */
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);
obj->Size = size;
obj->Usage = usage;
+ obj->StorageFlags = storageFlags;
/* Free previous storage */
nouveau_bo_ref(NULL, &nbo->bo);
GLsizeiptrARB size,
const GLvoid * data,
GLenum usage,
+ GLbitfield storageFlags,
struct gl_buffer_object *obj)
{
radeonContextPtr radeon = RADEON_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);
*/
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;
bufObj->Data = (GLubyte *) new_data;
bufObj->Size = size;
bufObj->Usage = usage;
+ bufObj->StorageFlags = storageFlags;
if (data) {
memcpy( bufObj->Data, data, 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()");
}
}
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,
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 */
GLsizeiptrARB size,
const GLvoid * data,
GLenum usage,
+ GLbitfield storageFlags,
struct gl_buffer_object *obj)
{
struct st_context *st = st_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.
st_obj->Base.Size = size;
st_obj->Base.Usage = usage;
+ st_obj->Base.StorageFlags = storageFlags;
switch (target) {
case GL_PIXEL_PACK_BUFFER_ARB:
/* 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");
}
}
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,
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 {