Re: [Mesa-dev] [PATCH] st/mesa: fix WPOS adjustment, with more comments
Tested-by: Marek Olšák On Wed, Apr 27, 2011 at 8:53 PM, Christoph Bumiller wrote: > Again, with a more detailed explanation added as comments. > > On 20.04.2011 17:33, Christoph Bumiller wrote: > > On 04/19/2011 04:00 AM, Christoph Bumiller wrote: > > On 16.04.2011 18:50, Christoph Bumiller wrote: > > I hope the new version is correct, the commit message describes why I > did the first change, and the second change is described in a comment. > > Note that the MAD for inversion uses Height - 1 instead of Height. > > With this, piglit glsl-arb-fragment-coord-conventions and > fbo-depth-sample-compare pass on nvc0. > > I was assuming that integer pixel centers for size 100 range from 0 to > 99 and half-integer pixel centers from 0.5 to 99.5. > > Attached a better version of the patch, potentially saving an > instruction and avoiding precision issues with NEAREST filtering that > made piglit's blending-in-shader fail. > > The only other location I found STATE_FB_WPOS_Y_TRANSFORM used was > r600 classic, which should also work more correctly now since (at > least according to gallium caps) it uses half-integer pixel center, > and for H=100, 0.5 * -1 + 99 obviously isn't the desired 99.5. > > Please review. > > Unfortunately I found another small error making a more precise piglit > test that draws to a float buffer instead of mangling the coordinate > like the original test does, which conceals errors. > > Now there's a dependency again on whether inversion is actually done or > not, so I added a check on the inversion constant in the shader, but > maybe adding additional uniforms or even adjusting > STATE_FB_WPOS_Y_TRANSFORM dependent on the coordinat convention might be > nicer ? > > Sorry for not noticing right away, > Christoph > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: fix WPOS adjustment, with more comments
Again, with a more detailed explanation added as comments. On 20.04.2011 17:33, Christoph Bumiller wrote: >> On 04/19/2011 04:00 AM, Christoph Bumiller wrote: >>> On 16.04.2011 18:50, Christoph Bumiller wrote: I hope the new version is correct, the commit message describes why I did the first change, and the second change is described in a comment. Note that the MAD for inversion uses Height - 1 instead of Height. With this, piglit glsl-arb-fragment-coord-conventions and fbo-depth-sample-compare pass on nvc0. I was assuming that integer pixel centers for size 100 range from 0 to 99 and half-integer pixel centers from 0.5 to 99.5. >>> Attached a better version of the patch, potentially saving an >>> instruction and avoiding precision issues with NEAREST filtering that >>> made piglit's blending-in-shader fail. >>> >>> The only other location I found STATE_FB_WPOS_Y_TRANSFORM used was >>> r600 classic, which should also work more correctly now since (at >>> least according to gallium caps) it uses half-integer pixel center, >>> and for H=100, 0.5 * -1 + 99 obviously isn't the desired 99.5. >>> >>> Please review. > Unfortunately I found another small error making a more precise piglit > test that draws to a float buffer instead of mangling the coordinate > like the original test does, which conceals errors. > > Now there's a dependency again on whether inversion is actually done or > not, so I added a check on the inversion constant in the shader, but > maybe adding additional uniforms or even adjusting > STATE_FB_WPOS_Y_TRANSFORM dependent on the coordinat convention might be > nicer ? > > Sorry for not noticing right away, > Christoph > > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev >From 1353940f25d8566554621e907938da1e294d9a77 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Wed, 27 Apr 2011 20:51:50 +0200 Subject: [PATCH 1/2] mesa,st/mesa: fix WPOS adjustment --- src/mesa/program/prog_statevars.c|4 +- src/mesa/program/prog_statevars.h|2 +- src/mesa/state_tracker/st_mesa_to_tgsi.c | 110 +++--- 3 files changed, 74 insertions(+), 42 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..a41e5b1 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -752,37 +752,15 @@ compile_instruction( /** - * Emit the TGSI instructions to adjust the WPOS pixel center convention - * Basically, add (adjX, adjY) to the fragment position. - */ -static void -emit_adjusted_wpos( struct st_translate *t, -const struct gl_program *program, -GLfloat adjX, GLfloat adjY) -{ - struct ureg_program *ureg = t->ureg; - struct ureg_dst wpos_temp = ureg_DECL_temporary(ureg); - struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]]; - - /* Note that we bias X and Y and pass Z and W through unchanged. -* The shader might also use gl_FragCoord.w and .z. -*/ - ureg_
Re: [Mesa-dev] [PATCH] st/mesa: fix WPOS adjustment
> On 04/19/2011 04:00 AM, Christoph Bumiller wrote: >> On 16.04.2011 18:50, Christoph Bumiller wrote: >>> I hope the new version is correct, the commit message describes why I >>> did the first change, and the second change is described in a comment. >>> >>> Note that the MAD for inversion uses Height - 1 instead of Height. >>> >>> With this, piglit glsl-arb-fragment-coord-conventions and >>> fbo-depth-sample-compare pass on nvc0. >>> >>> I was assuming that integer pixel centers for size 100 range from 0 to >>> 99 and half-integer pixel centers from 0.5 to 99.5. >>> >> Attached a better version of the patch, potentially saving an >> instruction and avoiding precision issues with NEAREST filtering that >> made piglit's blending-in-shader fail. >> >> The only other location I found STATE_FB_WPOS_Y_TRANSFORM used was >> r600 classic, which should also work more correctly now since (at >> least according to gallium caps) it uses half-integer pixel center, >> and for H=100, 0.5 * -1 + 99 obviously isn't the desired 99.5. >> >> Please review. > Unfortunately I found another small error making a more precise piglit test that draws to a float buffer instead of mangling the coordinate like the original test does, which conceals errors. Now there's a dependency again on whether inversion is actually done or not, so I added a check on the inversion constant in the shader, but maybe adding additional uniforms or even adjusting STATE_FB_WPOS_Y_TRANSFORM dependent on the coordinat convention might be nicer ? Sorry for not noticing right away, Christoph >From 52992fae19a691737bf6f408c37f9c358da2caae Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Wed, 20 Apr 2011 17:22:06 +0200 Subject: [PATCH] mesa,st/mesa: fix WPOS adjustment The pixel center adjustment also depends on whether an FBO is bound or not. center shift only: i -> h: +0.5 h -> i: -0.5 inversion only: l,i -> u,i: ( 0.0 + 1.0) * -1 + 100 = 99 l,h -> u,h: ( 0.5 + 0.0) * -1 + 100 = 99.5 u,i -> l,i: (99.0 + 1.0) * -1 + 100 = 0 u,h -> l,h: (99.5 + 0.0) * -1 + 100 = 0.5 inversion and center shift: l,i -> u,h: ( 0.0 + 0.5) * -1 + 100 = 99.5 l,h -> u,i: ( 0.5 + 0.5) * -1 + 100 = 99 u,i -> l,h: (99.0 + 0.5) * -1 + 100 = 0.5 u,h -> l,i: (99.5 + 0.5) * -1 + 100 = 0 --- src/mesa/program/prog_statevars.c|4 +- src/mesa/program/prog_statevars.h|2 +- src/mesa/state_tracker/st_mesa_to_tgsi.c | 77 +++--- 3 files changed, 41 insertions(+), 42 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..3acc414 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -752,37 +752,15 @@ compile_instruction( /** - * Emit the TGSI instructions to adjust the WPOS pixel center convention - * Basically, add (adjX, adjY) to the fragment position. - */ -static void -emit_adjusted_wpos( struct st_translate *t, -const struct gl_program *program, -GLfloat adjX, GLfloat adjY) -{ - struct ureg_program *ureg = t->ureg; - struct ureg_dst wpos_temp = ureg_DECL_temporary(ureg); - struct ureg_src wpos_input = t->inputs[t-
Re: [Mesa-dev] [PATCH] st/mesa: fix WPOS adjustment
On 04/19/2011 04:00 AM, Christoph Bumiller wrote: On 16.04.2011 18:50, Christoph Bumiller wrote: I hope the new version is correct, the commit message describes why I did the first change, and the second change is described in a comment. Note that the MAD for inversion uses Height - 1 instead of Height. With this, piglit glsl-arb-fragment-coord-conventions and fbo-depth-sample-compare pass on nvc0. I was assuming that integer pixel centers for size 100 range from 0 to 99 and half-integer pixel centers from 0.5 to 99.5. Attached a better version of the patch, potentially saving an instruction and avoiding precision issues with NEAREST filtering that made piglit's blending-in-shader fail. The only other location I found STATE_FB_WPOS_Y_TRANSFORM used was r600 classic, which should also work more correctly now since (at least according to gallium caps) it uses half-integer pixel center, and for H=100, 0.5 * -1 + 99 obviously isn't the desired 99.5. Please review. All the relevant piglit tests seem to pass with softpipe, llvmpipe and swrast. Tested-by: Brian Paul -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: fix WPOS adjustment
2011/4/19 Michel Dänzer > On Die, 2011-04-19 at 12:00 +0200, Christoph Bumiller wrote: > > On 16.04.2011 18:50, Christoph Bumiller wrote: > > > I hope the new version is correct, the commit message describes why I > > > did the first change, and the second change is described in a comment. > > > > > > Note that the MAD for inversion uses Height - 1 instead of Height. > > > > > > With this, piglit glsl-arb-fragment-coord-conventions and > > > fbo-depth-sample-compare pass on nvc0. > > > > > > I was assuming that integer pixel centers for size 100 range from 0 to > > > 99 and half-integer pixel centers from 0.5 to 99.5. > > > > > Attached a better version of the patch, potentially saving an > > instruction and avoiding precision issues with NEAREST filtering that > > made piglit's blending-in-shader fail. > > > > The only other location I found STATE_FB_WPOS_Y_TRANSFORM used was > > r600 classic, which should also work more correctly now since (at > > least according to gallium caps) it uses half-integer pixel center, > > and for H=100, 0.5 * -1 + 99 obviously isn't the desired 99.5. > > FWIW, this fixes compiz alpha-blurred contents being off by one > vertically on r300g. Thanks! > If that's true, it should be a candidate for 7.10 as well. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: fix WPOS adjustment
On Die, 2011-04-19 at 12:00 +0200, Christoph Bumiller wrote: > On 16.04.2011 18:50, Christoph Bumiller wrote: > > I hope the new version is correct, the commit message describes why I > > did the first change, and the second change is described in a comment. > > > > Note that the MAD for inversion uses Height - 1 instead of Height. > > > > With this, piglit glsl-arb-fragment-coord-conventions and > > fbo-depth-sample-compare pass on nvc0. > > > > I was assuming that integer pixel centers for size 100 range from 0 to > > 99 and half-integer pixel centers from 0.5 to 99.5. > > > Attached a better version of the patch, potentially saving an > instruction and avoiding precision issues with NEAREST filtering that > made piglit's blending-in-shader fail. > > The only other location I found STATE_FB_WPOS_Y_TRANSFORM used was > r600 classic, which should also work more correctly now since (at > least according to gallium caps) it uses half-integer pixel center, > and for H=100, 0.5 * -1 + 99 obviously isn't the desired 99.5. FWIW, this fixes compiz alpha-blurred contents being off by one vertically on r300g. Thanks! -- Earthling Michel Dänzer |http://www.vmware.com Libre software enthusiast | Debian, X and DRI developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: fix WPOS adjustment
On 16.04.2011 18:50, Christoph Bumiller wrote: > I hope the new version is correct, the commit message describes why I > did the first change, and the second change is described in a comment. > > Note that the MAD for inversion uses Height - 1 instead of Height. > > With this, piglit glsl-arb-fragment-coord-conventions and > fbo-depth-sample-compare pass on nvc0. > > I was assuming that integer pixel centers for size 100 range from 0 to > 99 and half-integer pixel centers from 0.5 to 99.5. > Attached a better version of the patch, potentially saving an instruction and avoiding precision issues with NEAREST filtering that made piglit's blending-in-shader fail. The only other location I found STATE_FB_WPOS_Y_TRANSFORM used was r600 classic, which should also work more correctly now since (at least according to gallium caps) it uses half-integer pixel center, and for H=100, 0.5 * -1 + 99 obviously isn't the desired 99.5. Please review. Christoph > > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev >From 0214363d8bfc1084b93f4c2541c483313caafbc4 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Tue, 19 Apr 2011 11:54:41 +0200 Subject: [PATCH] mesa,st/mesa: fix WPOS adjustment --- 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 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/mesa: fix WPOS adjustment
I hope the new version is correct, the commit message describes why I did the first change, and the second change is described in a comment. Note that the MAD for inversion uses Height - 1 instead of Height. With this, piglit glsl-arb-fragment-coord-conventions and fbo-depth-sample-compare pass on nvc0. I was assuming that integer pixel centers for size 100 range from 0 to 99 and half-integer pixel centers from 0.5 to 99.5. >From f150c14f8d33f5898b47d5ef01aef5aa051aa841 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 16 Apr 2011 18:38:16 +0200 Subject: [PATCH] st/mesa: fix WPOS adjustment For the first change, where we want to convert from half integer to integer coordinates, consider the upper left position: u,h -> l,i / 0.5 -> 99.0 : ( 0.5 - 0.5) * -1 + 99 u,h -> u,i / 0.5 -> 0.0 : ( 0.5 - 0.5) l,h -> u,i / 99.5 -> 0.0 : (99.5 - 0.5) * -1 + 99 l,h -> l,i / 99.5 -> 99.0 : (99.5 - 0.5) --- src/mesa/state_tracker/st_mesa_to_tgsi.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index c07739f..6a63a39 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); } @@ -891,6 +891,10 @@ emit_wpos(struct st_context *st, /* Fragment shader wants pixel center half integer */ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER)) { /* the driver supports pixel center half integer */ + if (invert) { +/* for h = 100: (0.5 -> 99.5) by ((0.5 - 1.0) * -1 + 99.0) */ +emit_adjusted_wpos(t, program, 0.0f, -1.0f); + } } 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 */ -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev