gallium: add PIPE_CAP_ESSL_FEATURE_LEVEL
authorRob Clark <robdclark@gmail.com>
Thu, 21 Mar 2019 12:56:17 +0000 (08:56 -0400)
committerRob Clark <robdclark@gmail.com>
Fri, 22 Mar 2019 20:39:13 +0000 (16:39 -0400)
Adds a new cap to allow drivers to expose higher shading language
versions in GLES contexts, to avoid having to report an artificially
low version for the benefit of GL contexts.

The motivation is to expose EXT_gpu_shader5 even though a driver may
not support all the features needed for the corresponding GL extension
(ARB_gpu_shader5).

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/auxiliary/util/u_screen.c
src/gallium/docs/source/screen.rst
src/gallium/include/pipe/p_defines.h

index b902c083ad441ce081ec440aba22ef85a9dec154..9f0be8060ee12d1d18e21dd9334ff64d0bda628d 100644 (file)
@@ -107,6 +107,10 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
       /* Minimum GLSL level implemented by gallium drivers. */
       return 120;
 
+   case PIPE_CAP_ESSL_FEATURE_LEVEL:
+      /* Tell state-tracker to fallback to PIPE_CAP_GLSL_FEATURE_LEVEL */
+      return 0;
+
    case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
    case PIPE_CAP_USER_VERTEX_BUFFERS:
    case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
index 60ba9bcbde01f67457d3e6a28cc9b097ff0bf065..a4d6a9557c0a1b3f8945fc3699491af8c19333cd 100644 (file)
@@ -105,6 +105,15 @@ The integer capabilities:
   The only legacy features that Gallium drivers must implement are
   the legacy shader inputs and outputs (colors, texcoords, fog, clipvertex,
   edgeflag).
+* ``PIPE_CAP_ESSL_FEATURE_LEVEL``: An optional cap to allow drivers to
+  report a higher GLSL version for GLES contexts.  This is useful when a
+  driver does not support all the required features for a higher GL version,
+  but does support the required features for a higher GLES version.  A driver
+  is allowed to return ``0`` in which case ``PIPE_CAP_GLSL_FEATURE_LEVEL`` is
+  used.
+  Note that simply returning the same value as the GLSL feature level cap is
+  incorrect.  For example, GLSL version 3.30 does not require ``ARB_gpu_shader5``,
+  but ESSL version 3.20 es does require ``EXT_gpu_shader5``
 * ``PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION``: Whether quads adhere to
   the flatshade_first setting in ``pipe_rasterizer_state``.
 * ``PIPE_CAP_USER_VERTEX_BUFFERS``: Whether the driver supports user vertex
index ebc44d7a75e429b7f5eecc153b9ba7ba1137916f..3dbdea035e4956d3b1f2c665229446d0afc25689 100644 (file)
@@ -718,6 +718,7 @@ enum pipe_cap
    PIPE_CAP_VERTEX_COLOR_CLAMPED,
    PIPE_CAP_GLSL_FEATURE_LEVEL,
    PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY,
+   PIPE_CAP_ESSL_FEATURE_LEVEL,
    PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION,
    PIPE_CAP_USER_VERTEX_BUFFERS,
    PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY,