From f5d3d5f10a8c83e25a8da450af4fd3ad701cab7f Mon Sep 17 00:00:00 2001 From: Luke Street Date: Tue, 29 Jul 2025 20:49:09 -0600 Subject: [PATCH] gui: Split OpenGL into OpenGL (glow), OpenGL ES (wgpu) --- objdiff-gui/src/app.rs | 4 ++-- objdiff-gui/src/main.rs | 3 ++- objdiff-gui/src/views/graphics.rs | 8 ++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/objdiff-gui/src/app.rs b/objdiff-gui/src/app.rs index bb1580a..ec0b663 100644 --- a/objdiff-gui/src/app.rs +++ b/objdiff-gui/src/app.rs @@ -465,7 +465,7 @@ impl App { Backend::Vulkan => "Vulkan", Backend::Metal => "Metal", Backend::Dx12 => "DirectX 12", - Backend::Gl => "OpenGL", + Backend::Gl => "OpenGL ES", Backend::BrowserWebGpu => "WebGPU", } .to_string(); @@ -474,7 +474,7 @@ impl App { #[cfg(feature = "glow")] if let Some(gl) = &cc.gl { use eframe::glow::HasContext; - app.view_state.graphics_state.active_backend = "OpenGL (Fallback)".to_string(); + app.view_state.graphics_state.active_backend = "OpenGL".to_string(); app.view_state.graphics_state.active_device = unsafe { gl.get_parameter_string(0x1F01) }; // GL_RENDERER } diff --git a/objdiff-gui/src/main.rs b/objdiff-gui/src/main.rs index 2687f01..f573030 100644 --- a/objdiff-gui/src/main.rs +++ b/objdiff-gui/src/main.rs @@ -95,7 +95,8 @@ fn main() -> ExitCode { GraphicsBackend::Dx12 => wgpu::Backends::DX12, GraphicsBackend::Metal => wgpu::Backends::METAL, GraphicsBackend::Vulkan => wgpu::Backends::VULKAN, - GraphicsBackend::OpenGL => wgpu::Backends::GL, + GraphicsBackend::OpenGLES => wgpu::Backends::GL, + GraphicsBackend::OpenGL => wgpu::Backends::empty(), }; WgpuSetup::CreateNew(setup) } diff --git a/objdiff-gui/src/views/graphics.rs b/objdiff-gui/src/views/graphics.rs index 1121a11..177db9e 100644 --- a/objdiff-gui/src/views/graphics.rs +++ b/objdiff-gui/src/views/graphics.rs @@ -26,7 +26,8 @@ pub enum GraphicsBackend { Vulkan, Metal, Dx12, - OpenGL, + OpenGL, // glow + OpenGLES, // wgpu } static ALL_BACKENDS: &[GraphicsBackend] = &[ @@ -35,6 +36,7 @@ static ALL_BACKENDS: &[GraphicsBackend] = &[ GraphicsBackend::Metal, GraphicsBackend::Dx12, GraphicsBackend::OpenGL, + GraphicsBackend::OpenGLES, ]; #[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)] @@ -67,7 +69,8 @@ impl GraphicsBackend { } GraphicsBackend::Metal => cfg!(all(feature = "wgpu", target_os = "macos")), GraphicsBackend::Dx12 => cfg!(all(feature = "wgpu", target_os = "windows")), - GraphicsBackend::OpenGL => true, + GraphicsBackend::OpenGL => cfg!(feature = "glow"), + GraphicsBackend::OpenGLES => cfg!(all(feature = "wgpu", target_os = "windows")), } } @@ -78,6 +81,7 @@ impl GraphicsBackend { GraphicsBackend::Metal => "Metal", GraphicsBackend::Dx12 => "DirectX 12", GraphicsBackend::OpenGL => "OpenGL", + GraphicsBackend::OpenGLES => "OpenGL ES", } } }