diff options
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 3f0ea05b79..dd0053f212 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -186,50 +186,18 @@ texture_dims(enum pipe_texture_target tex) } -static LLVMValueRef -lp_build_swizzle_chan_soa(struct lp_type type, - const LLVMValueRef *unswizzled, - enum util_format_swizzle swizzle) -{ - switch (swizzle) { - case PIPE_SWIZZLE_RED: - case PIPE_SWIZZLE_GREEN: - case PIPE_SWIZZLE_BLUE: - case PIPE_SWIZZLE_ALPHA: - return unswizzled[swizzle]; - case PIPE_SWIZZLE_ZERO: - return lp_build_zero(type); - case PIPE_SWIZZLE_ONE: - return lp_build_one(type); - default: - assert(0); - return lp_build_undef(type); - } -} - - static void -lp_build_swizzle_soa(struct lp_build_sample_context *bld, - LLVMValueRef *texel) +apply_sampler_swizzle(struct lp_build_sample_context *bld, + LLVMValueRef *texel) { - LLVMValueRef unswizzled[4]; unsigned char swizzles[4]; - unsigned chan; - - for (chan = 0; chan < 4; ++chan) { - unswizzled[chan] = texel[chan]; - } swizzles[0] = bld->static_state->swizzle_r; swizzles[1] = bld->static_state->swizzle_g; swizzles[2] = bld->static_state->swizzle_b; swizzles[3] = bld->static_state->swizzle_a; - for (chan = 0; chan < 4; ++chan) { - unsigned swizzle = swizzles[chan]; - texel[chan] = lp_build_swizzle_chan_soa(bld->texel_type, - unswizzled, swizzle); - } + lp_build_swizzle_soa_inplace(&bld->texel_bld, texel, swizzles); } @@ -345,7 +313,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, i, j, texel); - lp_build_swizzle_soa(bld, texel); + apply_sampler_swizzle(bld, texel); /* * Note: if we find an app which frequently samples the texture border @@ -2023,10 +1991,10 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, packed, unswizzled); lp_build_format_swizzle_soa(bld->format_desc, - bld->texel_type, unswizzled, - texel); + &bld->texel_bld, + unswizzled, texel); - lp_build_swizzle_soa(bld, texel); + apply_sampler_swizzle(bld, texel); } |