From 96d62b47fd66e787739235842f590c84dca92857 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 10 Apr 2025 11:18:39 +0200 Subject: [PATCH] mesa/main: search all the way to MAX_SAMPLES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/renderbuffer.c | 6 +++--- src/mesa/state_tracker/st_cb_texture.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 71b878dae67..8343544a5fe 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -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); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 5be5c161ff3..849c0f43daf 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -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)) {