aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_clip.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2017-01-13 14:29:52 -0800
committerKenneth Graunke <[email protected]>2017-01-13 17:25:48 -0800
commit0d5071db5e50629a63490639a3c86dfc65bf27ab (patch)
tree3edcacffce10a0106263994c1a6ce7e095afd34b /src/mesa/drivers/dri/i965/brw_clip.c
parent40a8f9e6f2d048e0fd32f9a974cc0ca58ad1335e (diff)
i965: Move Gen4-5 interpolation stuff to brw_wm_prog_data.
This fixes glxgears rendering, which had surprisingly been broken since late October! Specifically, commit 91d61fbf7cb61a44adcaae51ee08ad0dd6b. glxgears uses glShadeModel(GL_FLAT) when drawing the main portion of the gears, then uses glShadeModel(GL_SMOOTH) for drawing the Gouraud-shaded inner portion of the gears. This results in the same fragment program having two different state-dependent interpolation maps: one where gl_Color is flat, and another where it's smooth. The problem is that there's only one gen4_fragment_program, so it can't store both. Each FS compile would trash the last one. But, the FS compiles are cached, so the first one would store FLAT, and the second would see a matching program in the cache and never bother to compile one with SMOOTH. (Clearing the program cache on every draw made it render correctly.) Instead, move it to brw_wm_prog_data, where we can keep a copy for every specialization of the program. The only downside is bloating the structure a bit, but we can tighten that up a bit if we need to. This also lets us kill gen4_fragment_program entirely! Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_clip.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c
index 8560dd45996..e375674ec15 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -139,7 +139,7 @@ brw_upload_clip_prog(struct brw_context *brw)
_NEW_POLYGON |
_NEW_TRANSFORM,
BRW_NEW_BLORP |
- BRW_NEW_FRAGMENT_PROGRAM |
+ BRW_NEW_FS_PROG_DATA |
BRW_NEW_REDUCED_PRIMITIVE |
BRW_NEW_VUE_MAP_GEOM_OUT))
return;
@@ -149,15 +149,14 @@ brw_upload_clip_prog(struct brw_context *brw)
/* Populate the key:
*/
- const struct gl_program *fprog = brw->fragment_program;
- if (fprog) {
- assert(brw->gen < 6);
- struct gen4_fragment_program *p = (struct gen4_fragment_program *) fprog;
-
- /* BRW_NEW_FRAGMENT_PROGRAM */
- key.contains_flat_varying = p->contains_flat_varying;
- key.contains_noperspective_varying = p->contains_noperspective_varying;
- key.interp_mode = p->interp_mode;
+ /* BRW_NEW_FS_PROG_DATA */
+ const struct brw_wm_prog_data *wm_prog_data =
+ brw_wm_prog_data(brw->wm.base.prog_data);
+ if (wm_prog_data) {
+ key.contains_flat_varying = wm_prog_data->contains_flat_varying;
+ key.contains_noperspective_varying =
+ wm_prog_data->contains_noperspective_varying;
+ key.interp_mode = wm_prog_data->interp_mode;
}
/* BRW_NEW_REDUCED_PRIMITIVE */