}
+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.
/* _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.
*/
/* _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 &&
_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
},