From ea696ae4b118f7e2c7deafbf1e0dbbe95ae02b50 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Tue, 30 Jul 2024 12:46:17 +0200 Subject: [PATCH] cogl: Repace codegen_boilerplate_buffer with a local variable Part-of: --- cogl/cogl/cogl-context-private.h | 1 - cogl/cogl/cogl-context.c | 1 - cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cogl/cogl/cogl-context-private.h b/cogl/cogl/cogl-context-private.h index 45b641782..3ad13ea8d 100644 --- a/cogl/cogl/cogl-context-private.h +++ b/cogl/cogl/cogl-context-private.h @@ -119,7 +119,6 @@ struct _CoglContext GString *codegen_header_buffer; GString *codegen_source_buffer; - GString *codegen_boilerplate_buffer; CoglPipelineCache *pipeline_cache; diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c index eb74b6d32..eb8683f0d 100644 --- a/cogl/cogl/cogl-context.c +++ b/cogl/cogl/cogl-context.c @@ -284,7 +284,6 @@ cogl_context_new (CoglDisplay *display, context->codegen_header_buffer = g_string_new (""); context->codegen_source_buffer = g_string_new (""); - context->codegen_boilerplate_buffer = g_string_new (""); context->default_gl_texture_2d_tex = NULL; diff --git a/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c b/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c index 1d23bbeb5..033dac123 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-vertend-glsl.c @@ -217,6 +217,7 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx, g_autofree char *version_string = NULL; int count = 0; int n_layers; + g_autoptr (GString) layer_declarations = NULL; vertex_boilerplate = _COGL_VERTEX_SHADER_BOILERPLATE; fragment_boilerplate = _COGL_FRAGMENT_SHADER_BOILERPLATE; @@ -249,8 +250,7 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx, n_layers = cogl_pipeline_get_n_layers (pipeline); if (n_layers) { - GString *layer_declarations = ctx->codegen_boilerplate_buffer; - g_string_set_size (layer_declarations, 0); + layer_declarations = g_string_new (""); g_string_append_printf (layer_declarations, "varying vec4 _cogl_tex_coord[%d];\n",