2009-09-25 09:34:34 -04:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
2014-02-21 20:28:54 -05:00
|
|
|
* A Low Level GPU Graphics and Utilities API
|
2009-09-25 09:34:34 -04:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
|
|
|
*
|
2014-02-21 20:28:54 -05:00
|
|
|
* Permission is hereby granted, free of charge, to any person
|
|
|
|
* obtaining a copy of this software and associated documentation
|
|
|
|
* files (the "Software"), to deal in the Software without
|
|
|
|
* restriction, including without limitation the rights to use, copy,
|
|
|
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
|
|
* of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2009-09-25 09:34:34 -04:00
|
|
|
*
|
2014-02-21 20:28:54 -05:00
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
2009-09-25 09:34:34 -04:00
|
|
|
*
|
2014-02-21 20:28:54 -05:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2010-03-01 07:56:10 -05:00
|
|
|
*
|
|
|
|
*
|
2009-09-25 09:34:34 -04:00
|
|
|
*/
|
|
|
|
|
2009-11-26 14:06:35 -05:00
|
|
|
#ifndef __COGL_FRAMEBUFFER_PRIVATE_H
|
|
|
|
#define __COGL_FRAMEBUFFER_PRIVATE_H
|
2009-09-25 09:34:34 -04:00
|
|
|
|
2010-11-05 08:28:33 -04:00
|
|
|
#include "cogl-object-private.h"
|
2012-11-20 12:08:43 -05:00
|
|
|
#include "cogl-matrix-stack-private.h"
|
2011-01-06 08:25:45 -05:00
|
|
|
#include "cogl-journal-private.h"
|
2011-10-13 16:31:04 -04:00
|
|
|
#include "cogl-winsys-private.h"
|
2012-01-07 21:59:04 -05:00
|
|
|
#include "cogl-attribute-private.h"
|
2012-02-18 10:22:15 -05:00
|
|
|
#include "cogl-offscreen.h"
|
2012-05-08 10:53:25 -04:00
|
|
|
#include "cogl-gl-header.h"
|
2013-12-04 11:12:25 -05:00
|
|
|
#include "cogl-clip-stack.h"
|
2009-09-25 09:34:34 -04:00
|
|
|
|
2010-11-05 08:28:33 -04:00
|
|
|
#ifdef COGL_HAS_XLIB_SUPPORT
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef COGL_HAS_GLX_SUPPORT
|
|
|
|
#include <GL/glx.h>
|
|
|
|
#include <GL/glxext.h>
|
|
|
|
#endif
|
|
|
|
|
2009-11-26 14:06:35 -05:00
|
|
|
typedef enum _CoglFramebufferType {
|
|
|
|
COGL_FRAMEBUFFER_TYPE_ONSCREEN,
|
|
|
|
COGL_FRAMEBUFFER_TYPE_OFFSCREEN
|
|
|
|
} CoglFramebufferType;
|
2009-09-25 09:34:34 -04:00
|
|
|
|
2011-08-22 18:55:57 -04:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
CoglSwapChain *swap_chain;
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
CoglBool need_stencil;
|
2011-08-21 16:27:13 -04:00
|
|
|
int samples_per_pixel;
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
CoglBool swap_throttled;
|
2012-05-23 13:19:29 -04:00
|
|
|
CoglBool depth_texture_enabled;
|
2014-04-28 12:37:32 -04:00
|
|
|
CoglBool stereo_enabled;
|
2011-08-22 18:55:57 -04:00
|
|
|
} CoglFramebufferConfig;
|
|
|
|
|
2013-08-16 17:43:19 -04:00
|
|
|
/* Flags to pass to _cogl_offscreen_new_with_texture_full */
|
2011-08-23 08:55:12 -04:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL = 1
|
|
|
|
} CoglOffscreenFlags;
|
|
|
|
|
2011-11-21 10:53:40 -05:00
|
|
|
/* XXX: The order of these indices determines the order they are
|
|
|
|
* flushed.
|
|
|
|
*
|
|
|
|
* Flushing clip state may trash the modelview and projection matrices
|
|
|
|
* so we must do it before flushing the matrices.
|
|
|
|
*/
|
|
|
|
typedef enum _CoglFramebufferStateIndex
|
|
|
|
{
|
2011-11-21 15:48:23 -05:00
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_BIND = 0,
|
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_VIEWPORT = 1,
|
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_CLIP = 2,
|
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_DITHER = 3,
|
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_MODELVIEW = 4,
|
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_PROJECTION = 5,
|
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_COLOR_MASK = 6,
|
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_FRONT_FACE_WINDING = 7,
|
2013-10-10 12:10:52 -04:00
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_DEPTH_WRITE = 8,
|
2014-04-28 12:37:32 -04:00
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_STEREO_MODE = 9,
|
|
|
|
COGL_FRAMEBUFFER_STATE_INDEX_MAX = 10
|
2011-11-21 10:53:40 -05:00
|
|
|
} CoglFramebufferStateIndex;
|
|
|
|
|
|
|
|
typedef enum _CoglFramebufferState
|
|
|
|
{
|
2011-11-21 15:48:23 -05:00
|
|
|
COGL_FRAMEBUFFER_STATE_BIND = 1<<0,
|
|
|
|
COGL_FRAMEBUFFER_STATE_VIEWPORT = 1<<1,
|
|
|
|
COGL_FRAMEBUFFER_STATE_CLIP = 1<<2,
|
|
|
|
COGL_FRAMEBUFFER_STATE_DITHER = 1<<3,
|
|
|
|
COGL_FRAMEBUFFER_STATE_MODELVIEW = 1<<4,
|
|
|
|
COGL_FRAMEBUFFER_STATE_PROJECTION = 1<<5,
|
|
|
|
COGL_FRAMEBUFFER_STATE_COLOR_MASK = 1<<6,
|
2013-10-10 12:10:52 -04:00
|
|
|
COGL_FRAMEBUFFER_STATE_FRONT_FACE_WINDING = 1<<7,
|
2014-04-28 12:37:32 -04:00
|
|
|
COGL_FRAMEBUFFER_STATE_DEPTH_WRITE = 1<<8,
|
|
|
|
COGL_FRAMEBUFFER_STATE_STEREO_MODE = 1<<9
|
2011-11-21 10:53:40 -05:00
|
|
|
} CoglFramebufferState;
|
|
|
|
|
|
|
|
#define COGL_FRAMEBUFFER_STATE_ALL ((1<<COGL_FRAMEBUFFER_STATE_INDEX_MAX) - 1)
|
|
|
|
|
2012-03-27 12:24:50 -04:00
|
|
|
/* Private flags that can internally be added to CoglReadPixelsFlags */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/* If this is set then the data will not be flipped to compensate
|
|
|
|
for GL's upside-down coordinate system but instead will be left
|
|
|
|
in whatever order GL gives us (which will depend on whether the
|
|
|
|
framebuffer is offscreen or not) */
|
|
|
|
COGL_READ_PIXELS_NO_FLIP = 1L << 30
|
|
|
|
} CoglPrivateReadPixelsFlags;
|
|
|
|
|
2012-12-13 10:39:55 -05:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int red;
|
|
|
|
int blue;
|
|
|
|
int green;
|
|
|
|
int alpha;
|
2012-12-13 10:47:35 -05:00
|
|
|
int depth;
|
2012-12-13 10:49:38 -05:00
|
|
|
int stencil;
|
2012-12-13 10:39:55 -05:00
|
|
|
} CoglFramebufferBits;
|
|
|
|
|
2010-07-07 09:41:54 -04:00
|
|
|
struct _CoglFramebuffer
|
2009-09-25 09:34:34 -04:00
|
|
|
{
|
2010-07-07 09:41:54 -04:00
|
|
|
CoglObject _parent;
|
2010-11-05 08:28:33 -04:00
|
|
|
CoglContext *context;
|
2009-11-26 14:06:35 -05:00
|
|
|
CoglFramebufferType type;
|
2011-08-22 18:55:57 -04:00
|
|
|
|
|
|
|
/* The user configuration before allocation... */
|
|
|
|
CoglFramebufferConfig config;
|
|
|
|
|
2009-09-25 09:34:34 -04:00
|
|
|
int width;
|
|
|
|
int height;
|
2010-11-17 12:57:17 -05:00
|
|
|
/* Format of the pixels in the framebuffer (including the expected
|
|
|
|
premult state) */
|
2013-06-26 16:26:40 -04:00
|
|
|
CoglPixelFormat internal_format;
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
CoglBool allocated;
|
2009-09-25 09:34:34 -04:00
|
|
|
|
|
|
|
CoglMatrixStack *modelview_stack;
|
|
|
|
CoglMatrixStack *projection_stack;
|
2011-02-01 11:51:58 -05:00
|
|
|
float viewport_x;
|
|
|
|
float viewport_y;
|
|
|
|
float viewport_width;
|
|
|
|
float viewport_height;
|
2012-10-02 06:44:00 -04:00
|
|
|
int viewport_age;
|
|
|
|
int viewport_age_for_scissor_workaround;
|
2009-09-25 09:34:34 -04:00
|
|
|
|
2013-12-04 11:12:25 -05:00
|
|
|
CoglClipStack *clip_stack;
|
2010-04-26 13:08:45 -04:00
|
|
|
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
CoglBool dither_enabled;
|
2013-10-10 12:10:52 -04:00
|
|
|
CoglBool depth_writing_enabled;
|
2011-07-10 21:27:54 -04:00
|
|
|
CoglColorMask color_mask;
|
2014-04-28 12:37:32 -04:00
|
|
|
CoglStereoMode stereo_mode;
|
2011-07-13 11:33:25 -04:00
|
|
|
|
2011-01-06 08:25:45 -05:00
|
|
|
/* We journal the textured rectangles we want to submit to OpenGL so
|
|
|
|
* we have an oppertunity to batch them together into less draw
|
|
|
|
* calls. */
|
|
|
|
CoglJournal *journal;
|
|
|
|
|
|
|
|
/* The scene of a given framebuffer may depend on images in other
|
|
|
|
* framebuffers... */
|
|
|
|
GList *deps;
|
2011-01-12 17:12:41 -05:00
|
|
|
|
|
|
|
/* As part of an optimization for reading-back single pixels from a
|
|
|
|
* framebuffer in some simple cases where the geometry is still
|
|
|
|
* available in the journal we need to track the bounds of the last
|
|
|
|
* region cleared, its color and we need to track when something
|
|
|
|
* does in fact draw to that region so it is no longer clear.
|
|
|
|
*/
|
|
|
|
float clear_color_red;
|
|
|
|
float clear_color_green;
|
|
|
|
float clear_color_blue;
|
|
|
|
float clear_color_alpha;
|
|
|
|
int clear_clip_x0;
|
|
|
|
int clear_clip_y0;
|
|
|
|
int clear_clip_x1;
|
|
|
|
int clear_clip_y1;
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
CoglBool clear_clip_dirty;
|
2012-08-31 19:04:00 -04:00
|
|
|
|
2013-05-17 10:13:41 -04:00
|
|
|
/* Whether something has been drawn to the buffer since the last
|
|
|
|
* swap buffers or swap region. */
|
|
|
|
CoglBool mid_scene;
|
|
|
|
|
2012-08-31 19:04:00 -04:00
|
|
|
/* driver specific */
|
|
|
|
CoglBool dirty_bitmasks;
|
2012-12-13 10:39:55 -05:00
|
|
|
CoglFramebufferBits bits;
|
2012-08-31 19:04:00 -04:00
|
|
|
|
|
|
|
int samples_per_pixel;
|
2010-07-07 09:41:54 -04:00
|
|
|
};
|
2009-09-25 09:34:34 -04:00
|
|
|
|
2012-03-05 22:21:30 -05:00
|
|
|
typedef enum {
|
|
|
|
COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL = 1L<<0,
|
2012-09-06 05:14:44 -04:00
|
|
|
COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH = 1L<<1,
|
|
|
|
COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL = 1L<<2
|
2012-03-05 22:21:30 -05:00
|
|
|
} CoglOffscreenAllocateFlags;
|
|
|
|
|
|
|
|
typedef struct _CoglGLFramebuffer
|
|
|
|
{
|
|
|
|
GLuint fbo_handle;
|
|
|
|
GList *renderbuffers;
|
|
|
|
int samples_per_pixel;
|
|
|
|
} CoglGLFramebuffer;
|
|
|
|
|
2012-02-18 10:22:15 -05:00
|
|
|
struct _CoglOffscreen
|
2009-09-25 09:34:34 -04:00
|
|
|
{
|
2009-11-26 14:06:35 -05:00
|
|
|
CoglFramebuffer _parent;
|
2012-03-05 22:21:30 -05:00
|
|
|
|
|
|
|
CoglGLFramebuffer gl_framebuffer;
|
2011-08-22 18:55:57 -04:00
|
|
|
|
|
|
|
CoglTexture *texture;
|
2011-08-23 08:55:12 -04:00
|
|
|
int texture_level;
|
|
|
|
|
2012-05-23 13:19:29 -04:00
|
|
|
CoglTexture *depth_texture;
|
|
|
|
|
2012-03-05 22:21:30 -05:00
|
|
|
CoglOffscreenAllocateFlags allocation_flags;
|
|
|
|
|
2013-08-16 17:43:19 -04:00
|
|
|
/* FIXME: _cogl_offscreen_new_with_texture_full should be made to use
|
2011-08-23 08:55:12 -04:00
|
|
|
* fb->config to configure if we want a depth or stencil buffer so
|
|
|
|
* we can get rid of these flags */
|
|
|
|
CoglOffscreenFlags create_flags;
|
2012-02-18 10:22:15 -05:00
|
|
|
};
|
2009-09-25 09:34:34 -04:00
|
|
|
|
|
|
|
void
|
2011-10-13 16:31:04 -04:00
|
|
|
_cogl_framebuffer_init (CoglFramebuffer *framebuffer,
|
|
|
|
CoglContext *ctx,
|
|
|
|
CoglFramebufferType type,
|
|
|
|
int width,
|
|
|
|
int height);
|
2010-04-26 13:08:45 -04:00
|
|
|
|
2013-12-01 16:31:33 -05:00
|
|
|
/* XXX: For a public api we might instead want a way to explicitly
|
|
|
|
* set the _premult status of a framebuffer or what components we
|
|
|
|
* care about instead of exposing the CoglPixelFormat
|
|
|
|
* internal_format.
|
|
|
|
*
|
|
|
|
* The current use case for this api is where we create an offscreen
|
|
|
|
* framebuffer for a shared atlas texture that has a format of
|
|
|
|
* RGBA_8888 disregarding the premultiplied alpha status for
|
|
|
|
* individual atlased textures or whether the alpha component is being
|
|
|
|
* discarded. We want to overried the internal_format that will be
|
|
|
|
* derived from the texture.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
_cogl_framebuffer_set_internal_format (CoglFramebuffer *framebuffer,
|
|
|
|
CoglPixelFormat internal_format);
|
|
|
|
|
2011-10-13 16:31:04 -04:00
|
|
|
void _cogl_framebuffer_free (CoglFramebuffer *framebuffer);
|
|
|
|
|
|
|
|
const CoglWinsysVtable *
|
|
|
|
_cogl_framebuffer_get_winsys (CoglFramebuffer *framebuffer);
|
2011-02-22 13:25:29 -05:00
|
|
|
|
2011-01-05 10:30:04 -05:00
|
|
|
void
|
2011-08-03 12:06:10 -04:00
|
|
|
_cogl_framebuffer_clear_without_flush4f (CoglFramebuffer *framebuffer,
|
|
|
|
unsigned long buffers,
|
|
|
|
float red,
|
|
|
|
float green,
|
|
|
|
float blue,
|
|
|
|
float alpha);
|
2011-01-05 10:30:04 -05:00
|
|
|
|
2013-11-29 16:16:37 -05:00
|
|
|
void
|
|
|
|
_cogl_framebuffer_mark_clear_clip_dirty (CoglFramebuffer *framebuffer);
|
|
|
|
|
2011-01-12 17:12:41 -05:00
|
|
|
void
|
2013-05-29 11:59:27 -04:00
|
|
|
_cogl_framebuffer_mark_mid_scene (CoglFramebuffer *framebuffer);
|
2011-01-12 17:12:41 -05:00
|
|
|
|
2011-01-12 14:30:30 -05:00
|
|
|
/*
|
|
|
|
* _cogl_framebuffer_get_clip_stack:
|
|
|
|
* @framebuffer: A #CoglFramebuffer
|
|
|
|
*
|
|
|
|
* Gets a pointer to the current clip stack. This can be used to later
|
|
|
|
* return to the same clip stack state with
|
|
|
|
* _cogl_framebuffer_set_clip_stack(). A reference is not taken on the
|
|
|
|
* stack so if you want to keep it you should call
|
|
|
|
* _cogl_clip_stack_ref().
|
|
|
|
*
|
|
|
|
* Return value: a pointer to the @framebuffer clip stack.
|
|
|
|
*/
|
|
|
|
CoglClipStack *
|
|
|
|
_cogl_framebuffer_get_clip_stack (CoglFramebuffer *framebuffer);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* _cogl_framebuffer_set_clip_stack:
|
|
|
|
* @framebuffer: A #CoglFramebuffer
|
|
|
|
* @stack: a pointer to the replacement clip stack
|
|
|
|
*
|
|
|
|
* Replaces the @framebuffer clip stack with @stack.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
_cogl_framebuffer_set_clip_stack (CoglFramebuffer *framebuffer,
|
|
|
|
CoglClipStack *stack);
|
|
|
|
|
2009-09-25 09:34:34 -04:00
|
|
|
CoglMatrixStack *
|
2010-07-07 09:41:54 -04:00
|
|
|
_cogl_framebuffer_get_modelview_stack (CoglFramebuffer *framebuffer);
|
2010-04-26 13:08:45 -04:00
|
|
|
|
2009-09-25 09:34:34 -04:00
|
|
|
CoglMatrixStack *
|
2010-07-07 09:41:54 -04:00
|
|
|
_cogl_framebuffer_get_projection_stack (CoglFramebuffer *framebuffer);
|
2009-09-25 09:34:34 -04:00
|
|
|
|
2011-01-06 08:25:45 -05:00
|
|
|
void
|
|
|
|
_cogl_framebuffer_add_dependency (CoglFramebuffer *framebuffer,
|
|
|
|
CoglFramebuffer *dependency);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_framebuffer_remove_all_dependencies (CoglFramebuffer *framebuffer);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_framebuffer_flush_journal (CoglFramebuffer *framebuffer);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_framebuffer_flush_dependency_journals (CoglFramebuffer *framebuffer);
|
|
|
|
|
2009-09-25 09:34:34 -04:00
|
|
|
void
|
2011-02-02 09:23:53 -05:00
|
|
|
_cogl_framebuffer_flush_state (CoglFramebuffer *draw_buffer,
|
|
|
|
CoglFramebuffer *read_buffer,
|
2011-11-21 10:53:40 -05:00
|
|
|
CoglFramebufferState state);
|
2009-09-25 09:34:34 -04:00
|
|
|
|
2010-07-07 09:41:54 -04:00
|
|
|
CoglFramebuffer *
|
2011-03-10 16:33:31 -05:00
|
|
|
_cogl_get_read_framebuffer (void);
|
2010-04-26 13:08:45 -04:00
|
|
|
|
2009-09-25 09:34:34 -04:00
|
|
|
GSList *
|
2009-11-26 14:06:35 -05:00
|
|
|
_cogl_create_framebuffer_stack (void);
|
2010-04-26 13:08:45 -04:00
|
|
|
|
2009-09-25 09:34:34 -04:00
|
|
|
void
|
2009-11-26 14:06:35 -05:00
|
|
|
_cogl_free_framebuffer_stack (GSList *stack);
|
2009-09-25 09:34:34 -04:00
|
|
|
|
2010-11-11 10:28:44 -05:00
|
|
|
/*
|
2013-08-16 17:43:19 -04:00
|
|
|
* _cogl_offscreen_new_with_texture_full:
|
2011-08-24 16:30:34 -04:00
|
|
|
* @texture: A #CoglTexture pointer
|
2010-11-11 10:28:44 -05:00
|
|
|
* @create_flags: Flags specifying how to create the FBO
|
|
|
|
* @level: The mipmap level within the texture to target
|
|
|
|
*
|
|
|
|
* Creates a new offscreen buffer which will target the given
|
|
|
|
* texture. By default the buffer will have a depth and stencil
|
|
|
|
* buffer. This can be disabled by passing
|
|
|
|
* %COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL in @create_flags.
|
|
|
|
*
|
|
|
|
* Return value: the new CoglOffscreen object.
|
|
|
|
*/
|
2012-02-18 10:22:15 -05:00
|
|
|
CoglOffscreen *
|
2013-08-16 17:43:19 -04:00
|
|
|
_cogl_offscreen_new_with_texture_full (CoglTexture *texture,
|
|
|
|
CoglOffscreenFlags create_flags,
|
|
|
|
int level);
|
2010-11-11 10:28:44 -05:00
|
|
|
|
2011-02-02 09:23:53 -05:00
|
|
|
/*
|
|
|
|
* _cogl_push_framebuffers:
|
|
|
|
* @draw_buffer: A pointer to the buffer used for drawing
|
|
|
|
* @read_buffer: A pointer to the buffer used for reading back pixels
|
|
|
|
*
|
|
|
|
* Redirects drawing and reading to the specified framebuffers as in
|
|
|
|
* cogl_push_framebuffer() except that it allows the draw and read
|
|
|
|
* buffer to be different. The buffers are pushed as a pair so that
|
|
|
|
* they can later both be restored with a single call to
|
|
|
|
* cogl_pop_framebuffer().
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
_cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
|
|
|
|
CoglFramebuffer *read_buffer);
|
|
|
|
|
2011-02-05 06:19:52 -05:00
|
|
|
/*
|
|
|
|
* _cogl_blit_framebuffer:
|
2012-11-08 18:35:45 -05:00
|
|
|
* @src: The source #CoglFramebuffer
|
|
|
|
* @dest: The destination #CoglFramebuffer
|
2011-02-05 06:19:52 -05:00
|
|
|
* @src_x: Source x position
|
|
|
|
* @src_y: Source y position
|
|
|
|
* @dst_x: Destination x position
|
|
|
|
* @dst_y: Destination y position
|
|
|
|
* @width: Width of region to copy
|
|
|
|
* @height: Height of region to copy
|
|
|
|
*
|
|
|
|
* This blits a region of the color buffer of the current draw buffer
|
|
|
|
* to the current read buffer. The draw and read buffers can be set up
|
|
|
|
* using _cogl_push_framebuffers(). This function should only be
|
2011-10-12 17:47:42 -04:00
|
|
|
* called if the COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT feature is
|
2011-02-05 06:19:52 -05:00
|
|
|
* advertised. The two buffers must both be offscreen and have the
|
|
|
|
* same format.
|
|
|
|
*
|
|
|
|
* Note that this function differs a lot from the glBlitFramebuffer
|
|
|
|
* function provided by the GL_EXT_framebuffer_blit extension. Notably
|
|
|
|
* it doesn't support having different sizes for the source and
|
|
|
|
* destination rectangle. This isn't supported by the corresponding
|
|
|
|
* GL_ANGLE_framebuffer_blit extension on GLES2.0 and it doesn't seem
|
|
|
|
* like a particularly useful feature. If the application wanted to
|
|
|
|
* scale the results it may make more sense to draw a primitive
|
|
|
|
* instead.
|
|
|
|
*
|
|
|
|
* We can only really support blitting between two offscreen buffers
|
|
|
|
* for this function on GLES2.0. This is because we effectively render
|
|
|
|
* upside down to offscreen buffers to maintain Cogl's representation
|
|
|
|
* of the texture coordinate system where 0,0 is the top left of the
|
|
|
|
* texture. If we were to blit from an offscreen to an onscreen buffer
|
|
|
|
* then we would need to mirror the blit along the x-axis but the GLES
|
|
|
|
* extension does not support this.
|
|
|
|
*
|
|
|
|
* The GL function is documented to be affected by the scissor. This
|
|
|
|
* function therefore ensure that an empty clip stack is flushed
|
|
|
|
* before performing the blit which means the scissor is effectively
|
|
|
|
* ignored.
|
|
|
|
*
|
|
|
|
* The function also doesn't support specifying the buffers to copy
|
|
|
|
* and instead only the color buffer is copied. When copying the depth
|
|
|
|
* or stencil buffers the extension on GLES2.0 only supports copying
|
|
|
|
* the full buffer which would be awkward to document with this
|
|
|
|
* API. If we wanted to support that feature it may be better to have
|
|
|
|
* a separate function to copy the entire buffer for a given mask.
|
|
|
|
*/
|
|
|
|
void
|
2012-11-08 18:35:45 -05:00
|
|
|
_cogl_blit_framebuffer (CoglFramebuffer *src,
|
|
|
|
CoglFramebuffer *dest,
|
|
|
|
int src_x,
|
|
|
|
int src_y,
|
|
|
|
int dst_x,
|
|
|
|
int dst_y,
|
|
|
|
int width,
|
|
|
|
int height);
|
2011-02-05 06:19:52 -05:00
|
|
|
|
2011-11-20 13:50:29 -05:00
|
|
|
void
|
|
|
|
_cogl_framebuffer_push_projection (CoglFramebuffer *framebuffer);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_framebuffer_pop_projection (CoglFramebuffer *framebuffer);
|
|
|
|
|
2011-11-18 07:25:38 -05:00
|
|
|
void
|
|
|
|
_cogl_framebuffer_save_clip_stack (CoglFramebuffer *framebuffer);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_framebuffer_restore_clip_stack (CoglFramebuffer *framebuffer);
|
|
|
|
|
2012-01-24 13:16:03 -05:00
|
|
|
void
|
|
|
|
_cogl_framebuffer_unref (CoglFramebuffer *framebuffer);
|
|
|
|
|
2012-01-07 21:59:04 -05:00
|
|
|
/* This can be called directly by the CoglJournal to draw attributes
|
|
|
|
* skipping the implicit journal flush, the framebuffer flush and
|
|
|
|
* pipeline validation. */
|
|
|
|
void
|
|
|
|
_cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
|
|
|
|
CoglPipeline *pipeline,
|
|
|
|
CoglVerticesMode mode,
|
|
|
|
int first_vertex,
|
|
|
|
int n_vertices,
|
|
|
|
CoglAttribute **attributes,
|
|
|
|
int n_attributes,
|
|
|
|
CoglDrawFlags flags);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
|
|
|
CoglPipeline *pipeline,
|
|
|
|
CoglVerticesMode mode,
|
|
|
|
int first_vertex,
|
|
|
|
int n_vertices,
|
|
|
|
CoglIndices *indices,
|
|
|
|
CoglAttribute **attributes,
|
|
|
|
int n_attributes,
|
|
|
|
CoglDrawFlags flags);
|
|
|
|
|
2012-03-05 22:21:30 -05:00
|
|
|
gboolean
|
|
|
|
_cogl_framebuffer_try_creating_gl_fbo (CoglContext *ctx,
|
|
|
|
CoglTexture *texture,
|
|
|
|
int texture_level,
|
|
|
|
int texture_level_width,
|
|
|
|
int texture_level_height,
|
2012-05-23 13:19:29 -04:00
|
|
|
CoglTexture *depth_texture,
|
2012-03-05 22:21:30 -05:00
|
|
|
CoglFramebufferConfig *config,
|
|
|
|
CoglOffscreenAllocateFlags flags,
|
|
|
|
CoglGLFramebuffer *gl_framebuffer);
|
|
|
|
|
2012-08-31 19:04:00 -04:00
|
|
|
unsigned long
|
|
|
|
_cogl_framebuffer_compare (CoglFramebuffer *a,
|
|
|
|
CoglFramebuffer *b,
|
|
|
|
unsigned long state);
|
|
|
|
|
|
|
|
static inline CoglMatrixEntry *
|
|
|
|
_cogl_framebuffer_get_modelview_entry (CoglFramebuffer *framebuffer)
|
|
|
|
{
|
|
|
|
CoglMatrixStack *modelview_stack =
|
|
|
|
_cogl_framebuffer_get_modelview_stack (framebuffer);
|
|
|
|
return modelview_stack->last_entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline CoglMatrixEntry *
|
|
|
|
_cogl_framebuffer_get_projection_entry (CoglFramebuffer *framebuffer)
|
|
|
|
{
|
|
|
|
CoglMatrixStack *projection_stack =
|
|
|
|
_cogl_framebuffer_get_projection_stack (framebuffer);
|
|
|
|
return projection_stack->last_entry;
|
|
|
|
}
|
|
|
|
|
2012-11-08 12:54:10 -05:00
|
|
|
CoglBool
|
|
|
|
_cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
CoglReadPixelsFlags source,
|
|
|
|
CoglBitmap *bitmap,
|
|
|
|
CoglError **error);
|
2012-03-05 22:21:30 -05:00
|
|
|
|
2012-12-13 10:49:38 -05:00
|
|
|
/*
|
|
|
|
* _cogl_framebuffer_get_stencil_bits:
|
|
|
|
* @framebuffer: a pointer to a #CoglFramebuffer
|
|
|
|
*
|
|
|
|
* Retrieves the number of stencil bits of @framebuffer
|
|
|
|
*
|
|
|
|
* Return value: the number of bits
|
|
|
|
*
|
|
|
|
* Since: 2.0
|
|
|
|
* Stability: unstable
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
_cogl_framebuffer_get_stencil_bits (CoglFramebuffer *framebuffer);
|
|
|
|
|
2009-11-26 14:06:35 -05:00
|
|
|
#endif /* __COGL_FRAMEBUFFER_PRIVATE_H */
|