i965/gen6: Upload all the SF viewports
authorChris Forbes <chrisf@ijw.co.nz>
Wed, 6 May 2015 05:35:37 +0000 (17:35 +1200)
committerChris Forbes <chrisf@ijw.co.nz>
Wed, 6 May 2015 07:01:57 +0000 (19:01 +1200)
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_structs.h
src/mesa/drivers/dri/i965/gen6_viewport_state.c

index 7c97a95ce9aad58c980360c96a6c5c03bb03eaaf..55338c0e24307473988d29320bb7b083b2a44a18 100644 (file)
@@ -639,6 +639,8 @@ struct gen6_sf_viewport {
    float m30;
    float m31;
    float m32;
+
+   unsigned pad0[2];
 };
 
 struct gen7_sf_clip_viewport {
index 95d204f5c78fb1429fdb10fcc3d0e2616ccecddd..2fb0182c56e89704a34075df72a15cca300670c6 100644 (file)
@@ -81,14 +81,14 @@ static void
 gen6_upload_sf_vp(struct brw_context *brw)
 {
    struct gl_context *ctx = &brw->ctx;
-   struct brw_sf_viewport *sfv;
+   struct gen6_sf_viewport *sfv;
    GLfloat y_scale, y_bias;
-   double scale[3], translate[3];
    const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
 
    sfv = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
-                        sizeof(*sfv), 32, &brw->sf.vp_offset);
-   memset(sfv, 0, sizeof(*sfv));
+                         sizeof(*sfv) * ctx->Const.MaxViewports,
+                         32, &brw->sf.vp_offset);
+   memset(sfv, 0, sizeof(*sfv) * ctx->Const.MaxViewports);
 
    /* _NEW_BUFFERS */
    if (render_to_fbo) {
@@ -99,14 +99,19 @@ gen6_upload_sf_vp(struct brw_context *brw)
       y_bias = ctx->DrawBuffer->Height;
    }
 
-   /* _NEW_VIEWPORT */
-   _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];
+   for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) {
+      double scale[3], translate[3];
+
+      /* _NEW_VIEWPORT */
+      _mesa_get_viewport_xform(ctx, i, scale, translate);
+      sfv[i].m00 = scale[0];
+      sfv[i].m11 = scale[1] * y_scale;
+      sfv[i].m22 = scale[2];
+      sfv[i].m30 = translate[0];
+      sfv[i].m31 = translate[1] * y_scale + y_bias;
+      sfv[i].m32 = translate[2];
+
+   }
 
    brw->ctx.NewDriverState |= BRW_NEW_SF_VP;
 }