i965: Split out per-stage dirty-bit checking into separate functions
authorCarl Worth <cworth@cworth.org>
Fri, 20 Mar 2015 19:01:33 +0000 (12:01 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 3 Apr 2015 05:15:45 +0000 (22:15 -0700)
The dirty-bit checking from each brw_upload_<stage>_prog function is
split out into its a new brw_<stage>_state_dirty function.

This commit is intended to have no functional change. It exists in
preparation for some upcoming code movement in preparation for the
shader cache.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_ff_gs.c
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_wm.c

index 14ae4c144e9f47502417755d9158c33435be5b0b..b3cbbe8b919e6dffd0df00accf6d72663ba3920c 100644 (file)
@@ -147,6 +147,16 @@ static void compile_ff_gs_prog(struct brw_context *brw,
    ralloc_free(mem_ctx);
 }
 
+static bool
+brw_ff_gs_state_dirty(struct brw_context *brw)
+{
+   return brw_state_dirty(brw,
+                          _NEW_LIGHT,
+                          BRW_NEW_PRIMITIVE |
+                          BRW_NEW_TRANSFORM_FEEDBACK |
+                          BRW_NEW_VS_PROG_DATA);
+}
+
 static void
 brw_ff_gs_populate_key(struct brw_context *brw,
                        struct brw_ff_gs_prog_key *key)
@@ -227,11 +237,7 @@ brw_upload_ff_gs_prog(struct brw_context *brw)
 {
    struct brw_ff_gs_prog_key key;
 
-   if (!brw_state_dirty(brw,
-                        _NEW_LIGHT,
-                        BRW_NEW_PRIMITIVE |
-                        BRW_NEW_TRANSFORM_FEEDBACK |
-                        BRW_NEW_VS_PROG_DATA))
+   if (!brw_ff_gs_state_dirty(brw))
       return;
 
    /* Populate the key:
index e2330499ea01ab2242a013251782d030463b819c..6f7f1298e47b6eaa206539d2e9040ee802688f97 100644 (file)
@@ -288,6 +288,16 @@ do_gs_prog(struct brw_context *brw,
    return true;
 }
 
+static bool
+brw_gs_state_dirty(struct brw_context *brw)
+{
+   return brw_state_dirty(brw,
+                          _NEW_TEXTURE,
+                          BRW_NEW_GEOMETRY_PROGRAM |
+                          BRW_NEW_TRANSFORM_FEEDBACK |
+                          BRW_NEW_VUE_MAP_VS);
+}
+
 static void
 brw_gs_populate_key(struct brw_context *brw,
                     struct brw_gs_prog_key *key)
@@ -322,11 +332,7 @@ brw_upload_gs_prog(struct brw_context *brw)
    struct brw_geometry_program *gp =
       (struct brw_geometry_program *) brw->geometry_program;
 
-   if (!brw_state_dirty(brw,
-                        _NEW_TEXTURE,
-                        BRW_NEW_GEOMETRY_PROGRAM |
-                        BRW_NEW_TRANSFORM_FEEDBACK |
-                        BRW_NEW_VUE_MAP_VS))
+   if (!brw_gs_state_dirty(brw))
       return;
 
    if (gp == NULL) {
index 9069596489aa4c636e979108266604de499712be..2846ff69be5d63880f235c8f11bcb7847e1c9d34 100644 (file)
@@ -401,6 +401,20 @@ brw_setup_vue_key_clip_info(struct brw_context *brw,
    }
 }
 
+static bool
+brw_vs_state_dirty(struct brw_context *brw)
+{
+   return brw_state_dirty(brw,
+                          _NEW_BUFFERS |
+                          _NEW_LIGHT |
+                          _NEW_POINT |
+                          _NEW_POLYGON |
+                          _NEW_TEXTURE |
+                          _NEW_TRANSFORM,
+                          BRW_NEW_VERTEX_PROGRAM |
+                          BRW_NEW_VS_ATTRIB_WORKAROUNDS);
+}
+
 static void
 brw_vs_populate_key(struct brw_context *brw,
                     struct brw_vs_prog_key *key)
@@ -459,15 +473,7 @@ brw_upload_vs_prog(struct brw_context *brw)
    struct brw_vertex_program *vp =
       (struct brw_vertex_program *)brw->vertex_program;
 
-   if (!brw_state_dirty(brw,
-                        _NEW_BUFFERS |
-                        _NEW_LIGHT |
-                        _NEW_POINT |
-                        _NEW_POLYGON |
-                        _NEW_TEXTURE |
-                        _NEW_TRANSFORM,
-                        BRW_NEW_VERTEX_PROGRAM |
-                        BRW_NEW_VS_ATTRIB_WORKAROUNDS))
+   if (!brw_vs_state_dirty(brw))
       return;
 
    brw_vs_populate_key(brw, &key);
index a0eda3a8b94537247abc54f4caf26e9f5bf1cd7d..b85f236b8ea84d591bcbb8633cf2342697afe466 100644 (file)
@@ -421,6 +421,27 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
    }
 }
 
+static bool
+brw_wm_state_dirty (struct brw_context *brw)
+{
+   return brw_state_dirty(brw,
+                          _NEW_BUFFERS |
+                          _NEW_COLOR |
+                          _NEW_DEPTH |
+                          _NEW_FRAG_CLAMP |
+                          _NEW_HINT |
+                          _NEW_LIGHT |
+                          _NEW_LINE |
+                          _NEW_MULTISAMPLE |
+                          _NEW_POLYGON |
+                          _NEW_STENCIL |
+                          _NEW_TEXTURE,
+                          BRW_NEW_FRAGMENT_PROGRAM |
+                          BRW_NEW_REDUCED_PRIMITIVE |
+                          BRW_NEW_STATS_WM |
+                          BRW_NEW_VUE_MAP_GEOM_OUT);
+}
+
 static void brw_wm_populate_key( struct brw_context *brw,
                                 struct brw_wm_prog_key *key )
 {
@@ -590,22 +611,7 @@ brw_upload_wm_prog(struct brw_context *brw)
    struct brw_fragment_program *fp = (struct brw_fragment_program *)
       brw->fragment_program;
 
-   if (!brw_state_dirty(brw,
-                        _NEW_BUFFERS |
-                        _NEW_COLOR |
-                        _NEW_DEPTH |
-                        _NEW_FRAG_CLAMP |
-                        _NEW_HINT |
-                        _NEW_LIGHT |
-                        _NEW_LINE |
-                        _NEW_MULTISAMPLE |
-                        _NEW_POLYGON |
-                        _NEW_STENCIL |
-                        _NEW_TEXTURE,
-                        BRW_NEW_FRAGMENT_PROGRAM |
-                        BRW_NEW_REDUCED_PRIMITIVE |
-                        BRW_NEW_STATS_WM |
-                        BRW_NEW_VUE_MAP_GEOM_OUT))
+   if (!brw_wm_state_dirty(brw))
       return;
 
    brw_wm_populate_key(brw, &key);