[Mesa-dev] [PATCH 2/6] draw/llvm: Remove unused gs_constants from jit_context

Zack Rusin zackr at vmware.com
Tue Mar 26 09:38:52 PDT 2013


The member was never used and we'll need to handle it differently
because gs will also need samplers/textures setup.

Signed-off-by: Zack Rusin <zackr at vmware.com>
---
 src/gallium/auxiliary/draw/draw_llvm.c                |   17 +++++++----------
 src/gallium/auxiliary/draw/draw_llvm.h                |   15 ++++-----------
 .../draw/draw_pt_fetch_shade_pipeline_llvm.c          |    4 ----
 3 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 20c9b79..602839d 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -189,18 +189,17 @@ create_jit_context_type(struct gallivm_state *gallivm,
 {
    LLVMTargetDataRef target = gallivm->target;
    LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
-   LLVMTypeRef elem_types[6];
+   LLVMTypeRef elem_types[5];
    LLVMTypeRef context_type;
 
    elem_types[0] = LLVMArrayType(LLVMPointerType(float_type, 0), /* vs_constants */
                                  LP_MAX_TGSI_CONST_BUFFERS);
-   elem_types[1] = elem_types[0]; /* gs_constants */
-   elem_types[2] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4),
+   elem_types[1] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4),
                                                  DRAW_TOTAL_CLIP_PLANES), 0);
-   elem_types[3] = LLVMPointerType(float_type, 0); /* viewport */
-   elem_types[4] = LLVMArrayType(texture_type,
+   elem_types[2] = LLVMPointerType(float_type, 0); /* viewport */
+   elem_types[3] = LLVMArrayType(texture_type,
                                  PIPE_MAX_SHADER_SAMPLER_VIEWS); /* textures */
-   elem_types[5] = LLVMArrayType(sampler_type,
+   elem_types[4] = LLVMArrayType(sampler_type,
                                  PIPE_MAX_SAMPLERS); /* samplers */
    context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
                                           Elements(elem_types), 0);
@@ -212,12 +211,10 @@ create_jit_context_type(struct gallivm_state *gallivm,
 
    LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, vs_constants,
                           target, context_type, 0);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, gs_constants,
-                          target, context_type, 1);
    LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, planes,
-                          target, context_type, 2);
+                          target, context_type, 1);
    LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, viewport,
-                          target, context_type, 3);
+                          target, context_type, 2);
    LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, textures,
                           target, context_type,
                           DRAW_JIT_CTX_TEXTURES);
diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h
index c9f125b..c03c69e 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.h
+++ b/src/gallium/auxiliary/draw/draw_llvm.h
@@ -106,9 +106,6 @@ enum {
    DRAW_JIT_VERTEX_DATA
 };
 
-#define DRAW_JIT_CTX_TEXTURES 4
-#define DRAW_JIT_CTX_SAMPLERS 5
-
 /**
  * This structure is passed directly to the generated vertex shader.
  *
@@ -123,7 +120,6 @@ enum {
 struct draw_jit_context
 {
    const float *vs_constants[LP_MAX_TGSI_CONST_BUFFERS];
-   const float *gs_constants[LP_MAX_TGSI_CONST_BUFFERS];
    float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
    float *viewport;
 
@@ -135,17 +131,14 @@ struct draw_jit_context
 #define draw_jit_context_vs_constants(_gallivm, _ptr) \
    lp_build_struct_get_ptr(_gallivm, _ptr, 0, "vs_constants")
 
-#define draw_jit_context_gs_constants(_gallivm, _ptr) \
-   lp_build_struct_get_ptr(_gallivm, _ptr, 1, "gs_constants")
-
 #define draw_jit_context_planes(_gallivm, _ptr) \
-   lp_build_struct_get(_gallivm, _ptr, 2, "planes")
+   lp_build_struct_get(_gallivm, _ptr, 1, "planes")
 
 #define draw_jit_context_viewport(_gallivm, _ptr) \
-   lp_build_struct_get(_gallivm, _ptr, 3, "viewport")
+   lp_build_struct_get(_gallivm, _ptr, 2, "viewport")
 
-#define DRAW_JIT_CTX_TEXTURES 4
-#define DRAW_JIT_CTX_SAMPLERS 5
+#define DRAW_JIT_CTX_TEXTURES 3
+#define DRAW_JIT_CTX_SAMPLERS 4
 
 #define draw_jit_context_textures(_gallivm, _ptr) \
    lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_TEXTURES, "textures")
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
index 288b524..fab168c 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
@@ -200,10 +200,6 @@ llvm_middle_end_bind_parameters(struct draw_pt_middle_end *middle)
       fpme->llvm->jit_context.vs_constants[i] = draw->pt.user.vs_constants[i];
    }
 
-   for (i = 0; i < Elements(fpme->llvm->jit_context.gs_constants); ++i) {
-      fpme->llvm->jit_context.gs_constants[i] = draw->pt.user.gs_constants[i];
-   }
-
    fpme->llvm->jit_context.planes =
       (float (*)[DRAW_TOTAL_CLIP_PLANES][4]) draw->pt.user.planes[0];
 
-- 
1.7.10.4



More information about the mesa-dev mailing list