diff --git a/filament/backend/src/opengl/ShaderCompilerService.cpp b/filament/backend/src/opengl/ShaderCompilerService.cpp index 6bcb782138..55c931c056 100644 --- a/filament/backend/src/opengl/ShaderCompilerService.cpp +++ b/filament/backend/src/opengl/ShaderCompilerService.cpp @@ -1089,9 +1089,16 @@ UTILS_NOINLINE /* static */ std::string_view process_countBits(OpenGLContext& context) noexcept { using namespace std::literals; + // bitCount is available in GL 4.0 and GLES 3.1. if (context.isAtLeastGL<4, 0>() || context.isAtLeastGLES<3, 1>()) { return ""sv; } + + // GLES 2.0 does not support bitwise operations or unsigned integers. + if (context.isES2()) { + return ""sv; + } + return R"( // https://graphics.stanford.edu/%7Eseander/bithacks.html int bitCount(highp uint value) {