gallium: split PIPE_CAP_SAMPLER_REDUCTION_MINMAX into modes

this enables detection for the EXT vs the ARB extension, which have
different specifications regarding which formats must be 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-05 12:13:04 -04:00 committed by Marge Bot
parent 59ad872458
commit b122beaff3
9 changed files with 28 additions and 10 deletions

View File

@ -612,7 +612,8 @@ The integer capabilities:
* ``PIPE_CAP_PREFER_REAL_BUFFER_IN_CONSTBUF0``: The state tracker is encouraged to upload constants into a real buffer and bind it into constant buffer 0 instead of binding a user pointer. This may enable a faster codepath in a gallium frontend for drivers that really prefer a real buffer.
* ``PIPE_CAP_GL_CLAMP``: Driver natively supports GL_CLAMP. Required for non-NIR drivers with the GL frontend. NIR drivers with the cap unavailable will have GL_CLAMP lowered to txd/txl with a saturate on the coordinates.
* ``PIPE_CAP_TEXRECT``: Driver supports rectangle textures. Required for OpenGL on `!prefers_nir` drivers. If this cap is not present, st/mesa will lower the NIR to use normal 2D texture sampling by using either `txs` or `nir_intrinsic_load_texture_scaling` to normalize the texture coordinates.
* ``PIPE_CAP_SAMPLER_REDUCTION_MINMAX``: Driver support min/max sampler reduction.
* ``PIPE_CAP_SAMPLER_REDUCTION_MINMAX``: Driver supports EXT min/max sampler reduction.
* ``PIPE_CAP_SAMPLER_REDUCTION_MINMAX_ARB``: Driver supports ARB min/max sampler reduction with format queries.
.. _pipe_capf:

View File

@ -460,6 +460,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
return 0;
case PIPE_CAP_SAMPLER_REDUCTION_MINMAX:
case PIPE_CAP_SAMPLER_REDUCTION_MINMAX_ARB:
return 0;
case PIPE_CAP_ALLOW_DYNAMIC_VAO_FASTPATH:

View File

@ -413,6 +413,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_BLEND_EQUATION_ADVANCED:
case PIPE_CAP_NO_CLIP_ON_COPY_TEX:
case PIPE_CAP_DEVICE_PROTECTED_CONTENT:
case PIPE_CAP_SAMPLER_REDUCTION_MINMAX_ARB:
return 0;
case PIPE_CAP_VENDOR_ID:

View File

@ -987,6 +987,7 @@ enum pipe_cap
PIPE_CAP_GL_CLAMP,
PIPE_CAP_TEXRECT,
PIPE_CAP_SAMPLER_REDUCTION_MINMAX,
PIPE_CAP_SAMPLER_REDUCTION_MINMAX_ARB,
PIPE_CAP_ALLOW_DYNAMIC_VAO_FASTPATH,
PIPE_CAP_LAST,

View File

@ -161,7 +161,7 @@ EXT(ARB_texture_env_combine , ARB_texture_env_combine
EXT(ARB_texture_env_crossbar , ARB_texture_env_crossbar , GLL, x , x , x , 2001)
EXT(ARB_texture_env_dot3 , ARB_texture_env_dot3 , GLL, x , x , x , 2001)
EXT(ARB_texture_filter_anisotropic , ARB_texture_filter_anisotropic , GLL, GLC, x , x , 2017)
EXT(ARB_texture_filter_minmax , EXT_texture_filter_minmax , GLL, GLC, x , x , 2015)
EXT(ARB_texture_filter_minmax , ARB_texture_filter_minmax , GLL, GLC, x , x , 2015)
EXT(ARB_texture_float , ARB_texture_float , GLL, GLC, x , x , 2004)
EXT(ARB_texture_gather , ARB_texture_gather , GLL, GLC, x , x , 2009)
EXT(ARB_texture_mirror_clamp_to_edge , ARB_texture_mirror_clamp_to_edge , GLL, GLC, x , x , 2013)

View File

@ -4392,6 +4392,7 @@ struct gl_extensions
GLboolean ARB_texture_env_crossbar;
GLboolean ARB_texture_env_dot3;
GLboolean ARB_texture_filter_anisotropic;
GLboolean ARB_texture_filter_minmax;
GLboolean ARB_texture_float;
GLboolean ARB_texture_gather;
GLboolean ARB_texture_mirror_clamp_to_edge;

View File

@ -877,7 +877,8 @@ static GLuint
set_sampler_reduction_mode(struct gl_context *ctx,
struct gl_sampler_object *samp, GLenum param)
{
if (!ctx->Extensions.EXT_texture_filter_minmax)
if (!ctx->Extensions.EXT_texture_filter_minmax &&
!_mesa_has_ARB_texture_filter_minmax(ctx))
return INVALID_PNAME;
if (samp->Attrib.ReductionMode == param)
@ -1530,7 +1531,8 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
*params = (GLenum) sampObj->Attrib.sRGBDecode;
break;
case GL_TEXTURE_REDUCTION_MODE_EXT:
if (!ctx->Extensions.EXT_texture_filter_minmax)
if (!ctx->Extensions.EXT_texture_filter_minmax &&
!_mesa_has_ARB_texture_filter_minmax(ctx))
goto invalid_pname;
*params = (GLenum) sampObj->Attrib.ReductionMode;
break;
@ -1607,7 +1609,8 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
*params = (GLfloat) sampObj->Attrib.sRGBDecode;
break;
case GL_TEXTURE_REDUCTION_MODE_EXT:
if (!ctx->Extensions.EXT_texture_filter_minmax)
if (!ctx->Extensions.EXT_texture_filter_minmax &&
!_mesa_has_ARB_texture_filter_minmax(ctx))
goto invalid_pname;
*params = (GLfloat) sampObj->Attrib.ReductionMode;
break;
@ -1684,7 +1687,8 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
*params = (GLenum) sampObj->Attrib.sRGBDecode;
break;
case GL_TEXTURE_REDUCTION_MODE_EXT:
if (!ctx->Extensions.EXT_texture_filter_minmax)
if (!ctx->Extensions.EXT_texture_filter_minmax &&
!_mesa_has_ARB_texture_filter_minmax(ctx))
goto invalid_pname;
*params = (GLenum) sampObj->Attrib.ReductionMode;
break;
@ -1761,7 +1765,8 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
*params = (GLenum) sampObj->Attrib.sRGBDecode;
break;
case GL_TEXTURE_REDUCTION_MODE_EXT:
if (!ctx->Extensions.EXT_texture_filter_minmax)
if (!ctx->Extensions.EXT_texture_filter_minmax &&
!_mesa_has_ARB_texture_filter_minmax(ctx))
goto invalid_pname;
*params = (GLenum) sampObj->Attrib.ReductionMode;
break;

View File

@ -597,7 +597,8 @@ set_tex_parameteri(struct gl_context *ctx,
goto invalid_pname;
case GL_TEXTURE_REDUCTION_MODE_EXT:
if (ctx->Extensions.EXT_texture_filter_minmax) {
if (ctx->Extensions.EXT_texture_filter_minmax ||
_mesa_has_ARB_texture_filter_minmax(ctx)) {
GLenum mode = params[0];
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
@ -2377,7 +2378,8 @@ get_tex_parameterfv(struct gl_context *ctx,
break;
case GL_TEXTURE_REDUCTION_MODE_EXT:
if (!ctx->Extensions.EXT_texture_filter_minmax)
if (!ctx->Extensions.EXT_texture_filter_minmax &&
!_mesa_has_ARB_texture_filter_minmax(ctx))
goto invalid_pname;
*params = (GLfloat) obj->Sampler.Attrib.ReductionMode;
break;
@ -2649,7 +2651,8 @@ get_tex_parameteriv(struct gl_context *ctx,
break;
case GL_TEXTURE_REDUCTION_MODE_EXT:
if (!ctx->Extensions.EXT_texture_filter_minmax)
if (!ctx->Extensions.EXT_texture_filter_minmax &&
!_mesa_has_ARB_texture_filter_minmax(ctx))
goto invalid_pname;
*params = obj->Sampler.Attrib.ReductionMode;
break;

View File

@ -811,6 +811,7 @@ void st_init_extensions(struct pipe_screen *screen,
{ o(ARB_spirv_extensions), PIPE_CAP_GL_SPIRV },
{ o(ARB_texture_buffer_object), PIPE_CAP_TEXTURE_BUFFER_OBJECTS },
{ o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY },
{ o(ARB_texture_filter_minmax), PIPE_CAP_SAMPLER_REDUCTION_MINMAX_ARB },
{ o(ARB_texture_gather), PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS },
{ o(ARB_texture_mirror_clamp_to_edge), PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE },
{ o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE },
@ -1139,6 +1140,10 @@ void st_init_extensions(struct pipe_screen *screen,
}
}
/* EXT implies ARB here */
if (extensions->EXT_texture_filter_minmax)
extensions->ARB_texture_filter_minmax = GL_TRUE;
/* Expose the extensions which directly correspond to gallium formats. */
init_format_extensions(screen, extensions, rendertarget_mapping,
ARRAY_SIZE(rendertarget_mapping), PIPE_TEXTURE_2D,