diff --git a/filament/src/details/Material.cpp b/filament/src/details/Material.cpp index 69c1e529ff2..17e5d463346 100644 --- a/filament/src/details/Material.cpp +++ b/filament/src/details/Material.cpp @@ -192,19 +192,27 @@ Material* Material::Builder::build(Engine& engine) { return nullptr; } + // Print a warning if the material's stereo type doesn't align with the engine's setting. MaterialDomain materialDomain; + UserVariantFilterMask variantFilterMask; materialParser->getMaterialDomain(&materialDomain); - if (materialDomain == MaterialDomain::SURFACE) { + materialParser->getMaterialVariantFilterMask(&variantFilterMask); + bool const hasStereoVariants = !(variantFilterMask & UserVariantFilterMask(UserVariantFilterBit::STE)); + if (materialDomain == MaterialDomain::SURFACE && hasStereoVariants) { StereoscopicType const engineStereoscopicType = engine.getConfig().stereoscopicType; - StereoscopicType materialStereoscopicType = StereoscopicType::NONE; - materialParser->getStereoscopicType(&materialStereoscopicType); - if (materialStereoscopicType != engineStereoscopicType) { - CString name; - materialParser->getName(&name); - slog.w << "The stereoscopic type in the compiled material '" << name.c_str_safe() - << "' is " << (int)materialStereoscopicType - << ", which is not compatiable with the engine's setting " - << (int)engineStereoscopicType << "." << io::endl; + // Default materials are always compiled with either 'instanced' or 'multiview'. + // So, we only verify compatibility if the engine is set up for stereo. + if (engineStereoscopicType != StereoscopicType::NONE) { + StereoscopicType materialStereoscopicType = StereoscopicType::NONE; + materialParser->getStereoscopicType(&materialStereoscopicType); + if (materialStereoscopicType != engineStereoscopicType) { + CString name; + materialParser->getName(&name); + slog.w << "The stereoscopic type in the compiled material '" << name.c_str_safe() + << "' is " << (int)materialStereoscopicType + << ", which is not compatiable with the engine's setting " + << (int)engineStereoscopicType << "." << io::endl; + } } }