Mesa (gallium-llvmpipe): llvmpipe: Better structure dereference naming.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Tue Aug 25 07:05:19 UTC 2009


Module: Mesa
Branch: gallium-llvmpipe
Commit: f77b05e5835475d87d959e813204b4dfde97b361
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f77b05e5835475d87d959e813204b4dfde97b361

Author: José Fonseca <jfonseca at vmware.com>
Date:   Tue Aug 25 06:40:22 2009 +0100

llvmpipe: Better structure dereference naming.

---

 src/gallium/drivers/llvmpipe/lp_bld_struct.c |    9 +++++++--
 src/gallium/drivers/llvmpipe/lp_jit.h        |    8 ++++----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_bld_struct.c b/src/gallium/drivers/llvmpipe/lp_bld_struct.c
index 4877c4d..14d2b10 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_struct.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_struct.c
@@ -37,6 +37,7 @@
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 
+#include "lp_bld_debug.h"
 #include "lp_bld_struct.h"
 
 
@@ -47,8 +48,12 @@ lp_build_struct_get(LLVMBuilderRef builder,
                     const char *name)
 {
    LLVMValueRef indices[2];
+   LLVMValueRef member_ptr;
+   LLVMValueRef res;
    indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
    indices[1] = LLVMConstInt(LLVMInt32Type(), member, 0);
-   ptr = LLVMBuildGEP(builder, ptr, indices, Elements(indices), "");
-   return LLVMBuildLoad(builder, ptr, name);
+   member_ptr = LLVMBuildGEP(builder, ptr, indices, Elements(indices), "");
+   res = LLVMBuildLoad(builder, member_ptr, "");
+   lp_build_name(res, "%s.%s", LLVMGetValueName(ptr), name);
+   return res;
 }
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h
index e7e887f..33010ad 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -69,16 +69,16 @@ struct lp_jit_context
 
 
 #define lp_jit_context_constants(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, 0, "context.constants")
+   lp_build_struct_get(_builder, _ptr, 0, "constants")
 
 #define lp_jit_context_samplers(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, 1, "context.samplers")
+   lp_build_struct_get(_builder, _ptr, 1, "samplers")
 
 #define lp_jit_context_alpha_ref_value(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, 2, "context.alpha")
+   lp_build_struct_get(_builder, _ptr, 2, "alpha_ref_value")
 
 #define lp_jit_context_blend_color(_builder, _ptr) \
-   lp_build_struct_get(_builder, _ptr, 3, "context.blend")
+   lp_build_struct_get(_builder, _ptr, 3, "blend_color")
 
 
 typedef void




More information about the mesa-commit mailing list