From c4778363968e51514863541a44d84ac40ccdada1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 12 Feb 2021 14:21:42 +0100 Subject: [PATCH] magnum-shaderconverter: use the less error-prone >= for flag checks. Otherwise if some feature flags are combinations, & alone won't fail if only a subset is set. --- src/Magnum/ShaderTools/shaderconverter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Magnum/ShaderTools/shaderconverter.cpp b/src/Magnum/ShaderTools/shaderconverter.cpp index 543c08925..8cb3fd41c 100644 --- a/src/Magnum/ShaderTools/shaderconverter.cpp +++ b/src/Magnum/ShaderTools/shaderconverter.cpp @@ -335,7 +335,7 @@ see documentation of a particular converter for more information.)") Containers::Array> linkInputs; if(i == 0) { if((args.isSet("preprocess-only") || args.arrayValueCount("define") || args.arrayValueCount("undefine"))) { - if(!(converter->features() & ShaderTools::ConverterFeature::Preprocess)) { + if(!(converter->features() >= ShaderTools::ConverterFeature::Preprocess)) { Error{} << "The -E / -D / -U options are set, but" << converterName << "doesn't support preprocessing"; return 10; } @@ -360,7 +360,7 @@ see documentation of a particular converter for more information.)") } if(!args.value("optimize").isEmpty()) { - if(!(converter->features() & ShaderTools::ConverterFeature::Optimize)) { + if(!(converter->features() >= ShaderTools::ConverterFeature::Optimize)) { Error{} << "The -O option is set, but" << converterName << "doesn't support optimization"; return 11; } @@ -369,7 +369,7 @@ see documentation of a particular converter for more information.)") } if(!args.value("debug-info").isEmpty()) { - if(!(converter->features() & ShaderTools::ConverterFeature::DebugInfo)) { + if(!(converter->features() >= ShaderTools::ConverterFeature::DebugInfo)) { Error{} << "The -g option is set, but" << converterName << "doesn't support debug info"; return 12; } @@ -394,7 +394,7 @@ see documentation of a particular converter for more information.)") re-entered again */ CORRADE_INTERNAL_ASSERT(i == 0); - if(!(converter->features() & ShaderTools::ConverterFeature::ValidateFile)) { + if(!(converter->features() >= ShaderTools::ConverterFeature::ValidateFile)) { Error{} << converterName << "doesn't support file validation"; return 13; } @@ -417,7 +417,7 @@ see documentation of a particular converter for more information.)") /* This is the first *and* last --converter, go from a file to a file */ if(i == 0 && converterCount <= 1) { - if(!(converter->features() & ShaderTools::ConverterFeature::ConvertFile)) { + if(!(converter->features() >= ShaderTools::ConverterFeature::ConvertFile)) { Error{} << converterName << "doesn't support file conversion"; return 15; } @@ -441,7 +441,7 @@ see documentation of a particular converter for more information.)") /* Otherwise we need to go through data */ } else { - if(!(converter->features() & ShaderTools::ConverterFeature::ConvertData)) { + if(!(converter->features() >= ShaderTools::ConverterFeature::ConvertData)) { Error{} << converterName << "doesn't support data conversion"; return 18; }