From ea8f6a3c92ee807be7cd9a13d2c0c4c43024af2f Mon Sep 17 00:00:00 2001 From: Doris Wu Date: Fri, 23 Jan 2026 06:49:54 +0800 Subject: [PATCH] return empty string for es2 (#9623) --- filament/backend/src/opengl/ShaderCompilerService.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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) {