framebuffer: vp change = clip change for gen6 workaround

This makes sure that a viewport change when comparing between separate
framebuffers also implies a clip change when we are applying the Intel
gen6 workaround for broken viewport clipping. Without this then
switching between different size framebuffers could leave a scissor
matching the size of a previous framebuffer.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit f23f2129c58550f819cff783f47039d7bd91391e)
This commit is contained in:
Robert Bragg 2013-03-04 18:16:00 +00:00
parent b62b9a68bb
commit 3c5ebb8752

View File

@ -990,7 +990,27 @@ _cogl_framebuffer_compare_viewport_state (CoglFramebuffer *a,
/* NB: we render upside down to offscreen framebuffers and that /* NB: we render upside down to offscreen framebuffers and that
* can affect how we setup the GL viewport... */ * can affect how we setup the GL viewport... */
a->type != b->type) a->type != b->type)
return COGL_FRAMEBUFFER_STATE_VIEWPORT; {
unsigned long differences = COGL_FRAMEBUFFER_STATE_VIEWPORT;
CoglContext *context = a->context;
/* XXX: ONGOING BUG: Intel viewport scissor
*
* Intel gen6 drivers don't currently correctly handle offset
* viewports, since primitives aren't clipped within the bounds of
* the viewport. To workaround this we push our own clip for the
* viewport that will use scissoring to ensure we clip as expected.
*
* This workaround implies that a change in viewport state is
* effectively also a change in the clipping state.
*
* TODO: file a bug upstream!
*/
if (G_UNLIKELY (context->needs_viewport_scissor_workaround))
differences |= COGL_FRAMEBUFFER_STATE_CLIP;
return differences;
}
else else
return 0; return 0;
} }