mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
perf(compose): read PHOTOCRAFT_FX_NOCACHE once (#4423)
effect_maps looked the environment variable up (taking the process environment lock) for every effect-map lookup, i.e. per styled layer per render tile. It is read once, like PHOTOCRAFT_FX_TRACE in the GPU compositor. Claude-Session: https://claude.ai/code/session_01QUda3K786uop8kvEQoUjSf Co-authored-by: Claude <[email protected]>
This commit is contained in:
1 parent
3c469bfd05
commit
e683108613
1 file changed
+2
-1
@@ -1527,7 +1527,8 @@ fn effect_region(layer: &Layer, rect: Rect, cx: &Ctx) -> (Rect, bool) {
|
||||
fn effect_maps(layer: &Layer, rect: Rect, cx: &Ctx) -> std::sync::Arc<effects::FxMaps> {
|
||||
use std::hash::{Hash, Hasher};
|
||||
let (region, clipped) = effect_region(layer, rect, cx);
|
||||
if std::env::var_os("PHOTOCRAFT_FX_NOCACHE").is_some() {
|
||||
static NO_CACHE: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
||||
if *NO_CACHE.get_or_init(|| std::env::var_os("PHOTOCRAFT_FX_NOCACHE").is_some()) {
|
||||
let shape = if region.is_empty() { Vec::new() } else { effect_shape(layer, region, cx) };
|
||||
return std::sync::Arc::new(effects::build_maps_prepared(layer, shape, region, &cx.light, &texture_ctx(layer, region, cx), cx.patterns));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user