diff options
author | Mathias Froehlich <[email protected]> | 2015-03-29 18:57:45 +0200 |
---|---|---|
committer | Mathias Froehlich <[email protected]> | 2015-04-05 08:01:46 +0200 |
commit | a8ceb8e450354083b0b4141cd7fa0174a4d18f72 (patch) | |
tree | 1d7cc684d3bbfd591d1f10e8d1a70e5d8e22862a /src/mesa/drivers/dri/i965/gen8_viewport_state.c | |
parent | ba353935a392d2a43422f1d258456336b40b60ea (diff) |
i965: Make use of _mesa_get_viewport_xform.
Instead of _WindowMap just use the translation and scale
of the viewport transform directly. Thereby avoid dividing by
_DepthMaxF again.
Reviewed-by: Brian Paul <[email protected]>
Signed-off-by: Mathias Froehlich <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen8_viewport_state.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen8_viewport_state.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/gen8_viewport_state.c b/src/mesa/drivers/dri/i965/gen8_viewport_state.c index 93198c48672..322e4663b99 100644 --- a/src/mesa/drivers/dri/i965/gen8_viewport_state.c +++ b/src/mesa/drivers/dri/i965/gen8_viewport_state.c @@ -26,12 +26,12 @@ #include "brw_defines.h" #include "intel_batchbuffer.h" #include "main/fbobject.h" +#include "main/viewport.h" static void gen8_upload_sf_clip_viewport(struct brw_context *brw) { struct gl_context *ctx = &brw->ctx; - const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; float y_scale, y_bias; const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); @@ -51,15 +51,16 @@ gen8_upload_sf_clip_viewport(struct brw_context *brw) } for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) { - const GLfloat *const v = ctx->ViewportArray[i]._WindowMap.m; + double scale[3], translate[3]; + _mesa_get_viewport_xform(ctx, i, scale, translate); /* _NEW_VIEWPORT: Viewport Matrix Elements */ - vp[0] = v[MAT_SX]; /* m00 */ - vp[1] = v[MAT_SY] * y_scale; /* m11 */ - vp[2] = v[MAT_SZ] * depth_scale; /* m22 */ - vp[3] = v[MAT_TX]; /* m30 */ - vp[4] = v[MAT_TY] * y_scale + y_bias; /* m31 */ - vp[5] = v[MAT_TZ] * depth_scale; /* m32 */ + vp[0] = scale[0]; /* m00 */ + vp[1] = scale[1] * y_scale; /* m11 */ + vp[2] = scale[2]; /* m22 */ + vp[3] = translate[0]; /* m30 */ + vp[4] = translate[1] * y_scale + y_bias; /* m31 */ + vp[5] = translate[2]; /* m32 */ /* Reserved */ vp[6] = 0; |