[cogl] Don't endlessly print the same warning regarding layer fallbacks
There are various constraints for when we can support multi-texturing and when they can't be met we try and print a clear warning explaining why the operation isn't supported, but we shouldn't endlessly repeat the warning for every primitive of every frame. This patch fixes that.
This commit is contained in:
parent
2866b0e33b
commit
9611f33dd6
@ -2490,24 +2490,30 @@ _cogl_multitexture_unsliced_quad (float x_1,
|
|||||||
{
|
{
|
||||||
if (n_layers > 1)
|
if (n_layers > 1)
|
||||||
{
|
{
|
||||||
g_warning ("Skipping layers 1..n of your material since the "
|
static gboolean warning_seen = FALSE;
|
||||||
"first layer has waste and you supplied texture "
|
if (!warning_seen)
|
||||||
"coordinates outside the range [0,1]. We don't "
|
g_warning ("Skipping layers 1..n of your material since "
|
||||||
"currently support any multi-texturing using "
|
"the first layer has waste and you supplied "
|
||||||
"textures with waste when repeating is "
|
"texture coordinates outside the range [0,1]. "
|
||||||
"necissary so we are falling back to sliced "
|
"We don't currently support any "
|
||||||
"textures assuming layer 0 is the most "
|
"multi-texturing using textures with waste "
|
||||||
"important one keep");
|
"when repeating is necissary so we are "
|
||||||
|
"falling back to sliced textures assuming "
|
||||||
|
"layer 0 is the most important one keep");
|
||||||
|
warning_seen = TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_warning ("Skipping layer %d of your material "
|
static gboolean warning_seen = FALSE;
|
||||||
"consisting of a texture with waste since "
|
if (!warning_seen)
|
||||||
"you have supplied texture coords outside "
|
g_warning ("Skipping layer %d of your material "
|
||||||
"the range [0,1] (unsupported when "
|
"consisting of a texture with waste since "
|
||||||
"multi-texturing)", i);
|
"you have supplied texture coords outside "
|
||||||
|
"the range [0,1] (unsupported when "
|
||||||
|
"multi-texturing)", i);
|
||||||
|
warning_seen = TRUE;
|
||||||
|
|
||||||
/* NB: marking for fallback will replace the layer with
|
/* NB: marking for fallback will replace the layer with
|
||||||
* a default transparent texture */
|
* a default transparent texture */
|
||||||
@ -2652,19 +2658,25 @@ _cogl_rectangles_with_multitexture_coords (
|
|||||||
all_use_sliced_quad_fallback = TRUE;
|
all_use_sliced_quad_fallback = TRUE;
|
||||||
if (tmp->next)
|
if (tmp->next)
|
||||||
{
|
{
|
||||||
g_warning ("Skipping layers 1..n of your material since the "
|
static gboolean warning_seen = FALSE;
|
||||||
"first layer is sliced. We don't currently "
|
if (!warning_seen)
|
||||||
"support any multi-texturing with sliced "
|
g_warning ("Skipping layers 1..n of your material since "
|
||||||
"textures but assume layer 0 is the most "
|
"the first layer is sliced. We don't currently "
|
||||||
"important to keep");
|
"support any multi-texturing with sliced "
|
||||||
|
"textures but assume layer 0 is the most "
|
||||||
|
"important to keep");
|
||||||
|
warning_seen = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_warning ("Skipping layer %d of your material consisting of a "
|
static gboolean warning_seen = FALSE;
|
||||||
"sliced texture (unsuported for multi texturing)",
|
if (!warning_seen)
|
||||||
i);
|
g_warning ("Skipping layer %d of your material consisting of "
|
||||||
|
"a sliced texture (unsuported for multi texturing)",
|
||||||
|
i);
|
||||||
|
warning_seen = TRUE;
|
||||||
|
|
||||||
/* NB: marking for fallback will replace the layer with
|
/* NB: marking for fallback will replace the layer with
|
||||||
* a default transparent texture */
|
* a default transparent texture */
|
||||||
@ -2680,10 +2692,13 @@ _cogl_rectangles_with_multitexture_coords (
|
|||||||
if (flags & COGL_MATERIAL_LAYER_FLAG_HAS_USER_MATRIX
|
if (flags & COGL_MATERIAL_LAYER_FLAG_HAS_USER_MATRIX
|
||||||
&& _cogl_texture_span_has_waste (texture, 0, 0))
|
&& _cogl_texture_span_has_waste (texture, 0, 0))
|
||||||
{
|
{
|
||||||
g_warning ("Skipping layer %d of your material consisting of a "
|
static gboolean warning_seen = FALSE;
|
||||||
"texture with waste since you have supplied a custom "
|
if (!warning_seen)
|
||||||
"texture matrix and the result may try to sample from "
|
g_warning ("Skipping layer %d of your material consisting of a "
|
||||||
"the waste area of your texture.", i);
|
"texture with waste since you have supplied a custom "
|
||||||
|
"texture matrix and the result may try to sample from "
|
||||||
|
"the waste area of your texture.", i);
|
||||||
|
warning_seen = TRUE;
|
||||||
|
|
||||||
/* NB: marking for fallback will replace the layer with
|
/* NB: marking for fallback will replace the layer with
|
||||||
* a default transparent texture */
|
* a default transparent texture */
|
||||||
@ -3029,23 +3044,23 @@ cogl_polygon (CoglTextureVertex *vertices,
|
|||||||
{
|
{
|
||||||
#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GLES2)
|
#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GLES2)
|
||||||
{
|
{
|
||||||
static gboolean shown_gles_slicing_warning = FALSE;
|
static gboolean warning_seen = FALSE;
|
||||||
if (!shown_gles_slicing_warning)
|
if (!warning_seen)
|
||||||
g_warning ("cogl_polygon does not work for sliced textures "
|
g_warning ("cogl_polygon does not work for sliced textures "
|
||||||
"on GL ES");
|
"on GL ES");
|
||||||
shown_gles_slicing_warning = TRUE;
|
warning_seen = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (n_layers > 1)
|
if (n_layers > 1)
|
||||||
{
|
{
|
||||||
static gboolean shown_slicing_warning = FALSE;
|
static gboolean warning_seen = FALSE;
|
||||||
if (!shown_slicing_warning)
|
if (!warning_seen)
|
||||||
{
|
{
|
||||||
g_warning ("Disabling layers 1..n since multi-texturing with "
|
g_warning ("Disabling layers 1..n since multi-texturing with "
|
||||||
"cogl_polygon isn't supported when using sliced "
|
"cogl_polygon isn't supported when using sliced "
|
||||||
"textures\n");
|
"textures\n");
|
||||||
shown_slicing_warning = TRUE;
|
warning_seen = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
use_sliced_polygon_fallback = TRUE;
|
use_sliced_polygon_fallback = TRUE;
|
||||||
@ -3053,13 +3068,13 @@ cogl_polygon (CoglTextureVertex *vertices,
|
|||||||
|
|
||||||
if (tex->min_filter != GL_NEAREST || tex->mag_filter != GL_NEAREST)
|
if (tex->min_filter != GL_NEAREST || tex->mag_filter != GL_NEAREST)
|
||||||
{
|
{
|
||||||
static gboolean shown_filter_warning = FALSE;
|
static gboolean warning_seen = FALSE;
|
||||||
if (!shown_filter_warning)
|
if (!warning_seen)
|
||||||
{
|
{
|
||||||
g_warning ("cogl_texture_polygon does not work for sliced textures "
|
g_warning ("cogl_texture_polygon does not work for sliced textures "
|
||||||
"when the minification and magnification filters are not "
|
"when the minification and magnification filters are not "
|
||||||
"CGL_NEAREST");
|
"CGL_NEAREST");
|
||||||
shown_filter_warning = TRUE;
|
warning_seen = TRUE;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3076,10 +3091,13 @@ cogl_polygon (CoglTextureVertex *vertices,
|
|||||||
|
|
||||||
if (cogl_texture_is_sliced (tex_handle))
|
if (cogl_texture_is_sliced (tex_handle))
|
||||||
{
|
{
|
||||||
g_warning ("Disabling layer %d of the current source material, "
|
static gboolean warning_seen = FALSE;
|
||||||
"because texturing with the vertex buffer API is not "
|
if (!warning_seen)
|
||||||
"currently supported using sliced textures, or textures "
|
g_warning ("Disabling layer %d of the current source material, "
|
||||||
"with waste\n", i);
|
"because texturing with the vertex buffer API is not "
|
||||||
|
"currently supported using sliced textures, or "
|
||||||
|
"textures with waste\n", i);
|
||||||
|
warning_seen = TRUE;
|
||||||
|
|
||||||
fallback_mask |= (1 << i);
|
fallback_mask |= (1 << i);
|
||||||
continue;
|
continue;
|
||||||
|
@ -2594,24 +2594,30 @@ _cogl_multitexture_unsliced_quad (float x_1,
|
|||||||
{
|
{
|
||||||
if (n_layers > 1)
|
if (n_layers > 1)
|
||||||
{
|
{
|
||||||
g_warning ("Skipping layers 1..n of your material since the "
|
static gboolean warning_seen = FALSE;
|
||||||
"first layer has waste and you supplied texture "
|
if (!warning_seen)
|
||||||
"coordinates outside the range [0,1]. We don't "
|
g_warning ("Skipping layers 1..n of your material since "
|
||||||
"currently support any multi-texturing using "
|
"the first layer has waste and you supplied "
|
||||||
"textures with waste when repeating is "
|
"texture coordinates outside the range [0,1]. "
|
||||||
"necissary so we are falling back to sliced "
|
"We don't currently support any "
|
||||||
"textures assuming layer 0 is the most "
|
"multi-texturing using textures with waste "
|
||||||
"important one keep");
|
"when repeating is necissary so we are "
|
||||||
|
"falling back to sliced textures assuming "
|
||||||
|
"layer 0 is the most important one keep");
|
||||||
|
warning_seen = TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_warning ("Skipping layer %d of your material "
|
static gboolean warning_seen = FALSE;
|
||||||
"consisting of a texture with waste since "
|
if (!warning_seen)
|
||||||
"you have supplied texture coords outside "
|
g_warning ("Skipping layer %d of your material "
|
||||||
"the range [0,1] (unsupported when "
|
"consisting of a texture with waste since "
|
||||||
"multi-texturing)", i);
|
"you have supplied texture coords outside "
|
||||||
|
"the range [0,1] (unsupported when "
|
||||||
|
"multi-texturing)", i);
|
||||||
|
warning_seen = TRUE;
|
||||||
|
|
||||||
/* NB: marking for fallback will replace the layer with
|
/* NB: marking for fallback will replace the layer with
|
||||||
* a default transparent texture */
|
* a default transparent texture */
|
||||||
@ -2747,19 +2753,25 @@ _cogl_rectangles_with_multitexture_coords (
|
|||||||
all_use_sliced_quad_fallback = TRUE;
|
all_use_sliced_quad_fallback = TRUE;
|
||||||
if (tmp->next)
|
if (tmp->next)
|
||||||
{
|
{
|
||||||
g_warning ("Skipping layers 1..n of your material since the "
|
static gboolean warning_seen = FALSE;
|
||||||
"first layer is sliced. We don't currently "
|
if (!warning_seen)
|
||||||
"support any multi-texturing with sliced "
|
g_warning ("Skipping layers 1..n of your material since "
|
||||||
"textures but assume layer 0 is the most "
|
"the first layer is sliced. We don't currently "
|
||||||
"important to keep");
|
"support any multi-texturing with sliced "
|
||||||
|
"textures but assume layer 0 is the most "
|
||||||
|
"important to keep");
|
||||||
|
warning_seen = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_warning ("Skipping layer %d of your material consisting of a "
|
static gboolean warning_seen = FALSE;
|
||||||
"sliced texture (unsuported for multi texturing)",
|
if (!warning_seen)
|
||||||
i);
|
g_warning ("Skipping layer %d of your material consisting of "
|
||||||
|
"a sliced texture (unsuported for multi texturing)",
|
||||||
|
i);
|
||||||
|
warning_seen = TRUE;
|
||||||
|
|
||||||
/* NB: marking for fallback will replace the layer with
|
/* NB: marking for fallback will replace the layer with
|
||||||
* a default transparent texture */
|
* a default transparent texture */
|
||||||
@ -2775,13 +2787,14 @@ _cogl_rectangles_with_multitexture_coords (
|
|||||||
if (flags & COGL_MATERIAL_LAYER_FLAG_HAS_USER_MATRIX
|
if (flags & COGL_MATERIAL_LAYER_FLAG_HAS_USER_MATRIX
|
||||||
&& _cogl_texture_span_has_waste (texture, 0, 0))
|
&& _cogl_texture_span_has_waste (texture, 0, 0))
|
||||||
{
|
{
|
||||||
static gboolean shown_warning = FALSE;
|
static gboolean warning_seen = FALSE;
|
||||||
if (!shown_warning)
|
if (!warning_seen)
|
||||||
g_warning ("Skipping layer %d of your material consisting of a "
|
g_warning ("Skipping layer %d of your material consisting of a "
|
||||||
"texture with waste since you have supplied a custom "
|
"texture with waste since you have supplied a custom "
|
||||||
"texture matrix and the result may try to sample from "
|
"texture matrix and the result may try to sample from "
|
||||||
"the waste area of your texture.", i);
|
"the waste area of your texture.", i);
|
||||||
shown_warning = TRUE;
|
warning_seen = TRUE;
|
||||||
|
|
||||||
/* NB: marking for fallback will replace the layer with
|
/* NB: marking for fallback will replace the layer with
|
||||||
* a default transparent texture */
|
* a default transparent texture */
|
||||||
fallback_mask |= (1 << i);
|
fallback_mask |= (1 << i);
|
||||||
@ -3112,23 +3125,23 @@ cogl_polygon (CoglTextureVertex *vertices,
|
|||||||
{
|
{
|
||||||
#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GLES2)
|
#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GLES2)
|
||||||
{
|
{
|
||||||
static gboolean shown_gles_slicing_warning = FALSE;
|
static gboolean warning_seen = FALSE;
|
||||||
if (!shown_gles_slicing_warning)
|
if (!warning_seen)
|
||||||
g_warning ("cogl_polygon does not work for sliced textures "
|
g_warning ("cogl_polygon does not work for sliced textures "
|
||||||
"on GL ES");
|
"on GL ES");
|
||||||
shown_gles_slicing_warning = TRUE;
|
warning_seen = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (n_layers > 1)
|
if (n_layers > 1)
|
||||||
{
|
{
|
||||||
static gboolean shown_slicing_warning = FALSE;
|
static gboolean warning_seen = FALSE;
|
||||||
if (!shown_slicing_warning)
|
if (!warning_seen)
|
||||||
{
|
{
|
||||||
g_warning ("Disabling layers 1..n since multi-texturing with "
|
g_warning ("Disabling layers 1..n since multi-texturing with "
|
||||||
"cogl_polygon isn't supported when using sliced "
|
"cogl_polygon isn't supported when using sliced "
|
||||||
"textures\n");
|
"textures\n");
|
||||||
shown_slicing_warning = TRUE;
|
warning_seen = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
use_sliced_polygon_fallback = TRUE;
|
use_sliced_polygon_fallback = TRUE;
|
||||||
@ -3136,13 +3149,13 @@ cogl_polygon (CoglTextureVertex *vertices,
|
|||||||
|
|
||||||
if (tex->min_filter != GL_NEAREST || tex->mag_filter != GL_NEAREST)
|
if (tex->min_filter != GL_NEAREST || tex->mag_filter != GL_NEAREST)
|
||||||
{
|
{
|
||||||
static gboolean shown_filter_warning = FALSE;
|
static gboolean warning_seen = FALSE;
|
||||||
if (!shown_filter_warning)
|
if (!warning_seen)
|
||||||
{
|
{
|
||||||
g_warning ("cogl_texture_polygon does not work for sliced textures "
|
g_warning ("cogl_texture_polygon does not work for sliced textures "
|
||||||
"when the minification and magnification filters are not "
|
"when the minification and magnification filters are not "
|
||||||
"CGL_NEAREST");
|
"CGL_NEAREST");
|
||||||
shown_filter_warning = TRUE;
|
warning_seen = TRUE;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3159,10 +3172,13 @@ cogl_polygon (CoglTextureVertex *vertices,
|
|||||||
|
|
||||||
if (cogl_texture_is_sliced (tex_handle))
|
if (cogl_texture_is_sliced (tex_handle))
|
||||||
{
|
{
|
||||||
g_warning ("Disabling layer %d of the current source material, "
|
static gboolean warning_seen = FALSE;
|
||||||
"because texturing with the vertex buffer API is not "
|
if (!warning_seen)
|
||||||
"currently supported using sliced textures, or textures "
|
g_warning ("Disabling layer %d of the current source material, "
|
||||||
"with waste\n", i);
|
"because texturing with the vertex buffer API is not "
|
||||||
|
"currently supported using sliced textures, or "
|
||||||
|
"textures with waste\n", i);
|
||||||
|
warning_seen = TRUE;
|
||||||
|
|
||||||
fallback_mask |= (1 << i);
|
fallback_mask |= (1 << i);
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user