[Mesa-dev] [PATCH 07/10] i965: Split the brw_samplers atom into separate FS/VS stages.
Kenneth Graunke
kenneth at whitecape.org
Wed Aug 14 18:55:13 PDT 2013
This allows us to avoid uploading the VS sampler state table if only the
fragment program changes.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_state.h | 3 ++-
src/mesa/drivers/dri/i965/brw_state_upload.c | 9 ++++++---
src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 25 +++++++++++++++++++-----
3 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 6eaa4a6..0127e10 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -51,6 +51,7 @@ extern const struct brw_tracked_state brw_wm_pull_constants;
extern const struct brw_tracked_state brw_constant_buffer;
extern const struct brw_tracked_state brw_curbe_offsets;
extern const struct brw_tracked_state brw_invariant_state;
+extern const struct brw_tracked_state brw_fs_samplers;
extern const struct brw_tracked_state brw_gs_prog;
extern const struct brw_tracked_state brw_gs_unit;
extern const struct brw_tracked_state brw_line_stipple;
@@ -60,13 +61,13 @@ extern const struct brw_tracked_state brw_depthbuffer;
extern const struct brw_tracked_state brw_polygon_stipple_offset;
extern const struct brw_tracked_state brw_polygon_stipple;
extern const struct brw_tracked_state brw_recalculate_urb_fence;
-extern const struct brw_tracked_state brw_samplers;
extern const struct brw_tracked_state brw_sf_prog;
extern const struct brw_tracked_state brw_sf_unit;
extern const struct brw_tracked_state brw_sf_vp;
extern const struct brw_tracked_state brw_state_base_address;
extern const struct brw_tracked_state brw_urb_fence;
extern const struct brw_tracked_state brw_vs_prog;
+extern const struct brw_tracked_state brw_vs_samplers;
extern const struct brw_tracked_state brw_vs_ubo_surfaces;
extern const struct brw_tracked_state brw_vs_unit;
extern const struct brw_tracked_state brw_wm_prog;
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 3f34d39..4c11276 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -68,7 +68,8 @@ static const struct brw_tracked_state *gen4_atoms[] =
&brw_vs_binding_table,
&brw_wm_binding_table,
- &brw_samplers,
+ &brw_fs_samplers,
+ &brw_vs_samplers,
/* These set up state for brw_psp_urb_cbs */
&brw_wm_unit,
@@ -143,7 +144,8 @@ static const struct brw_tracked_state *gen6_atoms[] =
&gen6_gs_binding_table,
&brw_wm_binding_table,
- &brw_samplers,
+ &brw_fs_samplers,
+ &brw_vs_samplers,
&gen6_sampler_state,
&gen6_multisample_state,
@@ -206,7 +208,8 @@ static const struct brw_tracked_state *gen7_atoms[] =
&brw_vs_binding_table,
&brw_wm_binding_table,
- &brw_samplers,
+ &brw_fs_samplers,
+ &brw_vs_samplers,
&gen6_multisample_state,
&gen7_disable_stages,
diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index e8d47d0..a03953f 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -404,7 +404,7 @@ brw_upload_sampler_state_table(struct brw_context *brw,
}
static void
-brw_upload_samplers(struct brw_context *brw)
+brw_upload_fs_samplers(struct brw_context *brw)
{
/* BRW_NEW_FRAGMENT_PROGRAM */
struct gl_program *fs = (struct gl_program *) brw->fragment_program;
@@ -412,7 +412,21 @@ brw_upload_samplers(struct brw_context *brw)
&brw->wm.sampler_count,
&brw->wm.sampler_offset,
brw->wm.sdc_offset);
+}
+
+const struct brw_tracked_state brw_fs_samplers = {
+ .dirty = {
+ .mesa = _NEW_TEXTURE,
+ .brw = BRW_NEW_BATCH |
+ BRW_NEW_FRAGMENT_PROGRAM,
+ .cache = 0
+ },
+ .emit = brw_upload_fs_samplers,
+};
+static void
+brw_upload_vs_samplers(struct brw_context *brw)
+{
/* BRW_NEW_VERTEX_PROGRAM */
struct gl_program *vs = (struct gl_program *) brw->vertex_program;
brw->vtbl.upload_sampler_state_table(brw, vs,
@@ -421,17 +435,18 @@ brw_upload_samplers(struct brw_context *brw)
brw->vs.sdc_offset);
}
-const struct brw_tracked_state brw_samplers = {
+
+const struct brw_tracked_state brw_vs_samplers = {
.dirty = {
.mesa = _NEW_TEXTURE,
.brw = BRW_NEW_BATCH |
- BRW_NEW_VERTEX_PROGRAM |
- BRW_NEW_FRAGMENT_PROGRAM,
+ BRW_NEW_VERTEX_PROGRAM,
.cache = 0
},
- .emit = brw_upload_samplers,
+ .emit = brw_upload_vs_samplers,
};
+
void
gen4_init_vtable_sampler_functions(struct brw_context *brw)
{
--
1.8.3.4
More information about the mesa-dev
mailing list