aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-10-19 11:17:56 +0200
committermarha <marha@users.sourceforge.net>2014-10-19 11:17:56 +0200
commitfa5a6df66cfe9b19014ea9d2fca35b762f457041 (patch)
tree1925fdd9f855e3b32622d09280ecf7cda252f619 /mesalib/src/mesa
parent9480392b8817f8bfa79cbc694ff039a73fc0a57f (diff)
downloadvcxsrv-fa5a6df66cfe9b19014ea9d2fca35b762f457041.tar.gz
vcxsrv-fa5a6df66cfe9b19014ea9d2fca35b762f457041.tar.bz2
vcxsrv-fa5a6df66cfe9b19014ea9d2fca35b762f457041.zip
mesa git update 19 oct 2014
mesa commit 6212d2402df4ad0658cbb98ce889e35ef5f32fa3
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/common/meta_blit.c1
-rw-r--r--mesalib/src/mesa/main/bufferobj.c21
-rw-r--r--mesalib/src/mesa/main/bufferobj.h2
-rw-r--r--mesalib/src/mesa/main/dd.h2
-rw-r--r--mesalib/src/mesa/main/mtypes.h13
-rw-r--r--mesalib/src/mesa/main/shared.c2
-rw-r--r--mesalib/src/mesa/main/teximage.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_eglimage.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c13
-rw-r--r--mesalib/src/mesa/state_tracker/st_gen_mipmap.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_vdpau.c4
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c2
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_api.c4
16 files changed, 58 insertions, 30 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta_blit.c b/mesalib/src/mesa/drivers/common/meta_blit.c
index c6616d93d..01cb532fe 100644
--- a/mesalib/src/mesa/drivers/common/meta_blit.c
+++ b/mesalib/src/mesa/drivers/common/meta_blit.c
@@ -134,6 +134,7 @@ setup_glsl_msaa_blit_scaled_shader(struct gl_context *ctx,
break;
default:
_mesa_problem(ctx, "Unsupported sample count %d\n", samples);
+ unreachable("Unsupported sample count");
}
/* Create sample map string. */
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index b6879ceb5..0ee88560f 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -389,14 +389,14 @@ convert_clear_buffer_data(struct gl_context *ctx,
* Default callback for the \c dd_function_table::NewBufferObject() hook.
*/
static struct gl_buffer_object *
-_mesa_new_buffer_object( struct gl_context *ctx, GLuint name, GLenum target )
+_mesa_new_buffer_object(struct gl_context *ctx, GLuint name)
{
struct gl_buffer_object *obj;
(void) ctx;
obj = MALLOC_STRUCT(gl_buffer_object);
- _mesa_initialize_buffer_object(ctx, obj, name, target);
+ _mesa_initialize_buffer_object(ctx, obj, name);
return obj;
}
@@ -494,12 +494,10 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
* Initialize a buffer object to default values.
*/
void
-_mesa_initialize_buffer_object( struct gl_context *ctx,
- struct gl_buffer_object *obj,
- GLuint name, GLenum target )
+_mesa_initialize_buffer_object(struct gl_context *ctx,
+ struct gl_buffer_object *obj,
+ GLuint name)
{
- (void) target;
-
memset(obj, 0, sizeof(struct gl_buffer_object));
mtx_init(&obj->Mutex, mtx_plain);
obj->RefCount = 1;
@@ -906,7 +904,7 @@ _mesa_handle_bind_buffer_gen(struct gl_context *ctx,
* never used before, allocate a buffer object now.
*/
ASSERT(ctx->Driver.NewBufferObject);
- buf = ctx->Driver.NewBufferObject(ctx, buffer, target);
+ buf = ctx->Driver.NewBufferObject(ctx, buffer);
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller);
return false;
@@ -2652,6 +2650,12 @@ set_ubo_binding(struct gl_context *ctx,
binding->Offset = offset;
binding->Size = size;
binding->AutomaticSize = autoSize;
+
+ /* If this is a real buffer object, mark it has having been used
+ * at some point as a UBO.
+ */
+ if (size >= 0)
+ bufObj->UsageHistory |= USAGE_UNIFORM_BUFFER;
}
/**
@@ -2764,6 +2768,7 @@ set_atomic_buffer_binding(struct gl_context *ctx,
} else {
binding->Offset = offset;
binding->Size = size;
+ bufObj->UsageHistory |= USAGE_ATOMIC_COUNTER_BUFFER;
}
}
diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h
index 0779605c0..fe294fc0b 100644
--- a/mesalib/src/mesa/main/bufferobj.h
+++ b/mesalib/src/mesa/main/bufferobj.h
@@ -103,7 +103,7 @@ _mesa_multi_bind_lookup_bufferobj(struct gl_context *ctx,
extern void
_mesa_initialize_buffer_object(struct gl_context *ctx,
struct gl_buffer_object *obj,
- GLuint name, GLenum target);
+ GLuint name);
extern void
_mesa_reference_buffer_object_(struct gl_context *ctx,
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index c130b14a5..c07e83ad9 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -602,7 +602,7 @@ struct dd_function_table {
*/
/*@{*/
struct gl_buffer_object * (*NewBufferObject)(struct gl_context *ctx,
- GLuint buffer, GLenum target);
+ GLuint buffer);
void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj );
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 5e9453b2f..9f44edac6 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1465,6 +1465,16 @@ struct gl_buffer_mapping {
/**
+ * Usages we've seen for a buffer object.
+ */
+typedef enum {
+ USAGE_UNIFORM_BUFFER = 0x1,
+ USAGE_TEXTURE_BUFFER = 0x2,
+ USAGE_ATOMIC_COUNTER_BUFFER = 0x4,
+} gl_buffer_usage;
+
+
+/**
* GL_ARB_vertex/pixel_buffer_object buffer object
*/
struct gl_buffer_object
@@ -1481,6 +1491,7 @@ struct gl_buffer_object
GLboolean Written; /**< Ever written to? (for debugging) */
GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */
GLboolean Immutable; /**< GL_ARB_buffer_storage */
+ gl_buffer_usage UsageHistory; /**< How has this buffer been used so far? */
struct gl_buffer_mapping Mappings[MAP_COUNT];
};
@@ -4060,6 +4071,8 @@ struct gl_driver_flags
*/
uint64_t NewUniformBuffer;
+ uint64_t NewTextureBuffer;
+
/**
* gl_context::AtomicBufferBindings
*/
diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c
index 7ef932ff0..f74a8232f 100644
--- a/mesalib/src/mesa/main/shared.c
+++ b/mesalib/src/mesa/main/shared.c
@@ -86,7 +86,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
shared->SamplerObjects = _mesa_NewHashTable();
/* Allocate the default buffer object */
- shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0, 0);
+ shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0);
/* Create default texture objects */
for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index c0298af8e..4f4bb11dd 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -4652,6 +4652,12 @@ texbufferrange(struct gl_context *ctx, GLenum target, GLenum internalFormat,
texObj->BufferSize = size;
}
_mesa_unlock_texture(ctx, texObj);
+
+ ctx->NewDriverState |= ctx->DriverFlags.NewTextureBuffer;
+
+ if (bufObj) {
+ bufObj->UsageHistory |= USAGE_TEXTURE_BUFFER;
+ }
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index d53602c8b..55f36442a 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -54,14 +54,14 @@
* internal structure where somehow shared.
*/
static struct gl_buffer_object *
-st_bufferobj_alloc(struct gl_context *ctx, GLuint name, GLenum target)
+st_bufferobj_alloc(struct gl_context *ctx, GLuint name)
{
struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object);
if (!st_obj)
return NULL;
- _mesa_initialize_buffer_object(ctx, &st_obj->Base, name, target);
+ _mesa_initialize_buffer_object(ctx, &st_obj->Base, name);
return &st_obj->Base;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
index 34eb80959..8531afb29 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
@@ -96,6 +96,7 @@ st_bind_surface(struct gl_context *ctx, GLenum target,
struct gl_texture_image *texImage,
struct pipe_surface *ps)
{
+ struct st_context *st = st_context(ctx);
struct st_texture_object *stObj;
struct st_texture_image *stImage;
GLenum internalFormat;
@@ -124,7 +125,7 @@ st_bind_surface(struct gl_context *ctx, GLenum target,
/* FIXME create a non-default sampler view from the pipe_surface? */
pipe_resource_reference(&stObj->pt, ps->texture);
- st_texture_release_all_sampler_views(stObj);
+ st_texture_release_all_sampler_views(st, stObj);
pipe_resource_reference(&stImage->pt, stObj->pt);
stObj->width0 = ps->width;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index dfa188a3f..a8dbb7888 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -152,10 +152,11 @@ static void
st_DeleteTextureObject(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
+ struct st_context *st = st_context(ctx);
struct st_texture_object *stObj = st_texture_object(texObj);
pipe_resource_reference(&stObj->pt, NULL);
- st_texture_release_all_sampler_views(stObj);
+ st_texture_release_all_sampler_views(st, stObj);
st_texture_free_sampler_views(stObj);
_mesa_delete_texture_object(ctx, texObj);
}
@@ -512,7 +513,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
/* The parent texture object does not have space for this image */
pipe_resource_reference(&stObj->pt, NULL);
- st_texture_release_all_sampler_views(stObj);
+ st_texture_release_all_sampler_views(st, stObj);
if (!guess_and_alloc_texture(st, stObj, stImage)) {
/* Probably out of memory.
@@ -1571,13 +1572,13 @@ st_finalize_texture(struct gl_context *ctx,
if (!st_obj) {
pipe_resource_reference(&stObj->pt, NULL);
- st_texture_release_all_sampler_views(stObj);
+ st_texture_release_all_sampler_views(st, stObj);
return GL_TRUE;
}
if (st_obj->buffer != stObj->pt) {
pipe_resource_reference(&stObj->pt, st_obj->buffer);
- st_texture_release_all_sampler_views(stObj);
+ st_texture_release_all_sampler_views(st, stObj);
stObj->width0 = stObj->pt->width0 / _mesa_get_format_bytes(tObj->_BufferObjectFormat);
stObj->height0 = 1;
stObj->depth0 = 1;
@@ -1598,7 +1599,7 @@ st_finalize_texture(struct gl_context *ctx,
firstImage->pt != stObj->pt &&
(!stObj->pt || firstImage->pt->last_level >= stObj->pt->last_level)) {
pipe_resource_reference(&stObj->pt, firstImage->pt);
- st_texture_release_all_sampler_views(stObj);
+ st_texture_release_all_sampler_views(st, stObj);
}
/* If this texture comes from a window system, there is nothing else to do. */
@@ -1646,7 +1647,7 @@ st_finalize_texture(struct gl_context *ctx,
* gallium texture now. We'll make a new one below.
*/
pipe_resource_reference(&stObj->pt, NULL);
- st_texture_release_all_sampler_views(stObj);
+ st_texture_release_all_sampler_views(st, stObj);
st->dirty.st |= ST_NEW_FRAMEBUFFER;
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
index 18cf504a7..26e1c21f6 100644
--- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
@@ -124,7 +124,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
/* release the old tex (will likely be freed too) */
pipe_resource_reference(&oldTex, NULL);
- st_texture_release_all_sampler_views(stObj);
+ st_texture_release_all_sampler_views(st, stObj);
}
else {
/* Make sure that the base texture image data is present in the
diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c
index 5996b7d1b..ada984189 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_texture.c
@@ -519,12 +519,14 @@ st_texture_release_sampler_view(struct st_context *st,
}
void
-st_texture_release_all_sampler_views(struct st_texture_object *stObj)
+st_texture_release_all_sampler_views(struct st_context *st,
+ struct st_texture_object *stObj)
{
GLuint i;
+ /* XXX This should use sampler_views[i]->pipe, not st->pipe */
for (i = 0; i < stObj->num_sampler_views; ++i)
- pipe_sampler_view_reference(&stObj->sampler_views[i], NULL);
+ pipe_sampler_view_release(st->pipe, &stObj->sampler_views[i]);
}
diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h
index ce1cf8b0a..d66afcb56 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.h
+++ b/mesalib/src/mesa/state_tracker/st_texture.h
@@ -255,7 +255,8 @@ st_texture_release_sampler_view(struct st_context *st,
struct st_texture_object *stObj);
extern void
-st_texture_release_all_sampler_views(struct st_texture_object *stObj);
+st_texture_release_all_sampler_views(struct st_context *st,
+ struct st_texture_object *stObj);
void
st_texture_free_sampler_views(struct st_texture_object *stObj);
diff --git a/mesalib/src/mesa/state_tracker/st_vdpau.c b/mesalib/src/mesa/state_tracker/st_vdpau.c
index 8c10cdaf3..6ccaf3e3f 100644
--- a/mesalib/src/mesa/state_tracker/st_vdpau.c
+++ b/mesalib/src/mesa/state_tracker/st_vdpau.c
@@ -139,7 +139,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
texFormat);
pipe_resource_reference(&stObj->pt, res);
- st_texture_release_all_sampler_views(stObj);
+ st_texture_release_all_sampler_views(st, stObj);
pipe_resource_reference(&stImage->pt, res);
u_sampler_view_default_template(&templ, res, res->format);
@@ -172,7 +172,7 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
struct st_texture_image *stImage = st_texture_image(texImage);
pipe_resource_reference(&stObj->pt, NULL);
- st_texture_release_all_sampler_views(stObj);
+ st_texture_release_all_sampler_views(st, stObj);
pipe_resource_reference(&stImage->pt, NULL);
_mesa_dirty_texobj(ctx, texObj);
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index 2871100ae..5f8250e78 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -997,7 +997,7 @@ 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);
+ exec->vtx.bufferobj = ctx->Driver.NewBufferObject(ctx, bufName);
if (!ctx->Driver.BufferData(ctx, target, size, NULL, usage,
GL_MAP_WRITE_BIT |
GL_DYNAMIC_STORAGE_BIT |
diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c
index 1c6b91942..848eedaa4 100644
--- a/mesalib/src/mesa/vbo/vbo_save_api.c
+++ b/mesalib/src/mesa/vbo/vbo_save_api.c
@@ -191,9 +191,7 @@ alloc_vertex_store(struct gl_context *ctx)
* user. Perhaps there could be a special number for internal
* buffers:
*/
- vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx,
- VBO_BUF_ID,
- GL_ARRAY_BUFFER_ARB);
+ vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx, VBO_BUF_ID);
if (vertex_store->bufferobj) {
save->out_of_memory =
!ctx->Driver.BufferData(ctx,