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>
This commit is contained in:
Erik Faye-Lund
2025-07-18 09:57:54 +02:00
committed by Marge Bot
parent 7970ac6234
commit c7bc454dbd
+4 -2
View File
@@ -696,9 +696,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 */
@@ -719,8 +720,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)) {