diff options
author | Mathias Fröhlich <[email protected]> | 2014-09-21 18:09:21 +0200 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2014-10-24 19:21:20 +0200 |
commit | 6340e609a354770e04192b9b44e91fb06aab0159 (patch) | |
tree | a23faaf3f456f4775efd556e2701ad07021ff1b4 /src/mesa/drivers/dri | |
parent | 8c7ac377b7a859705479a0b421d1dacc53ca240a (diff) |
mesa: Refactor viewport transform computation.
This is for preparation of ARB_clip_control.
v3:
Add comments.
Reviewed-by: Brian Paul <[email protected]>
Signed-off-by: Mathias Froehlich <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_state.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index f31b271500f..f9aecba2327 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -34,6 +34,7 @@ #include "main/dd.h" #include "main/state.h" #include "main/stencil.h" +#include "main/viewport.h" #include "tnl/tnl.h" #include "tnl/t_context.h" @@ -401,26 +402,17 @@ void intelCalcViewport(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); + double scale[3], translate[3]; + + _mesa_get_viewport_xform(ctx, 0, scale, translate); if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { - _math_matrix_viewport(&intel->ViewportMatrix, - ctx->ViewportArray[0].X, - ctx->DrawBuffer->Height - ctx->ViewportArray[0].Y, - ctx->ViewportArray[0].Width, - -ctx->ViewportArray[0].Height, - ctx->ViewportArray[0].Near, - ctx->ViewportArray[0].Far, - 1.0); - } else { - _math_matrix_viewport(&intel->ViewportMatrix, - ctx->ViewportArray[0].X, - ctx->ViewportArray[0].Y, - ctx->ViewportArray[0].Width, - ctx->ViewportArray[0].Height, - ctx->ViewportArray[0].Near, - ctx->ViewportArray[0].Far, - 1.0); + scale[1] = -scale[1]; + translate[1] = ctx->DrawBuffer->Height - translate[1]; } + + _math_matrix_viewport(&intel->ViewportMatrix, + scale, translate, 1.0); } |