summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_upload.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c5
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffer_objects.c13
-rw-r--r--src/mesa/main/bufferobj.c3
-rw-r--r--src/mesa/main/mtypes.h6
-rw-r--r--src/mesa/main/uniforms.c4
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c9
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c4
-rw-r--r--src/mesa/state_tracker/st_context.c1
-rw-r--r--src/mesa/state_tracker/st_context.h1
13 files changed, 41 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index a676415dde0..745a1172772 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -152,6 +152,7 @@ brwCreateContext(int api,
ctx->DriverFlags.NewTransformFeedback = BRW_NEW_TRANSFORM_FEEDBACK;
ctx->DriverFlags.NewRasterizerDiscard = BRW_NEW_RASTERIZER_DISCARD;
+ ctx->DriverFlags.NewUniformBuffer = BRW_NEW_UNIFORM_BUFFER;
ctx->Const.MaxDualSourceDrawBuffers = 1;
ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index c6825018ddc..9baf57bc05c 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -153,6 +153,7 @@ enum brw_state_id {
BRW_STATE_TRANSFORM_FEEDBACK,
BRW_STATE_RASTERIZER_DISCARD,
BRW_STATE_STATS_WM,
+ BRW_STATE_UNIFORM_BUFFER
};
#define BRW_NEW_URB_FENCE (1 << BRW_STATE_URB_FENCE)
@@ -184,6 +185,7 @@ enum brw_state_id {
#define BRW_NEW_TRANSFORM_FEEDBACK (1 << BRW_STATE_TRANSFORM_FEEDBACK)
#define BRW_NEW_RASTERIZER_DISCARD (1 << BRW_STATE_RASTERIZER_DISCARD)
#define BRW_NEW_STATS_WM (1 << BRW_STATE_STATS_WM)
+#define BRW_NEW_UNIFORM_BUFFER (1 << BRW_STATE_UNIFORM_BUFFER)
struct brw_state_flags {
/** State update flags signalled by mesa internals */
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 270b3f46b8b..cdc26574910 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -372,6 +372,7 @@ static struct dirty_bit_map brw_bits[] = {
DEFINE_BIT(BRW_NEW_VUE_MAP_GEOM_OUT),
DEFINE_BIT(BRW_NEW_TRANSFORM_FEEDBACK),
DEFINE_BIT(BRW_NEW_RASTERIZER_DISCARD),
+ DEFINE_BIT(BRW_NEW_UNIFORM_BUFFER),
{0, 0, 0}
};
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index 968cc0336f7..cbad0713bde 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -122,9 +122,8 @@ brw_upload_vs_ubo_surfaces(struct brw_context *brw)
const struct brw_tracked_state brw_vs_ubo_surfaces = {
.dirty = {
- .mesa = (_NEW_PROGRAM |
- _NEW_BUFFER_OBJECT),
- .brw = BRW_NEW_BATCH,
+ .mesa = _NEW_PROGRAM,
+ .brw = BRW_NEW_BATCH | BRW_NEW_UNIFORM_BUFFER,
.cache = 0,
},
.emit = brw_upload_vs_ubo_surfaces,
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index b067f6db9e8..046c4e8c4ee 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1564,9 +1564,8 @@ brw_upload_wm_ubo_surfaces(struct brw_context *brw)
const struct brw_tracked_state brw_wm_ubo_surfaces = {
.dirty = {
- .mesa = (_NEW_PROGRAM |
- _NEW_BUFFER_OBJECT),
- .brw = BRW_NEW_BATCH,
+ .mesa = _NEW_PROGRAM,
+ .brw = BRW_NEW_BATCH | BRW_NEW_UNIFORM_BUFFER,
.cache = 0,
},
.emit = brw_upload_wm_ubo_surfaces,
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 996518b4e92..f568864f4b4 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -39,6 +39,10 @@
#include "intel_mipmap_tree.h"
#include "intel_regions.h"
+#ifndef I915
+#include "brw_context.h"
+#endif
+
static GLboolean
intel_bufferobj_unmap(struct gl_context * ctx, struct gl_buffer_object *obj);
@@ -49,6 +53,15 @@ intel_bufferobj_alloc_buffer(struct intel_context *intel,
{
intel_obj->buffer = drm_intel_bo_alloc(intel->bufmgr, "bufferobj",
intel_obj->Base.Size, 64);
+
+#ifndef I915
+ /* the buffer might be bound as a uniform buffer, need to update it
+ */
+ {
+ struct brw_context *brw = brw_context(&intel->ctx);
+ brw->state.dirty.brw |= BRW_NEW_UNIFORM_BUFFER;
+ }
+#endif
}
static void
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index e482c91cd0a..1566cb4c509 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2060,7 +2060,8 @@ set_ubo_binding(struct gl_context *ctx,
return;
}
- FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer;
_mesa_reference_buffer_object(ctx, &binding->BufferObject, bufObj);
binding->Offset = offset;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 137f0e3df0a..9e6ea8aed4b 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3333,6 +3333,12 @@ struct gl_driver_flags
/** gl_context::RasterDiscard */
GLbitfield NewRasterizerDiscard;
+
+ /**
+ * gl_context::UniformBufferBindings
+ * gl_shader_program::UniformBlocks
+ */
+ GLbitfield NewUniformBuffer;
};
struct gl_uniform_buffer_binding
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index a53e8e112c9..f0d80f0c812 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -631,7 +631,9 @@ _mesa_UniformBlockBinding(GLuint program,
uniformBlockBinding) {
int i;
- FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT);
+ FLUSH_VERTICES(ctx, 0);
+ ctx->NewDriverState |= ctx->DriverFlags.NewUniformBuffer;
+
shProg->UniformBlocks[uniformBlockIndex].Binding = uniformBlockBinding;
for (i = 0; i < MESA_SHADER_TYPES; i++) {
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index ed69166f6b5..ef208bc36fa 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -217,8 +217,8 @@ static void bind_vs_ubos(struct st_context *st)
const struct st_tracked_state st_bind_vs_ubos = {
"st_bind_vs_ubos",
{
- (_NEW_PROGRAM | _NEW_BUFFER_OBJECT),
- ST_NEW_VERTEX_PROGRAM,
+ _NEW_PROGRAM,
+ ST_NEW_VERTEX_PROGRAM | ST_NEW_UNIFORM_BUFFER,
},
bind_vs_ubos
};
@@ -231,14 +231,13 @@ static void bind_fs_ubos(struct st_context *st)
return;
st_bind_ubos(st, prog->_LinkedShaders[MESA_SHADER_FRAGMENT], PIPE_SHADER_FRAGMENT);
-
}
const struct st_tracked_state st_bind_fs_ubos = {
"st_bind_fs_ubos",
{
- (_NEW_PROGRAM | _NEW_BUFFER_OBJECT),
- ST_NEW_FRAGMENT_PROGRAM,
+ _NEW_PROGRAM,
+ ST_NEW_FRAGMENT_PROGRAM | ST_NEW_UNIFORM_BUFFER,
},
bind_fs_ubos
};
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 8ff32c84291..d166fe64414 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -247,9 +247,11 @@ st_bufferobj_data(struct gl_context *ctx,
if (data)
pipe_buffer_write(pipe, st_obj->buffer, 0, size, data);
- return GL_TRUE;
}
+ /* BufferData may change a uniform buffer, need to update it */
+ st->dirty.st |= ST_NEW_UNIFORM_BUFFER;
+
return GL_TRUE;
}
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 25e895b4a9d..dccf87bc326 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -209,6 +209,7 @@ static void st_init_driver_flags(struct gl_driver_flags *f)
{
f->NewArray = ST_NEW_VERTEX_ARRAYS;
f->NewRasterizerDiscard = ST_NEW_RASTERIZER;
+ f->NewUniformBuffer = ST_NEW_UNIFORM_BUFFER;
}
struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 451217ff69e..ab89b49473c 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -51,6 +51,7 @@ struct u_upload_mgr;
#define ST_NEW_GEOMETRY_PROGRAM (1 << 5)
#define ST_NEW_VERTEX_ARRAYS (1 << 6)
#define ST_NEW_RASTERIZER (1 << 7)
+#define ST_NEW_UNIFORM_BUFFER (1 << 8)
struct st_state_flags {