mesa/st: do not check single-sampled for max_samples

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 <marek.olsak@amd.com>
Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36156>
(cherry picked from commit c7bc454dbd)
This commit is contained in:
Erik Faye-Lund 2025-07-18 09:57:54 +02:00 committed by Eric Engestrom
parent d3ad9705dd
commit a7490b3575
2 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -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)) {