summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-09 17:59:13 -0600
committerBrian <[email protected]>2007-08-09 18:02:22 -0600
commitf1637e89ded7312a97dc0a8fdac74886d70766c0 (patch)
tree1f1b3d6a22cec835ccfd52a1216b0a500eabadb3 /src/mesa
parent584c0762010a467e391d7dcdb48aae4d7809f6b5 (diff)
invert Y axis with the viewport transformation to put things right side up
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index ebc55eb6346..a176165b74a 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -189,11 +189,24 @@ static void i915_set_viewport_state( struct pipe_context *pipe,
const struct pipe_viewport_state *viewport )
{
struct i915_context *i915 = i915_context(pipe);
+ float sy, ty;
i915->viewport = *viewport; /* struct copy */
+ /* Negate Y scale to flip image vertically.
+ * The NDC Y coords prior to viewport transformation are in the range
+ * [y=-1=bottom, y=1=top]
+ * Intel window coords are in the range [y=0=top, y=H-1=bottom] where H
+ * is the window height.
+ * Use the viewport transformation to invert Y.
+ */
+ sy = viewport->scale[1];
+ ty = viewport->translate[1];
+ i915->viewport.scale[1] = -sy;
+ i915->viewport.translate[1] = i915->framebuffer.cbufs[0]->height - ty;
+
/* pass the viewport info to the draw module */
- draw_set_viewport_state(i915->draw, viewport);
+ draw_set_viewport_state(i915->draw, &i915->viewport);
/* Using tnl/ and vf/ modules is temporary while getting started.
* Full pipe will have vertex shader, vertex fetch of its own.