mesa/st: plumb GL_TEXTURE_REDUCTION_MODE_ARB through QueryInternalFormat

enable per-format querying of texture_filter_minmax support if the ARB extension
is enabled

also now return 0 if neither extension is supported

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10030>
This commit is contained in:
Mike Blumenkrantz 2021-04-04 18:42:47 -04:00 committed by Marge Bot
parent b122beaff3
commit 376c878c16
2 changed files with 16 additions and 5 deletions

View file

@ -1564,11 +1564,13 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
break;
case GL_TEXTURE_REDUCTION_MODE_ARB:
/* We don't currently have a way of querying this information. A driver
* enabling this capability should handle all formats until this is
* addressed.
*/
buffer[0] = (GLint)1;
if (ctx->Extensions.EXT_texture_filter_minmax)
buffer[0] = (GLint)1;
else if (ctx->Extensions.ARB_texture_filter_minmax)
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
buffer);
else
buffer[0] = (GLint)0;
break;
default:

View file

@ -1463,6 +1463,15 @@ st_QueryInternalFormat(struct gl_context *ctx, GLenum target,
params[0] = internalFormat;
break;
}
case GL_TEXTURE_REDUCTION_MODE_ARB: {
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;
params[0] = pformat != PIPE_FORMAT_NONE &&
screen->is_format_supported(screen, pformat, PIPE_TEXTURE_2D,
0, 0, PIPE_BIND_SAMPLER_REDUCTION_MINMAX);
break;
}
default:
/* For the rest of the pnames, we call back the Mesa's default
* function for drivers that don't implement ARB_internalformat_query2.