mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
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:
parent
6ce210062d
commit
0098dc7acc
@ -234,12 +234,12 @@ cogl_sources_c = \
|
||||
$(srcdir)/cogl-pipeline-private.h \
|
||||
$(srcdir)/cogl-pipeline-opengl.c \
|
||||
$(srcdir)/cogl-pipeline-opengl-private.h \
|
||||
$(srcdir)/cogl-pipeline-glsl.c \
|
||||
$(srcdir)/cogl-pipeline-glsl-private.h \
|
||||
$(srcdir)/cogl-pipeline-arbfp.c \
|
||||
$(srcdir)/cogl-pipeline-arbfp-private.h \
|
||||
$(srcdir)/cogl-pipeline-fixed.c \
|
||||
$(srcdir)/cogl-pipeline-fixed-private.h \
|
||||
$(srcdir)/cogl-pipeline-fragend-glsl.c \
|
||||
$(srcdir)/cogl-pipeline-fragend-glsl-private.h \
|
||||
$(srcdir)/cogl-pipeline-fragend-arbfp.c \
|
||||
$(srcdir)/cogl-pipeline-fragend-arbfp-private.h \
|
||||
$(srcdir)/cogl-pipeline-fragend-fixed.c \
|
||||
$(srcdir)/cogl-pipeline-fragend-fixed-private.h \
|
||||
$(srcdir)/cogl-material-compat.c \
|
||||
$(srcdir)/cogl-program.c \
|
||||
$(srcdir)/cogl-program-private.h \
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
#include "cogl-pipeline-arbfp-private.h"
|
||||
#include "cogl-pipeline-fragend-arbfp-private.h"
|
||||
#define glActiveTexture _context->drv.pf_glActiveTexture
|
||||
#endif
|
||||
|
||||
@ -209,8 +209,8 @@ cogl_create_context (void)
|
||||
_context->legacy_depth_test_enabled = FALSE;
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
_context->arbfp_cache = g_hash_table_new (_cogl_pipeline_arbfp_hash,
|
||||
_cogl_pipeline_arbfp_equal);
|
||||
_context->arbfp_cache = g_hash_table_new (_cogl_pipeline_fragend_arbfp_hash,
|
||||
_cogl_pipeline_fragend_arbfp_equal);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < COGL_BUFFER_BIND_TARGET_COUNT; i++)
|
||||
|
@ -25,18 +25,19 @@
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __COGL_PIPELINE_ARBFP_PRIVATE_H
|
||||
#define __COGL_PIPELINE_ARBFP_PRIVATE_H
|
||||
#ifndef __COGL_PIPELINE_FRAGEND_ARBFP_PRIVATE_H
|
||||
#define __COGL_PIPELINE_FRAGEND_ARBFP_PRIVATE_H
|
||||
|
||||
#include "cogl-pipeline-private.h"
|
||||
|
||||
extern const CoglPipelineBackend _cogl_pipeline_arbfp_backend;
|
||||
extern const CoglPipelineFragend _cogl_pipeline_arbfp_fragend;
|
||||
|
||||
unsigned int
|
||||
_cogl_pipeline_arbfp_hash (const void *pipeline);
|
||||
_cogl_pipeline_fragend_arbfp_hash (const void *pipeline);
|
||||
|
||||
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 */
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "cogl-debug.h"
|
||||
#include "cogl-pipeline-private.h"
|
||||
|
||||
#ifdef COGL_PIPELINE_BACKEND_ARBFP
|
||||
#ifdef COGL_PIPELINE_FRAGEND_ARBFP
|
||||
|
||||
#include "cogl.h"
|
||||
#include "cogl-internal.h"
|
||||
@ -79,18 +79,18 @@
|
||||
* code generation.
|
||||
*/
|
||||
|
||||
#define COGL_PIPELINE_ARBFP_FRAGMENT_STATE_MASK \
|
||||
#define COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_STATE_MASK \
|
||||
(COGL_PIPELINE_STATE_LAYERS | \
|
||||
COGL_PIPELINE_STATE_USER_SHADER)
|
||||
|
||||
#define COGL_PIPELINE_ARBFP_FRAGMENT_PROGRAM_STATE_MASK \
|
||||
COGL_PIPELINE_ARBFP_FRAGMENT_STATE_MASK
|
||||
#define COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_PROGRAM_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
|
||||
|
||||
#define COGL_PIPELINE_ARBFP_LAYER_FRAGMENT_PROGRAM_STATE_MASK \
|
||||
(COGL_PIPELINE_ARBFP_LAYER_FRAGMENT_STATE_MASK & \
|
||||
#define COGL_PIPELINE_FRAGEND_ARBFP_LAYER_FRAGMENT_PROGRAM_STATE_MASK \
|
||||
(COGL_PIPELINE_FRAGEND_ARBFP_LAYER_FRAGMENT_STATE_MASK & \
|
||||
~(COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT | \
|
||||
COGL_PIPELINE_LAYER_STATE_FILTERS | \
|
||||
COGL_PIPELINE_LAYER_STATE_WRAP_MODES | \
|
||||
@ -127,12 +127,12 @@ typedef struct _ArbfpProgramState
|
||||
CoglPipeline *last_used_for_pipeline;
|
||||
} ArbfpProgramState;
|
||||
|
||||
typedef struct _CoglPipelineBackendARBfpPrivate
|
||||
typedef struct _CoglPipelineFragendARBfpPrivate
|
||||
{
|
||||
ArbfpProgramState *arbfp_program_state;
|
||||
} CoglPipelineBackendARBfpPrivate;
|
||||
} CoglPipelineFragendARBfpPrivate;
|
||||
|
||||
const CoglPipelineBackend _cogl_pipeline_arbfp_backend;
|
||||
const CoglPipelineFragend _cogl_pipeline_arbfp_fragend;
|
||||
|
||||
|
||||
static ArbfpProgramState *
|
||||
@ -174,50 +174,50 @@ arbfp_program_state_unref (ArbfpProgramState *state)
|
||||
}
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
||||
static CoglPipelineBackendARBfpPrivate *
|
||||
static CoglPipelineFragendARBfpPrivate *
|
||||
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 pipeline->backend_privs[COGL_PIPELINE_BACKEND_ARBFP];
|
||||
return pipeline->fragend_privs[COGL_PIPELINE_FRAGEND_ARBFP];
|
||||
}
|
||||
|
||||
static void
|
||||
set_arbfp_priv (CoglPipeline *pipeline, CoglPipelineBackendARBfpPrivate *priv)
|
||||
set_arbfp_priv (CoglPipeline *pipeline, CoglPipelineFragendARBfpPrivate *priv)
|
||||
{
|
||||
if (priv)
|
||||
{
|
||||
pipeline->backend_privs[COGL_PIPELINE_BACKEND_ARBFP] = priv;
|
||||
pipeline->backend_priv_set_mask |= COGL_PIPELINE_BACKEND_ARBFP_MASK;
|
||||
pipeline->fragend_privs[COGL_PIPELINE_FRAGEND_ARBFP] = priv;
|
||||
pipeline->fragend_priv_set_mask |= COGL_PIPELINE_FRAGEND_ARBFP_MASK;
|
||||
}
|
||||
else
|
||||
pipeline->backend_priv_set_mask &= ~COGL_PIPELINE_BACKEND_ARBFP_MASK;
|
||||
pipeline->fragend_priv_set_mask &= ~COGL_PIPELINE_FRAGEND_ARBFP_MASK;
|
||||
}
|
||||
|
||||
static ArbfpProgramState *
|
||||
get_arbfp_program_state (CoglPipeline *pipeline)
|
||||
{
|
||||
CoglPipelineBackendARBfpPrivate *priv = get_arbfp_priv (pipeline);
|
||||
CoglPipelineFragendARBfpPrivate *priv = get_arbfp_priv (pipeline);
|
||||
if (!priv)
|
||||
return NULL;
|
||||
return priv->arbfp_program_state;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_backend_arbfp_start (CoglPipeline *pipeline,
|
||||
_cogl_pipeline_fragend_arbfp_start (CoglPipeline *pipeline,
|
||||
int n_layers,
|
||||
unsigned long pipelines_difference,
|
||||
int n_tex_coord_attribs)
|
||||
{
|
||||
CoglPipelineBackendARBfpPrivate *priv;
|
||||
CoglPipelineFragendARBfpPrivate *priv;
|
||||
CoglPipeline *authority;
|
||||
CoglPipelineBackendARBfpPrivate *authority_priv;
|
||||
CoglPipelineFragendARBfpPrivate *authority_priv;
|
||||
ArbfpProgramState *arbfp_program_state;
|
||||
CoglHandle user_program;
|
||||
|
||||
@ -243,7 +243,7 @@ _cogl_pipeline_backend_arbfp_start (CoglPipeline *pipeline,
|
||||
priv = get_arbfp_priv (pipeline);
|
||||
if (!priv)
|
||||
{
|
||||
priv = g_slice_new0 (CoglPipelineBackendARBfpPrivate);
|
||||
priv = g_slice_new0 (CoglPipelineFragendARBfpPrivate);
|
||||
set_arbfp_priv (pipeline, priv);
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ _cogl_pipeline_backend_arbfp_start (CoglPipeline *pipeline,
|
||||
|
||||
if (!authority_priv)
|
||||
{
|
||||
authority_priv = g_slice_new0 (CoglPipelineBackendARBfpPrivate);
|
||||
authority_priv = g_slice_new0 (CoglPipelineFragendARBfpPrivate);
|
||||
set_arbfp_priv (authority, authority_priv);
|
||||
}
|
||||
|
||||
@ -349,12 +349,12 @@ _cogl_pipeline_backend_arbfp_start (CoglPipeline *pipeline,
|
||||
}
|
||||
|
||||
unsigned int
|
||||
_cogl_pipeline_arbfp_hash (const void *data)
|
||||
_cogl_pipeline_fragend_arbfp_hash (const void *data)
|
||||
{
|
||||
unsigned long fragment_state =
|
||||
COGL_PIPELINE_ARBFP_FRAGMENT_PROGRAM_STATE_MASK;
|
||||
COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_PROGRAM_STATE_MASK;
|
||||
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;
|
||||
|
||||
return _cogl_pipeline_hash ((CoglPipeline *)data,
|
||||
@ -363,12 +363,12 @@ _cogl_pipeline_arbfp_hash (const void *data)
|
||||
}
|
||||
|
||||
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 =
|
||||
COGL_PIPELINE_ARBFP_FRAGMENT_PROGRAM_STATE_MASK;
|
||||
COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_PROGRAM_STATE_MASK;
|
||||
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;
|
||||
|
||||
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_BACKEND_ARBFP_ARG_TYPE_CONSTANT,
|
||||
COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_TEXTURE
|
||||
} CoglPipelineBackendARBfpArgType;
|
||||
COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE,
|
||||
COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT,
|
||||
COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE
|
||||
} CoglPipelineFragendARBfpArgType;
|
||||
|
||||
typedef struct _CoglPipelineBackendARBfpArg
|
||||
typedef struct _CoglPipelineFragendARBfpArg
|
||||
{
|
||||
const char *name;
|
||||
|
||||
CoglPipelineBackendARBfpArgType type;
|
||||
CoglPipelineFragendARBfpArgType type;
|
||||
|
||||
/* for type = TEXTURE */
|
||||
int texture_unit;
|
||||
@ -438,22 +438,22 @@ typedef struct _CoglPipelineBackendARBfpArg
|
||||
|
||||
const char *swizzle;
|
||||
|
||||
} CoglPipelineBackendARBfpArg;
|
||||
} CoglPipelineFragendARBfpArg;
|
||||
|
||||
static void
|
||||
append_arg (GString *source, const CoglPipelineBackendARBfpArg *arg)
|
||||
append_arg (GString *source, const CoglPipelineFragendARBfpArg *arg)
|
||||
{
|
||||
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",
|
||||
arg->texture_unit, arg->swizzle);
|
||||
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",
|
||||
arg->constant_id, arg->swizzle);
|
||||
break;
|
||||
case COGL_PIPELINE_BACKEND_ARBFP_ARG_TYPE_SIMPLE:
|
||||
case COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE:
|
||||
g_string_append_printf (source, "%s%s",
|
||||
arg->name, arg->swizzle);
|
||||
break;
|
||||
@ -462,7 +462,7 @@ append_arg (GString *source, const CoglPipelineBackendARBfpArg *arg)
|
||||
|
||||
/* Note: we are trying to avoid duplicating strings during codegen
|
||||
* which is why we have the slightly awkward
|
||||
* CoglPipelineBackendARBfpArg mechanism. */
|
||||
* CoglPipelineFragendARBfpArg mechanism. */
|
||||
static void
|
||||
setup_arg (CoglPipeline *pipeline,
|
||||
CoglPipelineLayer *layer,
|
||||
@ -470,7 +470,7 @@ setup_arg (CoglPipeline *pipeline,
|
||||
int arg_index,
|
||||
GLint src,
|
||||
GLint op,
|
||||
CoglPipelineBackendARBfpArg *arg)
|
||||
CoglPipelineFragendARBfpArg *arg)
|
||||
{
|
||||
ArbfpProgramState *arbfp_program_state = get_arbfp_program_state (pipeline);
|
||||
static const char *tmp_name[3] = { "tmp0", "tmp1", "tmp2" };
|
||||
@ -480,7 +480,7 @@ setup_arg (CoglPipeline *pipeline,
|
||||
switch (src)
|
||||
{
|
||||
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->texture_unit = _cogl_pipeline_layer_get_unit_index (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->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->constant_id = unit_state->constant_id;
|
||||
break;
|
||||
}
|
||||
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";
|
||||
break;
|
||||
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)
|
||||
arg->name = "fragment.color.primary";
|
||||
else
|
||||
arg->name = "output";
|
||||
break;
|
||||
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->texture_unit = src - GL_TEXTURE0;
|
||||
texture = _cogl_pipeline_layer_get_texture (layer);
|
||||
@ -532,7 +532,7 @@ setup_arg (CoglPipeline *pipeline,
|
||||
arg_index);
|
||||
append_arg (arbfp_program_state->source, arg);
|
||||
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->swizzle = "";
|
||||
break;
|
||||
@ -553,7 +553,7 @@ setup_arg (CoglPipeline *pipeline,
|
||||
g_string_append_printf (arbfp_program_state->source, ".a;\n");
|
||||
else
|
||||
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];
|
||||
break;
|
||||
default:
|
||||
@ -563,8 +563,8 @@ setup_arg (CoglPipeline *pipeline,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
backend_arbfp_args_equal (CoglPipelineBackendARBfpArg *arg0,
|
||||
CoglPipelineBackendARBfpArg *arg1)
|
||||
fragend_arbfp_args_equal (CoglPipelineFragendARBfpArg *arg0,
|
||||
CoglPipelineFragendARBfpArg *arg1)
|
||||
{
|
||||
if (arg0->type != arg1->type)
|
||||
return FALSE;
|
||||
@ -573,13 +573,13 @@ backend_arbfp_args_equal (CoglPipelineBackendARBfpArg *arg0,
|
||||
strcmp (arg0->name, arg1->name) != 0)
|
||||
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)
|
||||
return FALSE;
|
||||
/* Note we don't have to check the target; a texture unit can only
|
||||
* 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)
|
||||
return FALSE;
|
||||
|
||||
@ -594,7 +594,7 @@ static void
|
||||
append_function (CoglPipeline *pipeline,
|
||||
CoglBlendStringChannelMask mask,
|
||||
GLint function,
|
||||
CoglPipelineBackendARBfpArg *args,
|
||||
CoglPipelineFragendARBfpArg *args,
|
||||
int n_args)
|
||||
{
|
||||
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]);
|
||||
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, ");
|
||||
append_arg (arbfp_program_state->source, &args[1]);
|
||||
@ -738,7 +738,7 @@ append_masked_combine (CoglPipeline *arbfp_authority,
|
||||
{
|
||||
int i;
|
||||
int n_args;
|
||||
CoglPipelineBackendARBfpArg args[3];
|
||||
CoglPipelineFragendARBfpArg args[3];
|
||||
|
||||
n_args = _cogl_get_n_args_for_combine_func (function);
|
||||
|
||||
@ -761,7 +761,7 @@ append_masked_combine (CoglPipeline *arbfp_authority,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_backend_arbfp_add_layer (CoglPipeline *pipeline,
|
||||
_cogl_pipeline_fragend_arbfp_add_layer (CoglPipeline *pipeline,
|
||||
CoglPipelineLayer *layer,
|
||||
unsigned long layers_difference)
|
||||
{
|
||||
@ -844,7 +844,7 @@ _cogl_pipeline_backend_arbfp_add_layer (CoglPipeline *pipeline,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_cogl_pipeline_backend_arbfp_passthrough (CoglPipeline *pipeline)
|
||||
_cogl_pipeline_fragend_arbfp_passthrough (CoglPipeline *pipeline)
|
||||
{
|
||||
ArbfpProgramState *arbfp_program_state = get_arbfp_program_state (pipeline);
|
||||
|
||||
@ -889,7 +889,7 @@ update_constants_cb (CoglPipeline *pipeline,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_backend_arbfp_end (CoglPipeline *pipeline,
|
||||
_cogl_pipeline_fragend_arbfp_end (CoglPipeline *pipeline,
|
||||
unsigned long pipelines_difference)
|
||||
{
|
||||
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)
|
||||
{
|
||||
GLenum gl_error;
|
||||
COGL_STATIC_COUNTER (backend_arbfp_compile_counter,
|
||||
COGL_STATIC_COUNTER (fragend_arbfp_compile_counter,
|
||||
"arbfp compile counter",
|
||||
"Increments each time a new ARBfp "
|
||||
"program is compiled",
|
||||
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,
|
||||
"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
|
||||
* calculating the hash of a CoglPipeline and in this case
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@ -1034,7 +1034,7 @@ _cogl_pipeline_backend_arbfp_end (CoglPipeline *pipeline,
|
||||
static void
|
||||
dirty_arbfp_program_state (CoglPipeline *pipeline)
|
||||
{
|
||||
CoglPipelineBackendARBfpPrivate *priv;
|
||||
CoglPipelineFragendARBfpPrivate *priv;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
@ -1050,12 +1050,12 @@ dirty_arbfp_program_state (CoglPipeline *pipeline)
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_pipeline_backend_arbfp_pipeline_pre_change_notify (
|
||||
_cogl_pipeline_fragend_arbfp_pipeline_pre_change_notify (
|
||||
CoglPipeline *pipeline,
|
||||
CoglPipelineState change,
|
||||
const CoglColor *new_color)
|
||||
{
|
||||
if (!(change & COGL_PIPELINE_ARBFP_FRAGMENT_PROGRAM_STATE_MASK))
|
||||
if (!(change & COGL_PIPELINE_FRAGEND_ARBFP_FRAGMENT_PROGRAM_STATE_MASK))
|
||||
return;
|
||||
|
||||
dirty_arbfp_program_state (pipeline);
|
||||
@ -1070,16 +1070,16 @@ _cogl_pipeline_backend_arbfp_pipeline_pre_change_notify (
|
||||
* yet!
|
||||
*/
|
||||
static void
|
||||
_cogl_pipeline_backend_arbfp_layer_pre_change_notify (
|
||||
_cogl_pipeline_fragend_arbfp_layer_pre_change_notify (
|
||||
CoglPipeline *owner,
|
||||
CoglPipelineLayer *layer,
|
||||
CoglPipelineLayerState change)
|
||||
{
|
||||
CoglPipelineBackendARBfpPrivate *priv = get_arbfp_priv (owner);
|
||||
CoglPipelineFragendARBfpPrivate *priv = get_arbfp_priv (owner);
|
||||
if (!priv)
|
||||
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);
|
||||
return;
|
||||
@ -1104,30 +1104,30 @@ _cogl_pipeline_backend_arbfp_layer_pre_change_notify (
|
||||
}
|
||||
|
||||
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->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);
|
||||
}
|
||||
}
|
||||
|
||||
const CoglPipelineBackend _cogl_pipeline_arbfp_backend =
|
||||
const CoglPipelineFragend _cogl_pipeline_arbfp_fragend =
|
||||
{
|
||||
_cogl_pipeline_backend_arbfp_get_max_texture_units,
|
||||
_cogl_pipeline_backend_arbfp_start,
|
||||
_cogl_pipeline_backend_arbfp_add_layer,
|
||||
_cogl_pipeline_backend_arbfp_passthrough,
|
||||
_cogl_pipeline_backend_arbfp_end,
|
||||
_cogl_pipeline_backend_arbfp_pipeline_pre_change_notify,
|
||||
_cogl_pipeline_fragend_arbfp_get_max_texture_units,
|
||||
_cogl_pipeline_fragend_arbfp_start,
|
||||
_cogl_pipeline_fragend_arbfp_add_layer,
|
||||
_cogl_pipeline_fragend_arbfp_passthrough,
|
||||
_cogl_pipeline_fragend_arbfp_end,
|
||||
_cogl_pipeline_fragend_arbfp_pipeline_pre_change_notify,
|
||||
NULL,
|
||||
_cogl_pipeline_backend_arbfp_layer_pre_change_notify,
|
||||
_cogl_pipeline_backend_arbfp_free_priv,
|
||||
_cogl_pipeline_fragend_arbfp_layer_pre_change_notify,
|
||||
_cogl_pipeline_fragend_arbfp_free_priv
|
||||
};
|
||||
|
||||
#endif /* COGL_PIPELINE_BACKEND_ARBFP */
|
||||
#endif /* COGL_PIPELINE_FRAGEND_ARBFP */
|
||||
|
@ -25,12 +25,12 @@
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __COGL_PIPELINE_FIXED_PRIVATE_H
|
||||
#define __COGL_PIPELINE_FIXED_PRIVATE_H
|
||||
#ifndef __COGL_PIPELINE_FRAGEND_FIXED_PRIVATE_H
|
||||
#define __COGL_PIPELINE_FRAGEND_FIXED_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 */
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "cogl-pipeline-private.h"
|
||||
#include "cogl-pipeline-opengl-private.h"
|
||||
|
||||
#ifdef COGL_PIPELINE_BACKEND_FIXED
|
||||
#ifdef COGL_PIPELINE_FRAGEND_FIXED
|
||||
|
||||
#include "cogl.h"
|
||||
#include "cogl-internal.h"
|
||||
@ -47,10 +47,10 @@
|
||||
#include <glib/gprintf.h>
|
||||
#include <string.h>
|
||||
|
||||
const CoglPipelineBackend _cogl_pipeline_fixed_backend;
|
||||
const CoglPipelineFragend _cogl_pipeline_fixed_fragend;
|
||||
|
||||
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);
|
||||
|
||||
@ -67,7 +67,7 @@ _cogl_pipeline_backend_fixed_get_max_texture_units (void)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_backend_fixed_start (CoglPipeline *pipeline,
|
||||
_cogl_pipeline_fragend_fixed_start (CoglPipeline *pipeline,
|
||||
int n_layers,
|
||||
unsigned long pipelines_difference,
|
||||
int n_tex_coord_attribs)
|
||||
@ -86,7 +86,7 @@ _cogl_pipeline_backend_fixed_start (CoglPipeline *pipeline,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_backend_fixed_add_layer (CoglPipeline *pipeline,
|
||||
_cogl_pipeline_fragend_fixed_add_layer (CoglPipeline *pipeline,
|
||||
CoglPipelineLayer *layer,
|
||||
unsigned long layers_difference)
|
||||
{
|
||||
@ -189,7 +189,7 @@ _cogl_pipeline_backend_fixed_add_layer (CoglPipeline *pipeline,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_backend_fixed_end (CoglPipeline *pipeline,
|
||||
_cogl_pipeline_fragend_fixed_end (CoglPipeline *pipeline,
|
||||
unsigned long pipelines_difference)
|
||||
{
|
||||
if (pipelines_difference & COGL_PIPELINE_STATE_FOG)
|
||||
@ -243,18 +243,18 @@ _cogl_pipeline_backend_fixed_end (CoglPipeline *pipeline,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const CoglPipelineBackend _cogl_pipeline_fixed_backend =
|
||||
const CoglPipelineFragend _cogl_pipeline_fixed_fragend =
|
||||
{
|
||||
_cogl_pipeline_backend_fixed_get_max_texture_units,
|
||||
_cogl_pipeline_backend_fixed_start,
|
||||
_cogl_pipeline_backend_fixed_add_layer,
|
||||
_cogl_pipeline_fragend_fixed_get_max_texture_units,
|
||||
_cogl_pipeline_fragend_fixed_start,
|
||||
_cogl_pipeline_fragend_fixed_add_layer,
|
||||
NULL, /* passthrough */
|
||||
_cogl_pipeline_backend_fixed_end,
|
||||
_cogl_pipeline_fragend_fixed_end,
|
||||
NULL, /* pipeline_change_notify */
|
||||
NULL, /* pipeline_set_parent_notify */
|
||||
NULL, /* layer_change_notify */
|
||||
NULL /* free_priv */
|
||||
};
|
||||
|
||||
#endif /* COGL_PIPELINE_BACKEND_FIXED */
|
||||
#endif /* COGL_PIPELINE_FRAGEND_FIXED */
|
||||
|
@ -25,12 +25,12 @@
|
||||
* Robert Bragg <robert@linux.intel.com>
|
||||
*/
|
||||
|
||||
#ifndef __COGL_PIPELINE_GLSL_PRIVATE_H
|
||||
#define __COGL_PIPELINE_GLSL_PRIVATE_H
|
||||
#ifndef __COGL_PIPELINE_FRAGEND_GLSL_PRIVATE_H
|
||||
#define __COGL_PIPELINE_FRAGEND_GLSL_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 */
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "cogl-shader-private.h"
|
||||
#include "cogl-blend-string.h"
|
||||
|
||||
#ifdef COGL_PIPELINE_BACKEND_GLSL
|
||||
#ifdef COGL_PIPELINE_FRAGEND_GLSL
|
||||
|
||||
#include "cogl.h"
|
||||
#include "cogl-internal.h"
|
||||
@ -131,15 +131,15 @@ typedef struct _GlslProgramState
|
||||
CoglPipeline *last_used_for_pipeline;
|
||||
} GlslProgramState;
|
||||
|
||||
typedef struct _CoglPipelineBackendGlslPrivate
|
||||
typedef struct _CoglPipelineFragendGlslPrivate
|
||||
{
|
||||
GlslProgramState *glsl_program_state;
|
||||
} CoglPipelineBackendGlslPrivate;
|
||||
} CoglPipelineFragendGlslPrivate;
|
||||
|
||||
const CoglPipelineBackend _cogl_pipeline_glsl_backend;
|
||||
const CoglPipelineFragend _cogl_pipeline_glsl_backend;
|
||||
|
||||
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 ();
|
||||
}
|
||||
@ -198,31 +198,31 @@ glsl_program_state_unref (GlslProgramState *state)
|
||||
}
|
||||
}
|
||||
|
||||
static CoglPipelineBackendGlslPrivate *
|
||||
static CoglPipelineFragendGlslPrivate *
|
||||
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 pipeline->backend_privs[COGL_PIPELINE_BACKEND_GLSL];
|
||||
return pipeline->fragend_privs[COGL_PIPELINE_FRAGEND_GLSL];
|
||||
}
|
||||
|
||||
static void
|
||||
set_glsl_priv (CoglPipeline *pipeline, CoglPipelineBackendGlslPrivate *priv)
|
||||
set_glsl_priv (CoglPipeline *pipeline, CoglPipelineFragendGlslPrivate *priv)
|
||||
{
|
||||
if (priv)
|
||||
{
|
||||
pipeline->backend_privs[COGL_PIPELINE_BACKEND_GLSL] = priv;
|
||||
pipeline->backend_priv_set_mask |= COGL_PIPELINE_BACKEND_GLSL_MASK;
|
||||
pipeline->fragend_privs[COGL_PIPELINE_FRAGEND_GLSL] = priv;
|
||||
pipeline->fragend_priv_set_mask |= COGL_PIPELINE_FRAGEND_GLSL_MASK;
|
||||
}
|
||||
else
|
||||
pipeline->backend_priv_set_mask &= ~COGL_PIPELINE_BACKEND_GLSL_MASK;
|
||||
pipeline->fragend_priv_set_mask &= ~COGL_PIPELINE_FRAGEND_GLSL_MASK;
|
||||
}
|
||||
|
||||
static GlslProgramState *
|
||||
get_glsl_program_state (CoglPipeline *pipeline)
|
||||
{
|
||||
CoglPipelineBackendGlslPrivate *priv = get_glsl_priv (pipeline);
|
||||
CoglPipelineFragendGlslPrivate *priv = get_glsl_priv (pipeline);
|
||||
if (!priv)
|
||||
return NULL;
|
||||
return priv->glsl_program_state;
|
||||
@ -231,7 +231,7 @@ get_glsl_program_state (CoglPipeline *pipeline)
|
||||
static void
|
||||
dirty_glsl_program_state (CoglPipeline *pipeline)
|
||||
{
|
||||
CoglPipelineBackendGlslPrivate *priv;
|
||||
CoglPipelineFragendGlslPrivate *priv;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
@ -284,14 +284,14 @@ link_program (GLint gl_program)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_backend_glsl_start (CoglPipeline *pipeline,
|
||||
_cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
|
||||
int n_layers,
|
||||
unsigned long pipelines_difference,
|
||||
int n_tex_coord_attribs)
|
||||
{
|
||||
CoglPipelineBackendGlslPrivate *priv;
|
||||
CoglPipelineFragendGlslPrivate *priv;
|
||||
CoglPipeline *authority;
|
||||
CoglPipelineBackendGlslPrivate *authority_priv;
|
||||
CoglPipelineFragendGlslPrivate *authority_priv;
|
||||
CoglProgram *user_program;
|
||||
GSList *l;
|
||||
int i;
|
||||
@ -311,7 +311,7 @@ _cogl_pipeline_backend_glsl_start (CoglPipeline *pipeline,
|
||||
priv = get_glsl_priv (pipeline);
|
||||
if (!priv)
|
||||
{
|
||||
priv = g_slice_new0 (CoglPipelineBackendGlslPrivate);
|
||||
priv = g_slice_new0 (CoglPipelineFragendGlslPrivate);
|
||||
set_glsl_priv (pipeline, priv);
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ _cogl_pipeline_backend_glsl_start (CoglPipeline *pipeline,
|
||||
authority_priv = get_glsl_priv (authority);
|
||||
if (!authority_priv)
|
||||
{
|
||||
authority_priv = g_slice_new0 (CoglPipelineBackendGlslPrivate);
|
||||
authority_priv = g_slice_new0 (CoglPipelineFragendGlslPrivate);
|
||||
set_glsl_priv (authority, authority_priv);
|
||||
}
|
||||
|
||||
@ -755,7 +755,7 @@ append_masked_combine (CoglPipeline *pipeline,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_backend_glsl_add_layer (CoglPipeline *pipeline,
|
||||
_cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline,
|
||||
CoglPipelineLayer *layer,
|
||||
unsigned long layers_difference)
|
||||
{
|
||||
@ -799,7 +799,7 @@ _cogl_pipeline_backend_glsl_add_layer (CoglPipeline *pipeline,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_cogl_pipeline_backend_glsl_passthrough (CoglPipeline *pipeline)
|
||||
_cogl_pipeline_fragend_glsl_passthrough (CoglPipeline *pipeline)
|
||||
{
|
||||
GlslProgramState *glsl_program_state = get_glsl_program_state (pipeline);
|
||||
|
||||
@ -996,7 +996,7 @@ update_alpha_test_reference (CoglPipeline *pipeline,
|
||||
#endif /* HAVE_COGL_GLES2 */
|
||||
|
||||
gboolean
|
||||
_cogl_pipeline_backend_glsl_end (CoglPipeline *pipeline,
|
||||
_cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
|
||||
unsigned long pipelines_difference)
|
||||
{
|
||||
GlslProgramState *glsl_program_state = get_glsl_program_state (pipeline);
|
||||
@ -1044,12 +1044,12 @@ _cogl_pipeline_backend_glsl_end (CoglPipeline *pipeline,
|
||||
GLint compile_status;
|
||||
GLuint shader;
|
||||
|
||||
COGL_STATIC_COUNTER (backend_glsl_compile_counter,
|
||||
COGL_STATIC_COUNTER (fragend_glsl_compile_counter,
|
||||
"glsl compile counter",
|
||||
"Increments each time a new GLSL "
|
||||
"program is compiled",
|
||||
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
|
||||
add_alpha_test_snippet (pipeline, glsl_program_state);
|
||||
@ -1163,7 +1163,7 @@ _cogl_pipeline_backend_glsl_end (CoglPipeline *pipeline,
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_pipeline_backend_glsl_pre_change_notify (CoglPipeline *pipeline,
|
||||
_cogl_pipeline_fragend_glsl_pre_change_notify (CoglPipeline *pipeline,
|
||||
CoglPipelineState change,
|
||||
const CoglColor *new_color)
|
||||
{
|
||||
@ -1196,12 +1196,12 @@ _cogl_pipeline_backend_glsl_pre_change_notify (CoglPipeline *pipeline,
|
||||
* yet!
|
||||
*/
|
||||
static void
|
||||
_cogl_pipeline_backend_glsl_layer_pre_change_notify (
|
||||
_cogl_pipeline_fragend_glsl_layer_pre_change_notify (
|
||||
CoglPipeline *owner,
|
||||
CoglPipelineLayer *layer,
|
||||
CoglPipelineLayerState change)
|
||||
{
|
||||
CoglPipelineBackendGlslPrivate *priv;
|
||||
CoglPipelineFragendGlslPrivate *priv;
|
||||
static const unsigned long not_fragment_op_changes =
|
||||
COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT |
|
||||
COGL_PIPELINE_LAYER_STATE_TEXTURE |
|
||||
@ -1234,30 +1234,30 @@ _cogl_pipeline_backend_glsl_layer_pre_change_notify (
|
||||
}
|
||||
|
||||
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->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);
|
||||
}
|
||||
}
|
||||
|
||||
const CoglPipelineBackend _cogl_pipeline_glsl_backend =
|
||||
const CoglPipelineFragend _cogl_pipeline_glsl_fragend =
|
||||
{
|
||||
_cogl_pipeline_backend_glsl_get_max_texture_units,
|
||||
_cogl_pipeline_backend_glsl_start,
|
||||
_cogl_pipeline_backend_glsl_add_layer,
|
||||
_cogl_pipeline_backend_glsl_passthrough,
|
||||
_cogl_pipeline_backend_glsl_end,
|
||||
_cogl_pipeline_backend_glsl_pre_change_notify,
|
||||
_cogl_pipeline_fragend_glsl_get_max_texture_units,
|
||||
_cogl_pipeline_fragend_glsl_start,
|
||||
_cogl_pipeline_fragend_glsl_add_layer,
|
||||
_cogl_pipeline_fragend_glsl_passthrough,
|
||||
_cogl_pipeline_fragend_glsl_end,
|
||||
_cogl_pipeline_fragend_glsl_pre_change_notify,
|
||||
NULL, /* pipeline_set_parent_notify */
|
||||
_cogl_pipeline_backend_glsl_layer_pre_change_notify,
|
||||
_cogl_pipeline_backend_glsl_free_priv
|
||||
_cogl_pipeline_fragend_glsl_layer_pre_change_notify,
|
||||
_cogl_pipeline_fragend_glsl_free_priv,
|
||||
};
|
||||
|
||||
#endif /* COGL_PIPELINE_BACKEND_GLSL */
|
||||
#endif /* COGL_PIPELINE_FRAGEND_GLSL */
|
||||
|
@ -313,7 +313,7 @@ _cogl_use_program (GLuint gl_program, CoglPipelineProgramType type)
|
||||
|
||||
if (type == COGL_PIPELINE_PROGRAM_TYPE_GLSL)
|
||||
{
|
||||
#ifdef COGL_PIPELINE_BACKEND_GLSL
|
||||
#ifdef COGL_PIPELINE_FRAGEND_GLSL
|
||||
|
||||
if (ctx->current_gl_program != gl_program)
|
||||
{
|
||||
@ -333,20 +333,20 @@ _cogl_use_program (GLuint gl_program, CoglPipelineProgramType type)
|
||||
|
||||
#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)
|
||||
g_warning ("Unexpected use of ARBFP backend!");
|
||||
#endif /* COGL_PIPELINE_BACKEND_ARBFP */
|
||||
g_warning ("Unexpected use of ARBFP fragend!");
|
||||
#endif /* COGL_PIPELINE_FRAGEND_ARBFP */
|
||||
|
||||
ctx->current_use_program_type = type;
|
||||
}
|
||||
|
||||
#if defined (COGL_PIPELINE_BACKEND_GLSL) || \
|
||||
defined (COGL_PIPELINE_BACKEND_ARBFP)
|
||||
#if defined (COGL_PIPELINE_FRAGEND_GLSL) || \
|
||||
defined (COGL_PIPELINE_FRAGEND_ARBFP)
|
||||
int
|
||||
_cogl_get_max_texture_image_units (void)
|
||||
{
|
||||
@ -917,20 +917,20 @@ compare_layer_differences_cb (CoglPipelineLayer *layer, void *user_data)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const CoglPipelineBackend *backend;
|
||||
const CoglPipelineFragend *fragend;
|
||||
CoglPipeline *pipeline;
|
||||
unsigned long *layer_differences;
|
||||
gboolean error_adding_layer;
|
||||
gboolean added_layer;
|
||||
} CoglPipelineBackendAddLayerState;
|
||||
} CoglPipelineFragendAddLayerState;
|
||||
|
||||
|
||||
static gboolean
|
||||
backend_add_layer_cb (CoglPipelineLayer *layer,
|
||||
fragend_add_layer_cb (CoglPipelineLayer *layer,
|
||||
void *user_data)
|
||||
{
|
||||
CoglPipelineBackendAddLayerState *state = user_data;
|
||||
const CoglPipelineBackend *backend = state->backend;
|
||||
CoglPipelineFragendAddLayerState *state = user_data;
|
||||
const CoglPipelineFragend *fragend = state->fragend;
|
||||
CoglPipeline *pipeline = state->pipeline;
|
||||
int unit_index = _cogl_pipeline_layer_get_unit_index (layer);
|
||||
CoglTextureUnit *unit = _cogl_get_texture_unit (unit_index);
|
||||
@ -943,7 +943,7 @@ backend_add_layer_cb (CoglPipelineLayer *layer,
|
||||
if (!unit->enabled)
|
||||
return FALSE;
|
||||
|
||||
if (G_UNLIKELY (unit_index >= backend->get_max_texture_units ()))
|
||||
if (G_UNLIKELY (unit_index >= fragend->get_max_texture_units ()))
|
||||
{
|
||||
int 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
|
||||
* fixed function glTexEnv for each layer... */
|
||||
if (G_LIKELY (backend->add_layer (pipeline,
|
||||
if (G_LIKELY (fragend->add_layer (pipeline,
|
||||
layer,
|
||||
state->layer_differences[unit_index])))
|
||||
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
|
||||
* 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
|
||||
* with the given backend so we will simply use that to avoid
|
||||
* fallback code paths.
|
||||
*/
|
||||
|
||||
if (pipeline->backend == COGL_PIPELINE_BACKEND_UNDEFINED)
|
||||
_cogl_pipeline_set_backend (pipeline, COGL_PIPELINE_BACKEND_DEFAULT);
|
||||
if (pipeline->fragend == COGL_PIPELINE_FRAGEND_UNDEFINED)
|
||||
_cogl_pipeline_set_fragend (pipeline, COGL_PIPELINE_FRAGEND_DEFAULT);
|
||||
|
||||
for (i = pipeline->backend;
|
||||
i < G_N_ELEMENTS (_cogl_pipeline_backends);
|
||||
i++, _cogl_pipeline_set_backend (pipeline, i))
|
||||
for (i = pipeline->fragend;
|
||||
i < G_N_ELEMENTS (_cogl_pipeline_fragends);
|
||||
i++, _cogl_pipeline_set_fragend (pipeline, i))
|
||||
{
|
||||
const CoglPipelineBackend *backend = _cogl_pipeline_backends[i];
|
||||
CoglPipelineBackendAddLayerState state;
|
||||
const CoglPipelineFragend *fragend = _cogl_pipeline_fragends[i];
|
||||
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... */
|
||||
if (G_UNLIKELY (!backend->start (pipeline,
|
||||
if (G_UNLIKELY (!fragend->start (pipeline,
|
||||
n_layers,
|
||||
pipelines_difference,
|
||||
n_tex_coord_attribs)))
|
||||
continue;
|
||||
|
||||
state.backend = backend;
|
||||
state.fragend = fragend;
|
||||
state.pipeline = pipeline;
|
||||
state.layer_differences = layer_differences;
|
||||
state.error_adding_layer = FALSE;
|
||||
state.added_layer = FALSE;
|
||||
_cogl_pipeline_foreach_layer_internal (pipeline,
|
||||
backend_add_layer_cb,
|
||||
fragend_add_layer_cb,
|
||||
&state);
|
||||
|
||||
if (G_UNLIKELY (state.error_adding_layer))
|
||||
continue;
|
||||
|
||||
if (!state.added_layer &&
|
||||
backend->passthrough &&
|
||||
G_UNLIKELY (!backend->passthrough (pipeline)))
|
||||
fragend->passthrough &&
|
||||
G_UNLIKELY (!fragend->passthrough (pipeline)))
|
||||
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
|
||||
* that program.
|
||||
*/
|
||||
if (G_UNLIKELY (!backend->end (pipeline, pipelines_difference)))
|
||||
if (G_UNLIKELY (!fragend->end (pipeline, pipelines_difference)))
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (i >= G_N_ELEMENTS (_cogl_pipeline_backends)))
|
||||
g_warning ("No usable pipeline backend was found!");
|
||||
if (G_UNLIKELY (i >= G_N_ELEMENTS (_cogl_pipeline_fragends)))
|
||||
g_warning ("No usable pipeline fragment backend was found!");
|
||||
|
||||
/* FIXME: This reference is actually resulting in lots of
|
||||
* copy-on-write reparenting because one-shot pipelines end up
|
||||
|
@ -42,34 +42,34 @@ typedef struct _CoglPipelineLayer CoglPipelineLayer;
|
||||
|
||||
#if defined (HAVE_COGL_GL)
|
||||
|
||||
/* NB: pipeline->backend is currently a 3bit unsigned int bitfield */
|
||||
#define COGL_PIPELINE_BACKEND_ARBFP 0
|
||||
#define COGL_PIPELINE_BACKEND_ARBFP_MASK (1L<<0)
|
||||
#define COGL_PIPELINE_BACKEND_FIXED 1
|
||||
#define COGL_PIPELINE_BACKEND_FIXED_MASK (1L<<1)
|
||||
#define COGL_PIPELINE_BACKEND_GLSL 2
|
||||
#define COGL_PIPELINE_BACKEND_GLSL_MASK (1L<<2)
|
||||
/* NB: pipeline->fragend is currently a 3bit unsigned int bitfield */
|
||||
#define COGL_PIPELINE_FRAGEND_ARBFP 0
|
||||
#define COGL_PIPELINE_FRAGEND_ARBFP_MASK (1L<<0)
|
||||
#define COGL_PIPELINE_FRAGEND_FIXED 1
|
||||
#define COGL_PIPELINE_FRAGEND_FIXED_MASK (1L<<1)
|
||||
#define COGL_PIPELINE_FRAGEND_GLSL 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)
|
||||
|
||||
#define COGL_PIPELINE_BACKEND_GLSL 0
|
||||
#define COGL_PIPELINE_BACKEND_GLSL_MASK (1L<<0)
|
||||
#define COGL_PIPELINE_FRAGEND_GLSL 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 */
|
||||
|
||||
#define COGL_PIPELINE_BACKEND_FIXED 0
|
||||
#define COGL_PIPELINE_BACKEND_FIXED_MASK (1L<<0)
|
||||
#define COGL_PIPELINE_FRAGEND_FIXED 0
|
||||
#define COGL_PIPELINE_FRAGEND_FIXED_MASK (1L<<0)
|
||||
|
||||
#define COGL_PIPELINE_N_BACKENDS 1
|
||||
#define COGL_PIPELINE_N_FRAGENDS 1
|
||||
|
||||
#endif
|
||||
|
||||
#define COGL_PIPELINE_BACKEND_DEFAULT 0
|
||||
#define COGL_PIPELINE_BACKEND_UNDEFINED 3
|
||||
#define COGL_PIPELINE_FRAGEND_DEFAULT 0
|
||||
#define COGL_PIPELINE_FRAGEND_UNDEFINED 3
|
||||
|
||||
/* XXX: should I rename these as
|
||||
* COGL_PIPELINE_LAYER_STATE_INDEX_XYZ... ?
|
||||
@ -510,7 +510,7 @@ struct _CoglPipeline
|
||||
|
||||
/* The fragment processing backends can associate private data with a
|
||||
* 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
|
||||
* 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[]
|
||||
* 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
|
||||
* 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
|
||||
* the pipeline and any private state the backend has associated
|
||||
* with the pipeline. */
|
||||
unsigned int backend:3;
|
||||
unsigned int fragend:3;
|
||||
};
|
||||
|
||||
typedef struct _CoglPipelineBackend
|
||||
typedef struct _CoglPipelineFragend
|
||||
{
|
||||
int (*get_max_texture_units) (void);
|
||||
|
||||
@ -633,7 +633,7 @@ typedef struct _CoglPipelineBackend
|
||||
CoglPipelineLayerState change);
|
||||
|
||||
void (*free_priv) (CoglPipeline *pipeline);
|
||||
} CoglPipelineBackend;
|
||||
} CoglPipelineFragend;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@ -642,8 +642,8 @@ typedef enum
|
||||
COGL_PIPELINE_PROGRAM_TYPE_FIXED
|
||||
} CoglPipelineProgramType;
|
||||
|
||||
extern const CoglPipelineBackend *
|
||||
_cogl_pipeline_backends[COGL_PIPELINE_N_BACKENDS];
|
||||
extern const CoglPipelineFragend *
|
||||
_cogl_pipeline_fragends[COGL_PIPELINE_N_FRAGENDS];
|
||||
|
||||
void
|
||||
_cogl_pipeline_init_default_pipeline (void);
|
||||
@ -877,7 +877,7 @@ _cogl_pipeline_weak_copy (CoglPipeline *pipeline,
|
||||
void *user_data);
|
||||
|
||||
void
|
||||
_cogl_pipeline_set_backend (CoglPipeline *pipeline, int backend);
|
||||
_cogl_pipeline_set_fragend (CoglPipeline *pipeline, int fragend);
|
||||
|
||||
CoglPipeline *
|
||||
_cogl_pipeline_get_parent (CoglPipeline *pipeline);
|
||||
|
@ -63,16 +63,16 @@ static void handle_automatic_blend_enable (CoglPipeline *pipeline,
|
||||
static void recursively_free_layer_caches (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
|
||||
#include "cogl-pipeline-glsl-private.h"
|
||||
#ifdef COGL_PIPELINE_FRAGEND_GLSL
|
||||
#include "cogl-pipeline-fragend-glsl-private.h"
|
||||
#endif
|
||||
#ifdef COGL_PIPELINE_BACKEND_ARBFP
|
||||
#include "cogl-pipeline-arbfp-private.h"
|
||||
#ifdef COGL_PIPELINE_FRAGEND_ARBFP
|
||||
#include "cogl-pipeline-fragend-arbfp-private.h"
|
||||
#endif
|
||||
#ifdef COGL_PIPELINE_BACKEND_FIXED
|
||||
#include "cogl-pipeline-fixed-private.h"
|
||||
#ifdef COGL_PIPELINE_FRAGEND_FIXED
|
||||
#include "cogl-pipeline-fragend-fixed-private.h"
|
||||
#endif
|
||||
|
||||
COGL_OBJECT_DEFINE (Pipeline, pipeline);
|
||||
@ -200,24 +200,24 @@ _cogl_pipeline_init_default_pipeline (void)
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
/* Take this opportunity to setup the fragment processing backends... */
|
||||
#ifdef COGL_PIPELINE_BACKEND_GLSL
|
||||
_cogl_pipeline_backends[COGL_PIPELINE_BACKEND_GLSL] =
|
||||
&_cogl_pipeline_glsl_backend;
|
||||
#ifdef COGL_PIPELINE_FRAGEND_GLSL
|
||||
_cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_GLSL] =
|
||||
&_cogl_pipeline_glsl_fragend;
|
||||
#endif
|
||||
#ifdef COGL_PIPELINE_BACKEND_ARBFP
|
||||
_cogl_pipeline_backends[COGL_PIPELINE_BACKEND_ARBFP] =
|
||||
&_cogl_pipeline_arbfp_backend;
|
||||
#ifdef COGL_PIPELINE_FRAGEND_ARBFP
|
||||
_cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_ARBFP] =
|
||||
&_cogl_pipeline_arbfp_fragend;
|
||||
#endif
|
||||
#ifdef COGL_PIPELINE_BACKEND_FIXED
|
||||
_cogl_pipeline_backends[COGL_PIPELINE_BACKEND_FIXED] =
|
||||
&_cogl_pipeline_fixed_backend;
|
||||
#ifdef COGL_PIPELINE_FRAGEND_FIXED
|
||||
_cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_FIXED] =
|
||||
&_cogl_pipeline_fixed_fragend;
|
||||
#endif
|
||||
|
||||
_cogl_pipeline_node_init (COGL_PIPELINE_NODE (pipeline));
|
||||
|
||||
pipeline->is_weak = FALSE;
|
||||
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->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
|
||||
* may be notified here...
|
||||
*/
|
||||
if (pipeline->backend != COGL_PIPELINE_BACKEND_UNDEFINED &&
|
||||
_cogl_pipeline_backends[pipeline->backend]->pipeline_set_parent_notify)
|
||||
if (pipeline->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED &&
|
||||
_cogl_pipeline_fragends[pipeline->fragend]->pipeline_set_parent_notify)
|
||||
{
|
||||
const CoglPipelineBackend *backend =
|
||||
_cogl_pipeline_backends[pipeline->backend];
|
||||
backend->pipeline_set_parent_notify (pipeline);
|
||||
const CoglPipelineFragend *fragend =
|
||||
_cogl_pipeline_fragends[pipeline->fragend];
|
||||
fragend->pipeline_set_parent_notify (pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,8 +429,8 @@ _cogl_pipeline_copy (CoglPipeline *src, gboolean is_weak)
|
||||
pipeline->layers_cache_dirty = TRUE;
|
||||
pipeline->deprecated_get_layers_list_dirty = TRUE;
|
||||
|
||||
pipeline->backend = src->backend;
|
||||
pipeline->backend_priv_set_mask = 0;
|
||||
pipeline->fragend = src->fragend;
|
||||
pipeline->fragend_priv_set_mask = 0;
|
||||
|
||||
pipeline->has_static_breadcrumb = FALSE;
|
||||
|
||||
@ -482,14 +482,14 @@ cogl_pipeline_new (void)
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_pipeline_backend_free_priv (CoglPipeline *pipeline)
|
||||
_cogl_pipeline_fragend_free_priv (CoglPipeline *pipeline)
|
||||
{
|
||||
if (pipeline->backend != COGL_PIPELINE_BACKEND_UNDEFINED &&
|
||||
_cogl_pipeline_backends[pipeline->backend]->free_priv)
|
||||
if (pipeline->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED &&
|
||||
_cogl_pipeline_fragends[pipeline->fragend]->free_priv)
|
||||
{
|
||||
const CoglPipelineBackend *backend =
|
||||
_cogl_pipeline_backends[pipeline->backend];
|
||||
backend->free_priv (pipeline);
|
||||
const CoglPipelineFragend *fragend =
|
||||
_cogl_pipeline_fragends[pipeline->fragend];
|
||||
fragend->free_priv (pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
@ -525,7 +525,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
|
||||
|
||||
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));
|
||||
|
||||
@ -936,10 +936,10 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_pipeline_set_backend (CoglPipeline *pipeline, int backend)
|
||||
_cogl_pipeline_set_fragend (CoglPipeline *pipeline, int fragend)
|
||||
{
|
||||
_cogl_pipeline_backend_free_priv (pipeline);
|
||||
pipeline->backend = backend;
|
||||
_cogl_pipeline_fragend_free_priv (pipeline);
|
||||
pipeline->fragend = fragend;
|
||||
}
|
||||
|
||||
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
|
||||
* try searching for another backend when the pipeline changes.
|
||||
*/
|
||||
#ifdef COGL_PIPELINE_BACKEND_FIXED
|
||||
if (pipeline->backend == COGL_PIPELINE_BACKEND_FIXED)
|
||||
_cogl_pipeline_set_backend (pipeline, COGL_PIPELINE_BACKEND_UNDEFINED);
|
||||
#ifdef COGL_PIPELINE_FRAGEND_FIXED
|
||||
if (pipeline->fragend == COGL_PIPELINE_FRAGEND_FIXED)
|
||||
_cogl_pipeline_set_fragend (pipeline, COGL_PIPELINE_FRAGEND_UNDEFINED);
|
||||
#endif
|
||||
|
||||
if (pipeline->backend != COGL_PIPELINE_BACKEND_UNDEFINED &&
|
||||
_cogl_pipeline_backends[pipeline->backend]->pipeline_pre_change_notify)
|
||||
if (pipeline->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED &&
|
||||
_cogl_pipeline_fragends[pipeline->fragend]->pipeline_pre_change_notify)
|
||||
{
|
||||
const CoglPipelineBackend *backend =
|
||||
_cogl_pipeline_backends[pipeline->backend];
|
||||
const CoglPipelineFragend *fragend =
|
||||
_cogl_pipeline_fragends[pipeline->fragend];
|
||||
|
||||
/* To simplify things for the backends we are careful about how
|
||||
* we report STATE_LAYERS changes.
|
||||
@ -1198,7 +1198,7 @@ _cogl_pipeline_pre_change_notify (CoglPipeline *pipeline,
|
||||
* layer pre-change notification for any particular 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;
|
||||
@ -1485,7 +1485,7 @@ _cogl_pipeline_prune_to_n_layers (CoglPipeline *pipeline, int n)
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_pipeline_backend_layer_change_notify (CoglPipeline *owner,
|
||||
_cogl_pipeline_fragend_layer_change_notify (CoglPipeline *owner,
|
||||
CoglPipelineLayer *layer,
|
||||
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
|
||||
* backend that needs to be notified of the layer change...
|
||||
*/
|
||||
if (owner->backend != COGL_PIPELINE_BACKEND_UNDEFINED &&
|
||||
_cogl_pipeline_backends[owner->backend]->layer_pre_change_notify)
|
||||
if (owner->fragend != COGL_PIPELINE_FRAGEND_UNDEFINED &&
|
||||
_cogl_pipeline_fragends[owner->fragend]->layer_pre_change_notify)
|
||||
{
|
||||
const CoglPipelineBackend *backend =
|
||||
_cogl_pipeline_backends[owner->backend];
|
||||
backend->layer_pre_change_notify (owner, layer, change);
|
||||
const CoglPipelineFragend *fragend =
|
||||
_cogl_pipeline_fragends[owner->fragend];
|
||||
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
|
||||
* 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
|
||||
* 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);
|
||||
|
||||
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
|
||||
* ancestors being the authority */
|
||||
|
Loading…
Reference in New Issue
Block a user