Mesa (main): gallium: add PIPE_CAP_FBFETCH_ZS and expose extension

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 22 05:02:10 UTC 2022


Module: Mesa
Branch: main
Commit: 41f22a1823a77183fb28e8a6dd312d723c3fda87
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=41f22a1823a77183fb28e8a6dd312d723c3fda87

Author: Pavel Asyutchenko <sventeam at yandex.ru>
Date:   Wed Sep  1 23:25:16 2021 +0300

gallium: add PIPE_CAP_FBFETCH_ZS and expose extension

st/mesa will expose GL_ARM_shader_framebuffer_fetch_depth_stencil
if this new capability is supported by the driver.

Signed-off-by: Pavel Asyutchenko <sventeam at yandex.ru>
Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13979>

---

 docs/features.txt                      | 1 +
 docs/gallium/screen.rst                | 2 ++
 src/gallium/auxiliary/util/u_screen.c  | 1 +
 src/gallium/include/pipe/p_defines.h   | 1 +
 src/mesa/main/consts_exts.h            | 1 +
 src/mesa/main/extensions_table.h       | 2 ++
 src/mesa/state_tracker/st_extensions.c | 3 ++-
 7 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/docs/features.txt b/docs/features.txt
index 4fa36e7f7de..047f6ee4d86 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -316,6 +316,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve
   GL_ARB_sparse_texture2                                DONE (radeonsi/gfx9+, zink)
   GL_ARB_sparse_texture_clamp                           DONE (radeonsi/gfx9+, zink)
   GL_ARB_texture_filter_minmax                          DONE (nvc0/gm200+, zink)
+  GL_ARM_shader_framebuffer_fetch_depth_stencil         DONE (llvmpipe)
   GL_EXT_color_buffer_half_float                        DONE (freedreno, i965, iris, llvmpipe, nv50, nvc0, radeonsi, zink)
   GL_EXT_depth_bounds_test                              DONE (i965/gen12+, nv50, nvc0, radeonsi, softpipe, zink)
   GL_EXT_memory_object                                  DONE (radeonsi, i965/gen7+, llvmpipe, zink)
diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst
index 2e8b6e74a35..8cddec99f82 100644
--- a/docs/gallium/screen.rst
+++ b/docs/gallium/screen.rst
@@ -424,6 +424,8 @@ The integer capabilities:
   and a larger value would mean that multiple render targets are supported.
 * ``PIPE_CAP_FBFETCH_COHERENT``: Whether framebuffer fetches from the fragment
   shader can be guaranteed to be coherent with framebuffer writes.
+* ``PIPE_CAP_FBFETCH_ZS``: Whether fragment shader can fetch current values of
+  Z/S attachments. These fetches are always coherent with framebuffer writes.
 * ``PIPE_CAP_LEGACY_MATH_RULES``: Whether NIR shaders support the
   ``shader_info.use_legacy_math_rules`` flag (see documentation there), and
   TGSI shaders support the corresponding ``TGSI_PROPERTY_LEGACY_MATH_RULES``.
diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index 227e599f0b3..a220a633538 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -308,6 +308,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
 
    case PIPE_CAP_FBFETCH:
    case PIPE_CAP_FBFETCH_COHERENT:
+   case PIPE_CAP_FBFETCH_ZS:
    case PIPE_CAP_BLEND_EQUATION_ADVANCED:
    case PIPE_CAP_LEGACY_MATH_RULES:
    case PIPE_CAP_DOUBLES:
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index cc7a482d05f..e57693958b4 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -1011,6 +1011,7 @@ enum pipe_cap
    PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT,
    PIPE_CAP_HARDWARE_GL_SELECT,
    PIPE_CAP_DITHERING,
+   PIPE_CAP_FBFETCH_ZS,
 
    PIPE_CAP_LAST,
    /* XXX do not add caps after PIPE_CAP_LAST! */
diff --git a/src/mesa/main/consts_exts.h b/src/mesa/main/consts_exts.h
index 1afe0ee6c77..c33242862a8 100644
--- a/src/mesa/main/consts_exts.h
+++ b/src/mesa/main/consts_exts.h
@@ -234,6 +234,7 @@ struct gl_extensions
    GLboolean AMD_vertex_shader_viewport_index;
    GLboolean ANDROID_extension_pack_es31a;
    GLboolean APPLE_object_purgeable;
+   GLboolean ARM_shader_framebuffer_fetch_depth_stencil;
    GLboolean ATI_meminfo;
    GLboolean ATI_texture_compression_3dc;
    GLboolean ATI_texture_mirror_once;
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 696a9aaea81..74cec475c99 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -200,6 +200,8 @@ EXT(ARB_vertex_type_2_10_10_10_rev          , ARB_vertex_type_2_10_10_10_rev
 EXT(ARB_viewport_array                      , ARB_viewport_array                     , GLL, GLC,  x ,  x , 2010)
 EXT(ARB_window_pos                          , dummy_true                             , GLL,  x ,  x ,  x , 2001)
 
+EXT(ARM_shader_framebuffer_fetch_depth_stencil, ARM_shader_framebuffer_fetch_depth_stencil, GLL, GLC,  x , ES2, 2014)
+
 EXT(ATI_blend_equation_separate             , EXT_blend_equation_separate            , GLL, GLC,  x ,  x , 2003)
 EXT(ATI_draw_buffers                        , dummy_true                             , GLL,  x ,  x ,  x , 2002)
 EXT(ATI_fragment_shader                     , ATI_fragment_shader                    , GLL,  x ,  x ,  x , 2001)
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 79051ba7ec3..8eaed354bb2 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -874,7 +874,8 @@ void st_init_extensions(struct pipe_screen *screen,
       { o(OES_texture_float_linear),         PIPE_CAP_TEXTURE_FLOAT_LINEAR             },
       { o(OES_texture_half_float_linear),    PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR        },
       { o(OES_texture_view),                 PIPE_CAP_SAMPLER_VIEW_TARGET              },
-      { o(INTEL_blackhole_render),           PIPE_CAP_FRONTEND_NOOP,                   },
+      { o(INTEL_blackhole_render),           PIPE_CAP_FRONTEND_NOOP                    },
+      { o(ARM_shader_framebuffer_fetch_depth_stencil), PIPE_CAP_FBFETCH_ZS             },
    };
 
    /* Required: render target and sampler support */



More information about the mesa-commit mailing list