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;
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)
#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 */
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}
};
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,
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,
#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);
{
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
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;
/** gl_context::RasterDiscard */
GLbitfield NewRasterizerDiscard;
+
+ /**
+ * gl_context::UniformBufferBindings
+ * gl_shader_program::UniformBlocks
+ */
+ GLbitfield NewUniformBuffer;
};
struct gl_uniform_buffer_binding
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++) {
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
};
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
};
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;
}
{
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,
#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 {