Mesa (master): gallium: add a sampler reduction cap + settings
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Mar 12 00:31:23 UTC 2021
Module: Mesa
Branch: master
Commit: 7c999249efc381bec959a6273beb56f219b83a74
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c999249efc381bec959a6273beb56f219b83a74
Author: Dave Airlie <airlied at redhat.com>
Date: Fri Mar 5 15:23:57 2021 +1000
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 at alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9487>
---
docs/gallium/screen.rst | 1 +
src/gallium/auxiliary/util/u_screen.c | 3 +++
src/gallium/include/pipe/p_defines.h | 7 +++++++
src/gallium/include/pipe/p_state.h | 1 +
4 files changed, 12 insertions(+)
diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst
index dda1a5a14ee..6f16f8aec15 100644
--- a/docs/gallium/screen.rst
+++ b/docs/gallium/screen.rst
@@ -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:
diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index 2bc560a1f07..f8d739bbaa9 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -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_*");
}
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 79f6bd5b152..9475fa2aa84 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -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! */
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 57ac9b6b29a..c1c0a464c7e 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -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;
More information about the mesa-commit
mailing list