---
CMakeLists.txt | 1 -
filament/backend/CMakeLists.txt | 8 +-
+ filament/backend/src/opengl/OpenGLBlitter.cpp | 2 +-
filament/backend/src/opengl/OpenGLContext.cpp | 4 +-
- filament/backend/src/opengl/OpenGLDriver.cpp | 4 +-
+ filament/backend/src/opengl/OpenGLDriver.cpp | 14 ++-
+ filament/backend/src/opengl/OpenGLDriver.h | 1 +
filament/backend/src/opengl/PlatformGLX.cpp | 151 +++-----------------------
filament/backend/src/opengl/PlatformGLX.h | 4 +-
filament/backend/src/opengl/gl_headers.h | 2 +-
- 7 files changed, 28 insertions(+), 146 deletions(-)
+ 9 files changed, 36 insertions(+), 151 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a95c557..5c117c3 100644
endif()
# ==================================================================================================
+diff --git a/filament/backend/src/opengl/OpenGLBlitter.cpp b/filament/backend/src/opengl/OpenGLBlitter.cpp
+index f1a7f70..ee7682a 100644
+--- a/filament/backend/src/opengl/OpenGLBlitter.cpp
++++ b/filament/backend/src/opengl/OpenGLBlitter.cpp
+@@ -73,7 +73,7 @@ void OpenGLBlitter::init() noexcept {
+ GLint status;
+ char const* vsource[2] = { s_vertexES, s_vertexGL };
+ char const* fsource[2] = { s_fragmentES, s_fragmentGL };
+- const size_t index = GLES30_HEADERS ? 0 : 1;
++ const size_t index = epoxy_is_desktop_gl() ? 1 : 0;
+
+ mVertexShader = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(mVertexShader, 1, vsource + index, nullptr);
diff --git a/filament/backend/src/opengl/OpenGLContext.cpp b/filament/backend/src/opengl/OpenGLContext.cpp
index 62aa98f..01a4e24 100644
--- a/filament/backend/src/opengl/OpenGLContext.cpp
shaderModel = ShaderModel::GL_CORE_41;
}
diff --git a/filament/backend/src/opengl/OpenGLDriver.cpp b/filament/backend/src/opengl/OpenGLDriver.cpp
-index 9b7135f..5ccf074 100644
+index 9b7135f..4b7c13a 100644
--- a/filament/backend/src/opengl/OpenGLDriver.cpp
+++ b/filament/backend/src/opengl/OpenGLDriver.cpp
-@@ -974,7 +974,7 @@ void OpenGLDriver::framebufferTexture(backend::TargetBufferInfo const& binfo,
+@@ -82,6 +82,7 @@ Driver* OpenGLDriver::create(
+ assert_invariant(platform);
+ OpenGLPlatform* const ec = platform;
+
++ bool isDesktopGL = epoxy_is_desktop_gl();
+ {
+ // here we check we're on a supported version of GL before initializing the driver
+ GLint major = 0, minor = 0;
+@@ -95,13 +96,13 @@ Driver* OpenGLDriver::create(
+ return {};
+ }
+
+- if (GLES30_HEADERS) {
++ if (!isDesktopGL) {
+ // we require GLES 3.1 headers, but we support GLES 3.0
+ if (UTILS_UNLIKELY(!(major >= 3 && minor >= 0))) {
+ PANIC_LOG("OpenGL ES 3.0 minimum needed (current %d.%d)", major, minor);
+ goto cleanup;
+ }
+- } else if (GL41_HEADERS) {
++ } else {
+ // we require GL 4.1 headers and minimum version
+ if (UTILS_UNLIKELY(!((major == 4 && minor >= 1) || major > 4))) {
+ PANIC_LOG("OpenGL 4.1 minimum needed (current %d.%d)", major, minor);
+@@ -111,6 +112,7 @@ Driver* OpenGLDriver::create(
+ }
+
+ OpenGLDriver* const driver = new OpenGLDriver(ec);
++ driver->mIsDesktopGL = isDesktopGL;
+ return driver;
+ }
+
+@@ -974,7 +976,7 @@ void OpenGLDriver::framebufferTexture(backend::TargetBufferInfo const& binfo,
// This extension only exists on OpenGL ES.
gl.bindFramebuffer(GL_FRAMEBUFFER, rt->gl.fbo);
if (any(t->usage & TextureUsage::SAMPLEABLE)) {
attachment, target, t->gl.id, binfo.level, rt->gl.samples);
} else {
glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment,
-@@ -1073,7 +1073,7 @@ void OpenGLDriver::renderBufferStorage(GLuint rbo, GLenum internalformat, uint32
+@@ -1073,7 +1075,7 @@ void OpenGLDriver::renderBufferStorage(GLuint rbo, GLenum internalformat, uint32
auto& gl = mContext;
if (gl.ext.EXT_multisampled_render_to_texture ||
gl.ext.EXT_multisampled_render_to_texture2) {
} else
#endif
{
+@@ -2329,7 +2331,7 @@ void OpenGLDriver::beginRenderPass(Handle<HwRenderTarget> rth,
+
+ // glInvalidateFramebuffer appeared on GLES 3.0 and GL4.3, for simplicity we just
+ // ignore it on GL (rather than having to do a runtime check).
+- if (GLES30_HEADERS) {
++ if (!mIsDesktopGL) {
+ if (!gl.bugs.disable_invalidate_framebuffer) {
+ std::array<GLenum, 6> attachments; // NOLINT
+ GLsizei attachmentCount = getAttachments(attachments, rt, discardFlags);
+@@ -2397,7 +2399,7 @@ void OpenGLDriver::endRenderPass(int) {
+
+ // glInvalidateFramebuffer appeared on GLES 3.0 and GL4.3, for simplicity we just
+ // ignore it on GL (rather than having to do a runtime check).
+- if (GLES30_HEADERS) {
++ if (!mIsDesktopGL) {
+ if (!gl.bugs.disable_invalidate_framebuffer) {
+ // we wouldn't have to bind the framebuffer if we had glInvalidateNamedFramebuffer()
+ gl.bindFramebuffer(GL_FRAMEBUFFER, rt->gl.fbo);
+diff --git a/filament/backend/src/opengl/OpenGLDriver.h b/filament/backend/src/opengl/OpenGLDriver.h
+index 7a8c734..30c8db1 100644
+--- a/filament/backend/src/opengl/OpenGLDriver.h
++++ b/filament/backend/src/opengl/OpenGLDriver.h
+@@ -431,6 +431,7 @@ private:
+ // timer query implementation
+ TimerQueryInterface* mTimerQueryImpl = nullptr;
+ bool mFrameTimeSupported = false;
++ bool mIsDesktopGL = false;
+ };
+
+ // ------------------------------------------------------------------------------------------------
diff --git a/filament/backend/src/opengl/PlatformGLX.cpp b/filament/backend/src/opengl/PlatformGLX.cpp
index b5cb484..32c16d8 100644
--- a/filament/backend/src/opengl/PlatformGLX.cpp