From b97031306d630bfe6dad9608f925a2538b5aa8f9 Mon Sep 17 00:00:00 2001 From: Stuart Hayhurst Date: Thu, 4 Jul 2024 20:57:08 +0100 Subject: [PATCH] Order shaders before caching to avoid re-caching due to order changes --- src/ammonite/graphics/shaders.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ammonite/graphics/shaders.cpp b/src/ammonite/graphics/shaders.cpp index de45255..a777e58 100644 --- a/src/ammonite/graphics/shaders.cpp +++ b/src/ammonite/graphics/shaders.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -359,6 +360,7 @@ namespace ammonite { /* - Take an array of shader paths, create a program and return the ID - Shaders with unidentifiable types will be ignored + - The order of shaders may be changed without re-caching - If possible, load and store a cache - Writes 'false' to externalSuccess on failure and returns -1 */ @@ -421,6 +423,9 @@ namespace ammonite { } } + //Ensure shaders don't get rebuilt due to a file order change + std::sort(shaderPaths.begin(), shaderPaths.end()); + //Create the program and return the ID return createProgramCached(&shaderPaths[0], &shaderTypes[0], shaderPaths.size(), externalSuccess);