cogl: Rename Shader/Program constructors
Otherwise they end up as global functions instead of constructors of their corresponding types. Helps with better docs Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
This commit is contained in:
parent
716f23c7c1
commit
b07c772fc8
@ -24,9 +24,9 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterShaderEffect:
|
* ClutterShaderEffect:
|
||||||
*
|
*
|
||||||
* Base class for shader effects
|
* Base class for shader effects
|
||||||
*
|
*
|
||||||
* #ClutterShaderEffect is a class that implements all the plumbing for
|
* #ClutterShaderEffect is a class that implements all the plumbing for
|
||||||
* creating [class@Effect]s using GLSL shaders.
|
* creating [class@Effect]s using GLSL shaders.
|
||||||
*
|
*
|
||||||
@ -305,11 +305,11 @@ clutter_shader_effect_create_shader (ClutterShaderEffect *self)
|
|||||||
switch (priv->shader_type)
|
switch (priv->shader_type)
|
||||||
{
|
{
|
||||||
case CLUTTER_FRAGMENT_SHADER:
|
case CLUTTER_FRAGMENT_SHADER:
|
||||||
return cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
|
return cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_VERTEX_SHADER:
|
case CLUTTER_VERTEX_SHADER:
|
||||||
return cogl_create_shader (COGL_SHADER_TYPE_VERTEX);
|
return cogl_shader_new (COGL_SHADER_TYPE_VERTEX);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -349,7 +349,7 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
|
|||||||
|
|
||||||
CLUTTER_NOTE (SHADER, "Compiling shader effect");
|
CLUTTER_NOTE (SHADER, "Compiling shader effect");
|
||||||
|
|
||||||
class_priv->program = cogl_create_program ();
|
class_priv->program = cogl_program_new ();
|
||||||
|
|
||||||
cogl_program_attach_shader (class_priv->program,
|
cogl_program_attach_shader (class_priv->program,
|
||||||
class_priv->shader);
|
class_priv->shader);
|
||||||
@ -873,7 +873,7 @@ clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
|
|||||||
|
|
||||||
CLUTTER_NOTE (SHADER, "Compiling shader effect");
|
CLUTTER_NOTE (SHADER, "Compiling shader effect");
|
||||||
|
|
||||||
priv->program = cogl_create_program ();
|
priv->program = cogl_program_new ();
|
||||||
|
|
||||||
cogl_program_attach_shader (priv->program, priv->shader);
|
cogl_program_attach_shader (priv->program, priv->shader);
|
||||||
|
|
||||||
|
@ -166,13 +166,13 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline);
|
|||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* This is the list of source-names usable as blend factors:
|
* This is the list of source-names usable as blend factors:
|
||||||
*
|
*
|
||||||
* - `SRC_COLOR`: The color of the incoming fragment
|
* - `SRC_COLOR`: The color of the incoming fragment
|
||||||
* - `DST_COLOR`: The color of the framebuffer
|
* - `DST_COLOR`: The color of the framebuffer
|
||||||
* - `CONSTANT`: The constant set via cogl_pipeline_set_blend_constant()
|
* - `CONSTANT`: The constant set via cogl_pipeline_set_blend_constant()
|
||||||
*
|
*
|
||||||
* These can also be used as factors:
|
* These can also be used as factors:
|
||||||
*
|
*
|
||||||
* - `0`: (0, 0, 0, 0)
|
* - `0`: (0, 0, 0, 0)
|
||||||
* - `1`: (1, 1, 1, 1)
|
* - `1`: (1, 1, 1, 1)
|
||||||
* - `SRC_ALPHA_SATURATE_FACTOR`: (f,f,f,1) where `f = MIN(SRC_COLOR[A],1-DST_COLOR[A])`
|
* - `SRC_ALPHA_SATURATE_FACTOR`: (f,f,f,1) where `f = MIN(SRC_COLOR[A],1-DST_COLOR[A])`
|
||||||
@ -319,13 +319,13 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline);
|
|||||||
* CoglProgram *program;
|
* CoglProgram *program;
|
||||||
* CoglPipeline *pipeline;
|
* CoglPipeline *pipeline;
|
||||||
*
|
*
|
||||||
* shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
|
* shader = cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT);
|
||||||
* cogl_shader_source (shader,
|
* cogl_shader_source (shader,
|
||||||
* "!!ARBfp1.0\n"
|
* "!!ARBfp1.0\n"
|
||||||
* "MOV result.color,fragment.color;\n"
|
* "MOV result.color,fragment.color;\n"
|
||||||
* "END\n");
|
* "END\n");
|
||||||
*
|
*
|
||||||
* program = cogl_create_program ();
|
* program = cogl_program_new ();
|
||||||
* cogl_program_attach_shader (program, shader);
|
* cogl_program_attach_shader (program, shader);
|
||||||
* cogl_program_link (program);
|
* cogl_program_link (program);
|
||||||
*
|
*
|
||||||
|
@ -86,7 +86,7 @@ cogl_program_class_init (CoglProgramClass *class)
|
|||||||
it. */
|
it. */
|
||||||
|
|
||||||
CoglProgram*
|
CoglProgram*
|
||||||
cogl_create_program (void)
|
cogl_program_new (void)
|
||||||
{
|
{
|
||||||
CoglProgram *program;
|
CoglProgram *program;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ cogl_shader_class_init (CoglShaderClass *class)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoglShader*
|
CoglShader*
|
||||||
cogl_create_shader (CoglShaderType type)
|
cogl_shader_new (CoglShaderType type)
|
||||||
{
|
{
|
||||||
CoglShader *shader;
|
CoglShader *shader;
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ cogl_create_shader (CoglShaderType type)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_warning ("Unexpected shader type (0x%08lX) given to "
|
g_warning ("Unexpected shader type (0x%08lX) given to "
|
||||||
"cogl_create_shader", (unsigned long) type);
|
"cogl_shader_new", (unsigned long) type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ typedef enum
|
|||||||
} CoglShaderType;
|
} CoglShaderType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_create_shader:
|
* cogl_shader_new:
|
||||||
* @shader_type: COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT.
|
* @shader_type: COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT.
|
||||||
*
|
*
|
||||||
* Create a new shader handle, use cogl_shader_source() to set the
|
* Create a new shader handle, use cogl_shader_source() to set the
|
||||||
@ -156,7 +156,7 @@ typedef enum
|
|||||||
*/
|
*/
|
||||||
COGL_DEPRECATED_FOR (cogl_snippet_)
|
COGL_DEPRECATED_FOR (cogl_snippet_)
|
||||||
COGL_EXPORT CoglShader*
|
COGL_EXPORT CoglShader*
|
||||||
cogl_create_shader (CoglShaderType shader_type);
|
cogl_shader_new (CoglShaderType shader_type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_shader_source:
|
* cogl_shader_source:
|
||||||
@ -165,7 +165,7 @@ cogl_create_shader (CoglShaderType shader_type);
|
|||||||
*
|
*
|
||||||
* Replaces the current source associated with a shader with a new
|
* Replaces the current source associated with a shader with a new
|
||||||
* one.
|
* one.
|
||||||
*
|
*
|
||||||
* Deprecated: 1.16: Use #CoglSnippet api
|
* Deprecated: 1.16: Use #CoglSnippet api
|
||||||
*/
|
*/
|
||||||
COGL_DEPRECATED_FOR (cogl_snippet_)
|
COGL_DEPRECATED_FOR (cogl_snippet_)
|
||||||
@ -188,7 +188,7 @@ COGL_EXPORT CoglShaderType
|
|||||||
cogl_shader_get_shader_type (CoglShader *self);
|
cogl_shader_get_shader_type (CoglShader *self);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_create_program:
|
* cogl_program_new:
|
||||||
*
|
*
|
||||||
* Create a new cogl program object that can be used to replace parts of the GL
|
* Create a new cogl program object that can be used to replace parts of the GL
|
||||||
* rendering pipeline with custom code.
|
* rendering pipeline with custom code.
|
||||||
@ -198,7 +198,7 @@ cogl_shader_get_shader_type (CoglShader *self);
|
|||||||
*/
|
*/
|
||||||
COGL_DEPRECATED_FOR (cogl_snippet_)
|
COGL_DEPRECATED_FOR (cogl_snippet_)
|
||||||
COGL_EXPORT CoglProgram*
|
COGL_EXPORT CoglProgram*
|
||||||
cogl_create_program (void);
|
cogl_program_new (void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_program_attach_shader:
|
* cogl_program_attach_shader:
|
||||||
|
@ -204,10 +204,10 @@ set_shader_num (int new_no)
|
|||||||
|
|
||||||
shader_pipeline = cogl_pipeline_new (ctx);
|
shader_pipeline = cogl_pipeline_new (ctx);
|
||||||
|
|
||||||
shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
|
shader = cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT);
|
||||||
cogl_shader_source (shader, shaders[new_no].source);
|
cogl_shader_source (shader, shaders[new_no].source);
|
||||||
|
|
||||||
program = cogl_create_program ();
|
program = cogl_program_new ();
|
||||||
cogl_program_attach_shader (program, shader);
|
cogl_program_attach_shader (program, shader);
|
||||||
g_object_unref (shader);
|
g_object_unref (shader);
|
||||||
cogl_program_link (program);
|
cogl_program_link (program);
|
||||||
@ -358,4 +358,3 @@ test_cogl_shader_glsl_main (int argc, char *argv[])
|
|||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ paint (TestState *state)
|
|||||||
|
|
||||||
/* Set up a dummy vertex shader that does nothing but the usual
|
/* Set up a dummy vertex shader that does nothing but the usual
|
||||||
fixed function transform */
|
fixed function transform */
|
||||||
shader = cogl_create_shader (COGL_SHADER_TYPE_VERTEX);
|
shader = cogl_shader_new (COGL_SHADER_TYPE_VERTEX);
|
||||||
cogl_shader_source (shader,
|
cogl_shader_source (shader,
|
||||||
"void\n"
|
"void\n"
|
||||||
"main ()\n"
|
"main ()\n"
|
||||||
@ -70,7 +70,7 @@ paint (TestState *state)
|
|||||||
" cogl_tex_coord_out[0] = cogl_tex_coord_in;\n"
|
" cogl_tex_coord_out[0] = cogl_tex_coord_in;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
program = cogl_create_program ();
|
program = cogl_program_new ();
|
||||||
cogl_program_attach_shader (program, shader);
|
cogl_program_attach_shader (program, shader);
|
||||||
cogl_program_link (program);
|
cogl_program_link (program);
|
||||||
|
|
||||||
|
@ -94,10 +94,10 @@ create_pipeline_for_shader (TestState *state, const char *shader_source)
|
|||||||
|
|
||||||
pipeline = cogl_pipeline_new (test_ctx);
|
pipeline = cogl_pipeline_new (test_ctx);
|
||||||
|
|
||||||
shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
|
shader = cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT);
|
||||||
cogl_shader_source (shader, shader_source);
|
cogl_shader_source (shader, shader_source);
|
||||||
|
|
||||||
program = cogl_create_program ();
|
program = cogl_program_new ();
|
||||||
cogl_program_attach_shader (program, shader);
|
cogl_program_attach_shader (program, shader);
|
||||||
|
|
||||||
cogl_pipeline_set_user_program (pipeline, program);
|
cogl_pipeline_set_user_program (pipeline, program);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user