mesa/main: search all the way to MAX_SAMPLES

The constants we were comparing with here aren't the max values in all
cases. These are the max *guaranteed* to be supported values, but
specific formats can support higher sample counts. If we don't serach
for higher values, we might end up not picking a format, leading to
FBOs that are incorrectly marked as incomplete.

Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34455>
This commit is contained in:
Erik Faye-Lund 2025-04-10 11:18:39 +02:00 committed by Marge Bot
parent 8ffce0e49b
commit 96d62b47fd
2 changed files with 4 additions and 4 deletions

View file

@ -185,7 +185,7 @@ renderbuffer_alloc_storage(struct gl_context * ctx,
rb->_BaseFormat == GL_STENCIL_INDEX) {
/* Find a supported depth-stencil format. */
for (unsigned samples = start;
samples <= ctx->Const.MaxDepthStencilFramebufferSamples;
samples <= MAX_SAMPLES;
samples++) {
format = choose_renderbuffer_format(ctx, internalFormat,
samples, samples);
@ -199,7 +199,7 @@ renderbuffer_alloc_storage(struct gl_context * ctx,
} else {
/* Find a supported color format, samples >= storage_samples. */
for (unsigned storage_samples = start_storage;
storage_samples <= ctx->Const.MaxColorFramebufferStorageSamples;
storage_samples <= MAX_SAMPLES;
storage_samples++) {
for (unsigned samples = MAX2(start, storage_samples);
samples <= ctx->Const.MaxColorFramebufferSamples;
@ -218,7 +218,7 @@ renderbuffer_alloc_storage(struct gl_context * ctx,
found:;
}
} else {
for (unsigned samples = start; samples <= ctx->Const.MaxSamples;
for (unsigned samples = start; samples <= MAX_SAMPLES;
samples++) {
format = choose_renderbuffer_format(ctx, internalFormat,
samples, samples);

View file

@ -3470,7 +3470,7 @@ st_texture_storage(struct gl_context *ctx,
num_samples = 2;
}
for (; num_samples <= ctx->Const.MaxSamples; num_samples++) {
for (; num_samples <= MAX_SAMPLES; num_samples++) {
if (screen->is_format_supported(screen, fmt, ptarget,
num_samples, num_samples,
PIPE_BIND_SAMPLER_VIEW)) {