From 6b2c114fc7f70a78ef91718f78ab9cefa6def0ee Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 19 May 2023 16:39:07 +0200 Subject: [PATCH] Fix missing 4X MSAA support on some OpenGL backends (#3780) * Always support 4x MSAA on GL * Update changelog --- CHANGELOG.md | 2 ++ wgpu-hal/src/gles/adapter.rs | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8592bd1505..fe486ffb2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,8 @@ Bottom level categories: ### Bug Fixes +- Fix missing 4X MSAA support on some OpenGL backends. By @emilk in [#3780](https://github.com/gfx-rs/wgpu/pull/3780) + #### General - Fix crash on dropping `wgpu::CommandBuffer`. By @wumpf in [#3726](https://github.com/gfx-rs/wgpu/pull/3726). diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 5ccae1154f..faea60e25c 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -713,10 +713,12 @@ impl crate::Adapter for super::Adapter { | Tfc::MULTISAMPLE_X16 } else if max_samples >= 8 { Tfc::MULTISAMPLE_X2 | Tfc::MULTISAMPLE_X4 | Tfc::MULTISAMPLE_X8 - } else if max_samples >= 4 { - Tfc::MULTISAMPLE_X2 | Tfc::MULTISAMPLE_X4 } else { - Tfc::MULTISAMPLE_X2 + // The lowest supported level in GLE3.0/WebGL2 is 4X + // (see GL_MAX_SAMPLES in https://registry.khronos.org/OpenGL-Refpages/es3.0/html/glGet.xhtml). + // On some platforms, like iOS Safari, `get_parameter_i32(MAX_SAMPLES)` returns 0, + // so we always fall back to supporting 4x here. + Tfc::MULTISAMPLE_X2 | Tfc::MULTISAMPLE_X4 } };