mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
cogl-pipeline: Use enums for the layer combine values
Once the GLES2 wrapper is removed then we won't have the GLenums needed for setting up the layer combine state. This adds Cogl enums instead which have the same values as the corresponding GLenums. The enums are: CoglPipelineCombineFunc CoglPipelineCombineSource and CoglPipelineCombineOp
This commit is contained in:
parent
a05c701e6b
commit
2b32a9eb2a
@ -455,7 +455,7 @@ setup_arg (CoglPipeline *pipeline,
|
||||
|
||||
switch (src)
|
||||
{
|
||||
case GL_TEXTURE:
|
||||
case COGL_PIPELINE_COMBINE_SOURCE_TEXTURE:
|
||||
arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE;
|
||||
arg->name = "texel%d";
|
||||
arg->texture_unit = _cogl_pipeline_layer_get_unit_index (layer);
|
||||
@ -463,7 +463,7 @@ setup_arg (CoglPipeline *pipeline,
|
||||
cogl_texture_get_gl_texture (texture, NULL, &gl_target);
|
||||
setup_texture_source (arbfp_program_state, arg->texture_unit, gl_target);
|
||||
break;
|
||||
case GL_CONSTANT:
|
||||
case COGL_PIPELINE_COMBINE_SOURCE_CONSTANT:
|
||||
{
|
||||
int unit_index = _cogl_pipeline_layer_get_unit_index (layer);
|
||||
UnitState *unit_state = &arbfp_program_state->unit_state[unit_index];
|
||||
@ -476,11 +476,11 @@ setup_arg (CoglPipeline *pipeline,
|
||||
arg->constant_id = unit_state->constant_id;
|
||||
break;
|
||||
}
|
||||
case GL_PRIMARY_COLOR:
|
||||
case COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR:
|
||||
arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE;
|
||||
arg->name = "fragment.color.primary";
|
||||
break;
|
||||
case GL_PREVIOUS:
|
||||
case COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS:
|
||||
arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE;
|
||||
if (_cogl_pipeline_layer_get_unit_index (layer) == 0)
|
||||
arg->name = "fragment.color.primary";
|
||||
@ -500,9 +500,9 @@ setup_arg (CoglPipeline *pipeline,
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case GL_SRC_COLOR:
|
||||
case COGL_PIPELINE_COMBINE_OP_SRC_COLOR:
|
||||
break;
|
||||
case GL_ONE_MINUS_SRC_COLOR:
|
||||
case COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR:
|
||||
g_string_append_printf (arbfp_program_state->source,
|
||||
"SUB tmp%d, one, ",
|
||||
arg_index);
|
||||
@ -512,13 +512,13 @@ setup_arg (CoglPipeline *pipeline,
|
||||
arg->name = tmp_name[arg_index];
|
||||
arg->swizzle = "";
|
||||
break;
|
||||
case GL_SRC_ALPHA:
|
||||
case COGL_PIPELINE_COMBINE_OP_SRC_ALPHA:
|
||||
/* avoid a swizzle if we know RGB are going to be masked
|
||||
* in the end anyway */
|
||||
if (mask != COGL_BLEND_STRING_CHANNEL_MASK_ALPHA)
|
||||
arg->swizzle = ".a";
|
||||
break;
|
||||
case GL_ONE_MINUS_SRC_ALPHA:
|
||||
case COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA:
|
||||
g_string_append_printf (arbfp_program_state->source,
|
||||
"SUB tmp%d, one, ",
|
||||
arg_index);
|
||||
@ -594,29 +594,29 @@ append_function (CoglPipeline *pipeline,
|
||||
|
||||
switch (function)
|
||||
{
|
||||
case GL_ADD:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_ADD:
|
||||
g_string_append_printf (arbfp_program_state->source,
|
||||
"ADD_SAT output%s, ",
|
||||
mask_name);
|
||||
break;
|
||||
case GL_MODULATE:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_MODULATE:
|
||||
/* Note: no need to saturate since we can assume operands
|
||||
* have values in the range [0,1] */
|
||||
g_string_append_printf (arbfp_program_state->source, "MUL output%s, ",
|
||||
mask_name);
|
||||
break;
|
||||
case GL_REPLACE:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_REPLACE:
|
||||
/* Note: no need to saturate since we can assume operand
|
||||
* has a value in the range [0,1] */
|
||||
g_string_append_printf (arbfp_program_state->source, "MOV output%s, ",
|
||||
mask_name);
|
||||
break;
|
||||
case GL_SUBTRACT:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_SUBTRACT:
|
||||
g_string_append_printf (arbfp_program_state->source,
|
||||
"SUB_SAT output%s, ",
|
||||
mask_name);
|
||||
break;
|
||||
case GL_ADD_SIGNED:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED:
|
||||
g_string_append_printf (arbfp_program_state->source, "ADD tmp3%s, ",
|
||||
mask_name);
|
||||
append_arg (arbfp_program_state->source, &args[0]);
|
||||
@ -628,7 +628,7 @@ append_function (CoglPipeline *pipeline,
|
||||
mask_name);
|
||||
n_args = 0;
|
||||
break;
|
||||
case GL_DOT3_RGB:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB:
|
||||
/* These functions are the same except that GL_DOT3_RGB never
|
||||
* updates the alpha channel.
|
||||
*
|
||||
@ -636,7 +636,7 @@ append_function (CoglPipeline *pipeline,
|
||||
* an RGBA mask and we end up ignoring any separate alpha channel
|
||||
* function.
|
||||
*/
|
||||
case GL_DOT3_RGBA:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA:
|
||||
{
|
||||
const char *tmp4 = "tmp4";
|
||||
|
||||
@ -671,7 +671,7 @@ append_function (CoglPipeline *pipeline,
|
||||
n_args = 0;
|
||||
}
|
||||
break;
|
||||
case GL_INTERPOLATE:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_INTERPOLATE:
|
||||
/* Note: no need to saturate since we can assume operands
|
||||
* have values in the range [0,1] */
|
||||
|
||||
@ -708,9 +708,9 @@ static void
|
||||
append_masked_combine (CoglPipeline *arbfp_authority,
|
||||
CoglPipelineLayer *layer,
|
||||
CoglBlendStringChannelMask mask,
|
||||
GLint function,
|
||||
GLint *src,
|
||||
GLint *op)
|
||||
CoglPipelineCombineFunc function,
|
||||
CoglPipelineCombineSource *src,
|
||||
CoglPipelineCombineOp *op)
|
||||
{
|
||||
int i;
|
||||
int n_args;
|
||||
@ -788,7 +788,8 @@ _cogl_pipeline_fragend_arbfp_add_layer (CoglPipeline *pipeline,
|
||||
big_state->texture_combine_rgb_src,
|
||||
big_state->texture_combine_rgb_op);
|
||||
}
|
||||
else if (big_state->texture_combine_rgb_func == GL_DOT3_RGBA)
|
||||
else if (big_state->texture_combine_rgb_func ==
|
||||
COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA)
|
||||
{
|
||||
/* GL_DOT3_RGBA Is a bit weird as a GL_COMBINE_RGB function
|
||||
* since if you use it, it overrides your ALPHA function...
|
||||
|
@ -463,8 +463,8 @@ static void
|
||||
add_arg (GlslShaderState *glsl_shader_state,
|
||||
CoglPipeline *pipeline,
|
||||
CoglPipelineLayer *layer,
|
||||
GLint src,
|
||||
GLenum operand,
|
||||
CoglPipelineCombineSource src,
|
||||
CoglPipelineCombineOp operand,
|
||||
const char *swizzle)
|
||||
{
|
||||
GString *shader_source = glsl_shader_state->source;
|
||||
@ -472,14 +472,16 @@ add_arg (GlslShaderState *glsl_shader_state,
|
||||
|
||||
g_string_append_c (shader_source, '(');
|
||||
|
||||
if (operand == GL_ONE_MINUS_SRC_COLOR || operand == GL_ONE_MINUS_SRC_ALPHA)
|
||||
if (operand == COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR ||
|
||||
operand == COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA)
|
||||
g_string_append_printf (shader_source,
|
||||
"vec4(1.0, 1.0, 1.0, 1.0).%s - ",
|
||||
swizzle);
|
||||
|
||||
/* If the operand is reading from the alpha then replace the swizzle
|
||||
with the same number of copies of the alpha */
|
||||
if (operand == GL_SRC_ALPHA || operand == GL_ONE_MINUS_SRC_ALPHA)
|
||||
if (operand == COGL_PIPELINE_COMBINE_OP_SRC_ALPHA ||
|
||||
operand == COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA)
|
||||
{
|
||||
alpha_swizzle[strlen (swizzle)] = '\0';
|
||||
swizzle = alpha_swizzle;
|
||||
@ -487,37 +489,38 @@ add_arg (GlslShaderState *glsl_shader_state,
|
||||
|
||||
switch (src)
|
||||
{
|
||||
case GL_TEXTURE:
|
||||
case COGL_PIPELINE_COMBINE_SOURCE_TEXTURE:
|
||||
add_texture_lookup (glsl_shader_state,
|
||||
pipeline,
|
||||
layer,
|
||||
swizzle);
|
||||
break;
|
||||
|
||||
case GL_CONSTANT:
|
||||
case COGL_PIPELINE_COMBINE_SOURCE_CONSTANT:
|
||||
add_constant_lookup (glsl_shader_state,
|
||||
pipeline,
|
||||
layer,
|
||||
swizzle);
|
||||
break;
|
||||
|
||||
case GL_PREVIOUS:
|
||||
case COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS:
|
||||
if (_cogl_pipeline_layer_get_unit_index (layer) > 0)
|
||||
{
|
||||
g_string_append_printf (shader_source, "cogl_color_out.%s", swizzle);
|
||||
break;
|
||||
}
|
||||
/* flow through */
|
||||
case GL_PRIMARY_COLOR:
|
||||
case COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR:
|
||||
g_string_append_printf (shader_source, "cogl_color_in.%s", swizzle);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (src >= GL_TEXTURE0 && src < GL_TEXTURE0 + 32)
|
||||
if (src >= COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0 &&
|
||||
src < COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0 + 32)
|
||||
{
|
||||
FindPipelineLayerData data;
|
||||
|
||||
data.unit_index = src - GL_TEXTURE0;
|
||||
data.unit_index = src - COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0;
|
||||
data.layer = layer;
|
||||
|
||||
_cogl_pipeline_foreach_layer_internal (pipeline,
|
||||
@ -539,9 +542,9 @@ static void
|
||||
append_masked_combine (CoglPipeline *pipeline,
|
||||
CoglPipelineLayer *layer,
|
||||
const char *swizzle,
|
||||
GLint function,
|
||||
GLint *src,
|
||||
GLint *op)
|
||||
CoglPipelineCombineFunc function,
|
||||
CoglPipelineCombineSource *src,
|
||||
CoglPipelineCombineOp *op)
|
||||
{
|
||||
GlslShaderState *glsl_shader_state = get_glsl_shader_state (pipeline);
|
||||
GString *shader_source = glsl_shader_state->source;
|
||||
@ -551,12 +554,12 @@ append_masked_combine (CoglPipeline *pipeline,
|
||||
|
||||
switch (function)
|
||||
{
|
||||
case GL_REPLACE:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_REPLACE:
|
||||
add_arg (glsl_shader_state, pipeline, layer,
|
||||
src[0], op[0], swizzle);
|
||||
break;
|
||||
|
||||
case GL_MODULATE:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_MODULATE:
|
||||
add_arg (glsl_shader_state, pipeline, layer,
|
||||
src[0], op[0], swizzle);
|
||||
g_string_append (shader_source, " * ");
|
||||
@ -564,7 +567,7 @@ append_masked_combine (CoglPipeline *pipeline,
|
||||
src[1], op[1], swizzle);
|
||||
break;
|
||||
|
||||
case GL_ADD:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_ADD:
|
||||
add_arg (glsl_shader_state, pipeline, layer,
|
||||
src[0], op[0], swizzle);
|
||||
g_string_append (shader_source, " + ");
|
||||
@ -572,7 +575,7 @@ append_masked_combine (CoglPipeline *pipeline,
|
||||
src[1], op[1], swizzle);
|
||||
break;
|
||||
|
||||
case GL_ADD_SIGNED:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED:
|
||||
add_arg (glsl_shader_state, pipeline, layer,
|
||||
src[0], op[0], swizzle);
|
||||
g_string_append (shader_source, " + ");
|
||||
@ -583,7 +586,7 @@ append_masked_combine (CoglPipeline *pipeline,
|
||||
swizzle);
|
||||
break;
|
||||
|
||||
case GL_SUBTRACT:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_SUBTRACT:
|
||||
add_arg (glsl_shader_state, pipeline, layer,
|
||||
src[0], op[0], swizzle);
|
||||
g_string_append (shader_source, " - ");
|
||||
@ -591,7 +594,7 @@ append_masked_combine (CoglPipeline *pipeline,
|
||||
src[1], op[1], swizzle);
|
||||
break;
|
||||
|
||||
case GL_INTERPOLATE:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_INTERPOLATE:
|
||||
add_arg (glsl_shader_state, pipeline, layer,
|
||||
src[0], op[0], swizzle);
|
||||
g_string_append (shader_source, " * ");
|
||||
@ -608,8 +611,8 @@ append_masked_combine (CoglPipeline *pipeline,
|
||||
g_string_append_c (shader_source, ')');
|
||||
break;
|
||||
|
||||
case GL_DOT3_RGB:
|
||||
case GL_DOT3_RGBA:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA:
|
||||
g_string_append (shader_source, "vec4(4.0 * ((");
|
||||
add_arg (glsl_shader_state, pipeline, layer,
|
||||
src[0], op[0], "r");
|
||||
@ -653,7 +656,8 @@ _cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline,
|
||||
/* GL_DOT3_RGBA Is a bit weird as a GL_COMBINE_RGB function
|
||||
* since if you use it, it overrides your ALPHA function...
|
||||
*/
|
||||
big_state->texture_combine_rgb_func == GL_DOT3_RGBA)
|
||||
big_state->texture_combine_rgb_func ==
|
||||
COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA)
|
||||
append_masked_combine (pipeline,
|
||||
layer,
|
||||
"rgba",
|
||||
|
@ -181,17 +181,49 @@ typedef enum
|
||||
|
||||
} CoglPipelineLayerState;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* These are the same values as GL */
|
||||
COGL_PIPELINE_COMBINE_FUNC_ADD = 0x0104,
|
||||
COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED = 0x8574,
|
||||
COGL_PIPELINE_COMBINE_FUNC_SUBTRACT = 0x84E7,
|
||||
COGL_PIPELINE_COMBINE_FUNC_INTERPOLATE = 0x8575,
|
||||
COGL_PIPELINE_COMBINE_FUNC_REPLACE = 0x1E01,
|
||||
COGL_PIPELINE_COMBINE_FUNC_MODULATE = 0x2100,
|
||||
COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB = 0x86AE,
|
||||
COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA = 0x86AF
|
||||
} CoglPipelineCombineFunc;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* These are the same values as GL */
|
||||
COGL_PIPELINE_COMBINE_SOURCE_TEXTURE = 0x1702,
|
||||
COGL_PIPELINE_COMBINE_SOURCE_CONSTANT = 0x8576,
|
||||
COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR = 0x8577,
|
||||
COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS = 0x8578,
|
||||
COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0 = 0x84C0
|
||||
} CoglPipelineCombineSource;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* These are the same values as GL */
|
||||
COGL_PIPELINE_COMBINE_OP_SRC_COLOR = 0x0300,
|
||||
COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR = 0x0301,
|
||||
COGL_PIPELINE_COMBINE_OP_SRC_ALPHA = 0x0302,
|
||||
COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA = 0x0303
|
||||
} CoglPipelineCombineOp;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* The texture combine state determines how the color of individual
|
||||
* texture fragments are calculated. */
|
||||
GLint texture_combine_rgb_func;
|
||||
GLint texture_combine_rgb_src[3];
|
||||
GLint texture_combine_rgb_op[3];
|
||||
CoglPipelineCombineFunc texture_combine_rgb_func;
|
||||
CoglPipelineCombineSource texture_combine_rgb_src[3];
|
||||
CoglPipelineCombineOp texture_combine_rgb_op[3];
|
||||
|
||||
GLint texture_combine_alpha_func;
|
||||
GLint texture_combine_alpha_src[3];
|
||||
GLint texture_combine_alpha_op[3];
|
||||
CoglPipelineCombineFunc texture_combine_alpha_func;
|
||||
CoglPipelineCombineSource texture_combine_alpha_src[3];
|
||||
CoglPipelineCombineOp texture_combine_alpha_op[3];
|
||||
|
||||
float texture_combine_constant[4];
|
||||
|
||||
@ -864,7 +896,7 @@ void
|
||||
_cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type);
|
||||
|
||||
unsigned int
|
||||
_cogl_get_n_args_for_combine_func (GLint func);
|
||||
_cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func);
|
||||
|
||||
/*
|
||||
* _cogl_pipeline_weak_copy:
|
||||
|
@ -777,11 +777,16 @@ layer_has_alpha_cb (CoglPipelineLayer *layer, void *data)
|
||||
* assume it may result in an alpha value < 1
|
||||
*
|
||||
* FIXME: we could do better than this. */
|
||||
if (big_state->texture_combine_alpha_func != GL_MODULATE ||
|
||||
big_state->texture_combine_alpha_src[0] != GL_PREVIOUS ||
|
||||
big_state->texture_combine_alpha_op[0] != GL_SRC_ALPHA ||
|
||||
big_state->texture_combine_alpha_src[1] != GL_TEXTURE ||
|
||||
big_state->texture_combine_alpha_op[1] != GL_SRC_ALPHA)
|
||||
if (big_state->texture_combine_alpha_func !=
|
||||
COGL_PIPELINE_COMBINE_FUNC_MODULATE ||
|
||||
big_state->texture_combine_alpha_src[0] !=
|
||||
COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS ||
|
||||
big_state->texture_combine_alpha_op[0] !=
|
||||
COGL_PIPELINE_COMBINE_OP_SRC_ALPHA ||
|
||||
big_state->texture_combine_alpha_src[1] !=
|
||||
COGL_PIPELINE_COMBINE_SOURCE_TEXTURE ||
|
||||
big_state->texture_combine_alpha_op[1] !=
|
||||
COGL_PIPELINE_COMBINE_OP_SRC_ALPHA)
|
||||
{
|
||||
*has_alpha = TRUE;
|
||||
/* return FALSE to stop iterating layers... */
|
||||
@ -1614,20 +1619,20 @@ _cogl_pipeline_progend_layer_change_notify (CoglPipeline *owner,
|
||||
}
|
||||
|
||||
unsigned int
|
||||
_cogl_get_n_args_for_combine_func (GLint func)
|
||||
_cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func)
|
||||
{
|
||||
switch (func)
|
||||
{
|
||||
case GL_REPLACE:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_REPLACE:
|
||||
return 1;
|
||||
case GL_MODULATE:
|
||||
case GL_ADD:
|
||||
case GL_ADD_SIGNED:
|
||||
case GL_SUBTRACT:
|
||||
case GL_DOT3_RGB:
|
||||
case GL_DOT3_RGBA:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_MODULATE:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_ADD:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_SUBTRACT:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA:
|
||||
return 2;
|
||||
case GL_INTERPOLATE:
|
||||
case COGL_PIPELINE_COMBINE_FUNC_INTERPOLATE:
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
@ -4788,16 +4793,26 @@ _cogl_pipeline_init_default_layers (void)
|
||||
|
||||
/* Choose the same default combine mode as OpenGL:
|
||||
* RGBA = MODULATE(PREVIOUS[RGBA],TEXTURE[RGBA]) */
|
||||
big_state->texture_combine_rgb_func = GL_MODULATE;
|
||||
big_state->texture_combine_rgb_src[0] = GL_PREVIOUS;
|
||||
big_state->texture_combine_rgb_src[1] = GL_TEXTURE;
|
||||
big_state->texture_combine_rgb_op[0] = GL_SRC_COLOR;
|
||||
big_state->texture_combine_rgb_op[1] = GL_SRC_COLOR;
|
||||
big_state->texture_combine_alpha_func = GL_MODULATE;
|
||||
big_state->texture_combine_alpha_src[0] = GL_PREVIOUS;
|
||||
big_state->texture_combine_alpha_src[1] = GL_TEXTURE;
|
||||
big_state->texture_combine_alpha_op[0] = GL_SRC_ALPHA;
|
||||
big_state->texture_combine_alpha_op[1] = GL_SRC_ALPHA;
|
||||
big_state->texture_combine_rgb_func =
|
||||
COGL_PIPELINE_COMBINE_FUNC_MODULATE;
|
||||
big_state->texture_combine_rgb_src[0] =
|
||||
COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS;
|
||||
big_state->texture_combine_rgb_src[1] =
|
||||
COGL_PIPELINE_COMBINE_SOURCE_TEXTURE;
|
||||
big_state->texture_combine_rgb_op[0] =
|
||||
COGL_PIPELINE_COMBINE_OP_SRC_COLOR;
|
||||
big_state->texture_combine_rgb_op[1] =
|
||||
COGL_PIPELINE_COMBINE_OP_SRC_COLOR;
|
||||
big_state->texture_combine_alpha_func =
|
||||
COGL_PIPELINE_COMBINE_FUNC_MODULATE;
|
||||
big_state->texture_combine_alpha_src[0] =
|
||||
COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS;
|
||||
big_state->texture_combine_alpha_src[1] =
|
||||
COGL_PIPELINE_COMBINE_SOURCE_TEXTURE;
|
||||
big_state->texture_combine_alpha_op[0] =
|
||||
COGL_PIPELINE_COMBINE_OP_SRC_ALPHA;
|
||||
big_state->texture_combine_alpha_op[1] =
|
||||
COGL_PIPELINE_COMBINE_OP_SRC_ALPHA;
|
||||
|
||||
big_state->point_sprite_coords = FALSE;
|
||||
|
||||
@ -4839,37 +4854,37 @@ _cogl_pipeline_init_default_layers (void)
|
||||
|
||||
static void
|
||||
setup_texture_combine_state (CoglBlendStringStatement *statement,
|
||||
GLint *texture_combine_func,
|
||||
GLint *texture_combine_src,
|
||||
GLint *texture_combine_op)
|
||||
CoglPipelineCombineFunc *texture_combine_func,
|
||||
CoglPipelineCombineSource *texture_combine_src,
|
||||
CoglPipelineCombineOp *texture_combine_op)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (statement->function->type)
|
||||
{
|
||||
case COGL_BLEND_STRING_FUNCTION_REPLACE:
|
||||
*texture_combine_func = GL_REPLACE;
|
||||
*texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_REPLACE;
|
||||
break;
|
||||
case COGL_BLEND_STRING_FUNCTION_MODULATE:
|
||||
*texture_combine_func = GL_MODULATE;
|
||||
*texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_MODULATE;
|
||||
break;
|
||||
case COGL_BLEND_STRING_FUNCTION_ADD:
|
||||
*texture_combine_func = GL_ADD;
|
||||
*texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_ADD;
|
||||
break;
|
||||
case COGL_BLEND_STRING_FUNCTION_ADD_SIGNED:
|
||||
*texture_combine_func = GL_ADD_SIGNED;
|
||||
*texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED;
|
||||
break;
|
||||
case COGL_BLEND_STRING_FUNCTION_INTERPOLATE:
|
||||
*texture_combine_func = GL_INTERPOLATE;
|
||||
*texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_INTERPOLATE;
|
||||
break;
|
||||
case COGL_BLEND_STRING_FUNCTION_SUBTRACT:
|
||||
*texture_combine_func = GL_SUBTRACT;
|
||||
*texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_SUBTRACT;
|
||||
break;
|
||||
case COGL_BLEND_STRING_FUNCTION_DOT3_RGB:
|
||||
*texture_combine_func = GL_DOT3_RGB;
|
||||
*texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB;
|
||||
break;
|
||||
case COGL_BLEND_STRING_FUNCTION_DOT3_RGBA:
|
||||
*texture_combine_func = GL_DOT3_RGBA;
|
||||
*texture_combine_func = COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4880,39 +4895,41 @@ setup_texture_combine_state (CoglBlendStringStatement *statement,
|
||||
switch (arg->source.info->type)
|
||||
{
|
||||
case COGL_BLEND_STRING_COLOR_SOURCE_CONSTANT:
|
||||
texture_combine_src[i] = GL_CONSTANT;
|
||||
texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_CONSTANT;
|
||||
break;
|
||||
case COGL_BLEND_STRING_COLOR_SOURCE_TEXTURE:
|
||||
texture_combine_src[i] = GL_TEXTURE;
|
||||
texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_TEXTURE;
|
||||
break;
|
||||
case COGL_BLEND_STRING_COLOR_SOURCE_TEXTURE_N:
|
||||
texture_combine_src[i] =
|
||||
GL_TEXTURE0 + arg->source.texture;
|
||||
COGL_PIPELINE_COMBINE_SOURCE_TEXTURE0 + arg->source.texture;
|
||||
break;
|
||||
case COGL_BLEND_STRING_COLOR_SOURCE_PRIMARY:
|
||||
texture_combine_src[i] = GL_PRIMARY_COLOR;
|
||||
texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR;
|
||||
break;
|
||||
case COGL_BLEND_STRING_COLOR_SOURCE_PREVIOUS:
|
||||
texture_combine_src[i] = GL_PREVIOUS;
|
||||
texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS;
|
||||
break;
|
||||
default:
|
||||
g_warning ("Unexpected texture combine source");
|
||||
texture_combine_src[i] = GL_TEXTURE;
|
||||
texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_TEXTURE;
|
||||
}
|
||||
|
||||
if (arg->source.mask == COGL_BLEND_STRING_CHANNEL_MASK_RGB)
|
||||
{
|
||||
if (statement->args[i].source.one_minus)
|
||||
texture_combine_op[i] = GL_ONE_MINUS_SRC_COLOR;
|
||||
texture_combine_op[i] =
|
||||
COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR;
|
||||
else
|
||||
texture_combine_op[i] = GL_SRC_COLOR;
|
||||
texture_combine_op[i] = COGL_PIPELINE_COMBINE_OP_SRC_COLOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (statement->args[i].source.one_minus)
|
||||
texture_combine_op[i] = GL_ONE_MINUS_SRC_ALPHA;
|
||||
texture_combine_op[i] =
|
||||
COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA;
|
||||
else
|
||||
texture_combine_op[i] = GL_SRC_ALPHA;
|
||||
texture_combine_op[i] = COGL_PIPELINE_COMBINE_OP_SRC_ALPHA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user