[Mesa-dev] [PATCH 10/15] gallivm: Allow user to supply the swizzle function to lp_bld_tgsi_aos

Tom Stellard tstellar at gmail.com
Fri Dec 9 14:16:02 PST 2011


---
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h     |    2 ++
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c |    5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index 5d31318..e8b73e5 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -399,6 +399,8 @@ struct lp_build_tgsi_aos_context
 
    LLVMValueRef (*emit_fetch_switch_file_fn)(struct lp_build_tgsi_aos_context *,
                                          const struct tgsi_full_src_register *);
+   LLVMValueRef (*emit_swizzle)(struct lp_build_tgsi_aos_context *,
+                         LLVMValueRef, unsigned, unsigned, unsigned, unsigned);
 };
 
 
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
index f9d1942..bf623ca 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
@@ -225,7 +225,7 @@ lp_emit_fetch_aos(
     * Swizzle the argument
     */
 
-   res = swizzle_aos(bld, res,
+   res = bld->emit_swizzle(bld, res,
                      reg->Register.SwizzleX,
                      reg->Register.SwizzleY,
                      reg->Register.SwizzleZ,
@@ -327,7 +327,7 @@ lp_emit_store_aos(
          pred = LLVMBuildNot(builder, pred, "");
       }
 
-      pred = swizzle_aos(bld, pred,
+      pred = bld->emit_swizzle(bld, pred,
                          inst->Predicate.SwizzleX,
                          inst->Predicate.SwizzleY,
                          inst->Predicate.SwizzleZ,
@@ -1039,6 +1039,7 @@ lp_build_tgsi_aos(struct gallivm_state *gallivm,
    bld.instructions = (struct tgsi_full_instruction *)
                       MALLOC(LP_MAX_INSTRUCTIONS * sizeof(struct tgsi_full_instruction));
    bld.max_instructions = LP_MAX_INSTRUCTIONS;
+   bld.emit_swizzle = swizzle_aos;
 
    if (!bld.instructions) {
       return;
-- 
1.7.6.4



More information about the mesa-dev mailing list