summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_cb_drawpixels.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-08-20 21:45:14 +0100
committerBrian <brian.paul@tungstengraphics.com>2007-08-20 21:45:14 +0100
commitd640198b2d52c104c707522e79d53a36f708ccd0 (patch)
tree099904da3631aea27c525d7a19f57bb615d36d9b /src/mesa/state_tracker/st_cb_drawpixels.c
parent3cb6fc3f9aaa94236be611bad04125c17e01ad6c (diff)
Set viewport state so viewport matches window dims.
trivial/readpixels.c works again.
Diffstat (limited to 'src/mesa/state_tracker/st_cb_drawpixels.c')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 108304f5e2..d3f060e691 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -364,6 +364,22 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
pipe->set_sampler_state(pipe, unit, &sampler);
}
+ /* viewport state: viewport matching window dims */
+ {
+ const float width = ctx->DrawBuffer->Width;
+ const float height = ctx->DrawBuffer->Height;
+ struct pipe_viewport_state vp;
+ vp.scale[0] = 0.5 * width;
+ vp.scale[1] = -0.5 * height;
+ vp.scale[2] = 0.5;
+ vp.scale[3] = 1.0;
+ vp.translate[0] = 0.5 * width;
+ vp.translate[1] = 0.5 * height;
+ vp.translate[2] = 0.5;
+ vp.translate[3] = 0.0;
+ pipe->set_viewport_state(pipe, &vp);
+ }
+
/* mipmap tree state: */
{
mt = make_mipmap_tree(ctx->st, width, height, format, type,
@@ -389,6 +405,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
pipe->set_vs_state(pipe, &ctx->st->state.vs);
pipe->set_texture_state(pipe, unit, ctx->st->state.texture[unit]);
pipe->set_sampler_state(pipe, unit, &ctx->st->state.sampler[unit]);
+ pipe->set_viewport_state(pipe, &ctx->st->state.viewport);
free_mipmap_tree(pipe, mt);
}