[cogl/cogl-1.14: 166/174] disable viewport scissor workaround for clear
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/cogl-1.14: 166/174] disable viewport scissor workaround for clear
- Date: Tue, 22 Jan 2013 18:44:44 +0000 (UTC)
commit 1d31055ddb251a107f229c82f448407691726b80
Author: Robert Bragg <robert linux intel com>
Date: Mon Jan 21 15:35:16 2013 +0000
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.
cogl/cogl-framebuffer.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 36962b6..93e3d50 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]