From 3c5ebb8752431ef89d7e5bbb04785485371cbe0d Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Mon, 4 Mar 2013 18:16:00 +0000 Subject: [PATCH] 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 (cherry picked from commit f23f2129c58550f819cff783f47039d7bd91391e) --- cogl/cogl-framebuffer.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c index 93e3d50a1..136ae860d 100644 --- a/cogl/cogl-framebuffer.c +++ b/cogl/cogl-framebuffer.c @@ -990,7 +990,27 @@ _cogl_framebuffer_compare_viewport_state (CoglFramebuffer *a, /* NB: we render upside down to offscreen framebuffers and that * can affect how we setup the GL viewport... */ 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 return 0; }