llvmpipe: only read 0 for channels being read
[mesa.git] / 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 */
-   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],