Rename CoglPipelineBackend to CoglPipelineFragend

The current Cogl pipeline backends are entirely concerned with the
fragment processing state. We also want to eventually have separate
backends to generate shaders for the vertex processing state so we
need to rename the fragment backends. 'Fragend' is a somewhat weird
name but we wanted to avoid ending up with illegible symbols like
CoglPipelineFragmentBackendGlslPrivate.
This commit is contained in:
Neil Roberts 2010-11-29 16:56:41 +00:00
parent 6ce210062d
commit 0098dc7acc
11 changed files with 265 additions and 264 deletions

View File

@ -234,12 +234,12 @@ cogl_sources_c = \
$(srcdir)/cogl-pipeline-private.h \ $(srcdir)/cogl-pipeline-private.h \
$(srcdir)/cogl-pipeline-opengl.c \ $(srcdir)/cogl-pipeline-opengl.c \
$(srcdir)/cogl-pipeline-opengl-private.h \ $(srcdir)/cogl-pipeline-opengl-private.h \
$(srcdir)/cogl-pipeline-glsl.c \ $(srcdir)/cogl-pipeline-fragend-glsl.c \
$(srcdir)/cogl-pipeline-glsl-private.h \ $(srcdir)/cogl-pipeline-fragend-glsl-private.h \
$(srcdir)/cogl-pipeline-arbfp.c \ $(srcdir)/cogl-pipeline-fragend-arbfp.c \
$(srcdir)/cogl-pipeline-arbfp-private.h \ $(srcdir)/cogl-pipeline-fragend-arbfp-private.h \
$(srcdir)/cogl-pipeline-fixed.c \ $(srcdir)/cogl-pipeline-fragend-fixed.c \
$(srcdir)/cogl-pipeline-fixed-private.h \ $(srcdir)/cogl-pipeline-fragend-fixed-private.h \
$(srcdir)/cogl-material-compat.c \ $(srcdir)/cogl-material-compat.c \
$(srcdir)/cogl-program.c \ $(srcdir)/cogl-program.c \
$(srcdir)/cogl-program-private.h \ $(srcdir)/cogl-program-private.h \

View File

@ -40,7 +40,7 @@
#include <string.h> #include <string.h>
#ifdef HAVE_COGL_GL #ifdef HAVE_COGL_GL
#include "cogl-pipeline-arbfp-private.h" #include "cogl-pipeline-fragend-arbfp-private.h"
#define glActiveTexture _context->drv.pf_glActiveTexture #define glActiveTexture _context->drv.pf_glActiveTexture
#endif #endif
@ -209,8 +209,8 @@ cogl_create_context (void)
_context->legacy_depth_test_enabled = FALSE; _context->legacy_depth_test_enabled = FALSE;
#ifdef HAVE_COGL_GL #ifdef HAVE_COGL_GL
_context->arbfp_cache = g_hash_table_new (_cogl_pipeline_arbfp_hash, _context->arbfp_cache = g_hash_table_new (_cogl_pipeline_fragend_arbfp_hash,
_cogl_pipeline_arbfp_equal); _cogl_pipeline_fragend_arbfp_equal);
#endif #endif
for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++) for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++)

View File

@ -25,18 +25,19 @@
* Robert Bragg <robert@linux.intel.com> * Robert Bragg <robert@linux.intel.com>
*/ */
#ifndef __COGL_PIPELINE_ARBFP_PRIVATE_H #ifndef __COGL_PIPELINE_FRAGEND_ARBFP_PRIVATE_H
#define __COGL_PIPELINE_ARBFP_PRIVATE_H #define __COGL_PIPELINE_FRAGEND_ARBFP_PRIVATE_H
#include "cogl-pipeline-private.h" #include "cogl-pipeline-private.h"
extern const CoglPipelineBackend _cogl_pipeline_arbfp_backend; extern const CoglPipelineFragend _cogl_pipeline_arbfp_fragend;
unsigned int unsigned int
_cogl_pipeline_arbfp_hash (const void *pipeline); _cogl_pipeline_fragend_arbfp_hash (const void *pipeline);
gboolean gboolean
_cogl_pipeline_arbfp_equal (const void *pipeline0, const void *pipeline1); _cogl_pipeline_fragend_arbfp_equal (const void *pipeline0,
const void *pipeline1);
#endif /* __COGL_PIPELINE_ARBFP_PRIVATE_H */ #endif /* __COGL_PIPELINE_ARBFP_PRIVATE_H */

View File

@ -32,7 +32,7 @@
#include "cogl-debug.h" #include "cogl-debug.h"
#include "cogl-pipeline-private.h" #include "cogl-pipeline-private.h"
#ifdef COGL_PIPELINE_BACKEND_ARBFP #ifdef COGL_PIPELINE_FRAGEND_ARBFP
#include "cogl.h" #include "cogl.h"
#include "cogl-internal.h" #include "cogl-internal.h"
@ -79,18 +79,18 @@
* code generation. * code generation.
*/ */
#define COGL_PIPELINE_ARBFP_FRAGMENT_STATE_MASK \ #define COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_STATE_MASK \
(COGL_PIPELINE_STATE_LAYERS | \ (COGL_PIPELINE_STATE_LAYERS | \
COGL_PIPELINE_STATE_USER_SHADER) COGL_PIPELINE_STATE_USER_SHADER)
#define COGL_PIPELINE_ARBFP_FRAGMENT_PROGRAM_STATE_MASK \ #define COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_PROGRAM_STATE_MASK \
COGL_PIPELINE_ARBFP_FRAGMENT_STATE_MASK COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_STATE_MASK
#define COGL_PIPELINE_ARBFP_LAYER_FRAGMENT_STATE_MASK \ #define COGL_PIPELINE_FRAGEND_ARBFP_LAYER_FRAGMENT_STATE_MASK \
COGL_PIPELINE_LAYER_STATE_ALL COGL_PIPELINE_LAYER_STATE_ALL
#define COGL_PIPELINE_ARBFP_LAYER_FRAGMENT_PROGRAM_STATE_MASK \ #define COGL_PIPELINE_FRAGEND_ARBFP_LAYER_FRAGMENT_PROGRAM_STATE_MASK \
(COGL_PIPELINE_ARBFP_LAYER_FRAGMENT_STATE_MASK & \ (COGL_PIPELINE_FRAGEND_ARBFP_LAYER_FRAGMENT_STATE_MASK & \
~(COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT | \ ~(COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT | \
COGL_PIPELINE_LAYER_STATE_FILTERS | \ COGL_PIPELINE_LAYER_STATE_FILTERS | \
COGL_PIPELINE_LAYER_STATE_WRAP_MODES | \ COGL_PIPELINE_LAYER_STATE_WRAP_MODES | \
@ -127,12 +127,12 @@ typedef struct _ArbfpProgramState
CoglPipeline *last_used_for_pipeline; CoglPipeline *last_used_for_pipeline;
} ArbfpProgramState; } ArbfpProgramState;
typedef struct _CoglPipelineBackendARBfpPrivate typedef struct _CoglPipelineFragendARBfpPrivate
{ {
ArbfpProgramState *arbfp_program_state; ArbfpProgramState *arbfp_program_state;
} CoglPipelineBackendARBfpPrivate; } CoglPipelineFragendARBfpPrivate;
const CoglPipelineBackend _cogl_pipeline_arbfp_backend; const CoglPipelineFragend _cogl_pipeline_arbfp_fragend;
static ArbfpProgramState * static ArbfpProgramState *
@ -174,50 +174,50 @@ arbfp_program_state_unref (ArbfpProgramState *state)
} }
static int static int
_cogl_pipeline_backend_arbfp_get_max_texture_units (void) _cogl_pipeline_fragend_arbfp_get_max_texture_units (void)
{ {
return _cogl_get_max_texture_image_units (); return _cogl_get_max_texture_image_units ();
} }
static CoglPipelineBackendARBfpPrivate * static CoglPipelineFragendARBfpPrivate *
get_arbfp_priv (CoglPipeline *pipeline) get_arbfp_priv (CoglPipeline *pipeline)
{ {
if (!(pipeline->backend_priv_set_mask & COGL_PIPELINE_BACKEND_ARBFP_MASK)) if (!(pipeline->fragend_priv_set_mask & COGL_PIPELINE_FRAGEND_ARBFP_MASK))
return NULL; return NULL;
return pipeline->backend_privs[COGL_PIPELINE_BACKEND_ARBFP]; return pipeline->fragend_privs[COGL_PIPELINE_FRAGEND_ARBFP];
} }
static void static void
set_arbfp_priv (CoglPipeline *pipeline, CoglPipelineBackendARBfpPrivate *priv) set_arbfp_priv (CoglPipeline *pipeline, CoglPipelineFragendARBfpPrivate *priv)
{ {
if (priv) if (priv)
{ {
pipeline->backend_privs[COGL_PIPELINE_BACKEND_ARBFP] = priv; pipeline->fragend_privs[COGL_PIPELINE_FRAGEND_ARBFP] = priv;
pipeline->backend_priv_set_mask |= COGL_PIPELINE_BACKEND_ARBFP_MASK; pipeline->fragend_priv_set_mask |= COGL_PIPELINE_FRAGEND_ARBFP_MASK;
} }
else else
pipeline->backend_priv_set_mask &= ~COGL_PIPELINE_BACKEND_ARBFP_MASK; pipeline->fragend_priv_set_mask &= ~COGL_PIPELINE_FRAGEND_ARBFP_MASK;
} }
static ArbfpProgramState * static ArbfpProgramState *
get_arbfp_program_state (CoglPipeline *pipeline) get_arbfp_program_state (CoglPipeline *pipeline)
{ {
CoglPipelineBackendARBfpPrivate *priv = get_arbfp_priv (pipeline); CoglPipelineFragendARBfpPrivate *priv = get_arbfp_priv (pipeline);
if (!priv) if (!priv)
return NULL; return NULL;
return priv->arbfp_program_state; return priv->arbfp_program_state;
} }
static gboolean static gboolean
_cogl_pipeline_backend_arbfp_start (CoglPipeline *pipeline, _cogl_pipeline_fragend_arbfp_start (CoglPipeline *pipeline,
int n_layers, int n_layers,
unsigned long pipelines_difference, unsigned long pipelines_difference,
int n_tex_coord_attribs) int n_tex_coord_attribs)
{ {
CoglPipelineBackendARBfpPrivate *priv; CoglPipelineFragendARBfpPrivate *priv;
CoglPipeline *authority; CoglPipeline *authority;
CoglPipelineBackendARBfpPrivate *authority_priv; CoglPipelineFragendARBfpPrivate *authority_priv;
ArbfpProgramState *arbfp_program_state; ArbfpProgramState *arbfp_program_state;
CoglHandle user_program; CoglHandle user_program;
@ -243,7 +243,7 @@ _cogl_pipeline_backend_arbfp_start (CoglPipeline *pipeline,
priv = get_arbfp_priv (pipeline); priv = get_arbfp_priv (pipeline);
if (!priv) if (!priv)
{ {
priv = g_slice_new0 (CoglPipelineBackendARBfpPrivate); priv = g_slice_new0 (CoglPipelineFragendARBfpPrivate);
set_arbfp_priv (pipeline, priv); set_arbfp_priv (pipeline, priv);
} }
@ -275,7 +275,7 @@ _cogl_pipeline_backend_arbfp_start (CoglPipeline *pipeline,
if (!authority_priv) if (!authority_priv)
{ {
authority_priv = g_slice_new0 (CoglPipelineBackendARBfpPrivate); authority_priv = g_slice_new0 (CoglPipelineFragendARBfpPrivate);
set_arbfp_priv (authority, authority_priv); set_arbfp_priv (authority, authority_priv);
} }
@ -349,12 +349,12 @@ _cogl_pipeline_backend_arbfp_start (CoglPipeline *pipeline,
} }
unsigned int unsigned int
_cogl_pipeline_arbfp_hash (const void *data) _cogl_pipeline_fragend_arbfp_hash (const void *data)
{ {
unsigned long fragment_state = unsigned long fragment_state =
COGL_PIPELINE_ARBFP_FRAGMENT_PROGRAM_STATE_MASK; COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_PROGRAM_STATE_MASK;
unsigned long layer_fragment_state = unsigned long layer_fragment_state =
COGL_PIPELINE_ARBFP_LAYER_FRAGMENT_PROGRAM_STATE_MASK; COGL_PIPELINE_FRAGEND_ARBFP_LAYER_FRAGMENT_PROGRAM_STATE_MASK;
CoglPipelineEvalFlags flags = COGL_PIPELINE_EVAL_FLAG_IGNORE_TEXTURE_DATA; CoglPipelineEvalFlags flags = COGL_PIPELINE_EVAL_FLAG_IGNORE_TEXTURE_DATA;
return _cogl_pipeline_hash ((CoglPipeline *)data, return _cogl_pipeline_hash ((CoglPipeline *)data,
@ -363,12 +363,12 @@ _cogl_pipeline_arbfp_hash (const void *data)
} }
gboolean gboolean
_cogl_pipeline_arbfp_equal (const void *a, const void *b) _cogl_pipeline_fragend_arbfp_equal (const void *a, const void *b)
{ {
unsigned long fragment_state = unsigned long fragment_state =
COGL_PIPELINE_ARBFP_FRAGMENT_PROGRAM_STATE_MASK; COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_PROGRAM_STATE_MASK;
unsigned long layer_fragment_state = unsigned long layer_fragment_state =
COGL_PIPELINE_ARBFP_LAYER_FRAGMENT_PROGRAM_STATE_MASK; COGL_PIPELINE_FRAGEND_ARBFP_LAYER_FRAGMENT_PROGRAM_STATE_MASK;
CoglPipelineEvalFlags flags = COGL_PIPELINE_EVAL_FLAG_IGNORE_TEXTURE_DATA; CoglPipelineEvalFlags flags = COGL_PIPELINE_EVAL_FLAG_IGNORE_TEXTURE_DATA;
return _cogl_pipeline_equal ((CoglPipeline *)a, (CoglPipeline *)b, return _cogl_pipeline_equal ((CoglPipeline *)a, (CoglPipeline *)b,
@ -416,18 +416,18 @@ setup_texture_source (ArbfpProgramState *arbfp_program_state,
} }
} }
typedef enum _CoglPipelineBackendARBfpArgType typedef enum _CoglPipelineFragendARBfpArgType
{ {
COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_SIMPLE, COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE,
COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_CONSTANT, COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT,
COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_TEXTURE COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE
} CoglPipelineBackendARBfpArgType; } CoglPipelineFragendARBfpArgType;
typedef struct _CoglPipelineBackendARBfpArg typedef struct _CoglPipelineFragendARBfpArg
{ {
const char *name; const char *name;
CoglPipelineBackendARBfpArgType type; CoglPipelineFragendARBfpArgType type;
/* for type = TEXTURE */ /* for type = TEXTURE */
int texture_unit; int texture_unit;
@ -438,22 +438,22 @@ typedef struct _CoglPipelineBackendARBfpArg
const char *swizzle; const char *swizzle;
} CoglPipelineBackendARBfpArg; } CoglPipelineFragendARBfpArg;
static void static void
append_arg (GString *source, const CoglPipelineBackendARBfpArg *arg) append_arg (GString *source, const CoglPipelineFragendARBfpArg *arg)
{ {
switch (arg->type) switch (arg->type)
{ {
case COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_TEXTURE: case COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE:
g_string_append_printf (source, "texel%d%s", g_string_append_printf (source, "texel%d%s",
arg->texture_unit, arg->swizzle); arg->texture_unit, arg->swizzle);
break; break;
case COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_CONSTANT: case COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT:
g_string_append_printf (source, "program.local[%d]%s", g_string_append_printf (source, "program.local[%d]%s",
arg->constant_id, arg->swizzle); arg->constant_id, arg->swizzle);
break; break;
case COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_SIMPLE: case COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE:
g_string_append_printf (source, "%s%s", g_string_append_printf (source, "%s%s",
arg->name, arg->swizzle); arg->name, arg->swizzle);
break; break;
@ -462,7 +462,7 @@ append_arg (GString *source, const CoglPipelineBackendARBfpArg *arg)
/* Note: we are trying to avoid duplicating strings during codegen /* Note: we are trying to avoid duplicating strings during codegen
* which is why we have the slightly awkward * which is why we have the slightly awkward
* CoglPipelineBackendARBfpArg mechanism. */ * CoglPipelineFragendARBfpArg mechanism. */
static void static void
setup_arg (CoglPipeline *pipeline, setup_arg (CoglPipeline *pipeline,
CoglPipelineLayer *layer, CoglPipelineLayer *layer,
@ -470,7 +470,7 @@ setup_arg (CoglPipeline *pipeline,
int arg_index, int arg_index,
GLint src, GLint src,
GLint op, GLint op,
CoglPipelineBackendARBfpArg *arg) CoglPipelineFragendARBfpArg *arg)
{ {
ArbfpProgramState *arbfp_program_state = get_arbfp_program_state (pipeline); ArbfpProgramState *arbfp_program_state = get_arbfp_program_state (pipeline);
static const char *tmp_name[3] = { "tmp0", "tmp1", "tmp2" }; static const char *tmp_name[3] = { "tmp0", "tmp1", "tmp2" };
@ -480,7 +480,7 @@ setup_arg (CoglPipeline *pipeline,
switch (src) switch (src)
{ {
case GL_TEXTURE: case GL_TEXTURE:
arg->type = COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_TEXTURE; arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE;
arg->name = "texel%d"; arg->name = "texel%d";
arg->texture_unit = _cogl_pipeline_layer_get_unit_index (layer); arg->texture_unit = _cogl_pipeline_layer_get_unit_index (layer);
texture = _cogl_pipeline_layer_get_texture (layer); texture = _cogl_pipeline_layer_get_texture (layer);
@ -495,24 +495,24 @@ setup_arg (CoglPipeline *pipeline,
unit_state->constant_id = arbfp_program_state->next_constant_id++; unit_state->constant_id = arbfp_program_state->next_constant_id++;
unit_state->dirty_combine_constant = TRUE; unit_state->dirty_combine_constant = TRUE;
arg->type = COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_CONSTANT; arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT;
arg->name = "program.local[%d]"; arg->name = "program.local[%d]";
arg->constant_id = unit_state->constant_id; arg->constant_id = unit_state->constant_id;
break; break;
} }
case GL_PRIMARY_COLOR: case GL_PRIMARY_COLOR:
arg->type = COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_SIMPLE; arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE;
arg->name = "fragment.color.primary"; arg->name = "fragment.color.primary";
break; break;
case GL_PREVIOUS: case GL_PREVIOUS:
arg->type = COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_SIMPLE; arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE;
if (_cogl_pipeline_layer_get_unit_index (layer) == 0) if (_cogl_pipeline_layer_get_unit_index (layer) == 0)
arg->name = "fragment.color.primary"; arg->name = "fragment.color.primary";
else else
arg->name = "output"; arg->name = "output";
break; break;
default: /* GL_TEXTURE0..N */ default: /* GL_TEXTURE0..N */
arg->type = COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_TEXTURE; arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE;
arg->name = "texture[%d]"; arg->name = "texture[%d]";
arg->texture_unit = src - GL_TEXTURE0; arg->texture_unit = src - GL_TEXTURE0;
texture = _cogl_pipeline_layer_get_texture (layer); texture = _cogl_pipeline_layer_get_texture (layer);
@ -532,7 +532,7 @@ setup_arg (CoglPipeline *pipeline,
arg_index); arg_index);
append_arg (arbfp_program_state->source, arg); append_arg (arbfp_program_state->source, arg);
g_string_append_printf (arbfp_program_state->source, ";\n"); g_string_append_printf (arbfp_program_state->source, ";\n");
arg->type = COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_SIMPLE; arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE;
arg->name = tmp_name[arg_index]; arg->name = tmp_name[arg_index];
arg->swizzle = ""; arg->swizzle = "";
break; break;
@ -553,7 +553,7 @@ setup_arg (CoglPipeline *pipeline,
g_string_append_printf (arbfp_program_state->source, ".a;\n"); g_string_append_printf (arbfp_program_state->source, ".a;\n");
else else
g_string_append_printf (arbfp_program_state->source, ";\n"); g_string_append_printf (arbfp_program_state->source, ";\n");
arg->type = COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_SIMPLE; arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE;
arg->name = tmp_name[arg_index]; arg->name = tmp_name[arg_index];
break; break;
default: default:
@ -563,8 +563,8 @@ setup_arg (CoglPipeline *pipeline,
} }
static gboolean static gboolean
backend_arbfp_args_equal (CoglPipelineBackendARBfpArg *arg0, fragend_arbfp_args_equal (CoglPipelineFragendARBfpArg *arg0,
CoglPipelineBackendARBfpArg *arg1) CoglPipelineFragendARBfpArg *arg1)
{ {
if (arg0->type != arg1->type) if (arg0->type != arg1->type)
return FALSE; return FALSE;
@ -573,13 +573,13 @@ backend_arbfp_args_equal (CoglPipelineBackendARBfpArg *arg0,
strcmp (arg0->name, arg1->name) != 0) strcmp (arg0->name, arg1->name) != 0)
return FALSE; return FALSE;
if (arg0->type == COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_TEXTURE && if (arg0->type == COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE &&
arg0->texture_unit != arg1->texture_unit) arg0->texture_unit != arg1->texture_unit)
return FALSE; return FALSE;
/* Note we don't have to check the target; a texture unit can only /* Note we don't have to check the target; a texture unit can only
* have one target enabled at a time. */ * have one target enabled at a time. */
if (arg0->type == COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_CONSTANT && if (arg0->type == COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT &&
arg0->constant_id != arg0->constant_id) arg0->constant_id != arg0->constant_id)
return FALSE; return FALSE;
@ -594,7 +594,7 @@ static void
append_function (CoglPipeline *pipeline, append_function (CoglPipeline *pipeline,
CoglBlendStringChannelMask mask, CoglBlendStringChannelMask mask,
GLint function, GLint function,
CoglPipelineBackendARBfpArg *args, CoglPipelineFragendARBfpArg *args,
int n_args) int n_args)
{ {
ArbfpProgramState *arbfp_program_state = get_arbfp_program_state (pipeline); ArbfpProgramState *arbfp_program_state = get_arbfp_program_state (pipeline);
@ -680,7 +680,7 @@ append_function (CoglPipeline *pipeline,
append_arg (arbfp_program_state->source, &args[0]); append_arg (arbfp_program_state->source, &args[0]);
g_string_append (arbfp_program_state->source, ", minus_one;\n"); g_string_append (arbfp_program_state->source, ", minus_one;\n");
if (!backend_arbfp_args_equal (&args[0], &args[1])) if (!fragend_arbfp_args_equal (&args[0], &args[1]))
{ {
g_string_append (arbfp_program_state->source, "MAD tmp4, two, "); g_string_append (arbfp_program_state->source, "MAD tmp4, two, ");
append_arg (arbfp_program_state->source, &args[1]); append_arg (arbfp_program_state->source, &args[1]);
@ -738,7 +738,7 @@ append_masked_combine (CoglPipeline *arbfp_authority,
{ {
int i; int i;
int n_args; int n_args;
CoglPipelineBackendARBfpArg args[3]; CoglPipelineFragendARBfpArg args[3];
n_args = _cogl_get_n_args_for_combine_func (function); n_args = _cogl_get_n_args_for_combine_func (function);
@ -761,7 +761,7 @@ append_masked_combine (CoglPipeline *arbfp_authority,
} }
static gboolean static gboolean
_cogl_pipeline_backend_arbfp_add_layer (CoglPipeline *pipeline, _cogl_pipeline_fragend_arbfp_add_layer (CoglPipeline *pipeline,
CoglPipelineLayer *layer, CoglPipelineLayer *layer,
unsigned long layers_difference) unsigned long layers_difference)
{ {
@ -844,7 +844,7 @@ _cogl_pipeline_backend_arbfp_add_layer (CoglPipeline *pipeline,
} }
gboolean gboolean
_cogl_pipeline_backend_arbfp_passthrough (CoglPipeline *pipeline) _cogl_pipeline_fragend_arbfp_passthrough (CoglPipeline *pipeline)
{ {
ArbfpProgramState *arbfp_program_state = get_arbfp_program_state (pipeline); ArbfpProgramState *arbfp_program_state = get_arbfp_program_state (pipeline);
@ -889,7 +889,7 @@ update_constants_cb (CoglPipeline *pipeline,
} }
static gboolean static gboolean
_cogl_pipeline_backend_arbfp_end (CoglPipeline *pipeline, _cogl_pipeline_fragend_arbfp_end (CoglPipeline *pipeline,
unsigned long pipelines_difference) unsigned long pipelines_difference)
{ {
ArbfpProgramState *arbfp_program_state = get_arbfp_program_state (pipeline); ArbfpProgramState *arbfp_program_state = get_arbfp_program_state (pipeline);
@ -900,13 +900,13 @@ _cogl_pipeline_backend_arbfp_end (CoglPipeline *pipeline,
if (arbfp_program_state->source) if (arbfp_program_state->source)
{ {
GLenum gl_error; GLenum gl_error;
COGL_STATIC_COUNTER (backend_arbfp_compile_counter, COGL_STATIC_COUNTER (fragend_arbfp_compile_counter,
"arbfp compile counter", "arbfp compile counter",
"Increments each time a new ARBfp " "Increments each time a new ARBfp "
"program is compiled", "program is compiled",
0 /* no application private data */); 0 /* no application private data */);
COGL_COUNTER_INC (_cogl_uprof_context, backend_arbfp_compile_counter); COGL_COUNTER_INC (_cogl_uprof_context, fragend_arbfp_compile_counter);
g_string_append (arbfp_program_state->source, g_string_append (arbfp_program_state->source,
"MOV result.color,output;\n"); "MOV result.color,output;\n");
@ -943,7 +943,7 @@ _cogl_pipeline_backend_arbfp_end (CoglPipeline *pipeline,
* with a pre-calculated hash value since there is a cost to * with a pre-calculated hash value since there is a cost to
* calculating the hash of a CoglPipeline and in this case * calculating the hash of a CoglPipeline and in this case
* we know we have already called _cogl_pipeline_hash during * we know we have already called _cogl_pipeline_hash during
* _cogl_pipeline_arbfp_backend_start so we could pass the * _cogl_pipeline_fragend_arbfp_backend_start so we could pass the
* value through to here to avoid hashing it again. * value through to here to avoid hashing it again.
*/ */
@ -1034,7 +1034,7 @@ _cogl_pipeline_backend_arbfp_end (CoglPipeline *pipeline,
static void static void
dirty_arbfp_program_state (CoglPipeline *pipeline) dirty_arbfp_program_state (CoglPipeline *pipeline)
{ {
CoglPipelineBackendARBfpPrivate *priv; CoglPipelineFragendARBfpPrivate *priv;
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
@ -1050,12 +1050,12 @@ dirty_arbfp_program_state (CoglPipeline *pipeline)
} }
static void static void
_cogl_pipeline_backend_arbfp_pipeline_pre_change_notify ( _cogl_pipeline_fragend_arbfp_pipeline_pre_change_notify (
CoglPipeline *pipeline, CoglPipeline *pipeline,
CoglPipelineState change, CoglPipelineState change,
const CoglColor *new_color) const CoglColor *new_color)
{ {
if (!(change & COGL_PIPELINE_ARBFP_FRAGMENT_PROGRAM_STATE_MASK)) if (!(change & COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_PROGRAM_STATE_MASK))
return; return;
dirty_arbfp_program_state (pipeline); dirty_arbfp_program_state (pipeline);
@ -1070,16 +1070,16 @@ _cogl_pipeline_backend_arbfp_pipeline_pre_change_notify (
* yet! * yet!
*/ */
static void static void
_cogl_pipeline_backend_arbfp_layer_pre_change_notify ( _cogl_pipeline_fragend_arbfp_layer_pre_change_notify (
CoglPipeline *owner, CoglPipeline *owner,
CoglPipelineLayer *layer, CoglPipelineLayer *layer,
CoglPipelineLayerState change) CoglPipelineLayerState change)
{ {
CoglPipelineBackendARBfpPrivate *priv = get_arbfp_priv (owner); CoglPipelineFragendARBfpPrivate *priv = get_arbfp_priv (owner);
if (!priv) if (!priv)
return; return;
if (change & COGL_PIPELINE_ARBFP_LAYER_FRAGMENT_PROGRAM_STATE_MASK) if (change & COGL_PIPELINE_FRAGEND_ARBFP_LAYER_FRAGMENT_PROGRAM_STATE_MASK)
{ {
dirty_arbfp_program_state (owner); dirty_arbfp_program_state (owner);
return; return;
@ -1104,30 +1104,30 @@ _cogl_pipeline_backend_arbfp_layer_pre_change_notify (
} }
static void static void
_cogl_pipeline_backend_arbfp_free_priv (CoglPipeline *pipeline) _cogl_pipeline_fragend_arbfp_free_priv (CoglPipeline *pipeline)
{ {
CoglPipelineBackendARBfpPrivate *priv = get_arbfp_priv (pipeline); CoglPipelineFragendARBfpPrivate *priv = get_arbfp_priv (pipeline);
if (priv) if (priv)
{ {
if (priv->arbfp_program_state) if (priv->arbfp_program_state)
arbfp_program_state_unref (priv->arbfp_program_state); arbfp_program_state_unref (priv->arbfp_program_state);
g_slice_free (CoglPipelineBackendARBfpPrivate, priv); g_slice_free (CoglPipelineFragendARBfpPrivate, priv);
set_arbfp_priv (pipeline, NULL); set_arbfp_priv (pipeline, NULL);
} }
} }
const CoglPipelineBackend _cogl_pipeline_arbfp_backend = const CoglPipelineFragend _cogl_pipeline_arbfp_fragend =
{ {
_cogl_pipeline_backend_arbfp_get_max_texture_units, _cogl_pipeline_fragend_arbfp_get_max_texture_units,
_cogl_pipeline_backend_arbfp_start, _cogl_pipeline_fragend_arbfp_start,
_cogl_pipeline_backend_arbfp_add_layer, _cogl_pipeline_fragend_arbfp_add_layer,
_cogl_pipeline_backend_arbfp_passthrough, _cogl_pipeline_fragend_arbfp_passthrough,
_cogl_pipeline_backend_arbfp_end, _cogl_pipeline_fragend_arbfp_end,
_cogl_pipeline_backend_arbfp_pipeline_pre_change_notify, _cogl_pipeline_fragend_arbfp_pipeline_pre_change_notify,
NULL, NULL,
_cogl_pipeline_backend_arbfp_layer_pre_change_notify, _cogl_pipeline_fragend_arbfp_layer_pre_change_notify,
_cogl_pipeline_backend_arbfp_free_priv, _cogl_pipeline_fragend_arbfp_free_priv
}; };
#endif /* COGL_PIPELINE_BACKEND_ARBFP */ #endif /* COGL_PIPELINE_FRAGEND_ARBFP */

View File

@ -25,12 +25,12 @@
* Robert Bragg <robert@linux.intel.com> * Robert Bragg <robert@linux.intel.com>
*/ */
#ifndef __COGL_PIPELINE_FIXED_PRIVATE_H #ifndef __COGL_PIPELINE_FRAGEND_FIXED_PRIVATE_H
#define __COGL_PIPELINE_FIXED_PRIVATE_H #define __COGL_PIPELINE_FRAGEND_FIXED_PRIVATE_H
#include "cogl-pipeline-private.h" #include "cogl-pipeline-private.h"
extern const CoglPipelineBackend _cogl_pipeline_fixed_backend; extern const CoglPipelineFragend _cogl_pipeline_fixed_fragend;
#endif /* __COGL_PIPELINE_FIXED_PRIVATE_H */ #endif /* __COGL_PIPELINE_FRAGEND_FIXED_PRIVATE_H */

View File

@ -32,7 +32,7 @@
#include "cogl-pipeline-private.h" #include "cogl-pipeline-private.h"
#include "cogl-pipeline-opengl-private.h" #include "cogl-pipeline-opengl-private.h"
#ifdef COGL_PIPELINE_BACKEND_FIXED #ifdef COGL_PIPELINE_FRAGEND_FIXED
#include "cogl.h" #include "cogl.h"
#include "cogl-internal.h" #include "cogl-internal.h"
@ -47,10 +47,10 @@
#include <glib/gprintf.h> #include <glib/gprintf.h>
#include <string.h> #include <string.h>
const CoglPipelineBackend _cogl_pipeline_fixed_backend; const CoglPipelineFragend _cogl_pipeline_fixed_fragend;
static int static int
_cogl_pipeline_backend_fixed_get_max_texture_units (void) _cogl_pipeline_fragend_fixed_get_max_texture_units (void)
{ {
_COGL_GET_CONTEXT (ctx, 0); _COGL_GET_CONTEXT (ctx, 0);
@ -67,7 +67,7 @@ _cogl_pipeline_backend_fixed_get_max_texture_units (void)
} }
static gboolean static gboolean
_cogl_pipeline_backend_fixed_start (CoglPipeline *pipeline, _cogl_pipeline_fragend_fixed_start (CoglPipeline *pipeline,
int n_layers, int n_layers,
unsigned long pipelines_difference, unsigned long pipelines_difference,
int n_tex_coord_attribs) int n_tex_coord_attribs)
@ -86,7 +86,7 @@ _cogl_pipeline_backend_fixed_start (CoglPipeline *pipeline,
} }
static gboolean static gboolean
_cogl_pipeline_backend_fixed_add_layer (CoglPipeline *pipeline, _cogl_pipeline_fragend_fixed_add_layer (CoglPipeline *pipeline,
CoglPipelineLayer *layer, CoglPipelineLayer *layer,
unsigned long layers_difference) unsigned long layers_difference)
{ {
@ -189,7 +189,7 @@ _cogl_pipeline_backend_fixed_add_layer (CoglPipeline *pipeline,
} }
static gboolean static gboolean
_cogl_pipeline_backend_fixed_end (CoglPipeline *pipeline, _cogl_pipeline_fragend_fixed_end (CoglPipeline *pipeline,
unsigned long pipelines_difference) unsigned long pipelines_difference)
{ {
if (pipelines_difference & COGL_PIPELINE_STATE_FOG) if (pipelines_difference & COGL_PIPELINE_STATE_FOG)
@ -243,18 +243,18 @@ _cogl_pipeline_backend_fixed_end (CoglPipeline *pipeline,
return TRUE; return TRUE;
} }
const CoglPipelineBackend _cogl_pipeline_fixed_backend = const CoglPipelineFragend _cogl_pipeline_fixed_fragend =
{ {
_cogl_pipeline_backend_fixed_get_max_texture_units, _cogl_pipeline_fragend_fixed_get_max_texture_units,
_cogl_pipeline_backend_fixed_start, _cogl_pipeline_fragend_fixed_start,
_cogl_pipeline_backend_fixed_add_layer, _cogl_pipeline_fragend_fixed_add_layer,
NULL, /* passthrough */ NULL, /* passthrough */
_cogl_pipeline_backend_fixed_end, _cogl_pipeline_fragend_fixed_end,
NULL, /* pipeline_change_notify */ NULL, /* pipeline_change_notify */
NULL, /* pipeline_set_parent_notify */ NULL, /* pipeline_set_parent_notify */
NULL, /* layer_change_notify */ NULL, /* layer_change_notify */
NULL /* free_priv */ NULL /* free_priv */
}; };
#endif /* COGL_PIPELINE_BACKEND_FIXED */ #endif /* COGL_PIPELINE_FRAGEND_FIXED */

View File

@ -25,12 +25,12 @@
* Robert Bragg <robert@linux.intel.com> * Robert Bragg <robert@linux.intel.com>
*/ */
#ifndef __COGL_PIPELINE_GLSL_PRIVATE_H #ifndef __COGL_PIPELINE_FRAGEND_GLSL_PRIVATE_H
#define __COGL_PIPELINE_GLSL_PRIVATE_H #define __COGL_PIPELINE_FRAGEND_GLSL_PRIVATE_H
#include "cogl-pipeline-private.h" #include "cogl-pipeline-private.h"
extern const CoglPipelineBackend _cogl_pipeline_glsl_backend; extern const CoglPipelineFragend _cogl_pipeline_glsl_fragend;
#endif /* __COGL_PIPELINE_GLSL_PRIVATE_H */ #endif /* __COGL_PIPELINE_FRAGEND_GLSL_PRIVATE_H */

View File

@ -35,7 +35,7 @@
#include "cogl-shader-private.h" #include "cogl-shader-private.h"
#include "cogl-blend-string.h" #include "cogl-blend-string.h"
#ifdef COGL_PIPELINE_BACKEND_GLSL #ifdef COGL_PIPELINE_FRAGEND_GLSL
#include "cogl.h" #include "cogl.h"
#include "cogl-internal.h" #include "cogl-internal.h"
@ -131,15 +131,15 @@ typedef struct _GlslProgramState
CoglPipeline *last_used_for_pipeline; CoglPipeline *last_used_for_pipeline;
} GlslProgramState; } GlslProgramState;
typedef struct _CoglPipelineBackendGlslPrivate typedef struct _CoglPipelineFragendGlslPrivate
{ {
GlslProgramState *glsl_program_state; GlslProgramState *glsl_program_state;
} CoglPipelineBackendGlslPrivate; } CoglPipelineFragendGlslPrivate;
const CoglPipelineBackend _cogl_pipeline_glsl_backend; const CoglPipelineFragend _cogl_pipeline_glsl_backend;
static int static int
_cogl_pipeline_backend_glsl_get_max_texture_units (void) _cogl_pipeline_fragend_glsl_get_max_texture_units (void)
{ {
return _cogl_get_max_texture_image_units (); return _cogl_get_max_texture_image_units ();
} }
@ -198,31 +198,31 @@ glsl_program_state_unref (GlslProgramState *state)
} }
} }
static CoglPipelineBackendGlslPrivate * static CoglPipelineFragendGlslPrivate *
get_glsl_priv (CoglPipeline *pipeline) get_glsl_priv (CoglPipeline *pipeline)
{ {
if (!(pipeline->backend_priv_set_mask & COGL_PIPELINE_BACKEND_GLSL_MASK)) if (!(pipeline->fragend_priv_set_mask & COGL_PIPELINE_FRAGEND_GLSL_MASK))
return NULL; return NULL;
return pipeline->backend_privs[COGL_PIPELINE_BACKEND_GLSL]; return pipeline->fragend_privs[COGL_PIPELINE_FRAGEND_GLSL];
} }
static void static void
set_glsl_priv (CoglPipeline *pipeline, CoglPipelineBackendGlslPrivate *priv) set_glsl_priv (CoglPipeline *pipeline, CoglPipelineFragendGlslPrivate *priv)
{ {
if (priv) if (priv)
{ {
pipeline->backend_privs[COGL_PIPELINE_BACKEND_GLSL] = priv; pipeline->fragend_privs[COGL_PIPELINE_FRAGEND_GLSL] = priv;
pipeline->backend_priv_set_mask |= COGL_PIPELINE_BACKEND_GLSL_MASK; pipeline->fragend_priv_set_mask |= COGL_PIPELINE_FRAGEND_GLSL_MASK;
} }
else else
pipeline->backend_priv_set_mask &= ~COGL_PIPELINE_BACKEND_GLSL_MASK; pipeline->fragend_priv_set_mask &= ~COGL_PIPELINE_FRAGEND_GLSL_MASK;
} }
static GlslProgramState * static GlslProgramState *
get_glsl_program_state (CoglPipeline *pipeline) get_glsl_program_state (CoglPipeline *pipeline)
{ {
CoglPipelineBackendGlslPrivate *priv = get_glsl_priv (pipeline); CoglPipelineFragendGlslPrivate *priv = get_glsl_priv (pipeline);
if (!priv) if (!priv)
return NULL; return NULL;
return priv->glsl_program_state; return priv->glsl_program_state;
@ -231,7 +231,7 @@ get_glsl_program_state (CoglPipeline *pipeline)
static void static void
dirty_glsl_program_state (CoglPipeline *pipeline) dirty_glsl_program_state (CoglPipeline *pipeline)
{ {
CoglPipelineBackendGlslPrivate *priv; CoglPipelineFragendGlslPrivate *priv;
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
@ -284,14 +284,14 @@ link_program (GLint gl_program)
} }
static gboolean static gboolean
_cogl_pipeline_backend_glsl_start (CoglPipeline *pipeline, _cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
int n_layers, int n_layers,
unsigned long pipelines_difference, unsigned long pipelines_difference,
int n_tex_coord_attribs) int n_tex_coord_attribs)
{ {
CoglPipelineBackendGlslPrivate *priv; CoglPipelineFragendGlslPrivate *priv;
CoglPipeline *authority; CoglPipeline *authority;
CoglPipelineBackendGlslPrivate *authority_priv; CoglPipelineFragendGlslPrivate *authority_priv;
CoglProgram *user_program; CoglProgram *user_program;
GSList *l; GSList *l;
int i; int i;
@ -311,7 +311,7 @@ _cogl_pipeline_backend_glsl_start (CoglPipeline *pipeline,
priv = get_glsl_priv (pipeline); priv = get_glsl_priv (pipeline);
if (!priv) if (!priv)
{ {
priv = g_slice_new0 (CoglPipelineBackendGlslPrivate); priv = g_slice_new0 (CoglPipelineFragendGlslPrivate);
set_glsl_priv (pipeline, priv); set_glsl_priv (pipeline, priv);
} }
@ -330,7 +330,7 @@ _cogl_pipeline_backend_glsl_start (CoglPipeline *pipeline,
authority_priv = get_glsl_priv (authority); authority_priv = get_glsl_priv (authority);
if (!authority_priv) if (!authority_priv)
{ {
authority_priv = g_slice_new0 (CoglPipelineBackendGlslPrivate); authority_priv = g_slice_new0 (CoglPipelineFragendGlslPrivate);
set_glsl_priv (authority, authority_priv); set_glsl_priv (authority, authority_priv);
} }
@ -755,7 +755,7 @@ append_masked_combine (CoglPipeline *pipeline,
} }
static gboolean static gboolean
_cogl_pipeline_backend_glsl_add_layer (CoglPipeline *pipeline, _cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline,
CoglPipelineLayer *layer, CoglPipelineLayer *layer,
unsigned long layers_difference) unsigned long layers_difference)
{ {
@ -799,7 +799,7 @@ _cogl_pipeline_backend_glsl_add_layer (CoglPipeline *pipeline,
} }
gboolean gboolean
_cogl_pipeline_backend_glsl_passthrough (CoglPipeline *pipeline) _cogl_pipeline_fragend_glsl_passthrough (CoglPipeline *pipeline)
{ {
GlslProgramState *glsl_program_state = get_glsl_program_state (pipeline); GlslProgramState *glsl_program_state = get_glsl_program_state (pipeline);
@ -996,7 +996,7 @@ update_alpha_test_reference (CoglPipeline *pipeline,
#endif /* HAVE_COGL_GLES2 */ #endif /* HAVE_COGL_GLES2 */
gboolean gboolean
_cogl_pipeline_backend_glsl_end (CoglPipeline *pipeline, _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
unsigned long pipelines_difference) unsigned long pipelines_difference)
{ {
GlslProgramState *glsl_program_state = get_glsl_program_state (pipeline); GlslProgramState *glsl_program_state = get_glsl_program_state (pipeline);
@ -1044,12 +1044,12 @@ _cogl_pipeline_backend_glsl_end (CoglPipeline *pipeline,
GLint compile_status; GLint compile_status;
GLuint shader; GLuint shader;
COGL_STATIC_COUNTER (backend_glsl_compile_counter, COGL_STATIC_COUNTER (fragend_glsl_compile_counter,
"glsl compile counter", "glsl compile counter",
"Increments each time a new GLSL " "Increments each time a new GLSL "
"program is compiled", "program is compiled",
0 /* no application private data */); 0 /* no application private data */);
COGL_COUNTER_INC (_cogl_uprof_context, backend_glsl_compile_counter); COGL_COUNTER_INC (_cogl_uprof_context, fragend_glsl_compile_counter);
#ifdef HAVE_COGL_GLES2 #ifdef HAVE_COGL_GLES2
add_alpha_test_snippet (pipeline, glsl_program_state); add_alpha_test_snippet (pipeline, glsl_program_state);
@ -1163,7 +1163,7 @@ _cogl_pipeline_backend_glsl_end (CoglPipeline *pipeline,
} }
static void static void
_cogl_pipeline_backend_glsl_pre_change_notify (CoglPipeline *pipeline, _cogl_pipeline_fragend_glsl_pre_change_notify (CoglPipeline *pipeline,
CoglPipelineState change, CoglPipelineState change,
const CoglColor *new_color) const CoglColor *new_color)
{ {
@ -1196,12 +1196,12 @@ _cogl_pipeline_backend_glsl_pre_change_notify (CoglPipeline *pipeline,
* yet! * yet!
*/ */
static void static void
_cogl_pipeline_backend_glsl_layer_pre_change_notify ( _cogl_pipeline_fragend_glsl_layer_pre_change_notify (
CoglPipeline *owner, CoglPipeline *owner,
CoglPipelineLayer *layer, CoglPipelineLayer *layer,
CoglPipelineLayerState change) CoglPipelineLayerState change)
{ {
CoglPipelineBackendGlslPrivate *priv; CoglPipelineFragendGlslPrivate *priv;
static const unsigned long not_fragment_op_changes = static const unsigned long not_fragment_op_changes =
COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT | COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT |
COGL_PIPELINE_LAYER_STATE_TEXTURE | COGL_PIPELINE_LAYER_STATE_TEXTURE |
@ -1234,30 +1234,30 @@ _cogl_pipeline_backend_glsl_layer_pre_change_notify (
} }
static void static void
_cogl_pipeline_backend_glsl_free_priv (CoglPipeline *pipeline) _cogl_pipeline_fragend_glsl_free_priv (CoglPipeline *pipeline)
{ {
CoglPipelineBackendGlslPrivate *priv = get_glsl_priv (pipeline); CoglPipelineFragendGlslPrivate *priv = get_glsl_priv (pipeline);
if (priv) if (priv)
{ {
if (priv->glsl_program_state) if (priv->glsl_program_state)
glsl_program_state_unref (priv->glsl_program_state); glsl_program_state_unref (priv->glsl_program_state);
g_slice_free (CoglPipelineBackendGlslPrivate, priv); g_slice_free (CoglPipelineFragendGlslPrivate, priv);
set_glsl_priv (pipeline, NULL); set_glsl_priv (pipeline, NULL);
} }
} }
const CoglPipelineBackend _cogl_pipeline_glsl_backend = const CoglPipelineFragend _cogl_pipeline_glsl_fragend =
{ {
_cogl_pipeline_backend_glsl_get_max_texture_units, _cogl_pipeline_fragend_glsl_get_max_texture_units,
_cogl_pipeline_backend_glsl_start, _cogl_pipeline_fragend_glsl_start,
_cogl_pipeline_backend_glsl_add_layer, _cogl_pipeline_fragend_glsl_add_layer,
_cogl_pipeline_backend_glsl_passthrough, _cogl_pipeline_fragend_glsl_passthrough,
_cogl_pipeline_backend_glsl_end, _cogl_pipeline_fragend_glsl_end,
_cogl_pipeline_backend_glsl_pre_change_notify, _cogl_pipeline_fragend_glsl_pre_change_notify,
NULL, /* pipeline_set_parent_notify */ NULL, /* pipeline_set_parent_notify */
_cogl_pipeline_backend_glsl_layer_pre_change_notify, _cogl_pipeline_fragend_glsl_layer_pre_change_notify,
_cogl_pipeline_backend_glsl_free_priv _cogl_pipeline_fragend_glsl_free_priv,
}; };
#endif /* COGL_PIPELINE_BACKEND_GLSL */ #endif /* COGL_PIPELINE_FRAGEND_GLSL */

View File

@ -313,7 +313,7 @@ _cogl_use_program (GLuint gl_program, CoglPipelineProgramType type)
if (type == COGL_PIPELINE_PROGRAM_TYPE_GLSL) if (type == COGL_PIPELINE_PROGRAM_TYPE_GLSL)
{ {
#ifdef COGL_PIPELINE_BACKEND_GLSL #ifdef COGL_PIPELINE_FRAGEND_GLSL
if (ctx->current_gl_program != gl_program) if (ctx->current_gl_program != gl_program)
{ {
@ -333,20 +333,20 @@ _cogl_use_program (GLuint gl_program, CoglPipelineProgramType type)
#else #else
g_warning ("Unexpected use of GLSL backend!"); g_warning ("Unexpected use of GLSL fragend!");
#endif /* COGL_PIPELINE_BACKEND_GLSL */ #endif /* COGL_PIPELINE_FRAGEND_GLSL */
} }
#ifndef COGL_PIPELINE_BACKEND_ARBFP #ifndef COGL_PIPELINE_FRAGEND_ARBFP
else if (type == COGL_PIPELINE_PROGRAM_TYPE_ARBFP) else if (type == COGL_PIPELINE_PROGRAM_TYPE_ARBFP)
g_warning ("Unexpected use of ARBFP backend!"); g_warning ("Unexpected use of ARBFP fragend!");
#endif /* COGL_PIPELINE_BACKEND_ARBFP */ #endif /* COGL_PIPELINE_FRAGEND_ARBFP */
ctx->current_use_program_type = type; ctx->current_use_program_type = type;
} }
#if defined (COGL_PIPELINE_BACKEND_GLSL) || \ #if defined (COGL_PIPELINE_FRAGEND_GLSL) || \
defined (COGL_PIPELINE_BACKEND_ARBFP) defined (COGL_PIPELINE_FRAGEND_ARBFP)
int int
_cogl_get_max_texture_image_units (void) _cogl_get_max_texture_image_units (void)
{ {
@ -917,20 +917,20 @@ compare_layer_differences_cb (CoglPipelineLayer *layer, void *user_data)
typedef struct typedef struct
{ {
const CoglPipelineBackend *backend; const CoglPipelineFragend *fragend;
CoglPipeline *pipeline; CoglPipeline *pipeline;
unsigned long *layer_differences; unsigned long *layer_differences;
gboolean error_adding_layer; gboolean error_adding_layer;
gboolean added_layer; gboolean added_layer;
} CoglPipelineBackendAddLayerState; } CoglPipelineFragendAddLayerState;
static gboolean static gboolean
backend_add_layer_cb (CoglPipelineLayer *layer, fragend_add_layer_cb (CoglPipelineLayer *layer,
void *user_data) void *user_data)
{ {
CoglPipelineBackendAddLayerState *state = user_data; CoglPipelineFragendAddLayerState *state = user_data;
const CoglPipelineBackend *backend = state->backend; const CoglPipelineFragend *fragend = state->fragend;
CoglPipeline *pipeline = state->pipeline; CoglPipeline *pipeline = state->pipeline;
int unit_index = _cogl_pipeline_layer_get_unit_index (layer); int unit_index = _cogl_pipeline_layer_get_unit_index (layer);
CoglTextureUnit *unit = _cogl_get_texture_unit (unit_index); CoglTextureUnit *unit = _cogl_get_texture_unit (unit_index);
@ -943,7 +943,7 @@ backend_add_layer_cb (CoglPipelineLayer *layer,
if (!unit->enabled) if (!unit->enabled)
return FALSE; return FALSE;
if (G_UNLIKELY (unit_index >= backend->get_max_texture_units ())) if (G_UNLIKELY (unit_index >= fragend->get_max_texture_units ()))
{ {
int j; int j;
for (j = unit_index; j < ctx->texture_units->len; j++) for (j = unit_index; j < ctx->texture_units->len; j++)
@ -956,7 +956,7 @@ backend_add_layer_cb (CoglPipelineLayer *layer,
/* Either generate per layer code snippets or setup the /* Either generate per layer code snippets or setup the
* fixed function glTexEnv for each layer... */ * fixed function glTexEnv for each layer... */
if (G_LIKELY (backend->add_layer (pipeline, if (G_LIKELY (fragend->add_layer (pipeline,
layer, layer,
state->layer_differences[unit_index]))) state->layer_differences[unit_index])))
state->added_layer = TRUE; state->added_layer = TRUE;
@ -1105,59 +1105,59 @@ _cogl_pipeline_flush_gl_state (CoglPipeline *pipeline,
* configuration and in that case it will report an error and we * configuration and in that case it will report an error and we
* will fallback to a different backend. * will fallback to a different backend.
* *
* NB: if pipeline->backend != COGL_PIPELINE_BACKEND_UNDEFINED then * NB: if pipeline->backend != COGL_PIPELINE_FRAGEND_UNDEFINED then
* we have previously managed to successfully flush this pipeline * we have previously managed to successfully flush this pipeline
* with the given backend so we will simply use that to avoid * with the given backend so we will simply use that to avoid
* fallback code paths. * fallback code paths.
*/ */
if (pipeline->backend == COGL_PIPELINE_BACKEND_UNDEFINED) if (pipeline->fragend == COGL_PIPELINE_FRAGEND_UNDEFINED)
_cogl_pipeline_set_backend (pipeline, COGL_PIPELINE_BACKEND_DEFAULT); _cogl_pipeline_set_fragend (pipeline, COGL_PIPELINE_FRAGEND_DEFAULT);
for (i = pipeline->backend; for (i = pipeline->fragend;
i < G_N_ELEMENTS (_cogl_pipeline_backends); i < G_N_ELEMENTS (_cogl_pipeline_fragends);
i++, _cogl_pipeline_set_backend (pipeline, i)) i++, _cogl_pipeline_set_fragend (pipeline, i))
{ {
const CoglPipelineBackend *backend = _cogl_pipeline_backends[i]; const CoglPipelineFragend *fragend = _cogl_pipeline_fragends[i];
CoglPipelineBackendAddLayerState state; CoglPipelineFragendAddLayerState state;
/* E.g. For backends generating code they can setup their /* E.g. For fragends generating code they can setup their
* scratch buffers here... */ * scratch buffers here... */
if (G_UNLIKELY (!backend->start (pipeline, if (G_UNLIKELY (!fragend->start (pipeline,
n_layers, n_layers,
pipelines_difference, pipelines_difference,
n_tex_coord_attribs))) n_tex_coord_attribs)))
continue; continue;
state.backend = backend; state.fragend = fragend;
state.pipeline = pipeline; state.pipeline = pipeline;
state.layer_differences = layer_differences; state.layer_differences = layer_differences;
state.error_adding_layer = FALSE; state.error_adding_layer = FALSE;
state.added_layer = FALSE; state.added_layer = FALSE;
_cogl_pipeline_foreach_layer_internal (pipeline, _cogl_pipeline_foreach_layer_internal (pipeline,
backend_add_layer_cb, fragend_add_layer_cb,
&state); &state);
if (G_UNLIKELY (state.error_adding_layer)) if (G_UNLIKELY (state.error_adding_layer))
continue; continue;
if (!state.added_layer && if (!state.added_layer &&
backend->passthrough && fragend->passthrough &&
G_UNLIKELY (!backend->passthrough (pipeline))) G_UNLIKELY (!fragend->passthrough (pipeline)))
continue; continue;
/* For backends generating code they may compile and link their /* For fragends generating code they may compile and link their
* programs here, update any uniforms and tell OpenGL to use * programs here, update any uniforms and tell OpenGL to use
* that program. * that program.
*/ */
if (G_UNLIKELY (!backend->end (pipeline, pipelines_difference))) if (G_UNLIKELY (!fragend->end (pipeline, pipelines_difference)))
continue; continue;
break; break;
} }
if (G_UNLIKELY (i >= G_N_ELEMENTS (_cogl_pipeline_backends))) if (G_UNLIKELY (i >= G_N_ELEMENTS (_cogl_pipeline_fragends)))
g_warning ("No usable pipeline backend was found!"); g_warning ("No usable pipeline fragment backend was found!");
/* FIXME: This reference is actually resulting in lots of /* FIXME: This reference is actually resulting in lots of
* copy-on-write reparenting because one-shot pipelines end up * copy-on-write reparenting because one-shot pipelines end up

View File

@ -42,34 +42,34 @@ typedef struct _CoglPipelineLayer CoglPipelineLayer;
#if defined (HAVE_COGL_GL) #if defined (HAVE_COGL_GL)
/* NB: pipeline->backend is currently a 3bit unsigned int bitfield */ /* NB: pipeline->fragend is currently a 3bit unsigned int bitfield */
#define COGL_PIPELINE_BACKEND_ARBFP 0 #define COGL_PIPELINE_FRAGEND_ARBFP 0
#define COGL_PIPELINE_BACKEND_ARBFP_MASK (1L<<0) #define COGL_PIPELINE_FRAGEND_ARBFP_MASK (1L<<0)
#define COGL_PIPELINE_BACKEND_FIXED 1 #define COGL_PIPELINE_FRAGEND_FIXED 1
#define COGL_PIPELINE_BACKEND_FIXED_MASK (1L<<1) #define COGL_PIPELINE_FRAGEND_FIXED_MASK (1L<<1)
#define COGL_PIPELINE_BACKEND_GLSL 2 #define COGL_PIPELINE_FRAGEND_GLSL 2
#define COGL_PIPELINE_BACKEND_GLSL_MASK (1L<<2) #define COGL_PIPELINE_FRAGEND_GLSL_MASK (1L<<2)
#define COGL_PIPELINE_N_BACKENDS 3 #define COGL_PIPELINE_N_FRAGENDS 3
#elif defined (HAVE_COGL_GLES2) #elif defined (HAVE_COGL_GLES2)
#define COGL_PIPELINE_BACKEND_GLSL 0 #define COGL_PIPELINE_FRAGEND_GLSL 0
#define COGL_PIPELINE_BACKEND_GLSL_MASK (1L<<0) #define COGL_PIPELINE_FRAGEND_GLSL_MASK (1L<<0)
#define COGL_PIPELINE_N_BACKENDS 1 #define COGL_PIPELINE_N_FRAGENDS 1
#else /* HAVE_COGL_GLES */ #else /* HAVE_COGL_GLES */
#define COGL_PIPELINE_BACKEND_FIXED 0 #define COGL_PIPELINE_FRAGEND_FIXED 0
#define COGL_PIPELINE_BACKEND_FIXED_MASK (1L<<0) #define COGL_PIPELINE_FRAGEND_FIXED_MASK (1L<<0)
#define COGL_PIPELINE_N_BACKENDS 1 #define COGL_PIPELINE_N_FRAGENDS 1
#endif #endif
#define COGL_PIPELINE_BACKEND_DEFAULT 0 #define COGL_PIPELINE_FRAGEND_DEFAULT 0
#define COGL_PIPELINE_BACKEND_UNDEFINED 3 #define COGL_PIPELINE_FRAGEND_UNDEFINED 3
/* XXX: should I rename these as /* XXX: should I rename these as
* COGL_PIPELINE_LAYER_STATE_INDEX_XYZ... ? * COGL_PIPELINE_LAYER_STATE_INDEX_XYZ... ?
@ -510,7 +510,7 @@ struct _CoglPipeline
/* The fragment processing backends can associate private data with a /* The fragment processing backends can associate private data with a
* pipeline. */ * pipeline. */
void *backend_privs[COGL_PIPELINE_N_BACKENDS]; void *fragend_privs[COGL_PIPELINE_N_FRAGENDS];
/* Whenever a pipeline is modified we increment the age. There's no /* Whenever a pipeline is modified we increment the age. There's no
* guarantee that it won't wrap but it can nevertheless be a * guarantee that it won't wrap but it can nevertheless be a
@ -572,7 +572,7 @@ struct _CoglPipeline
* Each set bit indicates if the correspondong ->backend_privs[] * Each set bit indicates if the correspondong ->backend_privs[]
* entry is valid. * entry is valid.
*/ */
unsigned int backend_priv_set_mask:COGL_PIPELINE_N_BACKENDS; unsigned int fragend_priv_set_mask:COGL_PIPELINE_N_FRAGENDS;
/* Weak pipelines don't count as dependants on their parents which /* Weak pipelines don't count as dependants on their parents which
* means that the parent pipeline can be modified without * means that the parent pipeline can be modified without
@ -606,10 +606,10 @@ struct _CoglPipeline
* glsl, arbfp and fixed. This identifies the backend being used for * glsl, arbfp and fixed. This identifies the backend being used for
* the pipeline and any private state the backend has associated * the pipeline and any private state the backend has associated
* with the pipeline. */ * with the pipeline. */
unsigned int backend:3; unsigned int fragend:3;
}; };
typedef struct _CoglPipelineBackend typedef struct _CoglPipelineFragend
{ {
int (*get_max_texture_units) (void); int (*get_max_texture_units) (void);
@ -633,7 +633,7 @@ typedef struct _CoglPipelineBackend
CoglPipelineLayerState change); CoglPipelineLayerState change);
void (*free_priv) (CoglPipeline *pipeline); void (*free_priv) (CoglPipeline *pipeline);
} CoglPipelineBackend; } CoglPipelineFragend;
typedef enum typedef enum
{ {
@ -642,8 +642,8 @@ typedef enum
COGL_PIPELINE_PROGRAM_TYPE_FIXED COGL_PIPELINE_PROGRAM_TYPE_FIXED
} CoglPipelineProgramType; } CoglPipelineProgramType;
extern const CoglPipelineBackend * extern const CoglPipelineFragend *
_cogl_pipeline_backends[COGL_PIPELINE_N_BACKENDS]; _cogl_pipeline_fragends[COGL_PIPELINE_N_FRAGENDS];
void void
_cogl_pipeline_init_default_pipeline (void); _cogl_pipeline_init_default_pipeline (void);
@ -877,7 +877,7 @@ _cogl_pipeline_weak_copy (CoglPipeline *pipeline,
void *user_data); void *user_data);
void void
_cogl_pipeline_set_backend (CoglPipeline *pipeline, int backend); _cogl_pipeline_set_fragend (CoglPipeline *pipeline, int fragend);
CoglPipeline * CoglPipeline *
_cogl_pipeline_get_parent (CoglPipeline *pipeline); _cogl_pipeline_get_parent (CoglPipeline *pipeline);

View File

@ -63,16 +63,16 @@ static void handle_automatic_blend_enable (CoglPipeline *pipeline,
static void recursively_free_layer_caches (CoglPipeline *pipeline); static void recursively_free_layer_caches (CoglPipeline *pipeline);
static gboolean _cogl_pipeline_is_weak (CoglPipeline *pipeline); static gboolean _cogl_pipeline_is_weak (CoglPipeline *pipeline);
const CoglPipelineBackend *_cogl_pipeline_backends[COGL_PIPELINE_N_BACKENDS]; const CoglPipelineFragend *_cogl_pipeline_fragends[COGL_PIPELINE_N_FRAGENDS];
#ifdef COGL_PIPELINE_BACKEND_GLSL #ifdef COGL_PIPELINE_FRAGEND_GLSL
#include "cogl-pipeline-glsl-private.h" #include "cogl-pipeline-fragend-glsl-private.h"
#endif #endif
#ifdef COGL_PIPELINE_BACKEND_ARBFP #ifdef COGL_PIPELINE_FRAGEND_ARBFP
#include "cogl-pipeline-arbfp-private.h" #include "cogl-pipeline-fragend-arbfp-private.h"
#endif #endif
#ifdef COGL_PIPELINE_BACKEND_FIXED #ifdef COGL_PIPELINE_FRAGEND_FIXED
#include "cogl-pipeline-fixed-private.h" #include "cogl-pipeline-fragend-fixed-private.h"
#endif #endif
COGL_OBJECT_DEFINE (Pipeline, pipeline); COGL_OBJECT_DEFINE (Pipeline, pipeline);
@ -200,24 +200,24 @@ _cogl_pipeline_init_default_pipeline (void)
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
/* Take this opportunity to setup the fragment processing backends... */ /* Take this opportunity to setup the fragment processing backends... */
#ifdef COGL_PIPELINE_BACKEND_GLSL #ifdef COGL_PIPELINE_FRAGEND_GLSL
_cogl_pipeline_backends[COGL_PIPELINE_BACKEND_GLSL] = _cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_GLSL] =
&_cogl_pipeline_glsl_backend; &_cogl_pipeline_glsl_fragend;
#endif #endif
#ifdef COGL_PIPELINE_BACKEND_ARBFP #ifdef COGL_PIPELINE_FRAGEND_ARBFP
_cogl_pipeline_backends[COGL_PIPELINE_BACKEND_ARBFP] = _cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_ARBFP] =
&_cogl_pipeline_arbfp_backend; &_cogl_pipeline_arbfp_fragend;
#endif #endif
#ifdef COGL_PIPELINE_BACKEND_FIXED #ifdef COGL_PIPELINE_FRAGEND_FIXED
_cogl_pipeline_backends[COGL_PIPELINE_BACKEND_FIXED] = _cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_FIXED] =
&_cogl_pipeline_fixed_backend; &_cogl_pipeline_fixed_fragend;
#endif #endif
_cogl_pipeline_node_init (COGL_PIPELINE_NODE (pipeline)); _cogl_pipeline_node_init (COGL_PIPELINE_NODE (pipeline));
pipeline->is_weak = FALSE; pipeline->is_weak = FALSE;
pipeline->journal_ref_count = 0; pipeline->journal_ref_count = 0;
pipeline->backend = COGL_PIPELINE_BACKEND_UNDEFINED; pipeline->fragend = COGL_PIPELINE_FRAGEND_UNDEFINED;
pipeline->differences = COGL_PIPELINE_STATE_ALL_SPARSE; pipeline->differences = COGL_PIPELINE_STATE_ALL_SPARSE;
pipeline->real_blend_enable = FALSE; pipeline->real_blend_enable = FALSE;
@ -349,12 +349,12 @@ _cogl_pipeline_set_parent (CoglPipeline *pipeline,
* with the pipeline that depends on the pipeline's ancestry then it * with the pipeline that depends on the pipeline's ancestry then it
* may be notified here... * may be notified here...
*/ */
if (pipeline->backend != COGL_PIPELINE_BACKEND_UNDEFINED && if (pipeline->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED &&
_cogl_pipeline_backends[pipeline->backend]->pipeline_set_parent_notify) _cogl_pipeline_fragends[pipeline->fragend]->pipeline_set_parent_notify)
{ {
const CoglPipelineBackend *backend = const CoglPipelineFragend *fragend =
_cogl_pipeline_backends[pipeline->backend]; _cogl_pipeline_fragends[pipeline->fragend];
backend->pipeline_set_parent_notify (pipeline); fragend->pipeline_set_parent_notify (pipeline);
} }
} }
@ -429,8 +429,8 @@ _cogl_pipeline_copy (CoglPipeline *src, gboolean is_weak)
pipeline->layers_cache_dirty = TRUE; pipeline->layers_cache_dirty = TRUE;
pipeline->deprecated_get_layers_list_dirty = TRUE; pipeline->deprecated_get_layers_list_dirty = TRUE;
pipeline->backend = src->backend; pipeline->fragend = src->fragend;
pipeline->backend_priv_set_mask = 0; pipeline->fragend_priv_set_mask = 0;
pipeline->has_static_breadcrumb = FALSE; pipeline->has_static_breadcrumb = FALSE;
@ -482,14 +482,14 @@ cogl_pipeline_new (void)
} }
static void static void
_cogl_pipeline_backend_free_priv (CoglPipeline *pipeline) _cogl_pipeline_fragend_free_priv (CoglPipeline *pipeline)
{ {
if (pipeline->backend != COGL_PIPELINE_BACKEND_UNDEFINED && if (pipeline->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED &&
_cogl_pipeline_backends[pipeline->backend]->free_priv) _cogl_pipeline_fragends[pipeline->fragend]->free_priv)
{ {
const CoglPipelineBackend *backend = const CoglPipelineFragend *fragend =
_cogl_pipeline_backends[pipeline->backend]; _cogl_pipeline_fragends[pipeline->fragend];
backend->free_priv (pipeline); fragend->free_priv (pipeline);
} }
} }
@ -525,7 +525,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
g_assert (!COGL_PIPELINE_NODE (pipeline)->has_children); g_assert (!COGL_PIPELINE_NODE (pipeline)->has_children);
_cogl_pipeline_backend_free_priv (pipeline); _cogl_pipeline_fragend_free_priv (pipeline);
_cogl_pipeline_unparent (COGL_PIPELINE_NODE (pipeline)); _cogl_pipeline_unparent (COGL_PIPELINE_NODE (pipeline));
@ -936,10 +936,10 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
} }
void void
_cogl_pipeline_set_backend (CoglPipeline *pipeline, int backend) _cogl_pipeline_set_fragend (CoglPipeline *pipeline, int fragend)
{ {
_cogl_pipeline_backend_free_priv (pipeline); _cogl_pipeline_fragend_free_priv (pipeline);
pipeline->backend = backend; pipeline->fragend = fragend;
} }
static void static void
@ -1168,16 +1168,16 @@ _cogl_pipeline_pre_change_notify (CoglPipeline *pipeline,
* code in response to a pipeline change therefore we don't want to * code in response to a pipeline change therefore we don't want to
* try searching for another backend when the pipeline changes. * try searching for another backend when the pipeline changes.
*/ */
#ifdef COGL_PIPELINE_BACKEND_FIXED #ifdef COGL_PIPELINE_FRAGEND_FIXED
if (pipeline->backend == COGL_PIPELINE_BACKEND_FIXED) if (pipeline->fragend == COGL_PIPELINE_FRAGEND_FIXED)
_cogl_pipeline_set_backend (pipeline, COGL_PIPELINE_BACKEND_UNDEFINED); _cogl_pipeline_set_fragend (pipeline, COGL_PIPELINE_FRAGEND_UNDEFINED);
#endif #endif
if (pipeline->backend != COGL_PIPELINE_BACKEND_UNDEFINED && if (pipeline->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED &&
_cogl_pipeline_backends[pipeline->backend]->pipeline_pre_change_notify) _cogl_pipeline_fragends[pipeline->fragend]->pipeline_pre_change_notify)
{ {
const CoglPipelineBackend *backend = const CoglPipelineFragend *fragend =
_cogl_pipeline_backends[pipeline->backend]; _cogl_pipeline_fragends[pipeline->fragend];
/* To simplify things for the backends we are careful about how /* To simplify things for the backends we are careful about how
* we report STATE_LAYERS changes. * we report STATE_LAYERS changes.
@ -1198,7 +1198,7 @@ _cogl_pipeline_pre_change_notify (CoglPipeline *pipeline,
* layer pre-change notification for any particular change. * layer pre-change notification for any particular change.
*/ */
if (!from_layer_change) if (!from_layer_change)
backend->pipeline_pre_change_notify (pipeline, change, new_color); fragend->pipeline_pre_change_notify (pipeline, change, new_color);
} }
/* There may be an arbitrary tree of descendants of this pipeline; /* There may be an arbitrary tree of descendants of this pipeline;
@ -1485,7 +1485,7 @@ _cogl_pipeline_prune_to_n_layers (CoglPipeline *pipeline, int n)
} }
static void static void
_cogl_pipeline_backend_layer_change_notify (CoglPipeline *owner, _cogl_pipeline_fragend_layer_change_notify (CoglPipeline *owner,
CoglPipelineLayer *layer, CoglPipelineLayer *layer,
CoglPipelineLayerState change) CoglPipelineLayerState change)
{ {
@ -1495,12 +1495,12 @@ _cogl_pipeline_backend_layer_change_notify (CoglPipeline *owner,
* have a single owner and can only be associated with a single * have a single owner and can only be associated with a single
* backend that needs to be notified of the layer change... * backend that needs to be notified of the layer change...
*/ */
if (owner->backend != COGL_PIPELINE_BACKEND_UNDEFINED && if (owner->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED &&
_cogl_pipeline_backends[owner->backend]->layer_pre_change_notify) _cogl_pipeline_fragends[owner->fragend]->layer_pre_change_notify)
{ {
const CoglPipelineBackend *backend = const CoglPipelineFragend *fragend =
_cogl_pipeline_backends[owner->backend]; _cogl_pipeline_fragends[owner->fragend];
backend->layer_pre_change_notify (owner, layer, change); fragend->layer_pre_change_notify (owner, layer, change);
} }
} }
@ -1660,7 +1660,7 @@ _cogl_pipeline_layer_pre_change_notify (CoglPipeline *required_owner,
* this layer (required_owner), and there are no other layers * this layer (required_owner), and there are no other layers
* dependant on this layer so it's ok to modify it. */ * dependant on this layer so it's ok to modify it. */
_cogl_pipeline_backend_layer_change_notify (required_owner, layer, change); _cogl_pipeline_fragend_layer_change_notify (required_owner, layer, change);
/* If the layer being changed is the same as the last layer we /* If the layer being changed is the same as the last layer we
* flushed to the corresponding texture unit then we keep a track of * flushed to the corresponding texture unit then we keep a track of
@ -4319,7 +4319,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE); _cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
if (program != COGL_INVALID_HANDLE) if (program != COGL_INVALID_HANDLE)
_cogl_pipeline_set_backend (pipeline, COGL_PIPELINE_BACKEND_DEFAULT); _cogl_pipeline_set_fragend (pipeline, COGL_PIPELINE_FRAGEND_DEFAULT);
/* If we are the current authority see if we can revert to one of our /* If we are the current authority see if we can revert to one of our
* ancestors being the authority */ * ancestors being the authority */