[cogl/wip/virtual-framebuffer: 32/37] fix: optimize framebuffer state flush
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/virtual-framebuffer: 32/37] fix: optimize framebuffer state flush
- Date: Wed, 23 Nov 2011 17:01:25 +0000 (UTC)
commit d3a030bc830590a550edcf5f3dcb82bd57fdc534
Author: Robert Bragg <robert linux intel com>
Date: Tue Nov 22 22:08:07 2011 +0000
fix: optimize framebuffer state flush
cogl/cogl-framebuffer.c | 12 ++++++++----
cogl/cogl-onscreen.c | 6 ------
2 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index a2feba4..d5ebc04 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -1348,7 +1348,10 @@ _cogl_framebuffer_compare_viewport_state (CoglFramebuffer *a,
if (a->viewport_x != b->viewport_x ||
a->viewport_y != b->viewport_y ||
a->viewport_width != b->viewport_width ||
- a->viewport_height != b->viewport_height)
+ a->viewport_height != b->viewport_height ||
+ /* 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;
else
return 0;
@@ -1590,6 +1593,7 @@ _cogl_framebuffer_flush_state (CoglFramebuffer *draw_buffer,
{
CoglContext *ctx = draw_buffer->context;
unsigned long differences;
+ int bit;
_COGL_RETURN_IF_FAIL (!cogl_is_virtual_framebuffer (draw_buffer));
_COGL_RETURN_IF_FAIL (!cogl_is_virtual_framebuffer (read_buffer));
@@ -1664,14 +1668,14 @@ _cogl_framebuffer_flush_state (CoglFramebuffer *draw_buffer,
return;
}
- COGL_FLAGS_FOREACH_START (differences,
- COGL_FRAMEBUFFER_STATE_INDEX_MAX, index)
+ COGL_FLAGS_FOREACH_START (&differences,
+ COGL_FRAMEBUFFER_STATE_INDEX_MAX, bit)
{
/* XXX: We considered having an array of callbacks for each state index
* that we'd call here but decided that this way the compiler is more
* likely going to be able to in-line the flush functions and use the
* index to jump straight to the required code. */
- switch (index)
+ switch (bit)
{
case COGL_FRAMEBUFFER_STATE_INDEX_VIEWPORT:
_cogl_framebuffer_flush_viewport_state (draw_buffer);
diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c
index f943993..8f1634b 100644
--- a/cogl/cogl-onscreen.c
+++ b/cogl/cogl-onscreen.c
@@ -334,15 +334,9 @@ void
_cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer,
int width, int height)
{
- CoglContext *ctx = framebuffer->context;
-
if (framebuffer->width == width && framebuffer->height == height)
return;
framebuffer->width = width;
framebuffer->height = height;
-
- /* We'll need to recalculate the GL viewport state derived
- * from the Cogl viewport */
- ctx->dirty_gl_viewport = 1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]