diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_sf_state.c | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_viewport_state.c | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_viewport_state.c | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen8_viewport_state.c | 17 |
4 files changed, 36 insertions, 32 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index e0558378108..2ed418bd4cb 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} diff --git a/src/mesa/drivers/dri/i965/gen6_viewport_state.c b/src/mesa/drivers/dri/i965/gen6_viewport_state.c index d80445272f8..0c632830815 100644 --- a/src/mesa/drivers/dri/i965/gen6_viewport_state.c +++ b/src/mesa/drivers/dri/i965/gen6_viewport_state.c @@ -30,6 +30,7 @@ #include "brw_defines.h" #include "intel_batchbuffer.h" #include "main/fbobject.h" +#include "main/viewport.h" /* The clip VP defines the guardband region where expensive clipping is skipped * and fragments are allowed to be generated and clipped out cheaply by the SF. @@ -78,11 +79,10 @@ static void gen6_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); @@ -98,12 +98,13 @@ gen6_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]; brw->ctx.NewDriverState |= BRW_NEW_SF_VP; } diff --git a/src/mesa/drivers/dri/i965/gen7_viewport_state.c b/src/mesa/drivers/dri/i965/gen7_viewport_state.c index bd11c3aa36c..eb596845b72 100644 --- a/src/mesa/drivers/dri/i965/gen7_viewport_state.c +++ b/src/mesa/drivers/dri/i965/gen7_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 gen7_upload_sf_clip_viewport(struct brw_context *brw) { struct gl_context *ctx = &brw->ctx; - const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF; GLfloat y_scale, y_bias; const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); struct gen7_sf_clip_viewport *vp; @@ -52,7 +52,8 @@ gen7_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); /* According to the "Vertex X,Y Clamping and Quantization" section of * the Strips and Fans documentation, objects must not have a @@ -76,12 +77,12 @@ gen7_upload_sf_clip_viewport(struct brw_context *brw) vp[i].guardband.ymax = gby; /* _NEW_VIEWPORT */ - vp[i].viewport.m00 = v[MAT_SX]; - vp[i].viewport.m11 = v[MAT_SY] * y_scale; - vp[i].viewport.m22 = v[MAT_SZ] * depth_scale; - vp[i].viewport.m30 = v[MAT_TX]; - vp[i].viewport.m31 = v[MAT_TY] * y_scale + y_bias; - vp[i].viewport.m32 = v[MAT_TZ] * depth_scale; + vp[i].viewport.m00 = scale[0]; + vp[i].viewport.m11 = scale[1] * y_scale; + vp[i].viewport.m22 = scale[2]; + vp[i].viewport.m30 = translate[0]; + vp[i].viewport.m31 = translate[1] * y_scale + y_bias; + vp[i].viewport.m32 = translate[2]; } BEGIN_BATCH(2); 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; |