diff options
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_viewport.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c index 7584f9b3d55..5b992084bd5 100644 --- a/src/mesa/state_tracker/st_atom_viewport.c +++ b/src/mesa/state_tracker/st_atom_viewport.c @@ -27,6 +27,7 @@ #include "main/context.h" +#include "main/viewport.h" #include "st_context.h" #include "st_atom.h" #include "pipe/p_context.h" @@ -63,21 +64,17 @@ update_viewport( struct st_context *st ) */ for (i = 0; i < ctx->Const.MaxViewports; i++) { - GLfloat x = ctx->ViewportArray[i].X; - GLfloat y = ctx->ViewportArray[i].Y; - GLfloat z = ctx->ViewportArray[i].Near; - GLfloat half_width = ctx->ViewportArray[i].Width * 0.5f; - GLfloat half_height = ctx->ViewportArray[i].Height * 0.5f; - GLfloat half_depth = (GLfloat)(ctx->ViewportArray[i].Far - ctx->ViewportArray[i].Near) * 0.5f; - - st->state.viewport[i].scale[0] = half_width; - st->state.viewport[i].scale[1] = half_height * yScale; - st->state.viewport[i].scale[2] = half_depth; + double scale[3], translate[3]; + _mesa_get_viewport_xform(ctx, i, scale, translate); + + st->state.viewport[i].scale[0] = scale[0]; + st->state.viewport[i].scale[1] = scale[1] * yScale; + st->state.viewport[i].scale[2] = scale[2]; st->state.viewport[i].scale[3] = 1.0; - st->state.viewport[i].translate[0] = half_width + x; - st->state.viewport[i].translate[1] = (half_height + y) * yScale + yBias; - st->state.viewport[i].translate[2] = half_depth + z; + st->state.viewport[i].translate[0] = translate[0]; + st->state.viewport[i].translate[1] = translate[1] * yScale + yBias; + st->state.viewport[i].translate[2] = translate[2]; st->state.viewport[i].translate[3] = 0.0; } |