mesa/i965/i915/r200: eliminate gl_vertex_program
[mesa.git] / src / mesa / drivers / dri / i965 / gen6_viewport_state.c
index 7c8d8849f4e1d354c8cb39c34a23f9eaef65da17..ad1e72d0a501132d600c41c75ff908d53d64f364 100644 (file)
@@ -42,10 +42,13 @@ gen6_upload_clip_vp(struct brw_context *brw)
    struct gl_context *ctx = &brw->ctx;
    struct brw_clipper_viewport *vp;
 
+   /* BRW_NEW_VIEWPORT_COUNT */
+   const unsigned viewport_count = brw->clip.viewport_count;
+
    vp = brw_state_batch(brw, AUB_TRACE_CLIP_VP_STATE,
-                        sizeof(*vp) * ctx->Const.MaxViewports, 32, &brw->clip.vp_offset);
+                        sizeof(*vp) * viewport_count, 32, &brw->clip.vp_offset);
 
-   for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) {
+   for (unsigned i = 0; i < viewport_count; i++) {
       /* According to the "Vertex X,Y Clamping and Quantization" section of the
        * Strips and Fans documentation, objects must not have a screen-space
        * extents of over 8192 pixels, or they may be mis-rasterized.  The maximum
@@ -73,7 +76,9 @@ gen6_upload_clip_vp(struct brw_context *brw)
 const struct brw_tracked_state gen6_clip_vp = {
    .dirty = {
       .mesa = _NEW_VIEWPORT,
-      .brw = BRW_NEW_BATCH,
+      .brw = BRW_NEW_BATCH |
+             BRW_NEW_BLORP |
+             BRW_NEW_VIEWPORT_COUNT,
    },
    .emit = gen6_upload_clip_vp,
 };
@@ -86,10 +91,13 @@ gen6_upload_sf_vp(struct brw_context *brw)
    GLfloat y_scale, y_bias;
    const bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);
 
+   /* BRW_NEW_VIEWPORT_COUNT */
+   const unsigned viewport_count = brw->clip.viewport_count;
+
    sfv = brw_state_batch(brw, AUB_TRACE_SF_VP_STATE,
-                         sizeof(*sfv) * ctx->Const.MaxViewports,
+                         sizeof(*sfv) * viewport_count,
                          32, &brw->sf.vp_offset);
-   memset(sfv, 0, sizeof(*sfv) * ctx->Const.MaxViewports);
+   memset(sfv, 0, sizeof(*sfv) * viewport_count);
 
    /* _NEW_BUFFERS */
    if (render_to_fbo) {
@@ -100,8 +108,8 @@ gen6_upload_sf_vp(struct brw_context *brw)
       y_bias = (float)_mesa_geometric_height(ctx->DrawBuffer);
    }
 
-   for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) {
-      double scale[3], translate[3];
+   for (unsigned i = 0; i < viewport_count; i++) {
+      float scale[3], translate[3];
 
       /* _NEW_VIEWPORT */
       _mesa_get_viewport_xform(ctx, i, scale, translate);
@@ -121,7 +129,9 @@ const struct brw_tracked_state gen6_sf_vp = {
    .dirty = {
       .mesa = _NEW_BUFFERS |
               _NEW_VIEWPORT,
-      .brw = BRW_NEW_BATCH,
+      .brw = BRW_NEW_BATCH |
+             BRW_NEW_BLORP |
+             BRW_NEW_VIEWPORT_COUNT,
    },
    .emit = gen6_upload_sf_vp,
 };
@@ -143,6 +153,7 @@ const struct brw_tracked_state gen6_viewport_state = {
    .dirty = {
       .mesa = 0,
       .brw = BRW_NEW_BATCH |
+             BRW_NEW_BLORP |
              BRW_NEW_CC_VP |
              BRW_NEW_CLIP_VP |
              BRW_NEW_SF_VP |