From 13d25a5cfc75bda27a0da2ff5aeebe7e559e573b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Thu, 14 Aug 2025 20:42:54 +0200 Subject: [PATCH] GPU: Shader: Fix parser not being consistent Using `std::sort` does not garantee the initial order is kept for items with the same ranking value. Using `std::stable_sort` fixes the issue. --- source/blender/gpu/glsl_preprocess/shader_parser.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/gpu/glsl_preprocess/shader_parser.hh b/source/blender/gpu/glsl_preprocess/shader_parser.hh index a2fc4796af3..aa2dd07d940 100644 --- a/source/blender/gpu/glsl_preprocess/shader_parser.hh +++ b/source/blender/gpu/glsl_preprocess/shader_parser.hh @@ -997,7 +997,7 @@ struct Parser { } /* Order mutations so that they can be applied in one pass. */ - std::sort(mutations_.begin(), mutations_.end()); + std::stable_sort(mutations_.begin(), mutations_.end()); int64_t offset = 0; for (const Mutation &mut : mutations_) {