gallium: Add a PIPE_CAP_NIR_COMPACT_ARRAYS capability bit.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 23 Jan 2019 10:04:01 +0000 (02:04 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 5 Feb 2019 21:58:46 +0000 (13:58 -0800)
Iris would like to use compact arrays for tesslevels and clip/cull
distances.  radeonsi will likely want to switch to these at some point,
since it'll be necessary for GL_ARB_gl_spirv support, but it's not ready
for them just yet.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.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 464d9dddc7fde3103123d0edbb862b51228b79a0..e9603916458dee6a14c310c16d7bc509f7467d08 100644 (file)
@@ -289,6 +289,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
    case PIPE_CAP_POST_DEPTH_COVERAGE:
    case PIPE_CAP_BINDLESS_TEXTURE:
    case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
+   case PIPE_CAP_NIR_COMPACT_ARRAYS:
    case PIPE_CAP_QUERY_SO_OVERFLOW:
    case PIPE_CAP_MEMOBJ:
    case PIPE_CAP_LOAD_CONSTBUF:
index eaf492ce8b0bf768b70ce13a8fd06f87280c5c54..8bf4a1ab54b17f3ef500df65526e5263a5e3ce41 100644 (file)
@@ -487,6 +487,7 @@ The integer capabilities:
 * ``PIPE_CAP_DEST_SURFACE_SRGB_CONTROL``: Indicates whether the drivers
   supports switching the format between sRGB and linear for a surface that is
   used as destination in draw and blit calls.
+* ``PIPE_CAP_NIR_COMPACT_ARRAYS``: True if the compiler backend supports NIR's compact array feature, for all shader stages.
 
 .. _pipe_capf:
 
index 1f2a3469cc933c06549afe788c237c86f6197253..8413a8e639c4913cdf18a96bd682426666f670f9 100644 (file)
@@ -856,6 +856,7 @@ enum pipe_cap
    PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE,
    PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND,
    PIPE_CAP_DEST_SURFACE_SRGB_CONTROL,
+   PIPE_CAP_NIR_COMPACT_ARRAYS,
 };
 
 /**
index 3449b2a964504e10839b2d67ea315d86670d01f1..c1a528551cd285f4558e42c9a63bf75b89cb3a7a 100644 (file)
@@ -321,7 +321,9 @@ void st_init_limits(struct pipe_screen *screen,
             screen->get_shader_param(screen, sh,
                                   PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT);
 
-      options->LowerCombinedClipCullDistance = true;
+      if (!screen->get_param(screen, PIPE_CAP_NIR_COMPACT_ARRAYS))
+         options->LowerCombinedClipCullDistance = true;
+
       options->LowerBufferInterfaceBlocks = true;
    }
 
@@ -336,7 +338,8 @@ void st_init_limits(struct pipe_screen *screen,
       screen->get_param(screen, PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY);
    c->GLSLTessLevelsAsInputs =
       screen->get_param(screen, PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS);
-   c->LowerTessLevel = true;
+   c->LowerTessLevel =
+      !screen->get_param(screen, PIPE_CAP_NIR_COMPACT_ARRAYS);
    c->LowerCsDerivedVariables = true;
    c->PrimitiveRestartForPatches =
       screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES);