gallium: add a sampler reduction cap + settings

This is to allow for
  VK_EXT_sampler_filter_minmax
  GL_EXT_texture_filter_minmax
support

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9487>
This commit is contained in:
Dave Airlie 2021-03-05 15:23:57 +10:00 committed by Marge Bot
parent 8016a098fc
commit 7c999249ef
4 changed files with 12 additions and 0 deletions

View File

@ -612,6 +612,7 @@ 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_capf:

View File

@ -459,6 +459,9 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_SHADER_ATOMIC_INT64:
return 0;
case PIPE_CAP_SAMPLER_REDUCTION_MINMAX:
return 0;
default:
unreachable("bad PIPE_CAP_*");
}

View File

@ -210,6 +210,12 @@ enum pipe_tex_compare {
PIPE_TEX_COMPARE_R_TO_TEXTURE,
};
enum pipe_tex_reduction_mode {
PIPE_TEX_REDUCTION_WEIGHTED_AVERAGE,
PIPE_TEX_REDUCTION_MIN,
PIPE_TEX_REDUCTION_MAX,
};
/**
* Clear buffer bits
*/
@ -979,6 +985,7 @@ enum pipe_cap
PIPE_CAP_PREFER_REAL_BUFFER_IN_CONSTBUF0,
PIPE_CAP_GL_CLAMP,
PIPE_CAP_TEXRECT,
PIPE_CAP_SAMPLER_REDUCTION_MINMAX,
PIPE_CAP_LAST,
/* XXX do not add caps after PIPE_CAP_LAST! */

View File

@ -413,6 +413,7 @@ struct pipe_sampler_state
unsigned max_anisotropy:5;
unsigned seamless_cube_map:1;
unsigned border_color_is_integer:1;
unsigned reduction_mode:2; /**< PIPE_TEX_REDUCTION_x */
float lod_bias; /**< LOD/lambda bias */
float min_lod, max_lod; /**< LOD clamp range, after bias */
union pipe_color_union border_color;