summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_sf_state.c
diff options
context:
space:
mode:
authorMathias Froehlich <Mathias.Froehlich@web.de>2015-03-29 18:57:45 +0200
committerMathias Froehlich <Mathias.Froehlich@gmx.net>2015-04-05 08:01:46 +0200
commita8ceb8e450354083b0b4141cd7fa0174a4d18f72 (patch)
tree1d7cc684d3bbfd591d1f10e8d1a70e5d8e22862a /src/mesa/drivers/dri/i965/brw_sf_state.c
parentba353935a392d2a43422f1d258456336b40b60ea (diff)
downloadexternal_mesa3d-a8ceb8e450354083b0b4141cd7fa0174a4d18f72.zip
external_mesa3d-a8ceb8e450354083b0b4141cd7fa0174a4d18f72.tar.gz
external_mesa3d-a8ceb8e450354083b0b4141cd7fa0174a4d18f72.tar.bz2
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 <brianp@vmware.com> Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_sf_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf_state.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c
index e055837..2ed418b 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_state.c
@@ -34,6 +34,7 @@
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/fbobject.h"
+#include "main/viewport.h"
#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
@@ -42,11 +43,10 @@
static void upload_sf_vp(struct brw_context *brw)
{
struct gl_context *ctx = &brw->ctx;
- const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
struct brw_sf_viewport *sfv;
GLfloat y_scale, y_bias;
+ double scale[3], translate[3];
const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
- const GLfloat *v = ctx->ViewportArray[0]._WindowMap.m;
sfv = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
sizeof(*sfv), 32, &brw->sf.vp_offset);
@@ -63,12 +63,13 @@ static void upload_sf_vp(struct brw_context *brw)
/* _NEW_VIEWPORT */
- sfv->viewport.m00 = v[MAT_SX];
- sfv->viewport.m11 = v[MAT_SY] * y_scale;
- sfv->viewport.m22 = v[MAT_SZ] * depth_scale;
- sfv->viewport.m30 = v[MAT_TX];
- sfv->viewport.m31 = v[MAT_TY] * y_scale + y_bias;
- sfv->viewport.m32 = v[MAT_TZ] * depth_scale;
+ _mesa_get_viewport_xform(ctx, 0, scale, translate);
+ sfv->viewport.m00 = scale[0];
+ sfv->viewport.m11 = scale[1] * y_scale;
+ sfv->viewport.m22 = scale[2];
+ sfv->viewport.m30 = translate[0];
+ sfv->viewport.m31 = translate[1] * y_scale + y_bias;
+ sfv->viewport.m32 = translate[2];
/* _NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT
* for DrawBuffer->_[XY]{min,max}