st/mesa: fix incorrect sprite origin when drawing to FBO/texture
authorBrian Paul <brianp@vmware.com>
Mon, 1 Jun 2009 20:59:11 +0000 (14:59 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 1 Jun 2009 20:59:11 +0000 (14:59 -0600)
Need to take the draw buffer's up/down orientation into consideration
when setting the sprite_coord_mode field.

Fixes inverted sprites when drawing into an FBO.

src/mesa/state_tracker/st_atom_rasterizer.c

index 4e70510c0c0fde129b62d1624706bdd9a0a9e2df..5c7206409cf63c356928b93f2caa0dbea8e2f4ba 100644 (file)
@@ -192,7 +192,8 @@ static void update_raster_state( struct st_context *st )
    raster->point_sprite = ctx->Point.PointSprite;
    for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
       if (ctx->Point.CoordReplace[i]) {
-         if (ctx->Point.SpriteOrigin == GL_UPPER_LEFT)
+         if ((ctx->Point.SpriteOrigin == GL_UPPER_LEFT) ^
+             (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM))
             raster->sprite_coord_mode[i] = PIPE_SPRITE_COORD_UPPER_LEFT;
          else 
             raster->sprite_coord_mode[i] = PIPE_SPRITE_COORD_LOWER_LEFT;