From: Marek Olšák <marek.ol...@amd.com>

---
 src/gallium/drivers/radeon/r600_pipe_common.c | 33 +++++++++++++++------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 4cc64c7..847527a 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -214,50 +214,53 @@ void r600_draw_rectangle(struct blitter_context *blitter,
        struct pipe_viewport_state viewport;
        struct pipe_resource *buf = NULL;
        unsigned offset = 0;
        float *vb;
 
        /* Some operations (like color resolve on r6xx) don't work
         * with the conventional primitive types.
         * One that works is PT_RECTLIST, which we use here. */
 
        /* setup viewport */
-       viewport.scale[0] = 1.0f;
-       viewport.scale[1] = 1.0f;
-       viewport.scale[2] = 1.0f;
-       viewport.translate[0] = 0.0f;
-       viewport.translate[1] = 0.0f;
-       viewport.translate[2] = 0.0f;
+       int width = x2 - x1;
+       int height = y2 - y1;
+
+       viewport.scale[0] = width / 2.0;
+       viewport.scale[1] = height / 2.0;
+       viewport.scale[2] = 0;
+       viewport.translate[0] = width / 2.0 + x1;
+       viewport.translate[1] = height / 2.0 + y1;
+       viewport.translate[2] = depth;
        rctx->b.set_viewport_states(&rctx->b, 0, 1, &viewport);
 
        /* Upload vertices. The hw rectangle has only 3 vertices,
         * The 4th one is derived from the first 3.
         * The vertex specification should match u_blitter's vertex element 
state. */
        u_upload_alloc(rctx->b.stream_uploader, 0, sizeof(float) * 24,
                       rctx->screen->info.tcc_cache_line_size,
                        &offset, &buf, (void**)&vb);
        if (!buf)
                return;
 
-       vb[0] = x1;
-       vb[1] = y1;
-       vb[2] = depth;
+       vb[0] = -1;
+       vb[1] = -1;
+       vb[2] = 0;
        vb[3] = 1;
 
-       vb[8] = x1;
-       vb[9] = y2;
-       vb[10] = depth;
+       vb[8] = -1;
+       vb[9] = 1;
+       vb[10] = 0;
        vb[11] = 1;
 
-       vb[16] = x2;
-       vb[17] = y1;
-       vb[18] = depth;
+       vb[16] = 1;
+       vb[17] = -1;
+       vb[18] = 0;
        vb[19] = 1;
 
        switch (type) {
        case UTIL_BLITTER_ATTRIB_COLOR:
                memcpy(vb+4, attrib->f, sizeof(float)*4);
                memcpy(vb+12, attrib->f, sizeof(float)*4);
                memcpy(vb+20, attrib->f, sizeof(float)*4);
                break;
        case UTIL_BLITTER_ATTRIB_TEXCOORD:
                vb[4] = attrib->f[0]; /* x1 */
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to