gallium: Implement GL_EXT_shader_samples_identical via a new capability
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 31 Jul 2019 22:47:34 +0000 (15:47 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 2 Aug 2019 06:38:54 +0000 (23:38 -0700)
This exposes the textureSamplesIdenticalEXT function in GLSL.

We enable it for iris and radeonsi, because their compilers already
have support for this.  Tested on Intel Kabylake and AMD Vega 64.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
docs/relnotes/19.2.0.html
src/gallium/auxiliary/util/u_screen.c
src/gallium/docs/source/screen.rst
src/gallium/drivers/iris/iris_screen.c
src/gallium/drivers/radeonsi/si_get.c
src/gallium/include/pipe/p_defines.h
src/mesa/state_tracker/st_extensions.c

index 20eb8d3d04f5a52dae3b5f80de8749140b93b27c..2d1c39a81af42e0448dbf587ededfec749692cbc 100644 (file)
@@ -40,6 +40,7 @@ TBD.
 
 <ul>
 <li>GL_ARB_post_depth_coverage on radeonsi (Navi)</li>
+<li>GL_EXT_shader_samples_identical on iris and radeonsi (if using NIR)</li>
 <li>EGL_EXT_platform_device</li>
 <li>VK_EXT_queue_family_foreign for radv</li>
 <li>VK_EXT_shader_demote_to_helper_invocation on Intel.</li>
index fec4a10c539064690d30028a98563dad1d3bdaeb..270d13a5056c566cee38119dfff6a1707f0067e2 100644 (file)
@@ -335,6 +335,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
    case PIPE_CAP_FRAGMENT_SHADER_INTERLOCK:
    case PIPE_CAP_CS_DERIVED_SYSTEM_VALUES_SUPPORTED:
    case PIPE_CAP_ATOMIC_FLOAT_MINMAX:
+   case PIPE_CAP_SHADER_SAMPLES_IDENTICAL:
       return 0;
 
    case PIPE_CAP_MAX_GS_INVOCATIONS:
index 065eb8fd2f172ccf2e93abc4a683182aa55c633f..3a1bb3e02eca6299718241653ffa108608a2e625 100644 (file)
@@ -546,6 +546,7 @@ The integer capabilities:
   modifiers in the vertex shader.
 * ``PIPE_CAP_TEXTURE_SHADOW_LOD``: True if the driver supports shadow sampler
   types with texture functions having interaction with LOD of texture lookup.
+* ``PIPE_CAP_SHADER_SAMPLES_IDENTICAL``: True if the driver supports a shader query to tell whether all samples of a multisampled surface are definitely identical.
 
 .. _pipe_capf:
 
index 9aea9e963c2dfa56f8ebeeb1ed0f25acc9ed0b16..092328967012683e626ae918fe851b629e096ac1 100644 (file)
@@ -198,6 +198,7 @@ iris_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
    case PIPE_CAP_CS_DERIVED_SYSTEM_VALUES_SUPPORTED:
    case PIPE_CAP_TEXTURE_SHADOW_LOD:
+   case PIPE_CAP_SHADER_SAMPLES_IDENTICAL:
       return true;
    case PIPE_CAP_FBFETCH:
       /* TODO: Support non-coherent FB fetch on Broadwell */
index 85807db0e1c8b2aa6893b0ad8592c424c910cc4b..15777392555c905d1a3100778ea86aab9b6fac76 100644 (file)
@@ -214,6 +214,7 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
                                RADEON_SPARSE_PAGE_SIZE : 0;
 
        case PIPE_CAP_PACKED_UNIFORMS:
+       case PIPE_CAP_SHADER_SAMPLES_IDENTICAL:
                if (sscreen->options.enable_nir)
                        return 1;
                return 0;
index c706f9819f8b23f08687e4e1daed1cc1f2f66daa..9662cf63b82d9a5666ea7e3144d6a3872be7c02d 100644 (file)
@@ -895,6 +895,7 @@ enum pipe_cap
    PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES,
    PIPE_CAP_VERTEX_SHADER_SATURATE,
    PIPE_CAP_TEXTURE_SHADOW_LOD,
+   PIPE_CAP_SHADER_SAMPLES_IDENTICAL,
 };
 
 /**
index 72a6d843ae9895a65c138e32424388028f257db0..c146c8d99028c17ec440fc76cf6c80ab082ef71a 100644 (file)
@@ -752,6 +752,7 @@ void st_init_extensions(struct pipe_screen *screen,
       { o(EXT_multisampled_render_to_texture), PIPE_CAP_SURFACE_SAMPLE_COUNT           },
       { o(EXT_semaphore),                    PIPE_CAP_FENCE_SIGNAL                     },
       { o(EXT_semaphore_fd),                 PIPE_CAP_FENCE_SIGNAL                     },
+      { o(EXT_shader_samples_identical),     PIPE_CAP_SHADER_SAMPLES_IDENTICAL         },
       { o(EXT_texture_array),                PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS         },
       { o(EXT_texture_filter_anisotropic),   PIPE_CAP_ANISOTROPIC_FILTER               },
       { o(EXT_texture_mirror_clamp),         PIPE_CAP_TEXTURE_MIRROR_CLAMP             },