cogl/pipeline: Add API to name a pipeline
It uses static strings, and is meant to make it easier to match what pipeline source code one might be looking at when running with COGL_DEBUG=show-sources. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
This commit is contained in:
parent
0c653b4cf2
commit
6cd28a84ac
@ -368,6 +368,9 @@ struct _CoglPipeline
|
|||||||
* string with a pipeline which can be an aid when trying to trace
|
* string with a pipeline which can be an aid when trying to trace
|
||||||
* where the pipeline originates from */
|
* where the pipeline originates from */
|
||||||
const char *static_breadcrumb;
|
const char *static_breadcrumb;
|
||||||
|
|
||||||
|
/* Pointer to a static string with a descriptive name, or NULL. */
|
||||||
|
const char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _CoglPipelineClass
|
struct _CoglPipelineClass
|
||||||
|
@ -335,6 +335,8 @@ _cogl_pipeline_copy (CoglPipeline *src, gboolean is_weak)
|
|||||||
if (src->capabilities)
|
if (src->capabilities)
|
||||||
pipeline->capabilities = g_array_copy (src->capabilities);
|
pipeline->capabilities = g_array_copy (src->capabilities);
|
||||||
|
|
||||||
|
pipeline->name = src->name;
|
||||||
|
|
||||||
/* XXX:
|
/* XXX:
|
||||||
* consider generalizing the idea of "cached" properties. These
|
* consider generalizing the idea of "cached" properties. These
|
||||||
* would still have an authority like other sparse properties but
|
* would still have an authority like other sparse properties but
|
||||||
@ -2855,3 +2857,16 @@ cogl_pipeline_has_capability (CoglPipeline *pipeline,
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cogl_pipeline_set_static_name (CoglPipeline *pipeline,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
pipeline->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
cogl_pipeline_get_name (CoglPipeline *pipeline)
|
||||||
|
{
|
||||||
|
return pipeline->name;
|
||||||
|
}
|
||||||
|
@ -160,4 +160,25 @@ cogl_pipeline_has_capability (CoglPipeline *pipeline,
|
|||||||
GQuark domain,
|
GQuark domain,
|
||||||
unsigned int capability);
|
unsigned int capability);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_pipeline_set_static_name:
|
||||||
|
* @pipeline: A #CoglPipeline object
|
||||||
|
* @name: A descriptive name
|
||||||
|
*
|
||||||
|
* Set a pipeline name. It may be used for debugging or logging purposes. The
|
||||||
|
* string must be a static string, and string. It will not be copied.
|
||||||
|
*/
|
||||||
|
COGL_EXPORT void
|
||||||
|
cogl_pipeline_set_static_name (CoglPipeline *pipeline,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_pipeline_get_name:
|
||||||
|
* @pipeline: A #CoglPipeline object
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): The pipeline name, or %NULL
|
||||||
|
*/
|
||||||
|
COGL_EXPORT const char *
|
||||||
|
cogl_pipeline_get_name (CoglPipeline *pipeline);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user