2008-04-25 09:37:36 -04:00
|
|
|
/*
|
2009-04-27 10:48:12 -04:00
|
|
|
* Cogl
|
2008-04-25 09:37:36 -04:00
|
|
|
*
|
2009-04-27 10:48:12 -04:00
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
2008-04-25 09:37:36 -04:00
|
|
|
*
|
2009-04-27 10:48:12 -04:00
|
|
|
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
2008-04-25 09:37:36 -04:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "cogl.h"
|
|
|
|
#include "cogl-internal.h"
|
|
|
|
#include "cogl-util.h"
|
2008-10-30 13:25:00 -04:00
|
|
|
#include "cogl-texture-private.h"
|
2008-04-25 09:37:36 -04:00
|
|
|
#include "cogl-fbo.h"
|
|
|
|
#include "cogl-context.h"
|
2008-04-29 12:10:37 -04:00
|
|
|
#include "cogl-handle.h"
|
2008-04-25 09:37:36 -04:00
|
|
|
|
|
|
|
/* Expecting EXT functions not to be defined - redirect to pointers in context */
|
2009-07-27 20:34:33 -04:00
|
|
|
#define glGenRenderbuffersEXT ctx->drv.pf_glGenRenderbuffersEXT
|
|
|
|
#define glDeleteRenderbuffersEXT ctx->drv.pf_glDeleteRenderbuffersEXT
|
|
|
|
#define glBindRenderbufferEXT ctx->drv.pf_glBindRenderbufferEXT
|
|
|
|
#define glRenderbufferStorageEXT ctx->drv.pf_glRenderbufferStorageEXT
|
|
|
|
#define glGenFramebuffersEXT ctx->drv.pf_glGenFramebuffersEXT
|
|
|
|
#define glBindFramebufferEXT ctx->drv.pf_glBindFramebufferEXT
|
|
|
|
#define glFramebufferTexture2DEXT ctx->drv.pf_glFramebufferTexture2DEXT
|
|
|
|
#define glFramebufferRenderbufferEXT ctx->drv.pf_glFramebufferRenderbufferEXT
|
|
|
|
#define glCheckFramebufferStatusEXT ctx->drv.pf_glCheckFramebufferStatusEXT
|
|
|
|
#define glDeleteFramebuffersEXT ctx->drv.pf_glDeleteFramebuffersEXT
|
|
|
|
#define glBlitFramebufferEXT ctx->drv.pf_glBlitFramebufferEXT
|
|
|
|
#define glRenderbufferStorageMultisampleEXT ctx->drv.pf_glRenderbufferStorageMultisampleEXT
|
2008-04-25 09:37:36 -04:00
|
|
|
|
2008-06-05 17:40:59 -04:00
|
|
|
#ifndef GL_READ_FRAMEBUFFER_EXT
|
|
|
|
#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
|
|
|
|
#endif
|
|
|
|
#ifndef GL_DRAW_FRAMEBUFFER_EXT
|
|
|
|
#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
|
|
|
|
#endif
|
|
|
|
|
2008-04-29 12:10:37 -04:00
|
|
|
static void _cogl_offscreen_free (CoglFbo *fbo);
|
2008-04-25 09:37:36 -04:00
|
|
|
|
2009-04-01 12:16:44 -04:00
|
|
|
COGL_HANDLE_DEFINE (Fbo, offscreen);
|
2008-04-25 09:37:36 -04:00
|
|
|
|
|
|
|
CoglHandle
|
|
|
|
cogl_offscreen_new_to_texture (CoglHandle texhandle)
|
|
|
|
{
|
|
|
|
CoglFbo *fbo;
|
2009-09-16 06:56:17 -04:00
|
|
|
int width;
|
|
|
|
int height;
|
2008-04-25 09:37:36 -04:00
|
|
|
GLuint tex_gl_handle;
|
2009-09-16 06:56:17 -04:00
|
|
|
GLenum tex_gl_target;
|
2008-04-25 09:37:36 -04:00
|
|
|
GLuint fbo_gl_handle;
|
2008-08-01 08:23:57 -04:00
|
|
|
GLuint gl_stencil_handle;
|
2008-04-25 09:37:36 -04:00
|
|
|
GLenum status;
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-06-23 07:01:30 -04:00
|
|
|
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-06-23 07:01:30 -04:00
|
|
|
if (!cogl_features_available (COGL_FEATURE_OFFSCREEN))
|
|
|
|
return COGL_INVALID_HANDLE;
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Make texhandle is a valid texture object */
|
|
|
|
if (!cogl_is_texture (texhandle))
|
|
|
|
return COGL_INVALID_HANDLE;
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* The texture must not be sliced */
|
2009-09-16 06:56:17 -04:00
|
|
|
if (cogl_texture_is_sliced (texhandle))
|
2008-04-25 09:37:36 -04:00
|
|
|
return COGL_INVALID_HANDLE;
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2009-09-16 06:56:17 -04:00
|
|
|
/* Pick the single texture slice width, height and GL id */
|
|
|
|
|
|
|
|
width = cogl_texture_get_width (texhandle);
|
|
|
|
height = cogl_texture_get_height (texhandle);
|
|
|
|
|
|
|
|
if (!cogl_texture_get_gl_texture (texhandle, &tex_gl_handle, &tex_gl_target))
|
2008-04-25 09:37:36 -04:00
|
|
|
return COGL_INVALID_HANDLE;
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2009-09-16 06:56:17 -04:00
|
|
|
if (tex_gl_target != GL_TEXTURE_2D)
|
|
|
|
return COGL_INVALID_HANDLE;
|
2008-08-01 08:23:57 -04:00
|
|
|
|
|
|
|
/* Create a renderbuffer for stenciling */
|
|
|
|
GE( glGenRenderbuffersEXT (1, &gl_stencil_handle) );
|
|
|
|
GE( glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, gl_stencil_handle) );
|
|
|
|
GE( glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX8_EXT,
|
|
|
|
cogl_texture_get_width (texhandle),
|
|
|
|
cogl_texture_get_height (texhandle)) );
|
|
|
|
GE( glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, 0) );
|
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Generate framebuffer */
|
|
|
|
glGenFramebuffersEXT (1, &fbo_gl_handle);
|
|
|
|
GE( glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, fbo_gl_handle) );
|
|
|
|
GE( glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
2009-09-16 06:56:17 -04:00
|
|
|
tex_gl_target, tex_gl_handle, 0) );
|
2008-08-01 08:23:57 -04:00
|
|
|
GE( glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT,
|
|
|
|
GL_STENCIL_ATTACHMENT_EXT,
|
|
|
|
GL_RENDERBUFFER_EXT, gl_stencil_handle) );
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2009-09-15 11:27:45 -04:00
|
|
|
/* XXX: The framebuffer_object spec isn't clear in defining whether attaching
|
|
|
|
* a texture as a renderbuffer with mipmap filtering enabled while the
|
|
|
|
* mipmaps have not been uploaded should result in an incomplete framebuffer
|
|
|
|
* object. (different drivers make different decisions)
|
|
|
|
*
|
|
|
|
* To avoid an error with drivers that do consider this a problem we
|
|
|
|
* explicitly set non mipmapped filters here. These will later be reset when
|
|
|
|
* the texture is actually used for rendering according to the filters set on
|
|
|
|
* the corresponding CoglMaterial.
|
|
|
|
*/
|
|
|
|
_cogl_texture_set_filters (texhandle, GL_NEAREST, GL_NEAREST);
|
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Make sure it's complete */
|
|
|
|
status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
|
|
|
|
{
|
2008-08-01 08:23:57 -04:00
|
|
|
/* Stencil renderbuffers aren't always supported. Try again
|
|
|
|
without the stencil buffer */
|
|
|
|
GE( glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT,
|
|
|
|
GL_STENCIL_ATTACHMENT_EXT,
|
|
|
|
GL_RENDERBUFFER_EXT,
|
|
|
|
0) );
|
|
|
|
GE( glDeleteRenderbuffersEXT (1, &gl_stencil_handle) );
|
|
|
|
gl_stencil_handle = 0;
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-08-01 08:23:57 -04:00
|
|
|
status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-08-01 08:23:57 -04:00
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
|
|
|
|
{
|
|
|
|
/* Still failing, so give up */
|
|
|
|
GE( glDeleteFramebuffersEXT (1, &fbo_gl_handle) );
|
|
|
|
GE( glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0) );
|
|
|
|
return COGL_INVALID_HANDLE;
|
|
|
|
}
|
2008-04-25 09:37:36 -04:00
|
|
|
}
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
GE( glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0) );
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Allocate and init a CoglFbo object (store non-wasted size
|
|
|
|
for subsequent blits and viewport setup) */
|
|
|
|
fbo = (CoglFbo*) g_malloc (sizeof (CoglFbo));
|
2009-09-16 06:56:17 -04:00
|
|
|
fbo->width = width;
|
|
|
|
fbo->height = height;
|
2008-08-01 08:23:57 -04:00
|
|
|
fbo->gl_handle = fbo_gl_handle;
|
|
|
|
fbo->gl_stencil_handle = gl_stencil_handle;
|
2008-04-29 12:10:37 -04:00
|
|
|
|
|
|
|
return _cogl_offscreen_handle_new (fbo);
|
2008-04-25 09:37:36 -04:00
|
|
|
}
|
|
|
|
|
2008-04-29 12:10:37 -04:00
|
|
|
static void
|
|
|
|
_cogl_offscreen_free (CoglFbo *fbo)
|
2008-04-25 09:37:36 -04:00
|
|
|
{
|
|
|
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
|
|
|
|
2008-04-29 12:10:37 -04:00
|
|
|
/* Frees FBO resources but its handle is not
|
|
|
|
released! Do that separately before this! */
|
2008-08-01 08:23:57 -04:00
|
|
|
if (fbo->gl_stencil_handle)
|
|
|
|
GE( glDeleteRenderbuffersEXT (1, &fbo->gl_stencil_handle) );
|
2008-04-29 12:10:37 -04:00
|
|
|
GE( glDeleteFramebuffersEXT (1, &fbo->gl_handle) );
|
|
|
|
g_free (fbo);
|
2008-04-25 09:37:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-04-30 17:19:43 -04:00
|
|
|
cogl_set_draw_buffer (CoglBufferTarget target, CoglHandle offscreen)
|
2008-04-25 09:37:36 -04:00
|
|
|
{
|
|
|
|
CoglFbo *fbo = NULL;
|
2009-02-19 22:37:08 -05:00
|
|
|
CoglDrawBufferState *draw_buffer;
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-06-23 07:01:30 -04:00
|
|
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
2009-04-27 10:48:12 -04:00
|
|
|
|
[cogl] Improving Cogl journal to minimize driver overheads + GPU state changes
Previously the journal was always flushed at the end of
_cogl_rectangles_with_multitexture_coords, (i.e. the end of any
cogl_rectangle* calls) but now we have broadened the potential for batching
geometry. In ideal circumstances we will only flush once per scene.
In summary the journal works like this:
When you use any of the cogl_rectangle* APIs then nothing is emitted to the
GPU at this point, we just log one or more quads into the journal. A
journal entry consists of the quad coordinates, an associated material
reference, and a modelview matrix. Ideally the journal only gets flushed
once at the end of a scene, but in fact there are things to consider that
may cause unwanted flushing, including:
- modifying materials mid-scene
This is because each quad in the journal has an associated material
reference (i.e. not copy), so if you try and modify a material that is
already referenced in the journal we force a flush first)
NOTE: For now this means you should avoid using cogl_set_source_color()
since that currently uses a single shared material. Later we
should change it to use a pool of materials that is recycled
when the journal is flushed.
- modifying any state that isn't currently logged, such as depth, fog and
backface culling enables.
The first thing that happens when flushing, is to upload all the vertex data
associated with the journal into a single VBO.
We then go through a process of splitting up the journal into batches that
have compatible state so they can be emitted to the GPU together. This is
currently broken up into 3 levels so we can stagger the state changes:
1) we break the journal up according to changes in the number of material layers
associated with logged quads. The number of layers in a material determines
the stride of the associated vertices, so we have to update our vertex
array offsets at this level. (i.e. calling gl{Vertex,Color},Pointer etc)
2) we further split batches up according to material compatability. (e.g.
materials with different textures) We flush material state at this level.
3) Finally we split batches up according to modelview changes. At this level
we update the modelview matrix and actually emit the actual draw command.
This commit is largely about putting the initial design in-place; this will be
followed by other changes that take advantage of the extended batching.
2009-06-17 13:46:42 -04:00
|
|
|
_cogl_journal_flush ();
|
|
|
|
|
2009-02-19 22:37:08 -05:00
|
|
|
g_assert (ctx->draw_buffer_stack != NULL);
|
|
|
|
draw_buffer = ctx->draw_buffer_stack->data;
|
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
if (target == COGL_OFFSCREEN_BUFFER)
|
|
|
|
{
|
|
|
|
/* Make sure it is a valid fbo handle */
|
2008-04-29 12:10:37 -04:00
|
|
|
if (!cogl_is_offscreen (offscreen))
|
2008-04-25 09:37:36 -04:00
|
|
|
return;
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-29 12:10:37 -04:00
|
|
|
fbo = _cogl_offscreen_pointer_from_handle (offscreen);
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Check current draw buffer target */
|
2009-02-19 22:37:08 -05:00
|
|
|
if (draw_buffer->target != COGL_OFFSCREEN_BUFFER)
|
2008-04-25 09:37:36 -04:00
|
|
|
{
|
|
|
|
/* Push the viewport and matrix setup if redirecting
|
|
|
|
from a non-screen buffer */
|
|
|
|
GE( glPushAttrib (GL_VIEWPORT_BIT) );
|
2009-02-24 13:51:25 -05:00
|
|
|
|
|
|
|
_cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
|
|
|
|
_cogl_current_matrix_push ();
|
|
|
|
_cogl_current_matrix_identity ();
|
|
|
|
|
|
|
|
_cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
|
|
|
|
_cogl_current_matrix_push ();
|
|
|
|
_cogl_current_matrix_identity ();
|
2008-04-25 09:37:36 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Override viewport and matrix setup if redirecting
|
|
|
|
from another offscreen buffer */
|
2009-02-24 13:51:25 -05:00
|
|
|
_cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
|
|
|
|
_cogl_current_matrix_identity ();
|
|
|
|
|
|
|
|
_cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
|
|
|
|
_cogl_current_matrix_identity ();
|
2008-04-25 09:37:36 -04:00
|
|
|
}
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Setup new viewport and matrices */
|
2009-07-01 07:57:30 -04:00
|
|
|
cogl_viewport (fbo->width, fbo->height);
|
2009-02-24 13:51:25 -05:00
|
|
|
_cogl_current_matrix_translate (-1.0f, -1.0f, 0.0f);
|
|
|
|
_cogl_current_matrix_scale (2.0f / fbo->width, 2.0f / fbo->height, 1.0f);
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Bind offscreen framebuffer object */
|
|
|
|
GE( glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, fbo->gl_handle) );
|
|
|
|
GE( glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) );
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Some implementation require a clear before drawing
|
|
|
|
to an fbo. Luckily it is affected by scissor test. */
|
|
|
|
/* FIXME: test where exactly this is needed end whether
|
|
|
|
a glClear with 0 argument is enough */
|
|
|
|
GE( glPushAttrib (GL_SCISSOR_BIT) );
|
|
|
|
GE( glScissor (0,0,0,0) );
|
|
|
|
GE( glEnable (GL_SCISSOR_TEST) );
|
|
|
|
GE( glClear (GL_COLOR_BUFFER_BIT) );
|
|
|
|
GE( glPopAttrib () );
|
|
|
|
}
|
2009-04-30 17:19:43 -04:00
|
|
|
else if (target & COGL_WINDOW_BUFFER)
|
2008-04-25 09:37:36 -04:00
|
|
|
{
|
|
|
|
/* Check current draw buffer target */
|
2009-02-19 22:37:08 -05:00
|
|
|
if (draw_buffer->target == COGL_OFFSCREEN_BUFFER)
|
2008-04-25 09:37:36 -04:00
|
|
|
{
|
|
|
|
/* Pop viewport and matrices if redirecting back
|
|
|
|
from an offscreen buffer */
|
|
|
|
GE( glPopAttrib () );
|
2009-02-24 13:51:25 -05:00
|
|
|
|
|
|
|
_cogl_set_current_matrix (COGL_MATRIX_PROJECTION);
|
|
|
|
_cogl_current_matrix_pop ();
|
|
|
|
|
|
|
|
_cogl_set_current_matrix (COGL_MATRIX_MODELVIEW);
|
|
|
|
_cogl_current_matrix_pop ();
|
2008-04-25 09:37:36 -04:00
|
|
|
}
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Bind window framebuffer object */
|
|
|
|
GE( glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0) );
|
|
|
|
}
|
2009-04-27 10:48:12 -04:00
|
|
|
|
2008-04-25 09:37:36 -04:00
|
|
|
/* Store new target */
|
2009-02-19 22:37:08 -05:00
|
|
|
draw_buffer->target = target;
|
|
|
|
if (draw_buffer->offscreen != offscreen)
|
|
|
|
{
|
|
|
|
if (draw_buffer->offscreen != COGL_INVALID_HANDLE)
|
|
|
|
cogl_handle_unref (draw_buffer->offscreen);
|
|
|
|
if (offscreen != COGL_INVALID_HANDLE)
|
|
|
|
cogl_handle_ref (offscreen);
|
|
|
|
draw_buffer->offscreen = offscreen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cogl_push_draw_buffer(void)
|
|
|
|
{
|
|
|
|
CoglDrawBufferState *old;
|
|
|
|
CoglDrawBufferState *draw_buffer;
|
|
|
|
|
|
|
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
|
|
|
|
|
|
|
g_assert (ctx->draw_buffer_stack != NULL);
|
|
|
|
old = ctx->draw_buffer_stack->data;
|
|
|
|
|
|
|
|
draw_buffer = g_slice_new0 (CoglDrawBufferState);
|
|
|
|
*draw_buffer = *old;
|
|
|
|
|
|
|
|
ctx->draw_buffer_stack =
|
|
|
|
g_slist_prepend (ctx->draw_buffer_stack, draw_buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cogl_pop_draw_buffer(void)
|
|
|
|
{
|
|
|
|
CoglDrawBufferState *to_pop;
|
|
|
|
CoglDrawBufferState *to_restore;
|
|
|
|
|
|
|
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
|
|
|
|
|
|
|
g_assert (ctx->draw_buffer_stack != NULL);
|
|
|
|
if (ctx->draw_buffer_stack->next == NULL)
|
|
|
|
{
|
|
|
|
g_warning ("1 more cogl_pop_draw_buffer() than cogl_push_draw_buffer()");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
to_pop = ctx->draw_buffer_stack->data;
|
|
|
|
to_restore = ctx->draw_buffer_stack->next->data;
|
|
|
|
|
2009-04-30 17:19:43 -04:00
|
|
|
/* the logic in cogl_set_draw_buffer() only works if
|
2009-02-19 22:37:08 -05:00
|
|
|
* to_pop is still on top of the stack, because
|
2009-04-30 17:19:43 -04:00
|
|
|
* cogl_set_draw_buffer() needs to know the previous
|
2009-02-19 22:37:08 -05:00
|
|
|
* state.
|
|
|
|
*/
|
2009-04-30 17:19:43 -04:00
|
|
|
cogl_set_draw_buffer (to_restore->target, to_restore->offscreen);
|
2009-02-19 22:37:08 -05:00
|
|
|
|
2009-04-30 17:19:43 -04:00
|
|
|
/* cogl_set_draw_buffer() should have set top of stack
|
2009-02-19 22:37:08 -05:00
|
|
|
* to to_restore
|
|
|
|
*/
|
|
|
|
g_assert (to_restore->target == to_pop->target);
|
|
|
|
g_assert (to_restore->offscreen == to_pop->offscreen);
|
|
|
|
|
|
|
|
g_assert (ctx->draw_buffer_stack->data == to_pop);
|
|
|
|
ctx->draw_buffer_stack =
|
|
|
|
g_slist_remove_link (ctx->draw_buffer_stack,
|
|
|
|
ctx->draw_buffer_stack);
|
|
|
|
|
|
|
|
g_slice_free (CoglDrawBufferState, to_pop);
|
2008-04-25 09:37:36 -04:00
|
|
|
}
|
2009-04-30 17:19:43 -04:00
|
|
|
|