[cogl] framebuffer: vp change = clip change for gen6 workaround



commit f23f2129c58550f819cff783f47039d7bd91391e
Author: Robert Bragg <robert linux intel com>
Date:   Mon Mar 4 18:16:00 2013 +0000

    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>

 cogl/cogl-framebuffer.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index fdd6c6f..ceb7916 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -705,7 +705,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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]