cogl-material: Compare GL texture numbers for material layer textures
When deciding if a material layer is equal it now compares the GL target and texture number if the textures are not sliced. This is needed to get batching across atlased textures.
This commit is contained in:
parent
e20c98e548
commit
e4455041c8
@ -1712,13 +1712,36 @@ _cogl_material_flush_gl_state (CoglHandle handle,
|
|||||||
0, sizeof (CoglMaterialFlushOptions));
|
0, sizeof (CoglMaterialFlushOptions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_cogl_material_texture_equal (CoglHandle texture0, CoglHandle texture1)
|
||||||
|
{
|
||||||
|
GLenum gl_handle0, gl_handle1, gl_target0, gl_target1;
|
||||||
|
|
||||||
|
/* If the texture handles are the same then the textures are
|
||||||
|
definitely equal */
|
||||||
|
if (texture0 == texture1)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
/* If neither texture is sliced then they could still be the same if
|
||||||
|
the are referring to the same GL texture */
|
||||||
|
if (cogl_texture_is_sliced (texture0) ||
|
||||||
|
cogl_texture_is_sliced (texture1))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
cogl_texture_get_gl_texture (texture0, &gl_handle0, &gl_target0);
|
||||||
|
cogl_texture_get_gl_texture (texture1, &gl_handle1, &gl_target1);
|
||||||
|
|
||||||
|
return gl_handle0 == gl_handle1 && gl_target0 == gl_target1;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_cogl_material_layer_equal (CoglMaterialLayer *material0_layer,
|
_cogl_material_layer_equal (CoglMaterialLayer *material0_layer,
|
||||||
CoglHandle material0_layer_texture,
|
CoglHandle material0_layer_texture,
|
||||||
CoglMaterialLayer *material1_layer,
|
CoglMaterialLayer *material1_layer,
|
||||||
CoglHandle material1_layer_texture)
|
CoglHandle material1_layer_texture)
|
||||||
{
|
{
|
||||||
if (material0_layer_texture != material1_layer_texture)
|
if (!_cogl_material_texture_equal (material0_layer_texture,
|
||||||
|
material1_layer_texture))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ((material0_layer->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE) !=
|
if ((material0_layer->flags & COGL_MATERIAL_LAYER_FLAG_DEFAULT_COMBINE) !=
|
||||||
|
Loading…
Reference in New Issue
Block a user