[PATCH] mesa,st/mesa: fix WPOS adjustment

Christoph Bumiller e0425955 at student.tuwien.ac.at
Tue Apr 19 02:54:41 PDT 2011


---
 src/mesa/program/prog_statevars.c        |    4 ++--
 src/mesa/program/prog_statevars.h        |    2 +-
 src/mesa/state_tracker/st_mesa_to_tgsi.c |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index 1fd26f4..d94d7fe 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -602,11 +602,11 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
             value[0] = 1.0F;
             value[1] = 0.0F;
             value[2] = -1.0F;
-            value[3] = (GLfloat) (ctx->DrawBuffer->Height - 1);
+            value[3] = (GLfloat) ctx->DrawBuffer->Height;
          } else {
             /* Flipping Y upside down (XY) followed by identity (ZW). */
             value[0] = -1.0F;
-            value[1] = (GLfloat) (ctx->DrawBuffer->Height - 1);
+            value[1] = (GLfloat) ctx->DrawBuffer->Height;
             value[2] = 1.0F;
             value[3] = 0.0F;
          }
diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h
index 9fe8d81..04af3f4 100644
--- a/src/mesa/program/prog_statevars.h
+++ b/src/mesa/program/prog_statevars.h
@@ -120,7 +120,7 @@ typedef enum gl_state_index_ {
    STATE_PT_BIAS,               /**< Pixel transfer RGBA bias */
    STATE_SHADOW_AMBIENT,        /**< ARB_shadow_ambient fail value; token[2] is texture unit index */
    STATE_FB_SIZE,               /**< (width-1, height-1, 0, 0) */
-   STATE_FB_WPOS_Y_TRANSFORM,   /**< (1, 0, -1, height-1) if a FBO is bound, (-1, height-1, 1, 0) otherwise */
+   STATE_FB_WPOS_Y_TRANSFORM,   /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */
    STATE_ROT_MATRIX_0,          /**< ATI_envmap_bumpmap, rot matrix row 0 */
    STATE_ROT_MATRIX_1,          /**< ATI_envmap_bumpmap, rot matrix row 1 */
    STATE_INTERNAL_DRIVER	/* first available state index for drivers (must be last) */
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index c07739f..21c5c82 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -883,7 +883,7 @@ emit_wpos(struct st_context *st,
          ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER);
       else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER))
          /* the driver supports pixel center half integer, need to bias X,Y */
-         emit_adjusted_wpos(t, program, 0.5f, invert ? 0.5f : -0.5f);
+         emit_adjusted_wpos(t, program, -0.5f, -0.5f);
       else
          assert(0);
    }
@@ -895,7 +895,7 @@ emit_wpos(struct st_context *st,
       else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) {
          /* the driver supports pixel center integer, need to bias X,Y */
          ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER);
-         emit_adjusted_wpos(t, program, 0.5f, invert ? -0.5f : 0.5f);
+         emit_adjusted_wpos(t, program, 0.5f, 0.5f);
       }
       else
          assert(0);
-- 
1.7.3.4


--------------060801080404090402000502--


More information about the mesa-dev mailing list