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,
*ymax = 0.0f;
}
}
-#endif
/**
* The pipe->set_viewport_states() driver hook.
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];
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);