mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 19:12:04 +00:00
cogl: Remove no-op cogl_shader_compile and cogl_shader_get_info_log
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1024
This commit is contained in:
parent
1981449776
commit
5c704e3f81
@ -367,24 +367,12 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
||||
|
||||
CLUTTER_NOTE (SHADER, "Compiling shader effect");
|
||||
|
||||
cogl_shader_compile (class_priv->shader);
|
||||
class_priv->program = cogl_create_program ();
|
||||
|
||||
if (cogl_shader_is_compiled (class_priv->shader))
|
||||
{
|
||||
class_priv->program = cogl_create_program ();
|
||||
cogl_program_attach_shader (class_priv->program,
|
||||
class_priv->shader);
|
||||
|
||||
cogl_program_attach_shader (class_priv->program,
|
||||
class_priv->shader);
|
||||
|
||||
cogl_program_link (class_priv->program);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *log_buf = cogl_shader_get_info_log (class_priv->shader);
|
||||
|
||||
g_warning (G_STRLOC ": Unable to compile the GLSL shader: %s", log_buf);
|
||||
g_free (log_buf);
|
||||
}
|
||||
cogl_program_link (class_priv->program);
|
||||
}
|
||||
|
||||
priv->shader = cogl_object_ref (class_priv->shader);
|
||||
@ -902,23 +890,11 @@ clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
|
||||
|
||||
CLUTTER_NOTE (SHADER, "Compiling shader effect");
|
||||
|
||||
cogl_shader_compile (priv->shader);
|
||||
priv->program = cogl_create_program ();
|
||||
|
||||
if (cogl_shader_is_compiled (priv->shader))
|
||||
{
|
||||
priv->program = cogl_create_program ();
|
||||
cogl_program_attach_shader (priv->program, priv->shader);
|
||||
|
||||
cogl_program_attach_shader (priv->program, priv->shader);
|
||||
|
||||
cogl_program_link (priv->program);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *log_buf = cogl_shader_get_info_log (priv->shader);
|
||||
|
||||
g_warning (G_STRLOC ": Unable to compile the GLSL shader: %s", log_buf);
|
||||
g_free (log_buf);
|
||||
}
|
||||
cogl_program_link (priv->program);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -418,7 +418,6 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline);
|
||||
* "!!ARBfp1.0\n"
|
||||
* "MOV result.color,fragment.color;\n"
|
||||
* "END\n");
|
||||
* cogl_shader_compile (shader);
|
||||
*
|
||||
* program = cogl_create_program ();
|
||||
* cogl_program_attach_shader (program, shader);
|
||||
|
@ -404,7 +404,6 @@ cogl_material_set_point_size (CoglMaterial *material,
|
||||
* "!!ARBfp1.0\n"
|
||||
* "MOV result.color,fragment.color;\n"
|
||||
* "END\n");
|
||||
* cogl_shader_compile (shader);
|
||||
*
|
||||
* program = cogl_create_program ();
|
||||
* cogl_program_attach_shader (program, shader);
|
||||
|
@ -124,19 +124,6 @@ cogl_shader_source (CoglHandle handle,
|
||||
shader->source = g_strdup (source);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_shader_compile (CoglHandle handle)
|
||||
{
|
||||
/* XXX: For GLSL we don't actually compile anything until the shader
|
||||
* gets used so we have an opportunity to add some boilerplate to
|
||||
* the shader.
|
||||
*
|
||||
* At the end of the day this is obviously a badly designed API
|
||||
* given that we are having to lie to the user. It was a mistake to
|
||||
* so thinly wrap the OpenGL shader API and the current plan is to
|
||||
* replace it with a pipeline snippets API. */
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_shader_compile_real (CoglHandle handle,
|
||||
CoglPipeline *pipeline)
|
||||
@ -208,33 +195,6 @@ _cogl_shader_compile_real (CoglHandle handle,
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
cogl_shader_get_info_log (CoglHandle handle)
|
||||
{
|
||||
if (!cogl_is_shader (handle))
|
||||
return NULL;
|
||||
|
||||
/* XXX: This API doesn't really do anything!
|
||||
*
|
||||
* This API is purely for compatibility
|
||||
*
|
||||
* The reason we don't do anything is because a shader needs to
|
||||
* be associated with a CoglPipeline for Cogl to be able to
|
||||
* compile and link anything.
|
||||
*
|
||||
* The way this API was originally designed as a very thin wrapper
|
||||
* over the GL api was a mistake and it's now very difficult to
|
||||
* make the API work in a meaningful way given how the rest of Cogl
|
||||
* has evolved.
|
||||
*
|
||||
* The CoglShader API is mostly deprecated by CoglSnippets and so
|
||||
* these days we do the bare minimum to support the existing users
|
||||
* of it until they are able to migrate to the snippets api.
|
||||
*/
|
||||
|
||||
return g_strdup ("");
|
||||
}
|
||||
|
||||
CoglShaderType
|
||||
cogl_shader_get_type (CoglHandle handle)
|
||||
{
|
||||
@ -251,35 +211,3 @@ cogl_shader_get_type (CoglHandle handle)
|
||||
shader = handle;
|
||||
return shader->type;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cogl_shader_is_compiled (CoglHandle handle)
|
||||
{
|
||||
#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2)
|
||||
if (!cogl_is_shader (handle))
|
||||
return FALSE;
|
||||
|
||||
/* XXX: This API doesn't really do anything!
|
||||
*
|
||||
* This API is purely for compatibility and blatantly lies to the
|
||||
* user about whether their shader has been compiled.
|
||||
*
|
||||
* I suppose we could say we're stretching the definition of
|
||||
* "compile" and are deferring any related errors to be "linker"
|
||||
* errors.
|
||||
*
|
||||
* The reason we don't do anything is because a shader needs to
|
||||
* be associated with a CoglPipeline for Cogl to be able to
|
||||
* compile and link anything.
|
||||
*
|
||||
* The CoglShader API is mostly deprecated by CoglSnippets and so
|
||||
* these days we do the bare minimum to support the existing users
|
||||
* of it until they are able to migrate to the snippets api.
|
||||
*/
|
||||
|
||||
return TRUE;
|
||||
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
@ -281,37 +281,6 @@ void
|
||||
cogl_shader_source (CoglHandle shader,
|
||||
const char *source);
|
||||
|
||||
/**
|
||||
* cogl_shader_compile:
|
||||
* @handle: #CoglHandle for a shader.
|
||||
*
|
||||
* Compiles the shader, no return value, but the shader is now ready
|
||||
* for linking into a program. Note that calling this function is
|
||||
* optional. If it is not called then the shader will be automatically
|
||||
* compiled when it is linked.
|
||||
* Deprecated: 1.16: Use #CoglSnippet api
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_snippet_)
|
||||
void
|
||||
cogl_shader_compile (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_shader_get_info_log:
|
||||
* @handle: #CoglHandle for a shader.
|
||||
*
|
||||
* Retrieves the information log for a coglobject, can be used in conjunction
|
||||
* with cogl_shader_get_parameteriv() to retrieve the compiler warnings/error
|
||||
* messages that caused a shader to not compile correctly, mainly useful for
|
||||
* debugging purposes.
|
||||
*
|
||||
* Return value: a newly allocated string containing the info log. Use
|
||||
* g_free() to free it
|
||||
* Deprecated: 1.16: Use #CoglSnippet api
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_snippet_)
|
||||
char *
|
||||
cogl_shader_get_info_log (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_shader_get_type:
|
||||
* @handle: #CoglHandle for a shader.
|
||||
@ -326,19 +295,6 @@ COGL_DEPRECATED_FOR (cogl_snippet_)
|
||||
CoglShaderType
|
||||
cogl_shader_get_type (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_shader_is_compiled:
|
||||
* @handle: #CoglHandle for a shader.
|
||||
*
|
||||
* Retrieves whether a shader #CoglHandle has been compiled
|
||||
*
|
||||
* Return value: %TRUE if the shader object has sucessfully be compiled
|
||||
* Deprecated: 1.16: Use #CoglSnippet api
|
||||
*/
|
||||
COGL_DEPRECATED_FOR (cogl_snippet_)
|
||||
gboolean
|
||||
cogl_shader_is_compiled (CoglHandle handle);
|
||||
|
||||
/**
|
||||
* cogl_create_program:
|
||||
*
|
||||
|
@ -69,14 +69,6 @@ paint (TestState *state)
|
||||
" cogl_color_out = cogl_color_in;\n"
|
||||
" cogl_tex_coord_out[0] = cogl_tex_coord_in;\n"
|
||||
"}\n");
|
||||
cogl_shader_compile (shader);
|
||||
if (!cogl_shader_is_compiled (shader))
|
||||
{
|
||||
char *log = cogl_shader_get_info_log (shader);
|
||||
g_warning ("Shader compilation failed:\n%s", log);
|
||||
g_free (log);
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
program = cogl_create_program ();
|
||||
cogl_program_attach_shader (program, shader);
|
||||
|
@ -196,7 +196,6 @@ set_shader_num (int new_no)
|
||||
|
||||
shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
|
||||
cogl_shader_source (shader, shaders[new_no].source);
|
||||
cogl_shader_compile (shader);
|
||||
|
||||
program = cogl_create_program ();
|
||||
cogl_program_attach_shader (program, shader);
|
||||
|
Loading…
Reference in New Issue
Block a user