From c78ac7fcfa37a78b835fc596441a9fbe1e679e4a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 Mar 2010 10:41:22 -0700 Subject: [PATCH] st/mesa: fix incorrect glDrawPixels into FBO We weren't inverting the textured quad when drawing into an fbo. (cherry picked from commit 8d3f629a13afb0d6acafc7a007972fdc5efe6847) --- src/mesa/state_tracker/st_cb_drawpixels.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 98453321f86..5278309e32d 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -405,7 +405,7 @@ make_texture(struct st_context *st, /** * Draw quad with texcoords and optional color. - * Coords are window coords with y=0=bottom. + * Coords are gallium window coords with y=0=top. * \param color may be null * \param invertTex if true, flip texcoords vertically */ @@ -592,10 +592,15 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, pipe->set_fragment_sampler_textures(pipe, 1, &pt); } - /* Compute window coords (y=0=bottom) with pixel zoom. + /* Compute Gallium window coords (y=0=top) with pixel zoom. * Recall that these coords are transformed by the current * vertex shader and viewport transformation. */ + if (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM) { + y = ctx->DrawBuffer->Height - (int) (y + height * ctx->Pixel.ZoomY); + invertTex = !invertTex; + } + x0 = (GLfloat) x; x1 = x + width * ctx->Pixel.ZoomX; y0 = (GLfloat) y; -- 2.30.2