mesa: implement FRAMEBUFFER_RENDERABLE internalformat query

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Erik Faye-Lund <erik-faye-lund@collabora.com>
Cc: mesa-stable
(cherry picked from commit 2b76f2e4a7)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40092>
This commit is contained in:
Pavel Ondračka 2026-02-13 23:19:17 +01:00 committed by Eric Engestrom
parent 372c7545e6
commit 0f21dc1bd4
2 changed files with 9 additions and 3 deletions

View file

@ -3124,7 +3124,7 @@
"description": "mesa: implement FRAMEBUFFER_RENDERABLE internalformat query",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1717,6 +1717,7 @@ st_QueryInternalFormat(struct gl_context *ctx, GLenum target,
params[0] = (GLint) num_rates;
break;
}
case GL_FRAMEBUFFER_RENDERABLE:
case GL_FRAMEBUFFER_BLEND: {
if (target == GL_RENDERBUFFER)
target = GL_TEXTURE_2D;
@ -1724,9 +1725,14 @@ st_QueryInternalFormat(struct gl_context *ctx, GLenum target,
mesa_format format = st_ChooseTextureFormat(ctx, target, internalFormat, GL_NONE, GL_NONE);
enum pipe_format pformat = st_mesa_format_to_pipe_format(st, format);
struct pipe_screen *screen = st->screen;
bool is_depth = util_format_is_depth_or_stencil(pformat);
unsigned bind = is_depth ? PIPE_BIND_DEPTH_STENCIL : PIPE_BIND_RENDER_TARGET;
if (pname == GL_FRAMEBUFFER_BLEND)
bind |= PIPE_BIND_BLENDABLE;
bool supported = pformat != PIPE_FORMAT_NONE &&
screen->is_format_supported(screen, pformat, ptarget, 0, 0,
PIPE_BIND_BLENDABLE | PIPE_BIND_RENDER_TARGET);
screen->is_format_supported(screen, pformat, ptarget, 0, 0, bind);
params[0] = supported ? GL_FULL_SUPPORT : GL_NONE;
break;
}