llvmpipe: only read 0 for channels being read
authorDave Airlie <airlied@redhat.com>
Wed, 12 Aug 2020 05:48:42 +0000 (15:48 +1000)
committerMarge Bot <eric+marge@anholt.net>
Sun, 16 Aug 2020 06:08:34 +0000 (06:08 +0000)
KHR-GL45.robust_buffer_access_behavior.vertex_buffer_objects
on the CTS 4.6.0 branch and this fixes it.

Roland identified that if the vertex format doesn't contain channels
then we shouldn't be overriding them to 0, so RGB fetch out of bounds
should return 0 for RGB, but the A channel should still be getting back
1.

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6287>

src/gallium/auxiliary/draw/draw_llvm.c

index 845ed6242b1031a8a2595adc084734d3f3601f42..22644aa5eabcd46b12dd0787f6492a8e110b78e3 100644 (file)
@@ -1128,7 +1128,7 @@ fetch_vector(struct gallivm_state *gallivm,
    }
 
    /* out-of-bound fetches return all zeros */
    }
 
    /* out-of-bound fetches return all zeros */
-   for (i = 0; i < TGSI_NUM_CHANNELS; i++) {
+   for (i = 0; i < format_desc->nr_channels; i++) {
       inputs[i] = LLVMBuildBitCast(builder, inputs[i], blduivec.vec_type, "");
       inputs[i] = LLVMBuildAnd(builder, inputs[i], valid_mask, "");
       inputs[i] = LLVMBuildBitCast(builder, inputs[i],
       inputs[i] = LLVMBuildBitCast(builder, inputs[i], blduivec.vec_type, "");
       inputs[i] = LLVMBuildAnd(builder, inputs[i], valid_mask, "");
       inputs[i] = LLVMBuildBitCast(builder, inputs[i],