i965: Split the brw_samplers atom into separate FS/VS stages.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 26 Jun 2013 22:42:43 +0000 (15:42 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 19 Aug 2013 20:17:00 +0000 (13:17 -0700)
This allows us to avoid uploading the VS sampler state table if only the
fragment program changes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/brw_wm_sampler_state.c

index 6eaa4a64d1ec54e0a5e2a4c78694bd2ef4c606ae..0127e107e3c8aa7cc73a835b8d4f3076a46d1fc2 100644 (file)
@@ -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;
index 3f34d39268d8faea330c5640ef326b672506bdb2..4c11276efc4ba788a85b081ee526c540bb2a7048 100644 (file)
@@ -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,
index e8d47d06e9c1affaf37336c4273dfa77e0bf87c8..a03953f17cdf5ea36548c56ff201d8f0b73cd729 100644 (file)
@@ -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)
 {