lavapipe: fix fsum with swizzle
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 7 May 2021 12:04:14 +0000 (14:04 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 7 May 2021 18:48:28 +0000 (18:48 +0000)
We can do stuff like this:

vec1 32 ssa_207 = fsum3 ssa_209.xxx

In this case, we'd end up not swizzling in get_alu_src, and reading
components out-of-bounds, which LLVM isn't very happy about, and thus
takes punitive actions, in the form of a segfault.

We don't want that, and we already know from the opcode what the
component counts should be here.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10690>

src/gallium/auxiliary/gallivm/lp_bld_nir.c
src/gallium/drivers/zink/ci/piglit-zink-lvp-fails.txt

index 5ac3e76..51c6ecb 100644 (file)
@@ -1004,7 +1004,7 @@ static void visit_alu(struct lp_build_nir_context *bld_base, const nir_alu_instr
    case nir_op_fsum2:
    case nir_op_fsum3:
    case nir_op_fsum4:
-      src_components = nir_src_num_components(instr->src[0].src);
+      src_components = nir_op_infos[instr->op].input_sizes[0];
       break;
    default:
       src_components = num_components;
index 5b6ec47..46dc88d 100644 (file)
@@ -64,7 +64,6 @@ spec@!opengl 3.2@gl-3.2-adj-prims pv-first,Fail
 spec@!opengl es 2.0@glsl-fs-pointcoord,Fail
 spec@!opengl es 3.0@gles-3.0-transform-feedback-uniform-buffer-object,Fail
 spec@arb_depth_texture@depth-tex-modes,Fail
-spec@arb_fragment_program@fp-abs-01,Crash
 spec@arb_framebuffer_object@fbo-blit-scaled-linear,Fail
 spec@arb_framebuffer_object@fbo-gl_pointcoord,Fail
 spec@arb_get_program_binary@restore-sso-program,Fail