diff options
author | Dave Airlie <[email protected]> | 2019-12-03 13:41:56 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2019-12-12 09:16:28 +1000 |
commit | bf2904010341e31d0d66954fcbd88da4da4e1cdd (patch) | |
tree | 6bd7256781abade95ec58d564014b1109720d68f /src/gallium/auxiliary | |
parent | e35b2c37cd2c419ae92308cda49cc02fab823f8a (diff) |
gallivm: fix transpose for when first channel isn't created
The previous fix worked when the second channel wasn't exposed, but
a couple of piglit tests have inputs with just the y/z chans, no x/w.
Partly Fixes piglit ext_transform_feedback-immediate-reuse-index-buffer
with llvmpipe/nir
Fixes: 5363cda52b84 ("gallivm: add swizzle support where one channel isn't defined.")
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_swizzle.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c index 24fbd9a5a78..b648e681994 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c @@ -662,23 +662,29 @@ lp_build_transpose_aos(struct gallivm_state *gallivm, LLVMValueRef double_type_zero = LLVMConstNull(double_type); /* Interleave x, y, z, w -> xy and zw */ - if (src[0]) { + if (src[0] || src[1]) { + LLVMValueRef src0 = src[0]; LLVMValueRef src1 = src[1]; + if (!src0) + src0 = LLVMConstNull(single_type); if (!src1) src1 = LLVMConstNull(single_type); - t0 = lp_build_interleave2_half(gallivm, single_type_lp, src[0], src1, 0); - t2 = lp_build_interleave2_half(gallivm, single_type_lp, src[0], src1, 1); + t0 = lp_build_interleave2_half(gallivm, single_type_lp, src0, src1, 0); + t2 = lp_build_interleave2_half(gallivm, single_type_lp, src0, src1, 1); /* Cast to double width type for second interleave */ t0 = LLVMBuildBitCast(gallivm->builder, t0, double_type, "t0"); t2 = LLVMBuildBitCast(gallivm->builder, t2, double_type, "t2"); } - if (src[2]) { + if (src[2] || src[3]) { + LLVMValueRef src2 = src[2]; LLVMValueRef src3 = src[3]; + if (!src2) + src2 = LLVMConstNull(single_type); if (!src3) src3 = LLVMConstNull(single_type); - t1 = lp_build_interleave2_half(gallivm, single_type_lp, src[2], src3, 0); - t3 = lp_build_interleave2_half(gallivm, single_type_lp, src[2], src3, 1); + t1 = lp_build_interleave2_half(gallivm, single_type_lp, src2, src3, 0); + t3 = lp_build_interleave2_half(gallivm, single_type_lp, src2, src3, 1); /* Cast to double width type for second interleave */ t1 = LLVMBuildBitCast(gallivm->builder, t1, double_type, "t1"); |