swr: fix support for GL_ARB_copy_image extension
authorKrzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Fri, 31 May 2019 11:33:32 +0000 (13:33 +0200)
committerKrzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Wed, 5 Jun 2019 15:26:47 +0000 (15:26 +0000)
This commit fix support and adjusts the capabilities
returned by the SWR driver and the documentation
to correctly report the GL_ARB_copy_image extension.

Reviewed-by: Alok Hota <alok.hota@intel.com>
docs/features.txt
src/gallium/drivers/swr/swr_screen.cpp

index f379f53bf2f21446f46d5b5d27890fd10098c272..06f8edb94ca24aed77912fb5800d106b758dc69e 100644 (file)
@@ -171,7 +171,7 @@ GL 4.3, GLSL 4.30 -- all DONE: i965/gen8+, nvc0, r600, radeonsi, virgl
   GL_ARB_ES3_compatibility                              DONE (all drivers that support GLSL 3.30)
   GL_ARB_clear_buffer_object                            DONE (all drivers)
   GL_ARB_compute_shader                                 DONE (freedreno/a5xx+, i965, softpipe)
-  GL_ARB_copy_image                                     DONE (i965, nv50, softpipe, llvmpipe)
+  GL_ARB_copy_image                                     DONE (i965, nv50, softpipe, llvmpipe, swr)
   GL_KHR_debug                                          DONE (all drivers)
   GL_ARB_explicit_uniform_location                      DONE (all drivers that support GLSL)
   GL_ARB_fragment_layer_viewport                        DONE (i965, nv50, llvmpipe, softpipe)
index 0164611a508d2407924de67c82da4a6ccef0bae1..5789af152fb8d8f53e8c1c2ba02d5cc6e8480622 100644 (file)
@@ -152,6 +152,21 @@ swr_is_format_supported(struct pipe_screen *_screen,
       return FALSE;
    }
 
+   if ((bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW)) &&
+       ((bind & PIPE_BIND_DISPLAY_TARGET) == 0)) {
+      /* Disable all 3-channel formats, where channel size != 32 bits.
+       * In some cases we run into crashes (in generate_unswizzled_blend()),
+       * for 3-channel RGB16 variants, there was an apparent LLVM bug.
+       * In any case, disabling the shallower 3-channel formats avoids a
+       * number of issues with GL_ARB_copy_image support.
+       */
+      if (format_desc->is_array &&
+          format_desc->nr_channels == 3 &&
+          format_desc->block.bits != 96) {
+         return FALSE;
+      }
+   }
+
    return TRUE;
 }
 
@@ -257,6 +272,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_CUBE_MAP_ARRAY:
    case PIPE_CAP_DOUBLES:
    case PIPE_CAP_TEXTURE_QUERY_LOD:
+   case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
       return 1;
 
    /* MSAA support
@@ -300,7 +316,6 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TGSI_TXQS:
    case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
    case PIPE_CAP_SHAREABLE_SHADERS:
-   case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
    case PIPE_CAP_DRAW_PARAMETERS:
    case PIPE_CAP_TGSI_PACK_HALF_FLOAT:
    case PIPE_CAP_MULTI_DRAW_INDIRECT: