X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi965%2Fgen6_viewport_state.c;h=ad1e72d0a501132d600c41c75ff908d53d64f364;hb=81faead818a0b2fde131df019f5dfb0baef49273;hp=eacffb9ba0f459e20712355372210b9e948d291b;hpb=6d5ce1b0433f4cbc5cd88b4bfeaf4cdcba6beda8;p=mesa.git diff --git a/src/mesa/drivers/dri/i965/gen6_viewport_state.c b/src/mesa/drivers/dri/i965/gen6_viewport_state.c index eacffb9ba0f..ad1e72d0a50 100644 --- a/src/mesa/drivers/dri/i965/gen6_viewport_state.c +++ b/src/mesa/drivers/dri/i965/gen6_viewport_state.c @@ -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 @@ -74,7 +77,8 @@ const struct brw_tracked_state gen6_clip_vp = { .dirty = { .mesa = _NEW_VIEWPORT, .brw = BRW_NEW_BATCH | - BRW_NEW_BLORP, + BRW_NEW_BLORP | + BRW_NEW_VIEWPORT_COUNT, }, .emit = gen6_upload_clip_vp, }; @@ -87,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) { @@ -101,7 +108,7 @@ 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++) { + for (unsigned i = 0; i < viewport_count; i++) { float scale[3], translate[3]; /* _NEW_VIEWPORT */ @@ -123,7 +130,8 @@ const struct brw_tracked_state gen6_sf_vp = { .mesa = _NEW_BUFFERS | _NEW_VIEWPORT, .brw = BRW_NEW_BATCH | - BRW_NEW_BLORP, + BRW_NEW_BLORP | + BRW_NEW_VIEWPORT_COUNT, }, .emit = gen6_upload_sf_vp, };