summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_const.c19
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_const.h7
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c6
3 files changed, 30 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c b/src/gallium/auxiliary/gallivm/lp_bld_const.c
index 6d8b7c26fc8..77ec1a70860 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.c
@@ -409,3 +409,22 @@ lp_build_const_mask_aos(struct gallivm_state *gallivm,
return LLVMConstVector(masks, type.length);
}
+
+
+/**
+ * Performs lp_build_const_mask_aos, but first swizzles the mask
+ */
+LLVMValueRef
+lp_build_const_mask_aos_swizzled(struct gallivm_state *gallivm,
+ struct lp_type type,
+ unsigned mask,
+ const unsigned char *swizzle)
+{
+ mask =
+ ((mask & (1 << swizzle[0])) >> swizzle[0])
+ | (((mask & (1 << swizzle[1])) >> swizzle[1]) << 1)
+ | (((mask & (1 << swizzle[2])) >> swizzle[2]) << 2)
+ | (((mask & (1 << swizzle[3])) >> swizzle[3]) << 3);
+
+ return lp_build_const_mask_aos(gallivm, type, mask);
+}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.h b/src/gallium/auxiliary/gallivm/lp_bld_const.h
index 69718eb4b3d..fd398516952 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.h
@@ -111,6 +111,13 @@ lp_build_const_mask_aos(struct gallivm_state *gallivm,
unsigned mask);
+LLVMValueRef
+lp_build_const_mask_aos_swizzled(struct gallivm_state *gallivm,
+ struct lp_type type,
+ unsigned mask,
+ const unsigned char *swizzle);
+
+
static INLINE LLVMValueRef
lp_build_const_int32(struct gallivm_state *gallivm, int i)
{
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
index 19652d13f3c..24bc13a9be8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
@@ -325,8 +325,10 @@ lp_emit_store_aos(
if (reg->Register.WriteMask != TGSI_WRITEMASK_XYZW) {
LLVMValueRef writemask;
- writemask = lp_build_const_mask_aos(bld->bld_base.base.gallivm, bld->bld_base.base.type,
- reg->Register.WriteMask);
+ writemask = lp_build_const_mask_aos_swizzled(bld->bld_base.base.gallivm,
+ bld->bld_base.base.type,
+ reg->Register.WriteMask,
+ bld->swizzles);
if (mask) {
mask = LLVMBuildAnd(builder, mask, writemask, "");