[Mesa-dev] [PATCH 4/5] i965: Scissor to the viewport when rendering points/lines.
Kenneth Graunke
kenneth at whitecape.org
Fri Mar 11 00:59:26 UTC 2016
We're about to start allowing wide points/lines whose vertices are
outside the viewport past the clipper. This scissoring hack ensures
that any fragments generated are still restricted to the viewport.
It is not necessary on Gen8+ as those platforms already discard
fragments which are outside the viewport.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94453
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94454
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/gen6_sf_state.c | 5 +++--
src/mesa/drivers/dri/i965/gen7_sf_state.c | 8 +++++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index 685fbdc..3626686 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -349,8 +349,9 @@ upload_sf_state(struct brw_context *brw)
unreachable("not reached");
}
- /* _NEW_SCISSOR */
- if (ctx->Scissor.EnableFlags)
+ /* _NEW_SCISSOR _NEW_POLYGON BRW_NEW_GEOMETRY_PROGRAM BRW_NEW_PRIMITIVE */
+ if (ctx->Scissor.EnableFlags ||
+ is_drawing_points(brw) || is_drawing_lines(brw))
dw3 |= GEN6_SF_SCISSOR_ENABLE;
/* _NEW_POLYGON */
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index b1f13ac..7c98c73 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -188,8 +188,9 @@ upload_sf_state(struct brw_context *brw)
dw2 |= GEN6_SF_CULL_NONE;
}
- /* _NEW_SCISSOR */
- if (ctx->Scissor.EnableFlags)
+ /* _NEW_SCISSOR _NEW_POLYGON BRW_NEW_GEOMETRY_PROGRAM BRW_NEW_PRIMITIVE */
+ if (ctx->Scissor.EnableFlags ||
+ is_drawing_points(brw) || is_drawing_lines(brw))
dw2 |= GEN6_SF_SCISSOR_ENABLE;
/* _NEW_LINE */
@@ -254,7 +255,8 @@ const struct brw_tracked_state gen7_sf_state = {
_NEW_POLYGON |
_NEW_PROGRAM |
_NEW_SCISSOR,
- .brw = BRW_NEW_CONTEXT,
+ .brw = BRW_NEW_CONTEXT |
+ BRW_NEW_PRIMITIVE,
},
.emit = upload_sf_state,
};
--
2.7.2
More information about the mesa-dev
mailing list