[Mesa-dev] [PATCH 12/15] gallivm: Allow user to define the load_store() function

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


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

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index ec366ca..554b4cb 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -325,6 +325,10 @@ struct lp_build_tgsi_soa_context
    LLVMValueRef (*emit_fetch_switch_file_fn)(struct lp_build_tgsi_soa_context *,
                                          const struct tgsi_full_src_register *,
                                          const unsigned);
+
+   void (*emit_store)(struct lp_build_tgsi_soa_context *,
+                      const struct tgsi_full_instruction *, unsigned,
+                      unsigned, LLVMValueRef,  LLVMValueRef);
 };
 
 void
@@ -410,6 +414,11 @@ struct lp_build_tgsi_aos_context
 
    LLVMValueRef (*emit_fetch_switch_file_fn)(struct lp_build_tgsi_aos_context *,
                                          const struct tgsi_full_src_register *);
+
+   void (*emit_store)(struct lp_build_tgsi_aos_context *,
+                      const struct tgsi_full_instruction *,
+                      unsigned,  LLVMValueRef);
+
    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 5f88eca..7bd59eb 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
@@ -995,7 +995,7 @@ lp_emit_instruction_aos(
    }
    
    if (info->num_dst) {
-      lp_emit_store_aos(bld, inst, 0, dst0);
+      bld->emit_store(bld, inst, 0, dst0);
    }
 
    return TRUE;
@@ -1035,6 +1035,7 @@ lp_build_tgsi_aos(struct gallivm_state *gallivm,
    bld.sampler = sampler;
    bld.indirect_files = info->indirect_files;
    bld.emit_fetch_switch_file_fn = emit_fetch_switch_file;
+   bld.emit_store = lp_emit_store_aos;
    bld.emit_swizzle = swizzle_aos;
 
    if (!lp_bld_tgsi_list_init(&bld.inst_list)) {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 93968e7..419d5b4 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -2242,7 +2242,7 @@ lp_emit_instruction_soa(
       emit_fetch_predicate( bld, inst, pred );
 
       FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
-         lp_emit_store_soa( bld, inst, 0, chan_index, pred[chan_index], dst0[chan_index]);
+         bld->emit_store( bld, inst, 0, chan_index, pred[chan_index], dst0[chan_index]);
       }
    }
 
@@ -2291,6 +2291,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
    bld.info = info;
    bld.indirect_files = info->indirect_files;
    bld.emit_fetch_switch_file_fn = emit_fetch_switch_file;
+   bld.emit_store = lp_emit_store_soa;
 
    if (!lp_bld_tgsi_list_init(&bld.inst_list)) {
       return;
-- 
1.7.6.4



More information about the mesa-dev mailing list