summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2014-08-31 10:26:49 -0700
committerKenneth Graunke <kenneth@whitecape.org>2015-01-10 19:27:10 -0800
commit973022283cc3b174dd1f764503718cae95e44fc1 (patch)
tree786086af0d81d4f2cefe9e0839038d0a6709ca94
parent0ae71b48a12b61222d9c7d44f54bbd3c71d2bbbf (diff)
i965: Disable clipping for RECTLIST primitives on Gen4-5.
We've never used rectangle primitives on Gen4-5 up until now, and attempting to emit one will trigger unreachable assertions when switching on the GL primitive type. On Gen6+, rectangle primitives aren't clipped properly, and are only used for driver-internal blit-like functionality, where we don't need clipping anyway. So, when using RECTLISTs, simply disable clipping by setting it to "accept all" mode. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_state.c10
2 files changed, 16 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c
index 3fef38ccab..f1874444dd 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -140,6 +140,14 @@ brw_upload_clip_prog(struct brw_context *brw)
memset(&key, 0, sizeof(key));
+ /* BRW_NEW_PRIMITIVE or BRW_NEW_REDUCED_PRIMITIVE */
+ if (brw->primitive == _3DPRIM_RECTLIST) {
+ /* Don't emit a clip program. We'll disable clipping. */
+ brw->clip.prog_offset = 0;
+ brw->clip.prog_data = NULL;
+ return;
+ }
+
/* Populate the key:
*/
diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c
index 09a2523d8a..5d301d9bba 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_state.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_state.c
@@ -67,6 +67,14 @@ brw_upload_clip_unit(struct brw_context *brw)
sizeof(*clip), 32, &brw->clip.state_offset);
memset(clip, 0, sizeof(*clip));
+ brw->state.dirty.brw |= BRW_NEW_GEN4_UNIT_STATE;
+
+ if (brw->clip.prog_data == NULL) {
+ /* A missing clip program means we want clipping disabled. */
+ clip->clip5.clip_mode = BRW_CLIPMODE_ACCEPT_ALL;
+ return;
+ }
+
/* BRW_NEW_PROGRAM_CACHE | BRW_NEW_CLIP_PROG_DATA */
clip->thread0.grf_reg_count = (ALIGN(brw->clip.prog_data->total_grf, 16) /
16 - 1);
@@ -157,8 +165,6 @@ brw_upload_clip_unit(struct brw_context *brw)
clip->viewport_xmax = 1;
clip->viewport_ymin = -1;
clip->viewport_ymax = 1;
-
- brw->state.dirty.brw |= BRW_NEW_GEN4_UNIT_STATE;
}
const struct brw_tracked_state brw_clip_unit = {