summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2013-06-26 15:42:43 -0700
committerKenneth Graunke <[email protected]>2013-08-19 13:17:00 -0700
commitc6e572275b60f0221691b9b97650b9b41b89a5a2 (patch)
tree9f9035f4fabc16a292bf71f36c8736206d633e0e /src/mesa
parent7e01af662ad12bd2b27034f3ca7687e2986b5dbd (diff)
i965: Split the brw_samplers atom into separate FS/VS stages.
This allows us to avoid uploading the VS sampler state table if only the fragment program changes. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa')
-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_sampler_state.c25
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 6eaa4a64d1e..0127e107e3c 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 3f34d39268d..4c11276efc4 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 e8d47d06e9c..a03953f17cd 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)
{