From 05cdeccc279045052a5e1d40bb2ec13cec4e2a0e Mon Sep 17 00:00:00 2001 From: Ben Doherty Date: Wed, 5 Feb 2025 11:05:03 -0800 Subject: [PATCH] Stop precaching stereo depth variants on non-supported platforms (#8413) --- filament/src/details/Material.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/filament/src/details/Material.cpp b/filament/src/details/Material.cpp index 4347e1aa28..d67fc11233 100644 --- a/filament/src/details/Material.cpp +++ b/filament/src/details/Material.cpp @@ -1103,8 +1103,13 @@ void FMaterial::precacheDepthVariants(FEngine const& engine) { // later, when/if needed by createAndCacheProgram(). Doing it now potentially uses more // memory and increases init time, but reduces hiccups during the first frame. if (UTILS_UNLIKELY(mIsDefaultMaterial)) { + const bool stereoSupported = mEngine.getDriverApi().isStereoSupported(); auto const allDepthVariants = VariantUtils::getDepthVariants(); for (auto const variant: allDepthVariants) { + // Don't precache any stereo variants if stereo is not supported. + if (!stereoSupported && Variant::isStereoVariant(variant)) { + continue; + } assert_invariant(Variant::isValidDepthVariant(variant)); if (hasVariant(variant)) { prepareProgram(variant);