From 681fa03e8d290ab1ee49de3f2c35f3dbb11636dc Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 5 Jul 2019 16:08:19 +0200 Subject: [PATCH] gallium: give fragment-shader derivatives its own cap MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Shader Model 3.0 is a big promise to make to the state-tracker, and for instance mobile hardware might support fragment-shader derivatives but not some of the other features of SM3. So let's give this its own cap for simplicity. Signed-off-by: Erik Faye-Lund Reviewed-by: Marek Olšák --- src/gallium/auxiliary/util/u_screen.c | 1 + src/gallium/docs/source/screen.rst | 2 ++ src/gallium/include/pipe/p_defines.h | 1 + src/mesa/state_tracker/st_extensions.c | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index 5baf7d72fb1..4b57c0c6342 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -371,6 +371,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen, #endif case PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD: + case PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES: return pscreen->get_param(pscreen, PIPE_CAP_SM3); default: diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 59fa82b427f..01072581883 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -536,6 +536,8 @@ The integer capabilities: * ``PIPE_CAP_TGSI_DIV``: Whether opcode DIV is supported * ``PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD``: Whether texture lookups with explicit LOD is supported in the fragment shader. +* ``PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES``: True if the driver supports + derivatives in fragment shaders. .. _pipe_capf: diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 8092fca4df1..1ce2d131195 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -889,6 +889,7 @@ enum pipe_cap PIPE_CAP_ATOMIC_FLOAT_MINMAX, PIPE_CAP_TGSI_DIV, PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD, + PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES, }; /** diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 3611cdcd5fd..3b771081592 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -776,7 +776,7 @@ void st_init_extensions(struct pipe_screen *screen, /* GL_NV_point_sprite is not supported by gallium because we don't * support the GL_POINT_SPRITE_R_MODE_NV option. */ - { o(OES_standard_derivatives), PIPE_CAP_SM3 }, + { o(OES_standard_derivatives), PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES }, { 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 }, -- 2.30.2