diff options
author | marha <marha@users.sourceforge.net> | 2011-01-25 20:04:12 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-01-25 20:04:12 +0000 |
commit | 542d457cc1382d5118bf01e88f4f88b3028be88c (patch) | |
tree | 8a58681b96b96fd49ae8ea89f0d8d4d6b1bd2fef /mesalib/src/mesa/state_tracker | |
parent | db83ae15824cd5a710d61684733f3dc09517748b (diff) | |
download | vcxsrv-542d457cc1382d5118bf01e88f4f88b3028be88c.tar.gz vcxsrv-542d457cc1382d5118bf01e88f4f88b3028be88c.tar.bz2 vcxsrv-542d457cc1382d5118bf01e88f4f88b3028be88c.zip |
mesalib pixman git update 25/1/2011
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c index b24729440..87c69e4dd 100644 --- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -751,10 +751,12 @@ 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 value)
+ const struct gl_program *program,
+ GLfloat adjX, GLfloat adjY)
{
struct ureg_program *ureg = t->ureg;
struct ureg_dst wpos_temp = ureg_DECL_temporary(ureg);
@@ -764,7 +766,7 @@ emit_adjusted_wpos( struct st_translate *t, * The shader might also use gl_FragCoord.w and .z.
*/
ureg_ADD(ureg, wpos_temp, wpos_input,
- ureg_imm4f(ureg, value, value, 0.0f, 0.0f));
+ ureg_imm4f(ureg, adjX, adjY, 0.0f, 0.0f));
t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]] = ureg_src(wpos_temp);
}
@@ -848,9 +850,12 @@ emit_wpos(struct st_context *st, boolean invert = FALSE;
if (fp->OriginUpperLeft) {
+ /* Fragment shader wants origin in upper-left */
if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) {
+ /* the driver supports upper-left origin */
}
else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) {
+ /* the driver supports lower-left origin, need to invert Y */
ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT);
invert = TRUE;
}
@@ -858,28 +863,37 @@ emit_wpos(struct st_context *st, assert(0);
}
else {
+ /* Fragment shader wants origin in lower-left */
if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT))
+ /* the driver supports lower-left origin */
ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT);
else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT))
+ /* the driver supports upper-left origin, need to invert Y */
invert = TRUE;
else
assert(0);
}
if (fp->PixelCenterInteger) {
+ /* Fragment shader wants pixel center integer */
if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER))
+ /* the driver supports pixel center integer */
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))
- emit_adjusted_wpos(t, program, invert ? 0.5f : -0.5f);
+ /* the driver supports pixel center half integer, need to bias X,Y */
+ emit_adjusted_wpos(t, program, 0.5f, invert ? 0.5f : -0.5f);
else
assert(0);
}
else {
+ /* 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 */
}
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, invert ? -0.5f : 0.5f);
+ emit_adjusted_wpos(t, program, 0.5f, invert ? -0.5f : 0.5f);
}
else
assert(0);
|