summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2013-01-21 15:35:16 +0000
committerRobert Bragg <robert@linux.intel.com>2013-01-22 17:48:19 +0000
commit1d31055ddb251a107f229c82f448407691726b80 (patch)
tree78fa7055e3c23c83c4c7fc45f66f40cb4e94f608
parent3a041ef41b5aeedf77b6697f9b41a9bed8823b2c (diff)
downloadcogl-1d31055ddb251a107f229c82f448407691726b80.tar.gz
disable viewport scissor workaround for clear
We have a workaround in Cogl to fix viewport clipping with Mesa Intel Gen 6 drivers but this was breaking the semantics of cogl_framebuffer_clear() which should not be affected by viewport clipping. This makes sure we disable and restore the workaround when clearing the framebuffer. This fixes Clutter's test-cogl-viewport conformance test.
-rw-r--r--cogl/cogl-framebuffer.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 36962b64..93e3d50a 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -244,11 +244,13 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
float blue,
float alpha)
{
+ CoglContext *ctx = framebuffer->context;
CoglClipStack *clip_stack = _cogl_framebuffer_get_clip_stack (framebuffer);
int scissor_x0;
int scissor_y0;
int scissor_x1;
int scissor_y1;
+ CoglBool saved_viewport_scissor_workaround;
_cogl_clip_stack_get_bounds (clip_stack,
&scissor_x0, &scissor_y0,
@@ -336,6 +338,31 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
_cogl_framebuffer_flush_journal (framebuffer);
+ /* XXX: ONGOING BUG: Intel viewport scissor
+ *
+ * The semantics of cogl_framebuffer_clear() are that it should not
+ * be affected by the current viewport and so if we are currently
+ * applying a workaround for viewport scissoring we need to
+ * temporarily disable the workaround before clearing so any
+ * special scissoring for the workaround will be removed first.
+ *
+ * Note: we only need to disable the workaround if the current
+ * viewport doesn't match the framebuffer's size since otherwise
+ * the workaround wont affect clearing anyway.
+ */
+ if (ctx->needs_viewport_scissor_workaround &&
+ (framebuffer->viewport_x != 0 ||
+ framebuffer->viewport_y != 0 ||
+ framebuffer->viewport_width != framebuffer->width ||
+ framebuffer->viewport_height != framebuffer->height))
+ {
+ saved_viewport_scissor_workaround = TRUE;
+ ctx->needs_viewport_scissor_workaround = FALSE;
+ ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP;
+ }
+ else
+ saved_viewport_scissor_workaround = FALSE;
+
/* NB: _cogl_framebuffer_flush_state may disrupt various state (such
* as the pipeline state) when flushing the clip stack, so should
* always be done first when preparing to draw. */
@@ -345,6 +372,16 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
_cogl_framebuffer_clear_without_flush4f (framebuffer, buffers,
red, green, blue, alpha);
+ /* XXX: ONGOING BUG: Intel viewport scissor
+ *
+ * See comment about temporarily disabling this workaround above
+ */
+ if (saved_viewport_scissor_workaround)
+ {
+ ctx->needs_viewport_scissor_workaround = TRUE;
+ ctx->current_draw_buffer_changes |= COGL_FRAMEBUFFER_STATE_CLIP;
+ }
+
/* This is a debugging variable used to visually display the quad
* batches from the journal. It is reset here to increase the
* chances of getting the same colours for each frame during an