diff --git a/clutter/cogl/cogl-material.h b/clutter/cogl/cogl-material.h index 66fbd8d5c..510ce8238 100644 --- a/clutter/cogl/cogl-material.h +++ b/clutter/cogl/cogl-material.h @@ -419,7 +419,8 @@ void cogl_material_set_alpha_test_function (CoglHandle material, * @error: A GError that may report lack of driver support if you give * separate blend string statements for the alpha channel and RGB * channels since some drivers or backends such as GLES 1.1 dont - * support this. + * support this. May be %NULL, in which case a warning will be + * printed out if an error is encountered. * * If not already familiar; please refer * here for an overview of what blend @@ -536,6 +537,8 @@ void cogl_material_remove_layer (CoglHandle material, * @blend_string: A Cogl blend string * describing the desired texture combine function. * @error: A GError that may report parse errors or lack of GPU/driver support. + * May be %NULL, in which case a warning will be printed out if an + * error is encountered. * * If not already familiar; you can refer * here for an overview of what blend diff --git a/clutter/cogl/common/cogl-material.c b/clutter/cogl/common/cogl-material.c index 68198858a..831fa30f1 100644 --- a/clutter/cogl/common/cogl-material.c +++ b/clutter/cogl/common/cogl-material.c @@ -533,6 +533,7 @@ cogl_material_set_blend (CoglHandle handle, CoglBlendStringStatement split[2]; CoglBlendStringStatement *rgb; CoglBlendStringStatement *a; + GError *internal_error = NULL; int count; g_return_val_if_fail (cogl_is_material (handle), FALSE); @@ -543,9 +544,19 @@ cogl_material_set_blend (CoglHandle handle, _cogl_blend_string_compile (blend_description, COGL_BLEND_STRING_CONTEXT_BLENDING, statements, - error); + &internal_error); if (!count) - return FALSE; + { + if (error) + g_propagate_error (error, internal_error); + else + { + g_warning ("Cannot compile blend description: %s\n", + internal_error->message); + g_error_free (internal_error); + } + return FALSE; + } if (statements[0].mask == COGL_BLEND_STRING_CHANNEL_MASK_RGBA) { @@ -806,6 +817,7 @@ cogl_material_set_layer_combine (CoglHandle handle, CoglBlendStringStatement split[2]; CoglBlendStringStatement *rgb; CoglBlendStringStatement *a; + GError *internal_error = NULL; int count; g_return_val_if_fail (cogl_is_material (handle), FALSE); @@ -817,9 +829,19 @@ cogl_material_set_layer_combine (CoglHandle handle, _cogl_blend_string_compile (combine_description, COGL_BLEND_STRING_CONTEXT_TEXTURE_COMBINE, statements, - error); + &internal_error); if (!count) - return FALSE; + { + if (error) + g_propagate_error (error, internal_error); + else + { + g_warning ("Cannot compile combine description: %s\n", + internal_error->message); + g_error_free (internal_error); + } + return FALSE; + } if (statements[0].mask == COGL_BLEND_STRING_CHANNEL_MASK_RGBA) {