pan/bi: Handle non-2D arrays
authorAlyssa Rosenzweig <alyssa@collabora.com>
Sat, 5 Mar 2022 20:49:43 +0000 (15:49 -0500)
committerMarge Bot <emma+marge@anholt.net>
Sat, 12 Mar 2022 17:34:01 +0000 (17:34 +0000)
Handle arrays generically by using the last component of the coordinate source
as the array index. That works for both 2D arrays and cube arrays, fixing cube
arrays. Cube arrays were already handled correctly in core Panfrost code.

This code path is not tested in dEQP-GLES31 without exposing OES_cube_map_array,
which depends on OES_geometry_shader, which we don't have. Yet we do expose
PIPE_CAP_CUBE_ARRAY, so ARB_cube_map_array is exposed.

Disabling PIPE_CAP_CUBE_ARRAY would be an easy band-aid fix, but it's easy
enough to handle correctly.

dEQP-GLES31 passes with a hack enabling OES_cube_map_array [without geometry
shaders].

Also fixes 1D arrays on Bifrost for the same reasons.

Fixes: 70d6c5675d6 ("pan/bi: Emit TEXC with builder")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15254>

src/panfrost/bifrost/bifrost_compile.c
src/panfrost/ci/panfrost-g52-fails.txt

index e58e1ee..4f04ea8 100644 (file)
@@ -2815,6 +2815,7 @@ bi_emit_texc(bi_builder *b, nir_tex_instr *instr)
         for (unsigned i = 0; i < instr->num_srcs; ++i) {
                 bi_index index = bi_src_index(&instr->src[i].src);
                 unsigned sz = nir_src_bit_size(instr->src[i].src);
+                unsigned components = nir_src_num_components(instr->src[i].src);
                 ASSERTED nir_alu_type base = nir_tex_instr_src_type(instr, i);
                 nir_alu_type T = base | sz;
 
@@ -2823,27 +2824,25 @@ bi_emit_texc(bi_builder *b, nir_tex_instr *instr)
                         if (instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE) {
                                 cx = bi_emit_texc_cube_coord(b, index, &cy);
                        } else {
-                                unsigned components = nir_src_num_components(instr->src[i].src);
-
                                 /* Copy XY (for 2D+) or XX (for 1D) */
                                 cx = index;
                                 cy = bi_word(index, MIN2(1, components - 1));
 
                                 assert(components >= 1 && components <= 3);
 
-                                if (components < 3) {
-                                        /* nothing to do */
-                                } else if (desc.array) {
-                                        /* 2D array */
-                                        dregs[BIFROST_TEX_DREG_ARRAY] =
-                                                bi_emit_texc_array_index(b,
-                                                                bi_word(index, 2), T);
-                                } else {
+                                if (components == 3 && !desc.array) {
                                         /* 3D */
                                         dregs[BIFROST_TEX_DREG_Z_COORD] =
                                                 bi_word(index, 2);
                                 }
                         }
+
+                        if (desc.array) {
+                                dregs[BIFROST_TEX_DREG_ARRAY] =
+                                                bi_emit_texc_array_index(b,
+                                                                bi_word(index, components - 1), T);
+                        }
+
                         break;
 
                 case nir_tex_src_lod:
index 95d7a3e..5898cd6 100644 (file)
@@ -73,8 +73,6 @@ spec@arb_get_program_binary@restore-sso-program,Fail
 spec@arb_pixel_buffer_object@fbo-pbo-readpixels-small,Fail
 spec@arb_pixel_buffer_object@fbo-pbo-readpixels-small@GL_DEPTH32F_STENCIL8-GL_DEPTH_STENCIL,Fail
 spec@arb_pixel_buffer_object@fbo-pbo-readpixels-small@GL_DEPTH32F_STENCIL8-GL_STENCIL_INDEX,Fail
-spec@arb_pixel_buffer_object@texsubimage array pbo,Fail
-spec@arb_pixel_buffer_object@texsubimage cube_map_array pbo,Fail
 spec@arb_point_sprite@arb_point_sprite-checkerboard,Fail
 spec@arb_point_sprite@arb_point_sprite-mipmap,Fail
 spec@arb_sample_shading@samplemask 2@0.250000 mask_in_one,Fail
@@ -115,10 +113,6 @@ spec@arb_shading_language_420pack@active sampler conflict,Crash
 spec@arb_texture_buffer_object@formats (fs- arb),Crash
 spec@arb_texture_buffer_object@formats (vs- arb),Crash
 spec@arb_texture_buffer_object@render-no-bo,Crash
-spec@arb_texture_cube_map_array@arb_texture_cube_map_array-cubemap,Fail
-spec@arb_texture_cube_map_array@arb_texture_cube_map_array-cubemap-lod,Fail
-spec@arb_texture_cube_map_array@arb_texture_cube_map_array-fbo-cubemap-array,Fail
-spec@arb_texture_cube_map_array@texsubimage cube_map_array,Fail
 spec@arb_texture_cube_map_array@texturesize@fs-texturesize-isamplercubearray,Fail
 spec@arb_texture_cube_map_array@texturesize@fs-texturesize-samplercubearray,Fail
 spec@arb_texture_cube_map_array@texturesize@fs-texturesize-samplercubearrayshadow,Fail
@@ -137,117 +131,6 @@ spec@arb_texture_float@fbo-generatemipmap-formats@GL_INTENSITY16F_ARB,Fail
 spec@arb_texture_float@fbo-generatemipmap-formats@GL_INTENSITY16F_ARB NPOT,Fail
 spec@arb_texture_float@multisample-formats 2 gl_arb_texture_float,Fail
 spec@arb_texture_float@multisample-formats 4 gl_arb_texture_float,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-alpha-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-alpha-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-alpha-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-alpha-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-blue-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-blue-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-blue-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-blue-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-green-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-green-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-green-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-green-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-none-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-none-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-none-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-none-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-red-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-red-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-red-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgba-red-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-blue-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-blue-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-blue-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-blue-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-green-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-green-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-green-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-green-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-none-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-none-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-none-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-none-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-red-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-red-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-red-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rgb-red-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-green-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-green-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-green-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-green-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-none-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-none-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-none-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-none-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-red-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-red-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-red-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-rg-red-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-r-none-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-r-none-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-r-none-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-r-red-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-r-red-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-r-red-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@fs-r-red-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-alpha-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-alpha-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-alpha-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-alpha-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-blue-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-blue-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-blue-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-blue-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-green-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-green-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-green-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-green-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-none-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-none-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-none-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-none-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-red-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-red-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-red-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgba-red-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-blue-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-blue-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-blue-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-blue-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-green-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-green-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-green-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-green-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-none-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-none-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-none-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-none-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-red-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-red-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-red-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rgb-red-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-green-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-green-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-green-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-green-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-none-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-none-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-none-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-none-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-red-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-red-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-red-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-rg-red-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-r-none-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-r-none-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-r-none-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-r-none-unorm-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-r-red-float-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-r-red-int-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-r-red-uint-cubearray,Fail
-spec@arb_texture_gather@texturegather@vs-r-red-unorm-cubearray,Fail
 spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch,Fail
 spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R16I,Fail
 spec@arb_texture_multisample@arb_texture_multisample-dsa-texelfetch@Texture type: GL_R16_SNORM,Fail
@@ -364,18 +247,6 @@ spec@ext_framebuffer_object@fbo-colormask-formats@GL_LUMINANCE,Fail
 spec@ext_framebuffer_object@fbo-fast-clear,Fail
 spec@ext_framebuffer_object@getteximage-formats init-by-clear-and-render,Fail
 spec@ext_framebuffer_object@getteximage-formats init-by-rendering,Fail
-spec@ext_gpu_shader4@execution@texelfetch@fs-texelfetch-isampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetch@fs-texelfetch-sampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetch@fs-texelfetch-usampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetchoffset@fs-texelfetch-isampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetchoffset@fs-texelfetch-sampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetchoffset@fs-texelfetch-usampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetchoffset@vs-texelfetch-isampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetchoffset@vs-texelfetch-sampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetchoffset@vs-texelfetch-usampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetch@vs-texelfetch-isampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetch@vs-texelfetch-sampler1darray,Fail
-spec@ext_gpu_shader4@execution@texelfetch@vs-texelfetch-usampler1darray,Fail
 spec@ext_image_dma_buf_import@ext_image_dma_buf_import-export,Crash
 spec@ext_image_dma_buf_import@ext_image_dma_buf_import-invalid_attributes,Crash
 spec@ext_image_dma_buf_import@ext_image_dma_buf_import-invalid_hints,Crash
@@ -401,13 +272,6 @@ spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yuv420,Crash
 spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yuyv,Crash
 spec@ext_image_dma_buf_import@ext_image_dma_buf_import-sample_yvu420,Crash
 spec@ext_image_dma_buf_import@ext_image_dma_buf_import-unsupported_format,Crash
-spec@ext_texture_array@array-texture,Fail
-spec@ext_texture_array@copyteximage 1d_array,Fail
-spec@ext_texture_array@copyteximage 1d_array samples=2,Fail
-spec@ext_texture_array@copyteximage 1d_array samples=4,Fail
-spec@ext_texture_array@fbo-generatemipmap-array,Fail
-spec@ext_texture_array@fbo-generatemipmap-array rgb9_e5,Fail
-spec@ext_texture_array@texsubimage array,Fail
 spec@ext_texture_compression_rgtc@rgtc-teximage-01,Fail
 spec@ext_texture_compression_rgtc@rgtc-teximage-02,Fail
 spec@ext_texture_srgb@fbo-fast-clear,Fail
@@ -540,47 +404,14 @@ spec@glsl-1.10@execution@varying-packing@simple vec3 separate,Fail
 spec@glsl-1.10@execution@varying-packing@simple vec4 array,Fail
 spec@glsl-1.10@execution@varying-packing@simple vec4 arrays_of_arrays,Fail
 spec@glsl-1.30@execution@clipping@clip-plane-transformation pos,Fail
-spec@glsl-1.30@execution@texelfetch@fs-texelfetch-isampler1darray,Fail
-spec@glsl-1.30@execution@texelfetch@fs-texelfetch-sampler1darray,Fail
-spec@glsl-1.30@execution@texelfetch@fs-texelfetch-usampler1darray,Fail
-spec@glsl-1.30@execution@texelfetchoffset@fs-texelfetch-isampler1darray,Fail
-spec@glsl-1.30@execution@texelfetchoffset@fs-texelfetch-sampler1darray,Fail
-spec@glsl-1.30@execution@texelfetchoffset@fs-texelfetch-usampler1darray,Fail
-spec@glsl-1.30@execution@texelfetchoffset@vs-texelfetch-isampler1darray,Fail
-spec@glsl-1.30@execution@texelfetchoffset@vs-texelfetch-sampler1darray,Fail
-spec@glsl-1.30@execution@texelfetchoffset@vs-texelfetch-usampler1darray,Fail
-spec@glsl-1.30@execution@texelfetch@vs-texelfetch-isampler1darray,Fail
-spec@glsl-1.30@execution@texelfetch@vs-texelfetch-sampler1darray,Fail
-spec@glsl-1.30@execution@texelfetch@vs-texelfetch-usampler1darray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texture() 1darray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texture() 1darrayshadow,Fail
 spec@glsl-1.30@execution@tex-miplevel-selection texture() 2drect,Crash
 spec@glsl-1.30@execution@tex-miplevel-selection texture() 2drectshadow,Crash
-spec@glsl-1.30@execution@tex-miplevel-selection texture(bias) 1darray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texture(bias) 1darrayshadow,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texture(bias) cubearray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texture() cubearray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texture() cubearrayshadow,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texturegrad 1darray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texturegrad 1darrayshadow,Fail
 spec@glsl-1.30@execution@tex-miplevel-selection texturegrad 2drect,Crash
 spec@glsl-1.30@execution@tex-miplevel-selection texturegrad 2drectshadow,Crash
-spec@glsl-1.30@execution@tex-miplevel-selection texturegrad cubearray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texturegradoffset 1darray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texturegradoffset 1darrayshadow,Fail
 spec@glsl-1.30@execution@tex-miplevel-selection texturegradoffset 2drect,Crash
 spec@glsl-1.30@execution@tex-miplevel-selection texturegradoffset 2drectshadow,Crash
-spec@glsl-1.30@execution@tex-miplevel-selection texturelod 1darray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texturelod 1darrayshadow,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texturelod cubearray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texturelodoffset 1darray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection texturelodoffset 1darrayshadow,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection textureoffset 1darray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection textureoffset 1darrayshadow,Fail
 spec@glsl-1.30@execution@tex-miplevel-selection textureoffset 2drect,Crash
 spec@glsl-1.30@execution@tex-miplevel-selection textureoffset 2drectshadow,Crash
-spec@glsl-1.30@execution@tex-miplevel-selection textureoffset(bias) 1darray,Fail
-spec@glsl-1.30@execution@tex-miplevel-selection textureoffset(bias) 1darrayshadow,Fail
 spec@glsl-1.30@execution@tex-miplevel-selection textureproj 2drect,Crash
 spec@glsl-1.30@execution@tex-miplevel-selection textureproj 2drect_projvec4,Crash
 spec@glsl-1.30@execution@tex-miplevel-selection textureproj 2drectshadow,Crash