From b7e6f6d1444a1923356e845bccc3c909339ae6e5 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Sat, 22 Feb 2025 16:12:21 +0100 Subject: [PATCH] cogl: Get the authority for vertex/fragment_snippets_state_equal They expect the authority of the pipeline, which is not necessarily the pipeline we're operating on. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3924 Fixes: 5e98ee5dbe ("cogl: Add pipeline hooks to user program pipelines") Part-of: --- .../driver/gl/cogl-pipeline-progend-glsl.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c index 60596749d..8267b0dce 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c @@ -729,6 +729,7 @@ needs_recompile (CoglShader *shader, * are the pipeline layer-indices, texture-unit-indices and * snippets */ + CoglPipeline *authority, *authority_prev; if (pipeline == prev) return FALSE; @@ -739,11 +740,25 @@ needs_recompile (CoglShader *shader, switch (shader->type) { case COGL_SHADER_TYPE_VERTEX: - if (!_cogl_pipeline_vertex_snippets_state_equal (prev, pipeline)) + authority = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_VERTEX_SNIPPETS); + authority_prev = + _cogl_pipeline_get_authority (prev, + COGL_PIPELINE_STATE_VERTEX_SNIPPETS); + + if (!_cogl_pipeline_vertex_snippets_state_equal (authority_prev, authority)) return TRUE; break; case COGL_SHADER_TYPE_FRAGMENT: - if (!_cogl_pipeline_fragment_snippets_state_equal (prev, pipeline)) + authority = + _cogl_pipeline_get_authority (pipeline, + COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS); + authority_prev = + _cogl_pipeline_get_authority (prev, + COGL_PIPELINE_STATE_FRAGMENT_SNIPPETS); + + if (!_cogl_pipeline_fragment_snippets_state_equal (authority_prev, authority)) return TRUE; break; default: