aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2011-11-02 13:50:02 -0700
committerKenneth Graunke <[email protected]>2011-11-10 22:51:19 -0800
commit4a42bd3931d6298ab9a84b76957ce5d83d289f69 (patch)
tree3959bcb9da9c5194d98d9bc5b3248787037fd854 /src
parenta7d0fa209b444e3c7ad9358f1d31e3f638c20e40 (diff)
i965: Split brw_wm_surfaces state into renderbuffer and texture atoms.
First, the texturing setup code is relevant for all pipeline stages, while renderbuffer surfaces are only used by the WM. Secondly, renderbuffer and texture setup depends on a different set of dirty bits. There's no reason to walk the array of textures when changing draw buffers, or vice-versa. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_state.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_upload.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c38
3 files changed, 35 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 3979206b3fb..9b11c6f1874 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -69,7 +69,8 @@ extern const struct brw_tracked_state brw_vs_unit;
extern const struct brw_tracked_state brw_wm_input_sizes;
extern const struct brw_tracked_state brw_wm_prog;
extern const struct brw_tracked_state brw_wm_samplers;
-extern const struct brw_tracked_state brw_wm_surfaces;
+extern const struct brw_tracked_state brw_renderbuffer_surfaces;
+extern const struct brw_tracked_state brw_texture_surfaces;
extern const struct brw_tracked_state brw_wm_binding_table;
extern const struct brw_tracked_state brw_wm_unit;
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index d3bc5e0f440..7f32c20da5d 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -67,7 +67,8 @@ static const struct brw_tracked_state *gen4_atoms[] =
&brw_wm_pull_constants, /* Before brw_wm_binding_table */
&brw_vs_surfaces, /* must do before unit */
- &brw_wm_surfaces, /* must do before samplers and unit */
+ &brw_renderbuffer_surfaces, /* must do before unit */
+ &brw_texture_surfaces, /* must do before unit */
&brw_wm_binding_table,
&brw_wm_samplers,
@@ -138,7 +139,8 @@ static const struct brw_tracked_state *gen6_atoms[] =
&gen6_wm_push_constants, /* Before wm_state */
&brw_vs_surfaces, /* must do before unit */
- &brw_wm_surfaces, /* must do before samplers and unit */
+ &brw_renderbuffer_surfaces, /* must do before unit */
+ &brw_texture_surfaces, /* must do before unit */
&brw_wm_binding_table,
&brw_wm_samplers,
@@ -202,7 +204,8 @@ const struct brw_tracked_state *gen7_atoms[] =
&gen6_wm_push_constants, /* Before wm_surfaces and constant_buffer */
&brw_vs_surfaces, /* must do before unit */
- &brw_wm_surfaces, /* must do before samplers and unit */
+ &brw_renderbuffer_surfaces, /* must do before unit */
+ &brw_texture_surfaces, /* must do before unit */
&brw_wm_binding_table,
&gen7_samplers,
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 1bce06c1eae..3bda5fa912a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -542,11 +542,10 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
}
/**
- * Constructs the set of surface state objects pointed to by the
- * binding table.
+ * Construct SURFACE_STATE objects for renderbuffers/draw buffers.
*/
static void
-brw_upload_wm_surfaces(struct brw_context *brw)
+brw_update_renderbuffer_surfaces(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &brw->intel.ctx;
@@ -565,15 +564,34 @@ brw_upload_wm_surfaces(struct brw_context *brw)
} else {
intel->vtbl.update_null_renderbuffer_surface(brw, 0);
}
+ brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
+}
+
+const struct brw_tracked_state brw_renderbuffer_surfaces = {
+ .dirty = {
+ .mesa = (_NEW_COLOR |
+ _NEW_BUFFERS),
+ .brw = BRW_NEW_BATCH,
+ .cache = 0
+ },
+ .emit = brw_update_renderbuffer_surfaces,
+};
- /* Update surfaces for textures */
- for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
+/**
+ * Construct SURFACE_STATE objects for enabled textures.
+ */
+static void
+brw_update_texture_surfaces(struct brw_context *brw)
+{
+ struct gl_context *ctx = &brw->intel.ctx;
+
+ for (unsigned i = 0; i < BRW_MAX_TEX_UNIT; i++) {
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
const GLuint surf = SURF_INDEX_TEXTURE(i);
/* _NEW_TEXTURE */
if (texUnit->_ReallyEnabled) {
- intel->vtbl.update_texture_surface(ctx, i);
+ brw->intel.vtbl.update_texture_surface(ctx, i);
} else {
brw->wm.surf_offset[surf] = 0;
}
@@ -582,15 +600,13 @@ brw_upload_wm_surfaces(struct brw_context *brw)
brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
}
-const struct brw_tracked_state brw_wm_surfaces = {
+const struct brw_tracked_state brw_texture_surfaces = {
.dirty = {
- .mesa = (_NEW_COLOR |
- _NEW_TEXTURE |
- _NEW_BUFFERS),
+ .mesa = _NEW_TEXTURE,
.brw = BRW_NEW_BATCH,
.cache = 0
},
- .emit = brw_upload_wm_surfaces,
+ .emit = brw_update_texture_surfaces,
};
/**