From: Kenneth Graunke Date: Mon, 3 Dec 2018 10:08:23 +0000 (-0800) Subject: iris: Enable guardband clipping X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=99cab4d381ba8c60eb1f1c0f030e8d9e9c9cb46a;p=mesa.git iris: Enable guardband clipping --- diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index d86107fad58..86e41b690db 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -1890,7 +1890,6 @@ viewport_extent(const struct pipe_viewport_state *state, int axis, float sign) return copysignf(state->scale[axis], sign) + state->translate[axis]; } -#if 0 static void calculate_guardband_size(uint32_t fb_width, uint32_t fb_height, float m00, float m11, float m30, float m31, @@ -1970,7 +1969,6 @@ calculate_guardband_size(uint32_t fb_width, uint32_t fb_height, *ymax = 0.0f; } } -#endif /** * The pipe->set_viewport_states() driver hook. @@ -3952,12 +3950,18 @@ iris_upload_dirty_render_state(struct iris_context *ice, for (unsigned i = 0; i < ice->state.num_viewports; i++) { const struct pipe_viewport_state *state = &ice->state.viewports[i]; + float gb_xmin, gb_xmax, gb_ymin, gb_ymax; float vp_xmin = viewport_extent(state, 0, -1.0f); float vp_xmax = viewport_extent(state, 0, 1.0f); float vp_ymin = viewport_extent(state, 1, -1.0f); float vp_ymax = viewport_extent(state, 1, 1.0f); + calculate_guardband_size(cso_fb->width, cso_fb->height, + state->scale[0], state->scale[1], + state->translate[0], state->translate[1], + &gb_xmin, &gb_xmax, &gb_ymin, &gb_ymax); + iris_pack_state(GENX(SF_CLIP_VIEWPORT), vp_map, vp) { vp.ViewportMatrixElementm00 = state->scale[0]; vp.ViewportMatrixElementm11 = state->scale[1]; @@ -3965,13 +3969,10 @@ iris_upload_dirty_render_state(struct iris_context *ice, vp.ViewportMatrixElementm30 = state->translate[0]; vp.ViewportMatrixElementm31 = state->translate[1]; vp.ViewportMatrixElementm32 = state->translate[2]; - /* XXX: in i965 this is computed based on the drawbuffer size, - * but we don't have that here... - */ - vp.XMinClipGuardband = -1.0; - vp.XMaxClipGuardband = 1.0; - vp.YMinClipGuardband = -1.0; - vp.YMaxClipGuardband = 1.0; + vp.XMinClipGuardband = gb_xmin; + vp.XMaxClipGuardband = gb_xmax; + vp.YMinClipGuardband = gb_ymin; + vp.YMaxClipGuardband = gb_ymax; vp.XMinViewPort = MAX2(vp_xmin, 0); vp.XMaxViewPort = MIN2(vp_xmax, cso_fb->width) - 1; vp.YMinViewPort = MAX2(vp_ymin, 0);