From f9b29c4a5862d7caeab89e8a3bd23f3275dbd9a6 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Thu, 28 Mar 2019 01:47:10 -0700 Subject: [PATCH] gallium: Add PIPE_CAP_COMPUTE_SHADER_DERIVATIVES To enable NV_compute_shader_derivatives, which allows derivatives (and texture lookups with implicit derivatives) in compute shaders. Reviewed-by: Kenneth Graunke Reviewed-by: Ian Romanick --- src/gallium/auxiliary/util/u_screen.c | 3 +++ src/gallium/docs/source/screen.rst | 1 + src/gallium/include/pipe/p_defines.h | 1 + src/mesa/state_tracker/st_extensions.c | 1 + 4 files changed, 6 insertions(+) diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index 9f0be80..43310f3 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -348,6 +348,9 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen, case PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK: return 0; + case PIPE_CAP_COMPUTE_SHADER_DERIVATIVES: + return 0; + default: unreachable("bad PIPE_CAP_*"); } diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index a4d6a955..7d3b262 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -503,6 +503,7 @@ The integer capabilities: cases may be a smaller number. * ``PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK``: Whether pipe_grid_info::last_block is implemented by the driver. See struct pipe_grid_info for more details. +* ``PIPE_CAP_COMPUTE_SHADER_DERIVATIVE``: True if the driver supports derivatives (and texture lookups with implicit derivatives) in compute shaders. .. _pipe_capf: diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 3dbdea0..695bb2b 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -865,6 +865,7 @@ enum pipe_cap PIPE_CAP_NIR_COMPACT_ARRAYS, PIPE_CAP_MAX_VARYINGS, PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK, + PIPE_CAP_COMPUTE_SHADER_DERIVATIVES, }; /** diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 405fc21..7c0d1a7 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -772,6 +772,7 @@ void st_init_extensions(struct pipe_screen *screen, { o(AMD_seamless_cubemap_per_texture), PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE }, { o(ATI_texture_mirror_once), PIPE_CAP_TEXTURE_MIRROR_CLAMP }, { o(MESA_tile_raster_order), PIPE_CAP_TILE_RASTER_ORDER }, + { o(NV_compute_shader_derivatives), PIPE_CAP_COMPUTE_SHADER_DERIVATIVES }, { o(NV_conditional_render), PIPE_CAP_CONDITIONAL_RENDER }, { o(NV_fill_rectangle), PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE }, { o(NV_primitive_restart), PIPE_CAP_PRIMITIVE_RESTART }, -- 2.7.4