summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-02-20 14:00:47 -0800
committerIan Romanick <ian.d.romanick@intel.com>2013-03-05 14:57:09 -0800
commit0b494917b18d8cc5156bc97c2ce4c9024ddc4406 (patch)
tree0101c790026c7ceddd920354ffe79969c668243d
parentfa23151f43452b46bb5b5882ebcff00f36f59565 (diff)
i965: Fix the W value of deprecated pointcoords on pre-gen6.
When you didn't have a texcoord array bound (or a non-1 current w attrib), we were telling the fragment shader that it could just use "1" instead of doing expensive pre-gen6 math to invert it. If you drew the point with a non-1 W value, then you'd get the right size (since all the vertex computations worked), but we'd mis-interpolate the coordinate across the face. Fixes the mesa pointsprite demo on GM45. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30232 Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com> Note: This is a candidate for the stable branches. (cherry picked from commit 50a5d5dea0c21886bc3445c0ad0928b03e64ab10)
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_constval.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c
index 3d53843edde..48635c54b5d 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_constval.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c
@@ -238,6 +238,23 @@ static void calc_wm_input_sizes( struct brw_context *brw )
calc_sizes(&t);
+ /* _NEW_POINT
+ *
+ * If the SF will be replacing the vertex output with a reference to
+ * gl_PointCoord, then tell the fragment shader that the value actually
+ * does vary.
+ */
+ if (ctx->Point.PointSprite) {
+ for (int i = 0; i < 8; i++) {
+ if (ctx->Point.CoordReplace[i]) {
+ t.size_masks[4-1] |= FRAG_BIT_TEX(i);
+ t.size_masks[3-1] |= FRAG_BIT_TEX(i);
+ t.size_masks[2-1] |= FRAG_BIT_TEX(i);
+ t.size_masks[1-1] |= FRAG_BIT_TEX(i);
+ }
+ }
+ }
+
if (memcmp(brw->wm.input_size_masks, t.size_masks, sizeof(t.size_masks)) != 0) {
memcpy(brw->wm.input_size_masks, t.size_masks, sizeof(t.size_masks));
brw->state.dirty.brw |= BRW_NEW_WM_INPUT_DIMENSIONS;
@@ -246,7 +263,7 @@ static void calc_wm_input_sizes( struct brw_context *brw )
const struct brw_tracked_state brw_wm_input_sizes = {
.dirty = {
- .mesa = _NEW_LIGHT | _NEW_PROGRAM,
+ .mesa = _NEW_LIGHT | _NEW_PROGRAM | _NEW_POINT,
.brw = BRW_NEW_VERTEX_PROGRAM | BRW_NEW_INPUT_DIMENSIONS,
.cache = 0
},