[Mesa-dev] [PATCH 1/2] st/mesa: use _mesa_geometric_width/height() in glDrawPixels code
Brian Paul
brianp at vmware.com
Sat Feb 13 17:23:45 UTC 2016
On 02/12/2016 06:07 PM, Ilia Mirkin wrote:
> Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
Thanks, but this comes after the preceding 14 or so patches that I
posted before. Care to review those too?
-Brian
>
> On Fri, Feb 12, 2016 at 8:07 PM, Brian Paul <brianp at vmware.com> wrote:
>> ---
>> src/mesa/state_tracker/st_cb_drawpixels.c | 19 +++++++++----------
>> 1 file changed, 9 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
>> index ee172a0..15a91c7 100644
>> --- a/src/mesa/state_tracker/st_cb_drawpixels.c
>> +++ b/src/mesa/state_tracker/st_cb_drawpixels.c
>> @@ -35,6 +35,7 @@
>> #include "main/bufferobj.h"
>> #include "main/blit.h"
>> #include "main/format_pack.h"
>> +#include "main/framebuffer.h"
>> #include "main/macros.h"
>> #include "main/mtypes.h"
>> #include "main/pack.h"
>> @@ -456,6 +457,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
>> struct st_context *st = st_context(ctx);
>> struct pipe_context *pipe = st->pipe;
>> struct cso_context *cso = st->cso_context;
>> + const unsigned fb_width = _mesa_geometric_width(ctx->DrawBuffer);
>> + const unsigned fb_height = _mesa_geometric_height(ctx->DrawBuffer);
>> GLfloat x0, y0, x1, y1;
>> GLsizei maxSize;
>> boolean normalized = sv[0]->texture->target == PIPE_TEXTURE_2D;
>> @@ -597,8 +600,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
>> }
>>
>> /* viewport state: viewport matching window dims */
>> - cso_set_viewport_dims(cso, ctx->DrawBuffer->Width,
>> - ctx->DrawBuffer->Height, TRUE);
>> + cso_set_viewport_dims(cso, fb_width, fb_height, TRUE);
>>
>> cso_set_vertex_elements(cso, 3, st->util_velems);
>> cso_set_stream_outputs(cso, 0, NULL, NULL);
>> @@ -608,7 +610,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
>> * vertex shader and viewport transformation.
>> */
>> if (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM) {
>> - y = ctx->DrawBuffer->Height - (int) (y + height * ctx->Pixel.ZoomY);
>> + y = fb_height - (int) (y + height * ctx->Pixel.ZoomY);
>> invertTex = !invertTex;
>> }
>>
>> @@ -621,13 +623,10 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
>> z = z * 2.0f - 1.0f;
>>
>> {
>> - const struct gl_framebuffer *fb = ctx->DrawBuffer;
>> - const float fb_width = (float) fb->Width;
>> - const float fb_height = (float) fb->Height;
>> - const float clip_x0 = x0 / fb_width * 2.0f - 1.0f;
>> - const float clip_y0 = y0 / fb_height * 2.0f - 1.0f;
>> - const float clip_x1 = x1 / fb_width * 2.0f - 1.0f;
>> - const float clip_y1 = y1 / fb_height * 2.0f - 1.0f;
>> + const float clip_x0 = x0 / (float) fb_width * 2.0f - 1.0f;
>> + const float clip_y0 = y0 / (float) fb_height * 2.0f - 1.0f;
>> + const float clip_x1 = x1 / (float) fb_width * 2.0f - 1.0f;
>> + const float clip_y1 = y1 / (float) fb_height * 2.0f - 1.0f;
>> const float maxXcoord = normalized ?
>> ((float) width / sv[0]->texture->width0) : (float) width;
>> const float maxYcoord = normalized
>> --
>> 1.9.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=4l3OjBB2uzSiE3Sg817qQQp2pafNGtLnlhu-36x8TQI&s=NPMUeLTbsX6zWEZ6W1cxTZKOsSBL1GHhfGy8gRbOz-I&e=
More information about the mesa-dev
mailing list