summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-12-03 02:08:23 -0800
committerKenneth Graunke <[email protected]>2019-02-21 10:26:10 -0800
commit99cab4d381ba8c60eb1f1c0f030e8d9e9c9cb46a (patch)
treee7d4c36225432060dcdc98892cd0187af5d5e1d7 /src/gallium/drivers
parentf062dcdfbb294b7a7627a137f58ee4c954011699 (diff)
iris: Enable guardband clipping
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/iris/iris_state.c19
1 files changed, 10 insertions, 9 deletions
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);