[mutter] cogl/pipeline/glsl: Distinguish between pipeline state types
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl/pipeline/glsl: Distinguish between pipeline state types
- Date: Mon, 8 Aug 2022 22:13:13 +0000 (UTC)
commit 04bbe31287d0d50e12820a54cfeb27d8a3135fb6
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Aug 5 11:46:31 2022 +0200
cogl/pipeline/glsl: Distinguish between pipeline state types
Both the fragend and vertend shader state was called
"CoglPipelineShaderState", which was rather annoying, especially when
the type needs to be exposed outside of the .c file as part of moving
out unit tests. Make the types unique. This also avoids confusing what
type one is looking at.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2555>
cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c | 42 ++++++++++++------------
cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c | 32 +++++++++---------
2 files changed, 37 insertions(+), 37 deletions(-)
---
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
b/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
index d25419b9b5..c386c43b2d 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
@@ -99,7 +99,7 @@ typedef struct
CoglList layers;
CoglPipelineCacheEntry *cache_entry;
-} CoglPipelineShaderState;
+} CoglPipelineFragendShaderState;
static CoglUserDataKey shader_state_key;
@@ -107,13 +107,13 @@ static void
ensure_layer_generated (CoglPipeline *pipeline,
int layer_num);
-static CoglPipelineShaderState *
+static CoglPipelineFragendShaderState *
shader_state_new (int n_layers,
CoglPipelineCacheEntry *cache_entry)
{
- CoglPipelineShaderState *shader_state;
+ CoglPipelineFragendShaderState *shader_state;
- shader_state = g_new0 (CoglPipelineShaderState, 1);
+ shader_state = g_new0 (CoglPipelineFragendShaderState, 1);
shader_state->ref_count = 1;
shader_state->unit_state = g_new0 (UnitState, n_layers);
shader_state->cache_entry = cache_entry;
@@ -121,7 +121,7 @@ shader_state_new (int n_layers,
return shader_state;
}
-static CoglPipelineShaderState *
+static CoglPipelineFragendShaderState *
get_shader_state (CoglPipeline *pipeline)
{
return cogl_object_get_user_data (COGL_OBJECT (pipeline), &shader_state_key);
@@ -131,7 +131,7 @@ static void
destroy_shader_state (void *user_data,
void *instance)
{
- CoglPipelineShaderState *shader_state = user_data;
+ CoglPipelineFragendShaderState *shader_state = user_data;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
@@ -151,7 +151,7 @@ destroy_shader_state (void *user_data,
}
static void
-set_shader_state (CoglPipeline *pipeline, CoglPipelineShaderState *shader_state)
+set_shader_state (CoglPipeline *pipeline, CoglPipelineFragendShaderState *shader_state)
{
if (shader_state)
{
@@ -182,7 +182,7 @@ dirty_shader_state (CoglPipeline *pipeline)
GLuint
_cogl_pipeline_fragend_glsl_get_shader (CoglPipeline *pipeline)
{
- CoglPipelineShaderState *shader_state = get_shader_state (pipeline);
+ CoglPipelineFragendShaderState *shader_state = get_shader_state (pipeline);
if (shader_state)
return shader_state->gl_shader;
@@ -230,7 +230,7 @@ static gboolean
add_layer_declaration_cb (CoglPipelineLayer *layer,
void *user_data)
{
- CoglPipelineShaderState *shader_state = user_data;
+ CoglPipelineFragendShaderState *shader_state = user_data;
g_string_append_printf (shader_state->header,
"uniform sampler2D cogl_sampler%i;\n",
@@ -241,7 +241,7 @@ add_layer_declaration_cb (CoglPipelineLayer *layer,
static void
add_layer_declarations (CoglPipeline *pipeline,
- CoglPipelineShaderState *shader_state)
+ CoglPipelineFragendShaderState *shader_state)
{
/* We always emit sampler uniforms in case there will be custom
* layer snippets that want to sample arbitrary layers. */
@@ -253,7 +253,7 @@ add_layer_declarations (CoglPipeline *pipeline,
static void
add_global_declarations (CoglPipeline *pipeline,
- CoglPipelineShaderState *shader_state)
+ CoglPipelineFragendShaderState *shader_state)
{
CoglSnippetHook hook = COGL_SNIPPET_HOOK_FRAGMENT_GLOBALS;
CoglPipelineSnippetList *snippets = get_fragment_snippets (pipeline);
@@ -271,7 +271,7 @@ _cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
int n_layers,
unsigned long pipelines_difference)
{
- CoglPipelineShaderState *shader_state;
+ CoglPipelineFragendShaderState *shader_state;
CoglPipeline *authority;
CoglPipelineCacheEntry *cache_entry = NULL;
CoglProgram *user_program = cogl_pipeline_get_user_program (pipeline);
@@ -386,7 +386,7 @@ _cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
}
static void
-add_constant_lookup (CoglPipelineShaderState *shader_state,
+add_constant_lookup (CoglPipelineFragendShaderState *shader_state,
CoglPipeline *pipeline,
CoglPipelineLayer *layer,
const char *swizzle)
@@ -397,7 +397,7 @@ add_constant_lookup (CoglPipelineShaderState *shader_state,
}
static void
-ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
+ensure_texture_lookup_generated (CoglPipelineFragendShaderState *shader_state,
CoglPipeline *pipeline,
CoglPipelineLayer *layer)
{
@@ -481,7 +481,7 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
}
static void
-add_arg (CoglPipelineShaderState *shader_state,
+add_arg (CoglPipelineFragendShaderState *shader_state,
CoglPipeline *pipeline,
CoglPipelineLayer *layer,
int previous_layer_index,
@@ -577,7 +577,7 @@ ensure_arg_generated (CoglPipeline *pipeline,
int previous_layer_index,
CoglPipelineCombineSource src)
{
- CoglPipelineShaderState *shader_state = get_shader_state (pipeline);
+ CoglPipelineFragendShaderState *shader_state = get_shader_state (pipeline);
switch (src)
{
@@ -650,7 +650,7 @@ append_masked_combine (CoglPipeline *pipeline,
CoglPipelineCombineSource *src,
CoglPipelineCombineOp *op)
{
- CoglPipelineShaderState *shader_state = get_shader_state (pipeline);
+ CoglPipelineFragendShaderState *shader_state = get_shader_state (pipeline);
GString *shader_source = shader_state->header;
g_string_append_printf (shader_state->header,
@@ -747,7 +747,7 @@ static void
ensure_layer_generated (CoglPipeline *pipeline,
int layer_index)
{
- CoglPipelineShaderState *shader_state = get_shader_state (pipeline);
+ CoglPipelineFragendShaderState *shader_state = get_shader_state (pipeline);
CoglPipelineLayer *combine_authority;
CoglPipelineLayerBigState *big_state;
CoglPipelineLayer *layer;
@@ -877,7 +877,7 @@ _cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline,
CoglPipelineLayer *layer,
unsigned long layers_difference)
{
- CoglPipelineShaderState *shader_state = get_shader_state (pipeline);
+ CoglPipelineFragendShaderState *shader_state = get_shader_state (pipeline);
LayerData *layer_data;
if (!shader_state->source)
@@ -910,7 +910,7 @@ _cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline,
static void
add_alpha_test_snippet (CoglPipeline *pipeline,
- CoglPipelineShaderState *shader_state)
+ CoglPipelineFragendShaderState *shader_state)
{
CoglPipelineAlphaFunc alpha_func;
@@ -974,7 +974,7 @@ static gboolean
_cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
unsigned long pipelines_difference)
{
- CoglPipelineShaderState *shader_state = get_shader_state (pipeline);
+ CoglPipelineFragendShaderState *shader_state = get_shader_state (pipeline);
_COGL_GET_CONTEXT (ctx, FALSE);
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
b/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
index 28b5d5d76d..efc3dfaeac 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
@@ -59,23 +59,23 @@ typedef struct
GString *header, *source;
CoglPipelineCacheEntry *cache_entry;
-} CoglPipelineShaderState;
+} CoglPipelineVertendShaderState;
static CoglUserDataKey shader_state_key;
-static CoglPipelineShaderState *
+static CoglPipelineVertendShaderState *
shader_state_new (CoglPipelineCacheEntry *cache_entry)
{
- CoglPipelineShaderState *shader_state;
+ CoglPipelineVertendShaderState *shader_state;
- shader_state = g_new0 (CoglPipelineShaderState, 1);
+ shader_state = g_new0 (CoglPipelineVertendShaderState, 1);
shader_state->ref_count = 1;
shader_state->cache_entry = cache_entry;
return shader_state;
}
-static CoglPipelineShaderState *
+static CoglPipelineVertendShaderState *
get_shader_state (CoglPipeline *pipeline)
{
return cogl_object_get_user_data (COGL_OBJECT (pipeline), &shader_state_key);
@@ -85,7 +85,7 @@ static void
destroy_shader_state (void *user_data,
void *instance)
{
- CoglPipelineShaderState *shader_state = user_data;
+ CoglPipelineVertendShaderState *shader_state = user_data;
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
@@ -104,7 +104,7 @@ destroy_shader_state (void *user_data,
static void
set_shader_state (CoglPipeline *pipeline,
- CoglPipelineShaderState *shader_state)
+ CoglPipelineVertendShaderState *shader_state)
{
if (shader_state)
{
@@ -279,7 +279,7 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx,
GLuint
_cogl_pipeline_vertend_glsl_get_shader (CoglPipeline *pipeline)
{
- CoglPipelineShaderState *shader_state = get_shader_state (pipeline);
+ CoglPipelineVertendShaderState *shader_state = get_shader_state (pipeline);
if (shader_state)
return shader_state->gl_shader;
@@ -310,7 +310,7 @@ static gboolean
add_layer_declaration_cb (CoglPipelineLayer *layer,
void *user_data)
{
- CoglPipelineShaderState *shader_state = user_data;
+ CoglPipelineVertendShaderState *shader_state = user_data;
g_string_append_printf (shader_state->header,
"uniform sampler2D cogl_sampler%i;\n",
@@ -321,7 +321,7 @@ add_layer_declaration_cb (CoglPipelineLayer *layer,
static void
add_layer_declarations (CoglPipeline *pipeline,
- CoglPipelineShaderState *shader_state)
+ CoglPipelineVertendShaderState *shader_state)
{
/* We always emit sampler uniforms in case there will be custom
* layer snippets that want to sample arbitrary layers. */
@@ -333,7 +333,7 @@ add_layer_declarations (CoglPipeline *pipeline,
static void
add_global_declarations (CoglPipeline *pipeline,
- CoglPipelineShaderState *shader_state)
+ CoglPipelineVertendShaderState *shader_state)
{
CoglSnippetHook hook = COGL_SNIPPET_HOOK_VERTEX_GLOBALS;
CoglPipelineSnippetList *snippets = get_vertex_snippets (pipeline);
@@ -351,7 +351,7 @@ _cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline,
int n_layers,
unsigned long pipelines_difference)
{
- CoglPipelineShaderState *shader_state;
+ CoglPipelineVertendShaderState *shader_state;
CoglPipelineCacheEntry *cache_entry = NULL;
CoglProgram *user_program = cogl_pipeline_get_user_program (pipeline);
@@ -473,7 +473,7 @@ _cogl_pipeline_vertend_glsl_add_layer (CoglPipeline *pipeline,
unsigned long layers_difference,
CoglFramebuffer *framebuffer)
{
- CoglPipelineShaderState *shader_state;
+ CoglPipelineVertendShaderState *shader_state;
CoglPipelineSnippetData snippet_data;
int layer_index = layer->index;
@@ -544,7 +544,7 @@ static gboolean
_cogl_pipeline_vertend_glsl_end (CoglPipeline *pipeline,
unsigned long pipelines_difference)
{
- CoglPipelineShaderState *shader_state;
+ CoglPipelineVertendShaderState *shader_state;
_COGL_GET_CONTEXT (ctx, FALSE);
@@ -712,7 +712,7 @@ _cogl_pipeline_vertend_glsl_layer_pre_change_notify (
CoglPipelineLayer *layer,
CoglPipelineLayerState change)
{
- CoglPipelineShaderState *shader_state;
+ CoglPipelineVertendShaderState *shader_state;
shader_state = get_shader_state (owner);
if (!shader_state)
@@ -743,7 +743,7 @@ UNIT_TEST (check_point_size_shader,
0 /* no failure cases */)
{
CoglPipeline *pipelines[4];
- CoglPipelineShaderState *shader_states[G_N_ELEMENTS (pipelines)];
+ CoglPipelineVertendShaderState *shader_states[G_N_ELEMENTS (pipelines)];
int i;
/* Default pipeline with zero point size */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]