From: Carl Worth Date: Fri, 20 Mar 2015 19:01:33 +0000 (-0700) Subject: i965: Split out per-stage dirty-bit checking into separate functions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a57672f18deca3060eab129a77cf84f5e420bac8;p=mesa.git i965: Split out per-stage dirty-bit checking into separate functions The dirty-bit checking from each brw_upload__prog function is split out into its a new brw__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 Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_ff_gs.c b/src/mesa/drivers/dri/i965/brw_ff_gs.c index 14ae4c144e9..b3cbbe8b919 100644 --- a/src/mesa/drivers/dri/i965/brw_ff_gs.c +++ b/src/mesa/drivers/dri/i965/brw_ff_gs.c @@ -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: diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index e2330499ea0..6f7f1298e47 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -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) { diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 9069596489a..2846ff69be5 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index a0eda3a8b94..b85f236b8ea 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -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);