summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_fragprog.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-01-26 12:43:43 -0800
committerEric Anholt <eric@anholt.net>2010-01-26 13:30:26 -0800
commit11c581c6ce0b09dc4203a7f93ebb8f76357f19be (patch)
tree6c1efd4a34ec21c2ffb3101a5c4828a588f0335e /src/mesa/swrast/s_fragprog.c
parentdea98eb792b5a0637ff2067d9bfe2f666f01423e (diff)
swrast: Implement ARB_fragment_coord_conventions but don't enable.
This brings swrast's support up to the state of gallium, and fixes the default center behavior of fragment.position.xy in piglit fp-arb-fragment-coord-conventions-none. The extension is not enabled currently because the GLSL part of the extension isn't supported, so piglit glsl-arb-fragment-coord-conventions-define fails as would any serious test of the GLSL part.
Diffstat (limited to 'src/mesa/swrast/s_fragprog.c')
-rw-r--r--src/mesa/swrast/s_fragprog.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 9ac33a26a6..1c6492cc8f 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -144,12 +144,22 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
const struct gl_fragment_program *program,
const SWspan *span, GLuint col)
{
+ GLfloat *wpos = span->array->attribs[FRAG_ATTRIB_WPOS][col];
+
if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) {
/* Clear temporary registers (undefined for ARB_f_p) */
_mesa_bzero(machine->Temporaries,
MAX_PROGRAM_TEMPS * 4 * sizeof(GLfloat));
}
+ /* ARB_fragment_coord_conventions */
+ if (program->OriginUpperLeft)
+ wpos[1] = ctx->DrawBuffer->Height - 1 - wpos[1];
+ if (!program->PixelCenterInteger) {
+ wpos[0] += 0.5;
+ wpos[1] += 0.5;
+ }
+
/* Setup pointer to input attributes */
machine->Attribs = span->array->attribs;