gallivm: simplify sampler interface
[mesa.git] / src / gallium / drivers / llvmpipe / lp_tex_sample.c
index 1828069bf1a7916cb0edbd4108b51c28f6a5205a..316d1c550821c043e2ba552d1a0df1f7f8e29c72 100644 (file)
@@ -235,43 +235,24 @@ lp_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
 static void
 lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
                                      struct gallivm_state *gallivm,
-                                     struct lp_type type,
-                                     boolean is_fetch,
-                                     unsigned texture_index,
-                                     unsigned sampler_index,
-                                     LLVMValueRef context_ptr,
-                                     const LLVMValueRef *coords,
-                                     const LLVMValueRef *offsets,
-                                     const struct lp_derivatives *derivs,
-                                     LLVMValueRef lod_bias, /* optional */
-                                     LLVMValueRef explicit_lod, /* optional */
-                                     enum lp_sampler_lod_property lod_property,
-                                     LLVMValueRef *texel)
+                                     const struct lp_sampler_params *params)
 {
    struct lp_llvm_sampler_soa *sampler = (struct lp_llvm_sampler_soa *)base;
+   unsigned texture_index = params->texture_index;
+   unsigned sampler_index = params->sampler_index;
 
    assert(sampler_index < PIPE_MAX_SAMPLERS);
    assert(texture_index < PIPE_MAX_SHADER_SAMPLER_VIEWS);
    
    if (LP_PERF & PERF_NO_TEX) {
-      lp_build_sample_nop(gallivm, type, coords, texel);
+      lp_build_sample_nop(gallivm, params->type, params->coords, params->texel);
       return;
    }
 
-   lp_build_sample_soa(gallivm,
-                       &sampler->dynamic_state.static_state[texture_index].texture_state,
+   lp_build_sample_soa(&sampler->dynamic_state.static_state[texture_index].texture_state,
                        &sampler->dynamic_state.static_state[sampler_index].sampler_state,
                        &sampler->dynamic_state.base,
-                       type,
-                       is_fetch,
-                       texture_index,
-                       sampler_index,
-                       context_ptr,
-                       coords,
-                       offsets,
-                       derivs,
-                       lod_bias, explicit_lod, lod_property,
-                       texel);
+                       gallivm, params);
 }
 
 /**
@@ -317,7 +298,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state)
       return NULL;
 
    sampler->base.destroy = lp_llvm_sampler_soa_destroy;
-   sampler->base.emit_fetch_texel = lp_llvm_sampler_soa_emit_fetch_texel;
+   sampler->base.emit_tex_sample = lp_llvm_sampler_soa_emit_fetch_texel;
    sampler->base.emit_size_query = lp_llvm_sampler_soa_emit_size_query;
    sampler->dynamic_state.base.width = lp_llvm_texture_width;
    sampler->dynamic_state.base.height = lp_llvm_texture_height;