cogl-gles2-wrapper: Layers aren't equal if one is enabled and one is not

Previously when comparing whether the settings for a layer are equal
it would only check if one of them was enabled. If so then it would
assume the other one was enabled and continue to compare the texture
environment. Now it also checks whether the enabledness differs.
This commit is contained in:
Neil Roberts 2010-07-13 13:59:07 +01:00
parent 23a172935d
commit ccd45fc723

View File

@ -252,34 +252,40 @@ cogl_gles2_settings_equal (const CoglGles2WrapperSettings *a,
/* Compare layer combine operation for each active unit */
if (fragment_tests)
for (i = 0; i < COGL_GLES2_MAX_TEXTURE_UNITS; i++)
if (COGL_GLES2_TEXTURE_UNIT_IS_ENABLED (a->texture_units, i))
{
const CoglGles2WrapperTexEnv *tex_env_a = a->tex_env + i;
const CoglGles2WrapperTexEnv *tex_env_b = b->tex_env + i;
int arg, n_args;
GLenum func;
{
if (!!COGL_GLES2_TEXTURE_UNIT_IS_ENABLED (a->texture_units, i) !=
!!COGL_GLES2_TEXTURE_UNIT_IS_ENABLED (b->texture_units, i))
return FALSE;
if (tex_env_a->point_sprite_coords !=
tex_env_b->point_sprite_coords)
return FALSE;
if (COGL_GLES2_TEXTURE_UNIT_IS_ENABLED (a->texture_units, i))
{
const CoglGles2WrapperTexEnv *tex_env_a = a->tex_env + i;
const CoglGles2WrapperTexEnv *tex_env_b = b->tex_env + i;
int arg, n_args;
GLenum func;
func = tex_env_a->texture_combine_rgb_func;
if (tex_env_a->point_sprite_coords !=
tex_env_b->point_sprite_coords)
return FALSE;
if (func != tex_env_b->texture_combine_rgb_func)
return FALSE;
func = tex_env_a->texture_combine_rgb_func;
n_args = cogl_gles2_get_n_args_for_combine_func (func);
if (func != tex_env_b->texture_combine_rgb_func)
return FALSE;
for (arg = 0; arg < n_args; arg++)
{
if (tex_env_a->texture_combine_rgb_src[arg] !=
tex_env_b->texture_combine_rgb_src[arg])
return FALSE;
if (tex_env_a->texture_combine_rgb_op[arg] !=
tex_env_b->texture_combine_rgb_op[arg])
return FALSE;
}
}
n_args = cogl_gles2_get_n_args_for_combine_func (func);
for (arg = 0; arg < n_args; arg++)
{
if (tex_env_a->texture_combine_rgb_src[arg] !=
tex_env_b->texture_combine_rgb_src[arg])
return FALSE;
if (tex_env_a->texture_combine_rgb_op[arg] !=
tex_env_b->texture_combine_rgb_op[arg])
return FALSE;
}
}
}
return TRUE;
}