From a7490b35751717c1f03ce87a140796858d359c19 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 18 Jul 2025 09:57:54 +0200 Subject: [PATCH] mesa/st: do not check single-sampled for max_samples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to screen.rst, sample_count of 1 is the same as a sample_count of 0, neither of which are multi-sampling. We only want to include formats that support multi-sampling when calculating max samples, otherwise we can't support the combination of floating-point textures and multi-sampling on DX9-class GPUs. ...There's one special-case, though; FakeMSAA, which is implemented as sample_count = 1. In that case, we actually need to check for a single sample. So let's check for that first, to figure out what the actual min value is. Ugh, this is hairy. This brings back GL_EXT_framebuffer_multisample and GL_EXT_framebuffer_multisample_blit_scaled on R300, and should get Crocus back to GL 3.x as it was before. Fixes: f56443ac ("st/mesa: search for smallest supported sample-count") Acked-by: Marek Olšák Reviewed-by: Pavel Ondračka Part-of: (cherry picked from commit c7bc454dbdeab995ae24e3f5908e18d4fc085fc6) --- .pick_status.json | 2 +- src/mesa/state_tracker/st_extensions.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 85c207b6086..3728d808798 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -124,7 +124,7 @@ "description": "mesa/st: do not check single-sampled for max_samples", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "f56443ac84bc1a46865debe76ccb82a37d042005", "notes": null diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 7430bfda1f4..6233221acb7 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -705,9 +705,10 @@ get_max_samples_for_formats(struct pipe_screen *screen, unsigned bind) { unsigned i, f, supported_samples = 0; + unsigned min_samples = screen->caps.fake_sw_msaa ? 1 : 2; for (f = 0; f < num_formats; f++) { - for (i = max_samples; i > 0; --i) { + for (i = max_samples; i >= min_samples; --i) { if (screen->is_format_supported(screen, formats[f], PIPE_TEXTURE_2D, i, i, bind)) { /* update both return value and loop-boundary */ @@ -728,8 +729,9 @@ get_max_samples_for_formats_advanced(struct pipe_screen *screen, unsigned bind) { unsigned i, f; + unsigned min_samples = screen->caps.fake_sw_msaa ? 1 : 2; - for (i = max_samples; i > 0; --i) { + for (i = max_samples; i >= min_samples; --i) { for (f = 0; f < num_formats; f++) { if (screen->is_format_supported(screen, formats[f], PIPE_TEXTURE_2D, i, num_storage_samples, bind)) {