i965: Split out per-stage dirty-bit checking into separate functions

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>
This commit is contained in:
Carl Worth
2015-03-20 12:01:33 -07:00
parent 28510d69ff
commit a57672f18d
4 changed files with 59 additions and 35 deletions
+11 -5
View 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:
+11 -5
View 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) {
+15 -9
View 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);
+22 -16
View 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);