llvmpipe: use scalar load instead of vectors for small vectors in fs backend
[mesa.git] / src / gallium / drivers / llvmpipe / lp_tex_sample.c
index 217abe963b7fdffacd7917c42eccf64648c94f12..5d0d35091958f7c20eb468a014c7ddf08061a1ed 100644 (file)
@@ -112,7 +112,7 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
    /* context[0].textures[unit].member */
    indices[3] = lp_build_const_int32(gallivm, member_index);
 
-   ptr = LLVMBuildGEP(builder, context_ptr, indices, Elements(indices), "");
+   ptr = LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
 
    if (emit_load)
       res = LLVMBuildLoad(builder, ptr, "");
@@ -190,7 +190,7 @@ lp_llvm_sampler_member(const struct lp_sampler_dynamic_state *base,
    /* context[0].samplers[unit].member */
    indices[3] = lp_build_const_int32(gallivm, member_index);
 
-   ptr = LLVMBuildGEP(builder, context_ptr, indices, Elements(indices), "");
+   ptr = LLVMBuildGEP(builder, context_ptr, indices, ARRAY_SIZE(indices), "");
 
    if (emit_load)
       res = LLVMBuildLoad(builder, ptr, "");
@@ -276,30 +276,16 @@ lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
 static void
 lp_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
                                     struct gallivm_state *gallivm,
-                                    struct lp_type type,
-                                    unsigned texture_unit,
-                                    unsigned target,
-                                    LLVMValueRef context_ptr,
-                                    boolean is_sviewinfo,
-                                    enum lp_sampler_lod_property lod_property,
-                                    LLVMValueRef explicit_lod, /* optional */
-                                    LLVMValueRef *sizes_out)
+                                    const struct lp_sampler_size_query_params *params)
 {
    struct lp_llvm_sampler_soa *sampler = (struct lp_llvm_sampler_soa *)base;
 
-   assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
+   assert(params->texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
 
    lp_build_size_query_soa(gallivm,
-                           &sampler->dynamic_state.static_state[texture_unit].texture_state,
+                           &sampler->dynamic_state.static_state[params->texture_unit].texture_state,
                            &sampler->dynamic_state.base,
-                           type,
-                           texture_unit,
-                           target,
-                           context_ptr,
-                           is_sviewinfo,
-                           lod_property,
-                           explicit_lod,
-                           sizes_out);
+                           params);
 }
 
 
@@ -309,7 +295,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state)
    struct lp_llvm_sampler_soa *sampler;
 
    sampler = CALLOC_STRUCT(lp_llvm_sampler_soa);
-   if(!sampler)
+   if (!sampler)
       return NULL;
 
    sampler->base.destroy = lp_llvm_sampler_soa_destroy;