2010-10-27 17:54:57 +00:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* A Low Level GPU Graphics and Utilities API
|
2010-10-27 17:54:57 +00:00
|
|
|
*
|
2011-09-08 23:40:06 +00:00
|
|
|
* Copyright (C) 2008,2009,2010,2011 Intel Corporation.
|
2010-10-27 17:54:57 +00:00
|
|
|
*
|
2014-02-22 01:28:54 +00: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:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* 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-10-27 17:54:57 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Robert Bragg <robert@linux.intel.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __COGL_PIPELINE_PRIVATE_H
|
|
|
|
#define __COGL_PIPELINE_PRIVATE_H
|
|
|
|
|
2011-09-08 23:40:06 +00:00
|
|
|
#include "cogl-node-private.h"
|
|
|
|
#include "cogl-pipeline-layer-private.h"
|
2010-10-27 17:54:57 +00:00
|
|
|
#include "cogl-pipeline.h"
|
|
|
|
#include "cogl-matrix.h"
|
|
|
|
#include "cogl-object-private.h"
|
|
|
|
#include "cogl-profile.h"
|
2013-06-08 22:03:25 +00:00
|
|
|
#include "cogl-list.h"
|
2011-10-27 15:54:50 +00:00
|
|
|
#include "cogl-boxed-value.h"
|
2011-11-25 15:31:21 +00:00
|
|
|
#include "cogl-pipeline-snippet-private.h"
|
2012-02-18 01:19:17 +00:00
|
|
|
#include "cogl-pipeline-state.h"
|
Re-design the matrix stack using a graph of ops
This re-designs the matrix stack so we now keep track of each separate
operation such as rotating, scaling, translating and multiplying as
immutable, ref-counted nodes in a graph.
Being a "graph" here means that different transformations composed of
a sequence of linked operation nodes may share nodes.
The first node in a matrix-stack is always a LOAD_IDENTITY operation.
As an example consider if an application where to draw three rectangles
A, B and C something like this:
cogl_framebuffer_scale (fb, 2, 2, 2);
cogl_framebuffer_push_matrix(fb);
cogl_framebuffer_translate (fb, 10, 0, 0);
cogl_framebuffer_push_matrix(fb);
cogl_framebuffer_rotate (fb, 45, 0, 0, 1);
cogl_framebuffer_draw_rectangle (...); /* A */
cogl_framebuffer_pop_matrix(fb);
cogl_framebuffer_draw_rectangle (...); /* B */
cogl_framebuffer_pop_matrix(fb);
cogl_framebuffer_push_matrix(fb);
cogl_framebuffer_set_modelview_matrix (fb, &mv);
cogl_framebuffer_draw_rectangle (...); /* C */
cogl_framebuffer_pop_matrix(fb);
That would result in a graph of nodes like this:
LOAD_IDENTITY
|
SCALE
/ \
SAVE LOAD
| |
TRANSLATE RECTANGLE(C)
| \
SAVE RECTANGLE(B)
|
ROTATE
|
RECTANGLE(A)
Each push adds a SAVE operation which serves as a marker to rewind too
when a corresponding pop is issued and also each SAVE node may also
store a cached matrix representing the composition of all its ancestor
nodes. This means if we repeatedly need to resolve a real CoglMatrix
for a given node then we don't need to repeat the composition.
Some advantages of this design are:
- A single pointer to any node in the graph can now represent a
complete, immutable transformation that can be logged for example
into a journal. Previously we were storing a full CoglMatrix in
each journal entry which is 16 floats for the matrix itself as well
as space for flags and another 16 floats for possibly storing a
cache of the inverse. This means that we significantly reduce
the size of the journal when drawing lots of primitives and we also
avoid copying over 128 bytes per entry.
- It becomes much cheaper to check for equality. In cases where some
(unlikely) false negatives are allowed simply comparing the pointers
of two matrix stack graph entries is enough. Previously we would use
memcmp() to compare matrices.
- It becomes easier to do comparisons of transformations. By looking
for the common ancestry between nodes we can determine the operations
that differentiate the transforms and use those to gain a high level
understanding of the differences. For example we use this in the
journal to be able to efficiently determine when two rectangle
transforms only differ by some translation so that we can perform
software clipping.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit f75aee93f6b293ca7a7babbd8fcc326ee6bf7aef)
2012-02-20 15:59:48 +00:00
|
|
|
#include "cogl-framebuffer.h"
|
2013-01-20 18:47:40 +00:00
|
|
|
#include "cogl-bitmask.h"
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
#ifdef HAVE_COGL_GL
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2012-09-25 20:08:10 +00:00
|
|
|
#define COGL_PIPELINE_PROGEND_FIXED_ARBFP 0
|
|
|
|
#define COGL_PIPELINE_PROGEND_FIXED 1
|
|
|
|
#define COGL_PIPELINE_PROGEND_GLSL 2
|
|
|
|
#define COGL_PIPELINE_N_PROGENDS 3
|
2012-09-21 16:00:09 +00:00
|
|
|
|
|
|
|
#define COGL_PIPELINE_VERTEND_FIXED 0
|
|
|
|
#define COGL_PIPELINE_VERTEND_GLSL 1
|
|
|
|
#define COGL_PIPELINE_N_VERTENDS 2
|
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
#define COGL_PIPELINE_FRAGEND_ARBFP 0
|
|
|
|
#define COGL_PIPELINE_FRAGEND_FIXED 1
|
|
|
|
#define COGL_PIPELINE_FRAGEND_GLSL 2
|
|
|
|
#define COGL_PIPELINE_N_FRAGENDS 3
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
#else /* HAVE_COGL_GL */
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
#ifdef HAVE_COGL_GLES2
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2012-09-21 16:00:09 +00:00
|
|
|
#define COGL_PIPELINE_PROGEND_GLSL 0
|
|
|
|
#define COGL_PIPELINE_VERTEND_GLSL 0
|
2011-07-07 19:44:56 +00:00
|
|
|
#define COGL_PIPELINE_FRAGEND_GLSL 0
|
2012-09-21 16:00:09 +00:00
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
#ifdef HAVE_COGL_GLES
|
2012-09-21 16:00:09 +00:00
|
|
|
#define COGL_PIPELINE_PROGEND_FIXED 1
|
|
|
|
#define COGL_PIPELINE_VERTEND_FIXED 1
|
2011-07-07 19:44:56 +00:00
|
|
|
#define COGL_PIPELINE_FRAGEND_FIXED 1
|
2012-09-21 16:00:09 +00:00
|
|
|
|
|
|
|
#define COGL_PIPELINE_N_PROGENDS 2
|
|
|
|
#define COGL_PIPELINE_N_VERTENDS 2
|
2011-07-07 19:44:56 +00:00
|
|
|
#define COGL_PIPELINE_N_FRAGENDS 2
|
|
|
|
#else
|
2012-09-21 16:00:09 +00:00
|
|
|
#define COGL_PIPELINE_N_PROGENDS 1
|
|
|
|
#define COGL_PIPELINE_N_VERTENDS 1
|
2011-07-07 19:44:56 +00:00
|
|
|
#define COGL_PIPELINE_N_FRAGENDS 1
|
|
|
|
#endif
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
#else /* HAVE_COGL_GLES2 */
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
#ifdef HAVE_COGL_GLES
|
2012-09-21 16:00:09 +00:00
|
|
|
#define COGL_PIPELINE_PROGEND_FIXED 0
|
|
|
|
#define COGL_PIPELINE_VERTEND_FIXED 0
|
2011-07-07 19:44:56 +00:00
|
|
|
#define COGL_PIPELINE_FRAGEND_FIXED 0
|
2012-09-21 16:00:09 +00:00
|
|
|
#define COGL_PIPELINE_N_PROGENDS 1
|
|
|
|
#define COGL_PIPELINE_N_VERTENDS 1
|
2011-07-07 19:44:56 +00:00
|
|
|
#define COGL_PIPELINE_N_FRAGENDS 1
|
|
|
|
#else
|
|
|
|
#error No drivers defined
|
|
|
|
#endif
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
#endif /* HAVE_COGL_GLES2 */
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
#endif /* HAVE_COGL_GL */
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2012-09-25 20:08:10 +00:00
|
|
|
#define COGL_PIPELINE_PROGEND_DEFAULT 0
|
|
|
|
#define COGL_PIPELINE_PROGEND_UNDEFINED 3
|
2010-11-29 18:32:21 +00:00
|
|
|
|
2010-12-03 11:36:49 +00:00
|
|
|
/* XXX: should I rename these as
|
|
|
|
* COGL_PIPELINE_STATE_INDEX_XYZ... ?
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/* sparse state */
|
|
|
|
COGL_PIPELINE_STATE_COLOR_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_LAYERS_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_LIGHTING_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_BLEND_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_USER_SHADER_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_DEPTH_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_FOG_INDEX,
|
2013-06-20 12:25:49 +00:00
|
|
|
COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE_INDEX,
|
2010-12-03 11:36:49 +00:00
|
|
|
COGL_PIPELINE_STATE_POINT_SIZE_INDEX,
|
2012-11-08 16:56:02 +00:00
|
|
|
COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE_INDEX,
|
2011-07-11 01:27:54 +00:00
|
|
|
COGL_PIPELINE_STATE_LOGIC_OPS_INDEX,
|
2011-09-15 10:25:39 +00:00
|
|
|
COGL_PIPELINE_STATE_CULL_FACE_INDEX,
|
cogl-pipeline: Add support for setting uniform values
This adds the following new public experimental functions to set
uniform values on a CoglPipeline:
void
cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline,
int uniform_location,
float value);
void
cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline,
int uniform_location,
int value);
void
cogl_pipeline_set_uniform_float (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const float *value);
void
cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const int *value);
void
cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
const float *value);
These are similar to the old functions used to set uniforms on a
CoglProgram. To get a value to pass in as the uniform_location there
is also:
int
cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
const char *uniform_name);
Conceptually the uniform locations are tied to the pipeline so that
whenever setting a value for a new pipeline the application is
expected to call this function. However in practice the uniform
locations are global to the CoglContext. The names are stored in a
linked list where the position in the list is the uniform location.
The global indices are used so that each pipeline can store a mask of
which uniforms it overrides. That way it is quicker to detect which
uniforms are different from the last pipeline that used the same
CoglProgramState so it can avoid flushing uniforms that haven't
changed. Currently the values are not actually compared which means
that it will only avoid flushing a uniform if there is a common
ancestor that sets the value (or if the same pipeline is being flushed
again - in which case the pipeline and its common ancestor are the
same thing).
The uniform values are stored in the big state of the pipeline as a
sparse linked list. A bitmask stores which values have been overridden
and only overridden values are stored in the linked list.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-03 17:20:43 +00:00
|
|
|
COGL_PIPELINE_STATE_UNIFORMS_INDEX,
|
2011-11-17 16:52:21 +00:00
|
|
|
COGL_PIPELINE_STATE_VERTEX_SNIPPETS_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS_INDEX,
|
2010-12-03 11:36:49 +00:00
|
|
|
|
|
|
|
/* non-sparse */
|
|
|
|
COGL_PIPELINE_STATE_REAL_BLEND_ENABLE_INDEX,
|
|
|
|
|
2012-02-20 00:09:37 +00:00
|
|
|
COGL_PIPELINE_STATE_COUNT
|
2010-12-03 11:36:49 +00:00
|
|
|
} CoglPipelineStateIndex;
|
|
|
|
|
2012-02-20 00:09:37 +00:00
|
|
|
#define COGL_PIPELINE_STATE_SPARSE_COUNT (COGL_PIPELINE_STATE_COUNT - 1)
|
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
/* Used in pipeline->differences masks and for notifying pipeline
|
2011-01-12 17:11:48 +00:00
|
|
|
* state changes.
|
|
|
|
*
|
|
|
|
* XXX: If you add or remove state groups here you may need to update
|
|
|
|
* some of the state masks following this enum too!
|
|
|
|
*
|
|
|
|
* FIXME: perhaps it would be better to rename this enum to
|
|
|
|
* CoglPipelineStateGroup to better convey the fact that a single enum
|
|
|
|
* here can map to multiple properties.
|
|
|
|
*/
|
2010-10-27 17:54:57 +00:00
|
|
|
typedef enum _CoglPipelineState
|
|
|
|
{
|
2010-12-03 11:36:49 +00:00
|
|
|
COGL_PIPELINE_STATE_COLOR =
|
|
|
|
1L<<COGL_PIPELINE_STATE_COLOR_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_BLEND_ENABLE =
|
|
|
|
1L<<COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_LAYERS =
|
|
|
|
1L<<COGL_PIPELINE_STATE_LAYERS_INDEX,
|
|
|
|
|
|
|
|
COGL_PIPELINE_STATE_LIGHTING =
|
|
|
|
1L<<COGL_PIPELINE_STATE_LIGHTING_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_ALPHA_FUNC =
|
|
|
|
1L<<COGL_PIPELINE_STATE_ALPHA_FUNC_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE =
|
|
|
|
1L<<COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_BLEND =
|
|
|
|
1L<<COGL_PIPELINE_STATE_BLEND_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_USER_SHADER =
|
|
|
|
1L<<COGL_PIPELINE_STATE_USER_SHADER_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_DEPTH =
|
|
|
|
1L<<COGL_PIPELINE_STATE_DEPTH_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_FOG =
|
|
|
|
1L<<COGL_PIPELINE_STATE_FOG_INDEX,
|
2013-06-20 12:25:49 +00:00
|
|
|
COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE =
|
|
|
|
1L<<COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE_INDEX,
|
2010-12-03 11:36:49 +00:00
|
|
|
COGL_PIPELINE_STATE_POINT_SIZE =
|
|
|
|
1L<<COGL_PIPELINE_STATE_POINT_SIZE_INDEX,
|
2012-11-08 16:56:02 +00:00
|
|
|
COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE =
|
|
|
|
1L<<COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE_INDEX,
|
2011-07-11 01:27:54 +00:00
|
|
|
COGL_PIPELINE_STATE_LOGIC_OPS =
|
|
|
|
1L<<COGL_PIPELINE_STATE_LOGIC_OPS_INDEX,
|
2011-09-15 10:25:39 +00:00
|
|
|
COGL_PIPELINE_STATE_CULL_FACE =
|
|
|
|
1L<<COGL_PIPELINE_STATE_CULL_FACE_INDEX,
|
cogl-pipeline: Add support for setting uniform values
This adds the following new public experimental functions to set
uniform values on a CoglPipeline:
void
cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline,
int uniform_location,
float value);
void
cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline,
int uniform_location,
int value);
void
cogl_pipeline_set_uniform_float (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const float *value);
void
cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const int *value);
void
cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
const float *value);
These are similar to the old functions used to set uniforms on a
CoglProgram. To get a value to pass in as the uniform_location there
is also:
int
cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
const char *uniform_name);
Conceptually the uniform locations are tied to the pipeline so that
whenever setting a value for a new pipeline the application is
expected to call this function. However in practice the uniform
locations are global to the CoglContext. The names are stored in a
linked list where the position in the list is the uniform location.
The global indices are used so that each pipeline can store a mask of
which uniforms it overrides. That way it is quicker to detect which
uniforms are different from the last pipeline that used the same
CoglProgramState so it can avoid flushing uniforms that haven't
changed. Currently the values are not actually compared which means
that it will only avoid flushing a uniform if there is a common
ancestor that sets the value (or if the same pipeline is being flushed
again - in which case the pipeline and its common ancestor are the
same thing).
The uniform values are stored in the big state of the pipeline as a
sparse linked list. A bitmask stores which values have been overridden
and only overridden values are stored in the linked list.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-03 17:20:43 +00:00
|
|
|
COGL_PIPELINE_STATE_UNIFORMS =
|
|
|
|
1L<<COGL_PIPELINE_STATE_UNIFORMS_INDEX,
|
2011-11-17 16:52:21 +00:00
|
|
|
COGL_PIPELINE_STATE_VERTEX_SNIPPETS =
|
|
|
|
1L<<COGL_PIPELINE_STATE_VERTEX_SNIPPETS_INDEX,
|
|
|
|
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS =
|
|
|
|
1L<<COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS_INDEX,
|
2010-12-03 11:36:49 +00:00
|
|
|
|
|
|
|
COGL_PIPELINE_STATE_REAL_BLEND_ENABLE =
|
|
|
|
1L<<COGL_PIPELINE_STATE_REAL_BLEND_ENABLE_INDEX,
|
|
|
|
|
2011-01-12 17:11:48 +00:00
|
|
|
} CoglPipelineState;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Various special masks that tag state-groups in different ways...
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COGL_PIPELINE_STATE_ALL \
|
|
|
|
((1L<<COGL_PIPELINE_STATE_COUNT) - 1)
|
|
|
|
|
|
|
|
#define COGL_PIPELINE_STATE_ALL_SPARSE \
|
|
|
|
(COGL_PIPELINE_STATE_ALL \
|
|
|
|
& ~COGL_PIPELINE_STATE_REAL_BLEND_ENABLE)
|
|
|
|
|
|
|
|
#define COGL_PIPELINE_STATE_AFFECTS_BLENDING \
|
|
|
|
(COGL_PIPELINE_STATE_COLOR | \
|
|
|
|
COGL_PIPELINE_STATE_BLEND_ENABLE | \
|
|
|
|
COGL_PIPELINE_STATE_LAYERS | \
|
|
|
|
COGL_PIPELINE_STATE_LIGHTING | \
|
|
|
|
COGL_PIPELINE_STATE_BLEND | \
|
2011-11-17 16:52:21 +00:00
|
|
|
COGL_PIPELINE_STATE_USER_SHADER | \
|
|
|
|
COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \
|
|
|
|
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS)
|
2011-01-12 17:11:48 +00:00
|
|
|
|
|
|
|
#define COGL_PIPELINE_STATE_NEEDS_BIG_STATE \
|
|
|
|
(COGL_PIPELINE_STATE_LIGHTING | \
|
|
|
|
COGL_PIPELINE_STATE_ALPHA_FUNC | \
|
|
|
|
COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE | \
|
|
|
|
COGL_PIPELINE_STATE_BLEND | \
|
|
|
|
COGL_PIPELINE_STATE_USER_SHADER | \
|
|
|
|
COGL_PIPELINE_STATE_DEPTH | \
|
|
|
|
COGL_PIPELINE_STATE_FOG | \
|
2013-06-20 12:25:49 +00:00
|
|
|
COGL_PIPELINE_STATE_NON_ZERO_POINT_SIZE | \
|
2011-07-11 01:27:54 +00:00
|
|
|
COGL_PIPELINE_STATE_POINT_SIZE | \
|
2012-11-08 16:56:02 +00:00
|
|
|
COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE | \
|
2011-09-15 10:25:39 +00:00
|
|
|
COGL_PIPELINE_STATE_LOGIC_OPS | \
|
cogl-pipeline: Add support for setting uniform values
This adds the following new public experimental functions to set
uniform values on a CoglPipeline:
void
cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline,
int uniform_location,
float value);
void
cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline,
int uniform_location,
int value);
void
cogl_pipeline_set_uniform_float (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const float *value);
void
cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const int *value);
void
cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
const float *value);
These are similar to the old functions used to set uniforms on a
CoglProgram. To get a value to pass in as the uniform_location there
is also:
int
cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
const char *uniform_name);
Conceptually the uniform locations are tied to the pipeline so that
whenever setting a value for a new pipeline the application is
expected to call this function. However in practice the uniform
locations are global to the CoglContext. The names are stored in a
linked list where the position in the list is the uniform location.
The global indices are used so that each pipeline can store a mask of
which uniforms it overrides. That way it is quicker to detect which
uniforms are different from the last pipeline that used the same
CoglProgramState so it can avoid flushing uniforms that haven't
changed. Currently the values are not actually compared which means
that it will only avoid flushing a uniform if there is a common
ancestor that sets the value (or if the same pipeline is being flushed
again - in which case the pipeline and its common ancestor are the
same thing).
The uniform values are stored in the big state of the pipeline as a
sparse linked list. A bitmask stores which values have been overridden
and only overridden values are stored in the linked list.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-03 17:20:43 +00:00
|
|
|
COGL_PIPELINE_STATE_CULL_FACE | \
|
2011-11-17 16:52:21 +00:00
|
|
|
COGL_PIPELINE_STATE_UNIFORMS | \
|
|
|
|
COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \
|
|
|
|
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS)
|
2011-01-12 17:11:48 +00:00
|
|
|
|
|
|
|
#define COGL_PIPELINE_STATE_MULTI_PROPERTY \
|
|
|
|
(COGL_PIPELINE_STATE_LAYERS | \
|
|
|
|
COGL_PIPELINE_STATE_LIGHTING | \
|
|
|
|
COGL_PIPELINE_STATE_BLEND | \
|
|
|
|
COGL_PIPELINE_STATE_DEPTH | \
|
2011-07-11 01:27:54 +00:00
|
|
|
COGL_PIPELINE_STATE_FOG | \
|
2011-09-15 10:25:39 +00:00
|
|
|
COGL_PIPELINE_STATE_LOGIC_OPS | \
|
cogl-pipeline: Add support for setting uniform values
This adds the following new public experimental functions to set
uniform values on a CoglPipeline:
void
cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline,
int uniform_location,
float value);
void
cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline,
int uniform_location,
int value);
void
cogl_pipeline_set_uniform_float (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const float *value);
void
cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const int *value);
void
cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
const float *value);
These are similar to the old functions used to set uniforms on a
CoglProgram. To get a value to pass in as the uniform_location there
is also:
int
cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
const char *uniform_name);
Conceptually the uniform locations are tied to the pipeline so that
whenever setting a value for a new pipeline the application is
expected to call this function. However in practice the uniform
locations are global to the CoglContext. The names are stored in a
linked list where the position in the list is the uniform location.
The global indices are used so that each pipeline can store a mask of
which uniforms it overrides. That way it is quicker to detect which
uniforms are different from the last pipeline that used the same
CoglProgramState so it can avoid flushing uniforms that haven't
changed. Currently the values are not actually compared which means
that it will only avoid flushing a uniform if there is a common
ancestor that sets the value (or if the same pipeline is being flushed
again - in which case the pipeline and its common ancestor are the
same thing).
The uniform values are stored in the big state of the pipeline as a
sparse linked list. A bitmask stores which values have been overridden
and only overridden values are stored in the linked list.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-03 17:20:43 +00:00
|
|
|
COGL_PIPELINE_STATE_CULL_FACE | \
|
2011-11-17 16:52:21 +00:00
|
|
|
COGL_PIPELINE_STATE_UNIFORMS | \
|
|
|
|
COGL_PIPELINE_STATE_VERTEX_SNIPPETS | \
|
|
|
|
COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS)
|
2011-01-12 17:11:48 +00:00
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_PIPELINE_LIGHTING_STATE_PROPERTY_AMBIENT = 1,
|
|
|
|
COGL_PIPELINE_LIGHTING_STATE_PROPERTY_DIFFUSE,
|
|
|
|
COGL_PIPELINE_LIGHTING_STATE_PROPERTY_SPECULAR,
|
|
|
|
COGL_PIPELINE_LIGHTING_STATE_PROPERTY_EMISSION,
|
|
|
|
COGL_PIPELINE_LIGHTING_STATE_PROPERTY_SHININESS
|
|
|
|
} CoglPipelineLightingStateProperty;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* Standard OpenGL lighting model attributes */
|
|
|
|
float ambient[4];
|
|
|
|
float diffuse[4];
|
|
|
|
float specular[4];
|
|
|
|
float emission[4];
|
|
|
|
float shininess;
|
|
|
|
} CoglPipelineLightingState;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* Determines what fragments are discarded based on their alpha */
|
|
|
|
CoglPipelineAlphaFunc alpha_func;
|
2010-11-04 13:57:36 +00:00
|
|
|
float alpha_func_reference;
|
2010-10-27 17:54:57 +00:00
|
|
|
} CoglPipelineAlphaFuncState;
|
|
|
|
|
|
|
|
typedef enum _CoglPipelineBlendEnable
|
|
|
|
{
|
|
|
|
/* XXX: we want to detect users mistakenly using TRUE or FALSE
|
|
|
|
* so start the enum at 2. */
|
|
|
|
COGL_PIPELINE_BLEND_ENABLE_ENABLED = 2,
|
|
|
|
COGL_PIPELINE_BLEND_ENABLE_DISABLED,
|
|
|
|
COGL_PIPELINE_BLEND_ENABLE_AUTOMATIC
|
|
|
|
} CoglPipelineBlendEnable;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* Determines how this pipeline is blended with other primitives */
|
2011-07-07 19:44:56 +00:00
|
|
|
#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL)
|
2010-10-27 17:54:57 +00:00
|
|
|
GLenum blend_equation_rgb;
|
|
|
|
GLenum blend_equation_alpha;
|
|
|
|
GLint blend_src_factor_alpha;
|
|
|
|
GLint blend_dst_factor_alpha;
|
|
|
|
CoglColor blend_constant;
|
|
|
|
#endif
|
|
|
|
GLint blend_src_factor_rgb;
|
|
|
|
GLint blend_dst_factor_rgb;
|
|
|
|
} CoglPipelineBlendState;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
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 20:56:40 +00:00
|
|
|
CoglBool enabled;
|
2010-10-27 17:54:57 +00:00
|
|
|
CoglColor color;
|
|
|
|
CoglFogMode mode;
|
|
|
|
float density;
|
|
|
|
float z_near;
|
|
|
|
float z_far;
|
|
|
|
} CoglPipelineFogState;
|
|
|
|
|
2011-07-11 01:27:54 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
CoglColorMask color_mask;
|
|
|
|
} CoglPipelineLogicOpsState;
|
|
|
|
|
2011-09-15 10:25:39 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
CoglPipelineCullFaceMode mode;
|
|
|
|
CoglWinding front_winding;
|
|
|
|
} CoglPipelineCullFaceState;
|
|
|
|
|
cogl-pipeline: Add support for setting uniform values
This adds the following new public experimental functions to set
uniform values on a CoglPipeline:
void
cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline,
int uniform_location,
float value);
void
cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline,
int uniform_location,
int value);
void
cogl_pipeline_set_uniform_float (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const float *value);
void
cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const int *value);
void
cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
const float *value);
These are similar to the old functions used to set uniforms on a
CoglProgram. To get a value to pass in as the uniform_location there
is also:
int
cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
const char *uniform_name);
Conceptually the uniform locations are tied to the pipeline so that
whenever setting a value for a new pipeline the application is
expected to call this function. However in practice the uniform
locations are global to the CoglContext. The names are stored in a
linked list where the position in the list is the uniform location.
The global indices are used so that each pipeline can store a mask of
which uniforms it overrides. That way it is quicker to detect which
uniforms are different from the last pipeline that used the same
CoglProgramState so it can avoid flushing uniforms that haven't
changed. Currently the values are not actually compared which means
that it will only avoid flushing a uniform if there is a common
ancestor that sets the value (or if the same pipeline is being flushed
again - in which case the pipeline and its common ancestor are the
same thing).
The uniform values are stored in the big state of the pipeline as a
sparse linked list. A bitmask stores which values have been overridden
and only overridden values are stored in the linked list.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-03 17:20:43 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
CoglBitmask override_mask;
|
2011-11-04 17:56:44 +00:00
|
|
|
|
|
|
|
/* This is an array of values. Only the uniforms that have a bit set
|
|
|
|
in override_mask have a corresponding value here. The uniform's
|
|
|
|
location is implicit from the order in this array */
|
|
|
|
CoglBoxedValue *override_values;
|
|
|
|
|
cogl-pipeline: Add support for setting uniform values
This adds the following new public experimental functions to set
uniform values on a CoglPipeline:
void
cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline,
int uniform_location,
float value);
void
cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline,
int uniform_location,
int value);
void
cogl_pipeline_set_uniform_float (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const float *value);
void
cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const int *value);
void
cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
const float *value);
These are similar to the old functions used to set uniforms on a
CoglProgram. To get a value to pass in as the uniform_location there
is also:
int
cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
const char *uniform_name);
Conceptually the uniform locations are tied to the pipeline so that
whenever setting a value for a new pipeline the application is
expected to call this function. However in practice the uniform
locations are global to the CoglContext. The names are stored in a
linked list where the position in the list is the uniform location.
The global indices are used so that each pipeline can store a mask of
which uniforms it overrides. That way it is quicker to detect which
uniforms are different from the last pipeline that used the same
CoglProgramState so it can avoid flushing uniforms that haven't
changed. Currently the values are not actually compared which means
that it will only avoid flushing a uniform if there is a common
ancestor that sets the value (or if the same pipeline is being flushed
again - in which case the pipeline and its common ancestor are the
same thing).
The uniform values are stored in the big state of the pipeline as a
sparse linked list. A bitmask stores which values have been overridden
and only overridden values are stored in the linked list.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-03 17:20:43 +00:00
|
|
|
/* Uniforms that have been modified since this pipeline was last
|
|
|
|
flushed */
|
|
|
|
CoglBitmask changed_mask;
|
|
|
|
} CoglPipelineUniformsState;
|
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
CoglPipelineLightingState lighting_state;
|
|
|
|
CoglPipelineAlphaFuncState alpha_state;
|
|
|
|
CoglPipelineBlendState blend_state;
|
|
|
|
CoglHandle user_program;
|
2011-04-14 17:12:03 +00:00
|
|
|
CoglDepthState depth_state;
|
2010-10-27 17:54:57 +00:00
|
|
|
CoglPipelineFogState fog_state;
|
|
|
|
float point_size;
|
2013-06-20 12:25:49 +00:00
|
|
|
unsigned int non_zero_point_size : 1;
|
|
|
|
unsigned int per_vertex_point_size : 1;
|
2011-07-11 01:27:54 +00:00
|
|
|
CoglPipelineLogicOpsState logic_ops_state;
|
2011-09-15 10:25:39 +00:00
|
|
|
CoglPipelineCullFaceState cull_face_state;
|
cogl-pipeline: Add support for setting uniform values
This adds the following new public experimental functions to set
uniform values on a CoglPipeline:
void
cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline,
int uniform_location,
float value);
void
cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline,
int uniform_location,
int value);
void
cogl_pipeline_set_uniform_float (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const float *value);
void
cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const int *value);
void
cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
const float *value);
These are similar to the old functions used to set uniforms on a
CoglProgram. To get a value to pass in as the uniform_location there
is also:
int
cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
const char *uniform_name);
Conceptually the uniform locations are tied to the pipeline so that
whenever setting a value for a new pipeline the application is
expected to call this function. However in practice the uniform
locations are global to the CoglContext. The names are stored in a
linked list where the position in the list is the uniform location.
The global indices are used so that each pipeline can store a mask of
which uniforms it overrides. That way it is quicker to detect which
uniforms are different from the last pipeline that used the same
CoglProgramState so it can avoid flushing uniforms that haven't
changed. Currently the values are not actually compared which means
that it will only avoid flushing a uniform if there is a common
ancestor that sets the value (or if the same pipeline is being flushed
again - in which case the pipeline and its common ancestor are the
same thing).
The uniform values are stored in the big state of the pipeline as a
sparse linked list. A bitmask stores which values have been overridden
and only overridden values are stored in the linked list.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-03 17:20:43 +00:00
|
|
|
CoglPipelineUniformsState uniforms_state;
|
2011-11-17 16:52:21 +00:00
|
|
|
CoglPipelineSnippetList vertex_snippets;
|
|
|
|
CoglPipelineSnippetList fragment_snippets;
|
2010-10-27 17:54:57 +00:00
|
|
|
} CoglPipelineBigState;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
CoglPipeline *owner;
|
|
|
|
CoglPipelineLayer *layer;
|
|
|
|
} CoglPipelineLayerCacheEntry;
|
|
|
|
|
2011-09-07 22:44:37 +00:00
|
|
|
typedef struct _CoglPipelineHashState
|
|
|
|
{
|
|
|
|
unsigned long layer_differences;
|
|
|
|
CoglPipelineEvalFlags flags;
|
|
|
|
unsigned int hash;
|
|
|
|
} CoglPipelineHashState;
|
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
/*
|
|
|
|
* CoglPipelineDestroyCallback
|
|
|
|
* @pipeline: The #CoglPipeline that has been destroyed
|
|
|
|
* @user_data: The private data associated with the callback
|
|
|
|
*
|
|
|
|
* Notifies when a weak pipeline has been destroyed because one
|
|
|
|
* of its ancestors has been freed or modified.
|
|
|
|
*/
|
|
|
|
typedef void (*CoglPipelineDestroyCallback)(CoglPipeline *pipeline,
|
|
|
|
void *user_data);
|
|
|
|
|
|
|
|
struct _CoglPipeline
|
|
|
|
{
|
|
|
|
/* XXX: Please think twice about adding members that *have* be
|
|
|
|
* initialized during a cogl_pipeline_copy. We are aiming to have
|
|
|
|
* copies be as cheap as possible and copies may be done by the
|
|
|
|
* primitives APIs which means they may happen in performance
|
|
|
|
* critical code paths.
|
|
|
|
*
|
|
|
|
* XXX: If you are extending the state we track please consider if
|
|
|
|
* the state is expected to vary frequently across many pipelines or
|
|
|
|
* if the state can be shared among many derived pipelines instead.
|
|
|
|
* This will determine if the state should be added directly to this
|
|
|
|
* structure which will increase the memory overhead for *all*
|
|
|
|
* pipelines or if instead it can go under ->big_state.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Layers represent their state in a tree structure where some of
|
|
|
|
* the state relating to a given pipeline or layer may actually be
|
|
|
|
* owned by one if is ancestors in the tree. We have a common data
|
|
|
|
* type to track the tree heirachy so we can share code... */
|
2011-09-08 23:40:06 +00:00
|
|
|
CoglNode _parent;
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
/* When weak pipelines are destroyed the user is notified via this
|
|
|
|
* callback */
|
|
|
|
CoglPipelineDestroyCallback destroy_callback;
|
|
|
|
|
|
|
|
/* When notifying that a weak pipeline has been destroyed this
|
|
|
|
* private data is passed to the above callback */
|
|
|
|
void *destroy_data;
|
|
|
|
|
2013-01-10 14:21:04 +00:00
|
|
|
/* We need to track if a pipeline is referenced in the journal
|
|
|
|
* because we can't allow modification to these pipelines without
|
|
|
|
* flushing the journal first */
|
|
|
|
unsigned int journal_ref_count;
|
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
/* A mask of which sparse state groups are different in this
|
|
|
|
* pipeline in comparison to its parent. */
|
2013-01-10 14:21:04 +00:00
|
|
|
unsigned int differences;
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
/* Whenever a pipeline is modified we increment the age. There's no
|
|
|
|
* guarantee that it won't wrap but it can nevertheless be a
|
|
|
|
* convenient mechanism to determine when a pipeline has been
|
|
|
|
* changed to you can invalidate some some associated cache that
|
|
|
|
* depends on the old state. */
|
2013-01-10 14:21:04 +00:00
|
|
|
unsigned int age;
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
/* This is the primary color of the pipeline.
|
|
|
|
*
|
|
|
|
* This is a sparse property, ref COGL_PIPELINE_STATE_COLOR */
|
2013-01-10 14:21:04 +00:00
|
|
|
CoglColor color;
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
/* A pipeline may be made up with multiple layers used to combine
|
|
|
|
* textures together.
|
|
|
|
*
|
|
|
|
* This is sparse state, ref COGL_PIPELINE_STATE_LAYERS */
|
|
|
|
unsigned int n_layers;
|
2013-01-10 14:21:04 +00:00
|
|
|
GList *layer_differences;
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
/* As a basic way to reduce memory usage we divide the pipeline
|
|
|
|
* state into two groups; the minimal state modified in 90% of
|
|
|
|
* all pipelines and the rest, so that the second group can
|
|
|
|
* be allocated dynamically when required... */
|
|
|
|
CoglPipelineBigState *big_state;
|
|
|
|
|
2013-05-30 14:42:35 +00:00
|
|
|
#ifdef COGL_DEBUG_ENABLED
|
2010-10-27 17:54:57 +00:00
|
|
|
/* For debugging purposes it's possible to associate a static const
|
|
|
|
* string with a pipeline which can be an aid when trying to trace
|
|
|
|
* where the pipeline originates from */
|
|
|
|
const char *static_breadcrumb;
|
2013-05-30 14:42:35 +00:00
|
|
|
#endif
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
/* Cached state... */
|
|
|
|
|
|
|
|
/* A cached, complete list of the layers this pipeline depends
|
|
|
|
* on sorted by layer->unit_index. */
|
|
|
|
CoglPipelineLayer **layers_cache;
|
|
|
|
/* To avoid a separate ->layers_cache allocation for common
|
|
|
|
* pipelines with only a few layers... */
|
|
|
|
CoglPipelineLayer *short_layers_cache[3];
|
|
|
|
|
|
|
|
/* The deprecated cogl_pipeline_get_layers() API returns a
|
|
|
|
* const GList of layers, which we track here... */
|
|
|
|
GList *deprecated_get_layers_list;
|
|
|
|
|
|
|
|
/* XXX: consider adding an authorities cache to speed up sparse
|
|
|
|
* property value lookups:
|
|
|
|
* CoglPipeline *authorities_cache[COGL_PIPELINE_N_SPARSE_PROPERTIES];
|
|
|
|
* and corresponding authorities_cache_dirty:1 bitfield
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* bitfields */
|
|
|
|
|
|
|
|
/* Weak pipelines don't count as dependants on their parents which
|
|
|
|
* means that the parent pipeline can be modified without
|
|
|
|
* considering how the modifications may affect the weak pipeline.
|
|
|
|
*/
|
|
|
|
unsigned int is_weak:1;
|
|
|
|
|
|
|
|
/* Determines if pipeline->big_state is valid */
|
|
|
|
unsigned int has_big_state:1;
|
|
|
|
|
|
|
|
/* By default blending is enabled automatically depending on the
|
|
|
|
* unlit color, the lighting colors or the texture format. The user
|
|
|
|
* can override this to explicitly enable or disable blending.
|
|
|
|
*
|
|
|
|
* This is a sparse property */
|
|
|
|
unsigned int blend_enable:3;
|
|
|
|
|
|
|
|
/* There are many factors that can determine if we need to enable
|
|
|
|
* blending, this holds our final decision */
|
|
|
|
unsigned int real_blend_enable:1;
|
|
|
|
|
2013-05-16 14:19:30 +00:00
|
|
|
/* Since the code for deciding if blending really needs to be
|
|
|
|
* enabled for a particular pipeline is quite expensive we update
|
|
|
|
* the real_blend_enable flag lazily when flushing a pipeline if
|
|
|
|
* this dirty flag has been set. */
|
|
|
|
unsigned int dirty_real_blend_enable:1;
|
|
|
|
|
|
|
|
/* Whenever a pipeline is flushed we keep track of whether the
|
|
|
|
* pipeline was used with a color attribute where we don't know
|
|
|
|
* whether the colors are opaque. The real_blend_enable state
|
|
|
|
* depends on this, and must be updated whenever this changes (even
|
|
|
|
* if dirty_real_blend_enable isn't set) */
|
|
|
|
unsigned int unknown_color_alpha:1;
|
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
unsigned int layers_cache_dirty:1;
|
|
|
|
unsigned int deprecated_get_layers_list_dirty:1;
|
|
|
|
|
2013-05-30 14:42:35 +00:00
|
|
|
#ifdef COGL_DEBUG_ENABLED
|
2010-10-27 17:54:57 +00:00
|
|
|
/* For debugging purposes it's possible to associate a static const
|
|
|
|
* string with a pipeline which can be an aid when trying to trace
|
|
|
|
* where the pipeline originates from */
|
|
|
|
unsigned int has_static_breadcrumb:1;
|
2013-05-30 14:42:35 +00:00
|
|
|
#endif
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2012-09-25 20:08:10 +00:00
|
|
|
/* There are multiple fragment and vertex processing backends for
|
|
|
|
* CoglPipeline, glsl, arbfp and fixed that are bundled under a
|
|
|
|
* "progend". This identifies the backend being used for the
|
|
|
|
* pipeline. */
|
|
|
|
unsigned int progend:3;
|
2010-10-27 17:54:57 +00:00
|
|
|
};
|
|
|
|
|
2010-11-29 16:56:41 +00:00
|
|
|
typedef struct _CoglPipelineFragend
|
2010-10-27 17:54:57 +00:00
|
|
|
{
|
2012-09-25 20:08:10 +00:00
|
|
|
void (*start) (CoglPipeline *pipeline,
|
|
|
|
int n_layers,
|
2012-09-27 10:06:16 +00:00
|
|
|
unsigned long pipelines_difference);
|
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 20:56:40 +00:00
|
|
|
CoglBool (*add_layer) (CoglPipeline *pipeline,
|
2010-10-27 17:54:57 +00:00
|
|
|
CoglPipelineLayer *layer,
|
|
|
|
unsigned long layers_difference);
|
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 20:56:40 +00:00
|
|
|
CoglBool (*passthrough) (CoglPipeline *pipeline);
|
|
|
|
CoglBool (*end) (CoglPipeline *pipeline,
|
2010-10-27 17:54:57 +00:00
|
|
|
unsigned long pipelines_difference);
|
|
|
|
|
|
|
|
void (*pipeline_pre_change_notify) (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineState change,
|
|
|
|
const CoglColor *new_color);
|
|
|
|
void (*pipeline_set_parent_notify) (CoglPipeline *pipeline);
|
|
|
|
void (*layer_pre_change_notify) (CoglPipeline *owner,
|
|
|
|
CoglPipelineLayer *layer,
|
|
|
|
CoglPipelineLayerState change);
|
2010-11-29 16:56:41 +00:00
|
|
|
} CoglPipelineFragend;
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2010-11-29 18:32:21 +00:00
|
|
|
typedef struct _CoglPipelineVertend
|
|
|
|
{
|
2012-09-25 20:08:10 +00:00
|
|
|
void (*start) (CoglPipeline *pipeline,
|
|
|
|
int n_layers,
|
2012-09-27 10:06:16 +00:00
|
|
|
unsigned long pipelines_difference);
|
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 20:56:40 +00:00
|
|
|
CoglBool (*add_layer) (CoglPipeline *pipeline,
|
2010-11-29 18:32:21 +00:00
|
|
|
CoglPipelineLayer *layer,
|
Re-design the matrix stack using a graph of ops
This re-designs the matrix stack so we now keep track of each separate
operation such as rotating, scaling, translating and multiplying as
immutable, ref-counted nodes in a graph.
Being a "graph" here means that different transformations composed of
a sequence of linked operation nodes may share nodes.
The first node in a matrix-stack is always a LOAD_IDENTITY operation.
As an example consider if an application where to draw three rectangles
A, B and C something like this:
cogl_framebuffer_scale (fb, 2, 2, 2);
cogl_framebuffer_push_matrix(fb);
cogl_framebuffer_translate (fb, 10, 0, 0);
cogl_framebuffer_push_matrix(fb);
cogl_framebuffer_rotate (fb, 45, 0, 0, 1);
cogl_framebuffer_draw_rectangle (...); /* A */
cogl_framebuffer_pop_matrix(fb);
cogl_framebuffer_draw_rectangle (...); /* B */
cogl_framebuffer_pop_matrix(fb);
cogl_framebuffer_push_matrix(fb);
cogl_framebuffer_set_modelview_matrix (fb, &mv);
cogl_framebuffer_draw_rectangle (...); /* C */
cogl_framebuffer_pop_matrix(fb);
That would result in a graph of nodes like this:
LOAD_IDENTITY
|
SCALE
/ \
SAVE LOAD
| |
TRANSLATE RECTANGLE(C)
| \
SAVE RECTANGLE(B)
|
ROTATE
|
RECTANGLE(A)
Each push adds a SAVE operation which serves as a marker to rewind too
when a corresponding pop is issued and also each SAVE node may also
store a cached matrix representing the composition of all its ancestor
nodes. This means if we repeatedly need to resolve a real CoglMatrix
for a given node then we don't need to repeat the composition.
Some advantages of this design are:
- A single pointer to any node in the graph can now represent a
complete, immutable transformation that can be logged for example
into a journal. Previously we were storing a full CoglMatrix in
each journal entry which is 16 floats for the matrix itself as well
as space for flags and another 16 floats for possibly storing a
cache of the inverse. This means that we significantly reduce
the size of the journal when drawing lots of primitives and we also
avoid copying over 128 bytes per entry.
- It becomes much cheaper to check for equality. In cases where some
(unlikely) false negatives are allowed simply comparing the pointers
of two matrix stack graph entries is enough. Previously we would use
memcmp() to compare matrices.
- It becomes easier to do comparisons of transformations. By looking
for the common ancestry between nodes we can determine the operations
that differentiate the transforms and use those to gain a high level
understanding of the differences. For example we use this in the
journal to be able to efficiently determine when two rectangle
transforms only differ by some translation so that we can perform
software clipping.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit f75aee93f6b293ca7a7babbd8fcc326ee6bf7aef)
2012-02-20 15:59:48 +00:00
|
|
|
unsigned long layers_difference,
|
|
|
|
CoglFramebuffer *framebuffer);
|
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 20:56:40 +00:00
|
|
|
CoglBool (*end) (CoglPipeline *pipeline,
|
2010-11-29 18:32:21 +00:00
|
|
|
unsigned long pipelines_difference);
|
|
|
|
|
|
|
|
void (*pipeline_pre_change_notify) (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineState change,
|
|
|
|
const CoglColor *new_color);
|
|
|
|
void (*layer_pre_change_notify) (CoglPipeline *owner,
|
|
|
|
CoglPipelineLayer *layer,
|
|
|
|
CoglPipelineLayerState change);
|
|
|
|
} CoglPipelineVertend;
|
|
|
|
|
2010-12-02 14:00:46 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-09-25 20:08:10 +00:00
|
|
|
int vertend;
|
|
|
|
int fragend;
|
|
|
|
CoglBool (*start) (CoglPipeline *pipeline);
|
2010-12-02 14:00:46 +00:00
|
|
|
void (*end) (CoglPipeline *pipeline,
|
2012-09-27 10:06:16 +00:00
|
|
|
unsigned long pipelines_difference);
|
2010-12-02 14:00:46 +00:00
|
|
|
void (*pipeline_pre_change_notify) (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineState change,
|
|
|
|
const CoglColor *new_color);
|
|
|
|
void (*layer_pre_change_notify) (CoglPipeline *owner,
|
|
|
|
CoglPipelineLayer *layer,
|
|
|
|
CoglPipelineLayerState change);
|
2010-12-06 12:31:51 +00:00
|
|
|
/* This is called after all of the other functions whenever the
|
|
|
|
pipeline is flushed, even if the pipeline hasn't changed since
|
|
|
|
the last flush */
|
Re-design the matrix stack using a graph of ops
This re-designs the matrix stack so we now keep track of each separate
operation such as rotating, scaling, translating and multiplying as
immutable, ref-counted nodes in a graph.
Being a "graph" here means that different transformations composed of
a sequence of linked operation nodes may share nodes.
The first node in a matrix-stack is always a LOAD_IDENTITY operation.
As an example consider if an application where to draw three rectangles
A, B and C something like this:
cogl_framebuffer_scale (fb, 2, 2, 2);
cogl_framebuffer_push_matrix(fb);
cogl_framebuffer_translate (fb, 10, 0, 0);
cogl_framebuffer_push_matrix(fb);
cogl_framebuffer_rotate (fb, 45, 0, 0, 1);
cogl_framebuffer_draw_rectangle (...); /* A */
cogl_framebuffer_pop_matrix(fb);
cogl_framebuffer_draw_rectangle (...); /* B */
cogl_framebuffer_pop_matrix(fb);
cogl_framebuffer_push_matrix(fb);
cogl_framebuffer_set_modelview_matrix (fb, &mv);
cogl_framebuffer_draw_rectangle (...); /* C */
cogl_framebuffer_pop_matrix(fb);
That would result in a graph of nodes like this:
LOAD_IDENTITY
|
SCALE
/ \
SAVE LOAD
| |
TRANSLATE RECTANGLE(C)
| \
SAVE RECTANGLE(B)
|
ROTATE
|
RECTANGLE(A)
Each push adds a SAVE operation which serves as a marker to rewind too
when a corresponding pop is issued and also each SAVE node may also
store a cached matrix representing the composition of all its ancestor
nodes. This means if we repeatedly need to resolve a real CoglMatrix
for a given node then we don't need to repeat the composition.
Some advantages of this design are:
- A single pointer to any node in the graph can now represent a
complete, immutable transformation that can be logged for example
into a journal. Previously we were storing a full CoglMatrix in
each journal entry which is 16 floats for the matrix itself as well
as space for flags and another 16 floats for possibly storing a
cache of the inverse. This means that we significantly reduce
the size of the journal when drawing lots of primitives and we also
avoid copying over 128 bytes per entry.
- It becomes much cheaper to check for equality. In cases where some
(unlikely) false negatives are allowed simply comparing the pointers
of two matrix stack graph entries is enough. Previously we would use
memcmp() to compare matrices.
- It becomes easier to do comparisons of transformations. By looking
for the common ancestry between nodes we can determine the operations
that differentiate the transforms and use those to gain a high level
understanding of the differences. For example we use this in the
journal to be able to efficiently determine when two rectangle
transforms only differ by some translation so that we can perform
software clipping.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit f75aee93f6b293ca7a7babbd8fcc326ee6bf7aef)
2012-02-20 15:59:48 +00:00
|
|
|
void (* pre_paint) (CoglPipeline *pipeline, CoglFramebuffer *framebuffer);
|
2010-12-02 14:00:46 +00:00
|
|
|
} CoglPipelineProgend;
|
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_PIPELINE_PROGRAM_TYPE_GLSL = 1,
|
|
|
|
COGL_PIPELINE_PROGRAM_TYPE_ARBFP,
|
|
|
|
COGL_PIPELINE_PROGRAM_TYPE_FIXED
|
|
|
|
} CoglPipelineProgramType;
|
|
|
|
|
2010-11-29 16:56:41 +00:00
|
|
|
extern const CoglPipelineFragend *
|
|
|
|
_cogl_pipeline_fragends[COGL_PIPELINE_N_FRAGENDS];
|
2010-11-29 18:32:21 +00:00
|
|
|
extern const CoglPipelineVertend *
|
|
|
|
_cogl_pipeline_vertends[COGL_PIPELINE_N_VERTENDS];
|
2010-12-02 14:00:46 +00:00
|
|
|
extern const CoglPipelineProgend *
|
|
|
|
_cogl_pipeline_progends[];
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_init_default_pipeline (void);
|
|
|
|
|
2010-12-03 16:56:54 +00:00
|
|
|
static inline CoglPipeline *
|
|
|
|
_cogl_pipeline_get_parent (CoglPipeline *pipeline)
|
|
|
|
{
|
2011-09-08 23:40:06 +00:00
|
|
|
CoglNode *parent_node = COGL_NODE (pipeline)->parent;
|
2010-12-03 16:56:54 +00:00
|
|
|
return COGL_PIPELINE (parent_node);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline CoglPipeline *
|
|
|
|
_cogl_pipeline_get_authority (CoglPipeline *pipeline,
|
|
|
|
unsigned long difference)
|
|
|
|
{
|
|
|
|
CoglPipeline *authority = pipeline;
|
|
|
|
while (!(authority->differences & difference))
|
|
|
|
authority = _cogl_pipeline_get_parent (authority);
|
|
|
|
return authority;
|
|
|
|
}
|
|
|
|
|
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 20:56:40 +00:00
|
|
|
typedef CoglBool (*CoglPipelineStateComparitor) (CoglPipeline *authority0,
|
2011-09-07 22:44:37 +00:00
|
|
|
CoglPipeline *authority1);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_update_authority (CoglPipeline *pipeline,
|
|
|
|
CoglPipeline *authority,
|
|
|
|
CoglPipelineState state,
|
|
|
|
CoglPipelineStateComparitor comparitor);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_pre_change_notify (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineState change,
|
|
|
|
const CoglColor *new_color,
|
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 20:56:40 +00:00
|
|
|
CoglBool from_layer_change);
|
2011-09-07 22:44:37 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_prune_redundant_ancestry (CoglPipeline *pipeline);
|
|
|
|
|
2013-05-16 14:19:30 +00:00
|
|
|
void
|
|
|
|
_cogl_pipeline_update_real_blend_enable (CoglPipeline *pipeline,
|
|
|
|
CoglBool unknown_color_alpha);
|
2011-09-07 22:44:37 +00:00
|
|
|
|
2012-02-09 20:38:03 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2012-08-25 18:39:51 +00:00
|
|
|
COGL_PIPELINE_GET_LAYER_NO_CREATE = 1<<0
|
2012-02-09 20:38:03 +00:00
|
|
|
} CoglPipelineGetLayerFlags;
|
|
|
|
|
2011-09-07 23:42:22 +00:00
|
|
|
CoglPipelineLayer *
|
2012-02-09 20:38:03 +00:00
|
|
|
_cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline,
|
|
|
|
int layer_index,
|
|
|
|
CoglPipelineGetLayerFlags flags);
|
|
|
|
|
|
|
|
#define _cogl_pipeline_get_layer(p, l) \
|
|
|
|
_cogl_pipeline_get_layer_with_flags (p, l, 0)
|
2011-09-07 23:42:22 +00: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 20:56:40 +00:00
|
|
|
CoglBool
|
2011-09-07 23:42:22 +00:00
|
|
|
_cogl_is_pipeline_layer (void *object);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_prune_empty_layer_difference (CoglPipeline *layers_authority,
|
|
|
|
CoglPipelineLayer *layer);
|
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
/*
|
|
|
|
* SECTION:cogl-pipeline-internals
|
|
|
|
* @short_description: Functions for creating custom primitives that make use
|
|
|
|
* of Cogl pipelines for filling.
|
|
|
|
*
|
|
|
|
* Normally you shouldn't need to use this API directly, but if you need to
|
|
|
|
* developing a custom/specialised primitive - probably using raw OpenGL - then
|
|
|
|
* this API aims to expose enough of the pipeline internals to support being
|
|
|
|
* able to fill your geometry according to a given Cogl pipeline.
|
|
|
|
*/
|
|
|
|
|
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 20:56:40 +00:00
|
|
|
CoglBool
|
2010-10-27 17:54:57 +00:00
|
|
|
_cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Calls the pre_paint method on the layer texture if there is
|
|
|
|
* one. This will determine whether mipmaps are needed based on the
|
|
|
|
* filter settings.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
_cogl_pipeline_pre_paint_for_layer (CoglPipeline *pipeline,
|
|
|
|
int layer_id);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CoglPipelineFlushFlag:
|
|
|
|
* @COGL_PIPELINE_FLUSH_FALLBACK_MASK: The fallback_layers member is set to
|
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 20:56:40 +00:00
|
|
|
* a uint32_t mask of the layers that can't be supported with the user
|
2010-10-27 17:54:57 +00:00
|
|
|
* supplied texture and need to be replaced with fallback textures. (1 =
|
|
|
|
* fallback, and the least significant bit = layer 0)
|
|
|
|
* @COGL_PIPELINE_FLUSH_DISABLE_MASK: The disable_layers member is set to
|
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 20:56:40 +00:00
|
|
|
* a uint32_t mask of the layers that you want to completly disable
|
2010-10-27 17:54:57 +00:00
|
|
|
* texturing for (1 = fallback, and the least significant bit = layer 0)
|
|
|
|
* @COGL_PIPELINE_FLUSH_LAYER0_OVERRIDE: The layer0_override_texture member is
|
|
|
|
* set to a GLuint OpenGL texture name to override the texture used for
|
|
|
|
* layer 0 of the pipeline. This is intended for dealing with sliced
|
|
|
|
* textures where you will need to point to each of the texture slices in
|
|
|
|
* turn when drawing your geometry. Passing a value of 0 is the same as
|
|
|
|
* not passing the option at all.
|
|
|
|
* @COGL_PIPELINE_FLUSH_SKIP_GL_COLOR: When flushing the GL state for the
|
|
|
|
* pipeline don't call glColor.
|
|
|
|
*/
|
|
|
|
typedef enum _CoglPipelineFlushFlag
|
|
|
|
{
|
|
|
|
COGL_PIPELINE_FLUSH_FALLBACK_MASK = 1L<<0,
|
|
|
|
COGL_PIPELINE_FLUSH_DISABLE_MASK = 1L<<1,
|
|
|
|
COGL_PIPELINE_FLUSH_LAYER0_OVERRIDE = 1L<<2,
|
2010-11-11 15:08:38 +00:00
|
|
|
COGL_PIPELINE_FLUSH_SKIP_GL_COLOR = 1L<<3
|
2010-10-27 17:54:57 +00:00
|
|
|
} CoglPipelineFlushFlag;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* CoglPipelineFlushOptions:
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef struct _CoglPipelineFlushOptions
|
|
|
|
{
|
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 20:56:40 +00:00
|
|
|
CoglPipelineFlushFlag flags;
|
2010-10-27 17:54:57 +00: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 20:56:40 +00:00
|
|
|
uint32_t fallback_layers;
|
|
|
|
uint32_t disable_layers;
|
|
|
|
CoglTexture *layer0_override_texture;
|
2010-10-27 17:54:57 +00:00
|
|
|
} CoglPipelineFlushOptions;
|
|
|
|
|
|
|
|
void
|
2010-12-02 20:48:45 +00:00
|
|
|
_cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type);
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
unsigned int
|
2010-12-06 21:29:56 +00:00
|
|
|
_cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func);
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* _cogl_pipeline_weak_copy:
|
|
|
|
* @pipeline: A #CoglPipeline object
|
|
|
|
* @callback: A callback to notify when your weak pipeline is destroyed
|
|
|
|
* @user_data: Private data to pass to your given callback.
|
|
|
|
*
|
|
|
|
* Returns a weak copy of the given source @pipeline. Unlike a normal
|
|
|
|
* copy no internal reference is taken on the source @pipeline and you
|
|
|
|
* can expect that later modifications of the source pipeline (or in
|
|
|
|
* fact any other pipeline) can result in the weak pipeline being
|
|
|
|
* destroyed.
|
|
|
|
*
|
|
|
|
* To understand this better its good to know a bit about the internal
|
|
|
|
* design of #CoglPipeline...
|
|
|
|
*
|
|
|
|
* Internally #CoglPipeline<!-- -->s are represented as a graph of
|
|
|
|
* property diff's, where each node is a diff of properties that gets
|
|
|
|
* applied on top of its parent. Copying a pipeline creates an empty
|
|
|
|
* diff and a child->parent relationship between the empty diff and
|
|
|
|
* the source @pipeline, parent.
|
|
|
|
*
|
|
|
|
* Because of this internal graph design a single #CoglPipeline may
|
|
|
|
* indirectly depend on a chain of ancestors to fully define all of
|
|
|
|
* its properties. Because a node depends on its ancestors it normally
|
|
|
|
* owns a reference to its parent to stop it from being freed. Also if
|
|
|
|
* you try to modify a pipeline with children we internally use a
|
|
|
|
* copy-on-write mechanism to ensure that you don't indirectly change
|
|
|
|
* the properties those children.
|
|
|
|
*
|
|
|
|
* Weak pipelines avoid the use of copy-on-write to preserve the
|
|
|
|
* integrity of weak dependants and instead weak dependants are
|
|
|
|
* simply destroyed allowing the parent to be modified directly. Also
|
|
|
|
* because weak pipelines don't own a reference to their parent they
|
|
|
|
* won't stop the source @pipeline from being freed when the user
|
|
|
|
* releases their reference on it.
|
|
|
|
*
|
|
|
|
* Because weak pipelines don't own a reference on their parent they
|
|
|
|
* are the recommended mechanism for creating derived pipelines that you
|
|
|
|
* want to cache as a private property of the original pipeline
|
|
|
|
* because they won't result in a circular dependency.
|
|
|
|
*
|
|
|
|
* An example use case:
|
|
|
|
*
|
|
|
|
* Consider for example you are implementing a custom primitive that is
|
|
|
|
* not compatible with certain source pipelines. To handle this you
|
|
|
|
* implement a validation stage that given an arbitrary pipeline as
|
|
|
|
* input will create a derived pipeline that is suitable for drawing
|
|
|
|
* your primitive.
|
|
|
|
*
|
|
|
|
* Because you don't want to have to repeat this validation every time
|
|
|
|
* the same incompatible pipeline is given as input you want to cache
|
|
|
|
* the result as a private property of the original pipeline. If the
|
|
|
|
* derived pipeline were created using cogl_pipeline_copy that would
|
|
|
|
* create a circular dependency so the original pipeline can never be
|
|
|
|
* freed.
|
|
|
|
*
|
|
|
|
* If you instead create a weak copy you won't stop the original pipeline
|
|
|
|
* from being freed if it's no longer needed, and you will instead simply
|
|
|
|
* be notified that your weak pipeline has been destroyed.
|
|
|
|
*
|
|
|
|
* This is the recommended coding pattern for validating an input
|
|
|
|
* pipeline and caching a derived result:
|
|
|
|
* |[
|
|
|
|
* static CoglUserDataKey _cogl_my_cache_key;
|
|
|
|
*
|
|
|
|
* typedef struct {
|
|
|
|
* CoglPipeline *validated_source;
|
|
|
|
* } MyValidatedMaterialCache;
|
|
|
|
*
|
|
|
|
* static void
|
|
|
|
* destroy_cache_cb (CoglObject *object, void *user_data)
|
|
|
|
* {
|
|
|
|
* g_slice_free (MyValidatedMaterialCache, user_data);
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* static void
|
|
|
|
* invalidate_cache_cb (CoglPipeline *destroyed, void *user_data)
|
|
|
|
* {
|
|
|
|
* MyValidatedMaterialCache *cache = user_data;
|
|
|
|
* cogl_object_unref (cache->validated_source);
|
|
|
|
* cache->validated_source = NULL;
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* static CoglPipeline *
|
|
|
|
* get_validated_pipeline (CoglPipeline *source)
|
|
|
|
* {
|
|
|
|
* MyValidatedMaterialCache *cache =
|
|
|
|
* cogl_object_get_user_data (COGL_OBJECT (source),
|
|
|
|
* &_cogl_my_cache_key);
|
|
|
|
* if (G_UNLIKELY (cache == NULL))
|
|
|
|
* {
|
|
|
|
* cache = g_slice_new (MyValidatedMaterialCache);
|
|
|
|
* cogl_object_set_user_data (COGL_OBJECT (source),
|
|
|
|
* &_cogl_my_cache_key,
|
|
|
|
* cache, destroy_cache_cb);
|
|
|
|
* cache->validated_source = source;
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* if (G_UNLIKELY (cache->validated_source == NULL))
|
|
|
|
* {
|
|
|
|
* cache->validated_source = source;
|
|
|
|
*
|
|
|
|
* / * Start validating source... * /
|
|
|
|
*
|
|
|
|
* / * If you find you need to change something... * /
|
|
|
|
* if (cache->validated_source == source)
|
|
|
|
* cache->validated_source =
|
|
|
|
* cogl_pipeline_weak_copy (source,
|
|
|
|
* invalidate_cache_cb,
|
|
|
|
* cache);
|
|
|
|
*
|
|
|
|
* / * Modify cache->validated_source * /
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* return cache->validated_source;
|
|
|
|
* }
|
|
|
|
* ]|
|
|
|
|
*/
|
|
|
|
CoglPipeline *
|
|
|
|
_cogl_pipeline_weak_copy (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineDestroyCallback callback,
|
|
|
|
void *user_data);
|
|
|
|
|
|
|
|
void
|
2012-09-25 20:08:10 +00:00
|
|
|
_cogl_pipeline_set_progend (CoglPipeline *pipeline, int progend);
|
2010-11-29 18:32:21 +00:00
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
CoglPipeline *
|
|
|
|
_cogl_pipeline_get_parent (CoglPipeline *pipeline);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_get_colorubv (CoglPipeline *pipeline,
|
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 20:56:40 +00:00
|
|
|
uint8_t *color);
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2010-11-04 13:57:36 +00:00
|
|
|
/* XXX: At some point it could be good for this to accept a mask of
|
|
|
|
* the state groups we are interested in comparing since we can
|
|
|
|
* probably use that information in a number situations to reduce
|
|
|
|
* the work we do. */
|
2010-10-27 17:54:57 +00:00
|
|
|
unsigned long
|
|
|
|
_cogl_pipeline_compare_differences (CoglPipeline *pipeline0,
|
|
|
|
CoglPipeline *pipeline1);
|
|
|
|
|
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 20:56:40 +00:00
|
|
|
CoglBool
|
2010-10-27 17:54:57 +00:00
|
|
|
_cogl_pipeline_equal (CoglPipeline *pipeline0,
|
|
|
|
CoglPipeline *pipeline1,
|
2013-05-16 14:19:30 +00:00
|
|
|
unsigned int differences,
|
2010-12-03 11:36:49 +00:00
|
|
|
unsigned long layer_differences,
|
|
|
|
CoglPipelineEvalFlags flags);
|
2010-10-27 17:54:57 +00:00
|
|
|
|
2010-11-04 13:57:36 +00:00
|
|
|
unsigned int
|
|
|
|
_cogl_pipeline_hash (CoglPipeline *pipeline,
|
2013-05-16 14:19:30 +00:00
|
|
|
unsigned int differences,
|
2010-11-04 13:57:36 +00:00
|
|
|
unsigned long layer_differences,
|
|
|
|
CoglPipelineEvalFlags flags);
|
|
|
|
|
2013-03-26 11:17:55 +00:00
|
|
|
/* Makes a copy of the given pipeline that is a child of the root
|
|
|
|
* pipeline rather than a child of the source pipeline. That way the
|
|
|
|
* new pipeline won't hold a reference to the source pipeline. The
|
|
|
|
* differences specified in @differences and @layer_differences are
|
|
|
|
* copied across and all other state is left with the default
|
|
|
|
* values. */
|
|
|
|
CoglPipeline *
|
|
|
|
_cogl_pipeline_deep_copy (CoglPipeline *pipeline,
|
|
|
|
unsigned long differences,
|
|
|
|
unsigned long layer_differences);
|
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
CoglPipeline *
|
|
|
|
_cogl_pipeline_journal_ref (CoglPipeline *pipeline);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_journal_unref (CoglPipeline *pipeline);
|
|
|
|
|
2010-12-06 12:31:16 +00:00
|
|
|
const CoglMatrix *
|
|
|
|
_cogl_pipeline_get_layer_matrix (CoglPipeline *pipeline,
|
|
|
|
int layer_index);
|
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
void
|
2011-08-24 20:30:34 +00:00
|
|
|
_cogl_pipeline_texture_storage_change_notify (CoglTexture *texture);
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_apply_legacy_state (CoglPipeline *pipeline);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_apply_overrides (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineFlushOptions *options);
|
|
|
|
|
|
|
|
CoglPipelineBlendEnable
|
|
|
|
_cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineBlendEnable enable);
|
|
|
|
|
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 20:56:40 +00:00
|
|
|
CoglBool
|
2011-09-14 14:25:58 +00:00
|
|
|
_cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline);
|
|
|
|
|
2013-05-30 14:42:35 +00:00
|
|
|
#ifdef COGL_DEBUG_ENABLED
|
2010-10-27 17:54:57 +00:00
|
|
|
void
|
|
|
|
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
|
|
|
|
const char *breadcrumb);
|
2013-05-30 14:42:35 +00:00
|
|
|
#endif
|
2010-10-27 17:54:57 +00:00
|
|
|
|
|
|
|
unsigned long
|
|
|
|
_cogl_pipeline_get_age (CoglPipeline *pipeline);
|
|
|
|
|
|
|
|
CoglPipeline *
|
|
|
|
_cogl_pipeline_get_authority (CoglPipeline *pipeline,
|
|
|
|
unsigned long difference);
|
|
|
|
|
2011-09-08 23:40:06 +00:00
|
|
|
void
|
|
|
|
_cogl_pipeline_add_layer_difference (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineLayer *layer,
|
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 20:56:40 +00:00
|
|
|
CoglBool inc_n_layers);
|
2011-09-08 23:40:06 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_remove_layer_difference (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineLayer *layer,
|
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 20:56:40 +00:00
|
|
|
CoglBool dec_n_layers);
|
2011-09-08 23:40:06 +00:00
|
|
|
|
2010-12-01 17:06:18 +00:00
|
|
|
CoglPipeline *
|
|
|
|
_cogl_pipeline_find_equivalent_parent (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineState pipeline_state,
|
2011-01-11 16:02:06 +00:00
|
|
|
CoglPipelineLayerState layer_state);
|
2010-12-01 17:06:18 +00:00
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
void
|
|
|
|
_cogl_pipeline_get_layer_combine_constant (CoglPipeline *pipeline,
|
|
|
|
int layer_index,
|
|
|
|
float *constant);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_prune_to_n_layers (CoglPipeline *pipeline, int n);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* API to support the deprecate cogl_pipeline_layer_xyz functions...
|
|
|
|
*/
|
|
|
|
|
2011-06-09 15:21:15 +00:00
|
|
|
const GList *
|
2010-10-27 17:54:57 +00:00
|
|
|
_cogl_pipeline_get_layers (CoglPipeline *pipeline);
|
|
|
|
|
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 20:56:40 +00:00
|
|
|
typedef CoglBool (*CoglPipelineInternalLayerCallback) (CoglPipelineLayer *layer,
|
2010-10-27 17:54:57 +00:00
|
|
|
void *user_data);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_foreach_layer_internal (CoglPipeline *pipeline,
|
|
|
|
CoglPipelineInternalLayerCallback callback,
|
|
|
|
void *user_data);
|
|
|
|
|
2012-09-27 10:06:16 +00:00
|
|
|
CoglBool
|
|
|
|
_cogl_pipeline_layer_numbers_equal (CoglPipeline *pipeline0,
|
|
|
|
CoglPipeline *pipeline1);
|
|
|
|
|
2013-01-19 16:00:33 +00:00
|
|
|
CoglBool
|
|
|
|
_cogl_pipeline_layer_and_unit_numbers_equal (CoglPipeline *pipeline0,
|
|
|
|
CoglPipeline *pipeline1);
|
|
|
|
|
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 20:56:40 +00:00
|
|
|
CoglBool
|
2010-11-19 15:42:26 +00:00
|
|
|
_cogl_pipeline_need_texture_combine_separate
|
|
|
|
(CoglPipelineLayer *combine_authority);
|
|
|
|
|
2010-11-04 13:57:36 +00:00
|
|
|
void
|
|
|
|
_cogl_pipeline_init_state_hash_functions (void);
|
|
|
|
|
|
|
|
void
|
|
|
|
_cogl_pipeline_init_layer_state_hash_functions (void);
|
|
|
|
|
2013-06-20 12:25:49 +00:00
|
|
|
CoglPipelineState
|
|
|
|
_cogl_pipeline_get_state_for_vertex_codegen (CoglContext *context);
|
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
CoglPipelineLayerState
|
|
|
|
_cogl_pipeline_get_layer_state_for_fragment_codegen (CoglContext *context);
|
|
|
|
|
|
|
|
CoglPipelineState
|
|
|
|
_cogl_pipeline_get_state_for_fragment_codegen (CoglContext *context);
|
|
|
|
|
2010-10-27 17:54:57 +00:00
|
|
|
#endif /* __COGL_PIPELINE_PRIVATE_H */
|
|
|
|
|