From 8519f39bf5abd65df3a5c5f77c45ad2457be62a1 Mon Sep 17 00:00:00 2001 From: robtfm <50659922+robtfm@users.noreply.github.com> Date: Wed, 24 Jun 2026 18:26:34 +0100 Subject: [PATCH] Emit override-redirected functions in deterministic order `Redirector::into_module` drove emission order by iterating a `HashMap`, so a module that uses a function override composed to byte-different output each run, defeating caches keyed on the generated source. Use an `IndexMap` for stable, deterministic source-arena order. --- src/redirect.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/redirect.rs b/src/redirect.rs index ec487f8..07c9461 100644 --- a/src/redirect.rs +++ b/src/redirect.rs @@ -1,5 +1,6 @@ -use std::collections::{HashMap, HashSet}; +use std::collections::HashSet; +use indexmap::IndexMap; use naga::{Block, Expression, Function, Handle, Module, Statement}; use thiserror::Error; @@ -183,8 +184,9 @@ impl Redirector { } pub fn into_module(self) -> Result { - // reorder functions so that dependents come first - let mut requirements: HashMap<_, _> = self + // reorder functions so that dependents come first. IndexMap (not HashMap) + // so the emission order is deterministic across runs. + let mut requirements: IndexMap<_, _> = self .module .functions .iter()