summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/gen6_sf_state.c
diff options
context:
space:
mode:
authorYuanhan Liu <yuanhan.liu@linux.intel.com>2012-01-20 07:48:52 +0800
committerYuanhan Liu <yuanhan.liu@linux.intel.com>2012-01-28 09:59:13 +0800
commiteaf360e5bffc5630789367020252cd12fe586177 (patch)
tree55370eabae63dfcca904454b212fe1bbcbc5f1bc /src/mesa/drivers/dri/i965/gen6_sf_state.c
parentd250287d53c0dcd936ca632f4d991ffaac6693c2 (diff)
downloadexternal_mesa3d-eaf360e5bffc5630789367020252cd12fe586177.zip
external_mesa3d-eaf360e5bffc5630789367020252cd12fe586177.tar.gz
external_mesa3d-eaf360e5bffc5630789367020252cd12fe586177.tar.bz2
i965: fix inverted point sprite origin when rendering to FBO
When rendering to FBO, rendering is inverted. At the same time, we would also make sure the point sprite origin is inverted. Or, we will get an inverted result correspoinding to rendering to the default winsys FBO. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44613 NOTE: This is a candidate for stable release branches. v2: add the simliar logic to ivb, too (comments from Ian) simplify the logic operation (comments from Brian) v3: pick a better comment from Eric use != for the logic instead of ^ (comments from Ian) Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen6_sf_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/gen6_sf_state.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index 548c5a3..163b54c 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -129,6 +129,7 @@ upload_sf_state(struct brw_context *brw)
float point_size;
uint16_t attr_overrides[FRAG_ATTRIB_MAX];
bool userclip_active;
+ uint32_t point_sprite_origin;
/* _NEW_TRANSFORM */
userclip_active = (ctx->Transform.ClipPlanesEnabled != 0);
@@ -258,8 +259,16 @@ upload_sf_state(struct brw_context *brw)
/* Clamp to the hardware limits and convert to fixed point */
dw4 |= U_FIXED(CLAMP(point_size, 0.125, 255.875), 3);
- if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT)
- dw1 |= GEN6_SF_POINT_SPRITE_LOWERLEFT;
+ /*
+ * Window coordinates in an FBO are inverted, which means point
+ * sprite origin must be inverted, too.
+ */
+ if ((ctx->Point.SpriteOrigin == GL_LOWER_LEFT) != render_to_fbo) {
+ point_sprite_origin = GEN6_SF_POINT_SPRITE_LOWERLEFT;
+ } else {
+ point_sprite_origin = GEN6_SF_POINT_SPRITE_UPPERLEFT;
+ }
+ dw1 |= point_sprite_origin;
/* _NEW_LIGHT */
if (ctx->Light.ProvokingVertex != GL_FIRST_VERTEX_CONVENTION) {