gallium: give fragment-shader derivatives its own cap
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 5 Jul 2019 14:08:19 +0000 (16:08 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 10 Jul 2019 13:49:57 +0000 (15:49 +0200)
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 <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/util/u_screen.c
src/gallium/docs/source/screen.rst
src/gallium/include/pipe/p_defines.h
src/mesa/state_tracker/st_extensions.c

index 5baf7d72fb16f5c1da1287bdcc81c3a10dab7f53..4b57c0c6342d8f866b36dca1bd44f80476e3ee8f 100644 (file)
@@ -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:
index 59fa82b427f8f96bd929660724d8305836a3f848..010725818830e84a5b842985ce0078e7ee4a6bd6 100644 (file)
@@ -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:
 
index 8092fca4df17c6847e74f052f1e365bb8aa7de2d..1ce2d131195eb36a77491792d25970403434d296 100644 (file)
@@ -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,
 };
 
 /**
index 3611cdcd5fdec13e10c39f1ed6750a86f76259bd..3b771081592d6f18ab0a55fbbeb2aefe4b33c277 100644 (file)
@@ -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              },