Mesa (master): gallium: Add new cap PIPE_CAP_TEXTURE_BUFFER_SAMPLER
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jan 12 19:25:10 UTC 2021
Module: Mesa
Branch: master
Commit: d5d3f77e4ac7b08761c4c30bf2b227fda148c4c7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d5d3f77e4ac7b08761c4c30bf2b227fda148c4c7
Author: Icecream95 <ixn at disroot.org>
Date: Mon Jan 4 20:41:57 2021 +1300
gallium: Add new cap PIPE_CAP_TEXTURE_BUFFER_SAMPLER
This indicates whether a driver wants samplers for buffer textures as
well as normal textures.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8300>
---
docs/gallium/screen.rst | 3 +++
src/gallium/auxiliary/util/u_screen.c | 1 +
src/gallium/include/pipe/p_defines.h | 1 +
src/mesa/state_tracker/st_context.c | 2 ++
src/mesa/state_tracker/st_context.h | 1 +
5 files changed, 8 insertions(+)
diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst
index 5e9820fc9fd..cbd5dcb85dd 100644
--- a/docs/gallium/screen.rst
+++ b/docs/gallium/screen.rst
@@ -165,6 +165,9 @@ The integer capabilities:
TEXCOORD semantic.
Also, TGSI_SEMANTIC_PCOORD becomes available, which labels a fragment shader
input that will always be replaced with sprite coordinates.
+* ``PIPE_CAP_TEXTURE_BUFFER_SAMPLER``: Whether a sampler should still
+ be used for PIPE_BUFFER resources (normally a sampler is only used
+ if the texture target is PIPE_TEXTURE_*).
* ``PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER``: Whether it is preferable
to use a blit to implement a texture transfer which needs format conversions
and swizzling in gallium frontends. Generally, all hardware drivers with
diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index df067cca409..048749e3099 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -148,6 +148,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
case PIPE_CAP_TGSI_TEXCOORD:
+ case PIPE_CAP_TEXTURE_BUFFER_SAMPLER:
return 0;
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 98381515852..3b984b716ca 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -792,6 +792,7 @@ enum pipe_cap
PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT,
PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY,
PIPE_CAP_TGSI_TEXCOORD,
+ PIPE_CAP_TEXTURE_BUFFER_SAMPLER,
PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER,
PIPE_CAP_QUERY_PIPELINE_STATISTICS,
PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK,
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index cf4ae0aff26..a035d792ce0 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -685,6 +685,8 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
!!(screen->get_param(screen, PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK) &
(PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 |
PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_R600));
+ st->texture_buffer_sampler =
+ screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_SAMPLER);
st->has_time_elapsed =
screen->get_param(screen, PIPE_CAP_QUERY_TIME_ELAPSED);
st->has_half_float_packing =
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 2f358bf302b..274bda960b8 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -181,6 +181,7 @@ struct st_context
boolean needs_texcoord_semantic;
boolean apply_texture_swizzle_to_border_color;
+ boolean texture_buffer_sampler;
/* On old libGL's for linux we need to invalidate the drawables
* on glViewpport calls, this is set via a option.
More information about the mesa-commit
mailing list