From 4ff02b3edddbb4024c6dc349973f60f5ba4886d6 Mon Sep 17 00:00:00 2001 From: Krzysztof Raszkowski Date: Fri, 31 May 2019 13:33:32 +0200 Subject: [PATCH] swr: fix support for GL_ARB_copy_image extension 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 --- docs/features.txt | 2 +- src/gallium/drivers/swr/swr_screen.cpp | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/features.txt b/docs/features.txt index f379f53bf2f..06f8edb94ca 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -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) diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index 0164611a508..5789af152fb 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -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: -- 2.30.2