summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/gen6_sf_state.c57
-rw-r--r--src/mesa/drivers/dri/i965/gen7_sf_state.c4
2 files changed, 49 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index 24d27546cd8..fd7c3958ff5 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -129,6 +129,20 @@ get_attr_override(const struct brw_vue_map *vue_map, int urb_entry_read_offset,
}
+static bool
+is_drawing_points(const struct brw_context *brw)
+{
+ /* Determine if the primitives *reaching the SF* are points */
+ if (brw->geometry_program) {
+ /* BRW_NEW_GEOMETRY_PROGRAM */
+ return brw->geometry_program->OutputType == GL_POINTS;
+ } else {
+ /* BRW_NEW_PRIMITIVE */
+ return brw->primitive == _3DPRIM_POINTLIST;
+ }
+}
+
+
/**
* Create the mapping from the FS inputs we produce to the previous pipeline
* stage (GS or VS) outputs they source from.
@@ -149,6 +163,23 @@ calculate_attr_overrides(const struct brw_context *brw,
/* _NEW_LIGHT */
bool shade_model_flat = brw->ctx.Light.ShadeModel == GL_FLAT;
+ /* From the Ivybridge PRM, Vol 2 Part 1, 3DSTATE_SBE,
+ * description of dw10 Point Sprite Texture Coordinate Enable:
+ *
+ * "This field must be programmed to zero when non-point primitives
+ * are rendered."
+ *
+ * The SandyBridge PRM doesn't explicitly say that point sprite enables
+ * must be programmed to zero when rendering non-point primitives, but
+ * the IvyBridge PRM does, and if we don't, we get garbage.
+ *
+ * This is not required on Haswell, as the hardware ignores this state
+ * when drawing non-points -- although we do still need to be careful to
+ * correctly set the attr overrides.
+ */
+ /* BRW_NEW_PRIMITIVE | BRW_NEW_GEOMETRY_PROGRAM */
+ bool drawing_points = is_drawing_points(brw);
+
/* Initialize all the attr_overrides to 0. In the loop below we'll modify
* just the ones that correspond to inputs used by the fs.
*/
@@ -167,18 +198,20 @@ calculate_attr_overrides(const struct brw_context *brw,
/* _NEW_POINT */
bool point_sprite = false;
- if (brw->ctx.Point.PointSprite &&
- (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) &&
- brw->ctx.Point.CoordReplace[attr - VARYING_SLOT_TEX0]) {
- point_sprite = true;
+ if (drawing_points) {
+ if (brw->ctx.Point.PointSprite &&
+ (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) &&
+ brw->ctx.Point.CoordReplace[attr - VARYING_SLOT_TEX0]) {
+ point_sprite = true;
+ }
+
+ if (attr == VARYING_SLOT_PNTC)
+ point_sprite = true;
+
+ if (point_sprite)
+ *point_sprite_enables |= (1 << input_index);
}
- if (attr == VARYING_SLOT_PNTC)
- point_sprite = true;
-
- if (point_sprite)
- *point_sprite_enables |= (1 << input_index);
-
/* flat shading */
if (interp_qualifier == INTERP_QUALIFIER_FLAT ||
(shade_model_flat && is_gl_Color &&
@@ -410,7 +443,9 @@ const struct brw_tracked_state gen6_sf_state = {
_NEW_POINT |
_NEW_MULTISAMPLE),
.brw = (BRW_NEW_CONTEXT |
- BRW_NEW_FRAGMENT_PROGRAM |
+ BRW_NEW_FRAGMENT_PROGRAM |
+ BRW_NEW_GEOMETRY_PROGRAM |
+ BRW_NEW_PRIMITIVE |
BRW_NEW_VUE_MAP_GEOM_OUT),
.cache = CACHE_NEW_WM_PROG
},
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index 109b825de19..a1fa18ede2b 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -92,7 +92,9 @@ const struct brw_tracked_state gen7_sbe_state = {
_NEW_POINT |
_NEW_PROGRAM),
.brw = (BRW_NEW_CONTEXT |
- BRW_NEW_FRAGMENT_PROGRAM |
+ BRW_NEW_FRAGMENT_PROGRAM |
+ BRW_NEW_GEOMETRY_PROGRAM |
+ BRW_NEW_PRIMITIVE |
BRW_NEW_VUE_MAP_GEOM_OUT),
.cache = CACHE_NEW_WM_PROG
},