summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-04-27 11:25:26 -0700
committerKenneth Graunke <[email protected]>2016-05-16 00:11:49 -0700
commit7b70a12e1c6dffc63fbcec6a89af3e02ba9a1a1d (patch)
tree6ac2042d5066ca102b23cd8fb4ecc4163b09da31 /src
parentb23b099a0bc3ea0c6857b342b6d75f0dbfc334bd (diff)
i965: Move Gen4-5 programs to brw_upload_programs() too.
This way all the programs are in one place again, and it also should make some future STATE_BASE_ADDRESS related changes possible. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip.c28
-rw-r--r--src/mesa/drivers/dri/i965/brw_interpolation_map.c20
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf.c36
-rw-r--r--src/mesa/drivers/dri/i965/brw_state.h12
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_upload.c11
5 files changed, 51 insertions, 56 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c
index 9baaddd0ab0..4c9d5c56c12 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -132,12 +132,23 @@ static void compile_clip_prog( struct brw_context *brw,
/* Calculate interpolants for triangle and line rasterization.
*/
-static void
+void
brw_upload_clip_prog(struct brw_context *brw)
{
struct gl_context *ctx = &brw->ctx;
struct brw_clip_prog_key key;
+ if (!brw_state_dirty(brw,
+ _NEW_BUFFERS |
+ _NEW_LIGHT |
+ _NEW_POLYGON |
+ _NEW_TRANSFORM,
+ BRW_NEW_BLORP |
+ BRW_NEW_INTERPOLATION_MAP |
+ BRW_NEW_REDUCED_PRIMITIVE |
+ BRW_NEW_VUE_MAP_GEOM_OUT))
+ return;
+
memset(&key, 0, sizeof(key));
/* Populate the key:
@@ -252,18 +263,3 @@ brw_upload_clip_prog(struct brw_context *brw)
compile_clip_prog( brw, &key );
}
}
-
-
-const struct brw_tracked_state brw_clip_prog = {
- .dirty = {
- .mesa = _NEW_BUFFERS |
- _NEW_LIGHT |
- _NEW_POLYGON |
- _NEW_TRANSFORM,
- .brw = BRW_NEW_BLORP |
- BRW_NEW_INTERPOLATION_MAP |
- BRW_NEW_REDUCED_PRIMITIVE |
- BRW_NEW_VUE_MAP_GEOM_OUT,
- },
- .emit = brw_upload_clip_prog
-};
diff --git a/src/mesa/drivers/dri/i965/brw_interpolation_map.c b/src/mesa/drivers/dri/i965/brw_interpolation_map.c
index 0b8c1be84e0..87b35d8d59d 100644
--- a/src/mesa/drivers/dri/i965/brw_interpolation_map.c
+++ b/src/mesa/drivers/dri/i965/brw_interpolation_map.c
@@ -36,12 +36,19 @@ static char const *get_qual_name(int mode)
/* Set up interpolation modes for every element in the VUE */
-static void
+void
brw_setup_vue_interpolation(struct brw_context *brw)
{
const struct gl_fragment_program *fprog = brw->fragment_program;
struct brw_vue_map *vue_map = &brw->vue_map_geom_out;
+ if (!brw_state_dirty(brw,
+ _NEW_LIGHT,
+ BRW_NEW_BLORP |
+ BRW_NEW_FRAGMENT_PROGRAM |
+ BRW_NEW_VUE_MAP_GEOM_OUT))
+ return;
+
memset(&brw->interpolation_mode, INTERP_QUALIFIER_NONE, sizeof(brw->interpolation_mode));
brw->ctx.NewDriverState |= BRW_NEW_INTERPOLATION_MAP;
@@ -100,14 +107,3 @@ brw_setup_vue_interpolation(struct brw_context *brw)
}
}
}
-
-
-const struct brw_tracked_state brw_interpolation_map = {
- .dirty = {
- .mesa = _NEW_LIGHT,
- .brw = BRW_NEW_BLORP |
- BRW_NEW_FRAGMENT_PROGRAM |
- BRW_NEW_VUE_MAP_GEOM_OUT,
- },
- .emit = brw_setup_vue_interpolation
-};
diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c
index c03af8201a2..c85d8bc0ea2 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.c
+++ b/src/mesa/drivers/dri/i965/brw_sf.c
@@ -133,11 +133,26 @@ static void compile_sf_prog( struct brw_context *brw,
/* Calculate interpolants for triangle and line rasterization.
*/
-static void
+void
brw_upload_sf_prog(struct brw_context *brw)
{
struct gl_context *ctx = &brw->ctx;
struct brw_sf_prog_key key;
+
+ if (!brw_state_dirty(brw,
+ _NEW_BUFFERS |
+ _NEW_HINT |
+ _NEW_LIGHT |
+ _NEW_POINT |
+ _NEW_POLYGON |
+ _NEW_PROGRAM |
+ _NEW_TRANSFORM,
+ BRW_NEW_BLORP |
+ BRW_NEW_INTERPOLATION_MAP |
+ BRW_NEW_REDUCED_PRIMITIVE |
+ BRW_NEW_VUE_MAP_GEOM_OUT))
+ return;
+
/* _NEW_BUFFERS */
bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
@@ -213,22 +228,3 @@ brw_upload_sf_prog(struct brw_context *brw)
compile_sf_prog( brw, &key );
}
}
-
-
-const struct brw_tracked_state brw_sf_prog = {
- .dirty = {
- .mesa = _NEW_BUFFERS |
- _NEW_HINT |
- _NEW_LIGHT |
- _NEW_POINT |
- _NEW_POLYGON |
- _NEW_PROGRAM |
- _NEW_TRANSFORM,
- .brw = BRW_NEW_BLORP |
- BRW_NEW_INTERPOLATION_MAP |
- BRW_NEW_REDUCED_PRIMITIVE |
- BRW_NEW_VUE_MAP_GEOM_OUT,
- },
- .emit = brw_upload_sf_prog
-};
-
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 9c369460455..7adebad7f3b 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -45,7 +45,6 @@ enum intel_msaa_layout;
extern const struct brw_tracked_state brw_blend_constant_color;
extern const struct brw_tracked_state brw_cc_vp;
extern const struct brw_tracked_state brw_cc_unit;
-extern const struct brw_tracked_state brw_clip_prog;
extern const struct brw_tracked_state brw_clip_unit;
extern const struct brw_tracked_state brw_vs_pull_constants;
extern const struct brw_tracked_state brw_tcs_pull_constants;
@@ -65,7 +64,6 @@ 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_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;
@@ -102,7 +100,6 @@ extern const struct brw_tracked_state brw_cs_ubo_surfaces;
extern const struct brw_tracked_state brw_cs_abo_surfaces;
extern const struct brw_tracked_state brw_cs_image_surfaces;
extern const struct brw_tracked_state brw_wm_unit;
-extern const struct brw_tracked_state brw_interpolation_map;
extern const struct brw_tracked_state brw_psp_urb_cbs;
@@ -415,6 +412,15 @@ void gen7_enable_hw_binding_tables(struct brw_context *brw);
void gen7_disable_hw_binding_tables(struct brw_context *brw);
void gen7_reset_hw_bt_pool_offsets(struct brw_context *brw);
+/* brw_interpolation_map.c */
+void brw_setup_vue_interpolation(struct brw_context *brw);
+
+/* brw_clip.c */
+void brw_upload_clip_prog(struct brw_context *brw);
+
+/* brw_sf.c */
+void brw_upload_sf_prog(struct brw_context *brw);
+
/* gen7_l3_state.c */
void
gen7_restore_default_l3_config(struct brw_context *brw);
diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 56bb95cd802..a70b246c5ce 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -45,11 +45,6 @@
static const struct brw_tracked_state *gen4_atoms[] =
{
- &brw_interpolation_map,
-
- &brw_clip_prog, /* must do before state base address */
- &brw_sf_prog, /* must do before state base address */
-
/* Once all the programs are done, we know how large urb entry
* sizes need to be and can decide if we need to change the urb
* layout.
@@ -749,6 +744,12 @@ brw_upload_programs(struct brw_context *brw,
old_separate != brw->vue_map_geom_out.separate)
brw->ctx.NewDriverState |= BRW_NEW_VUE_MAP_GEOM_OUT;
+ if (brw->gen < 6) {
+ brw_setup_vue_interpolation(brw);
+ brw_upload_clip_prog(brw);
+ brw_upload_sf_prog(brw);
+ }
+
brw_upload_wm_prog(brw);
} else if (pipeline == BRW_COMPUTE_PIPELINE) {
brw_upload_cs_prog(brw);