tgsi/ureg: make the dst register match the src indirection
[mesa.git] / src / gallium / auxiliary / draw / draw_llvm_sample.c
index 9932b911120ebb0296295746ec81534f1a4c3348..e51e01101f6f7f19b73bf8674912589b9f59684b 100644 (file)
@@ -86,7 +86,7 @@ struct draw_llvm_sampler_soa
 static LLVMValueRef
 draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
                          struct gallivm_state *gallivm,
-                         unsigned unit,
+                         unsigned texture_unit,
                          unsigned member_index,
                          const char *member_name,
                          boolean emit_load)
@@ -98,14 +98,14 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
    LLVMValueRef ptr;
    LLVMValueRef res;
 
-   debug_assert(unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
+   debug_assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
 
    /* context[0] */
    indices[0] = lp_build_const_int32(gallivm, 0);
    /* context[0].textures */
    indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_TEXTURES);
    /* context[0].textures[unit] */
-   indices[2] = lp_build_const_int32(gallivm, unit);
+   indices[2] = lp_build_const_int32(gallivm, texture_unit);
    /* context[0].textures[unit].member */
    indices[3] = lp_build_const_int32(gallivm, member_index);
 
@@ -116,7 +116,7 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
    else
       res = ptr;
 
-   lp_build_name(res, "context.texture%u.%s", unit, member_name);
+   lp_build_name(res, "context.texture%u.%s", texture_unit, member_name);
 
    return res;
 }
@@ -133,7 +133,7 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
 static LLVMValueRef
 draw_llvm_sampler_member(const struct lp_sampler_dynamic_state *base,
                          struct gallivm_state *gallivm,
-                         unsigned unit,
+                         unsigned sampler_unit,
                          unsigned member_index,
                          const char *member_name,
                          boolean emit_load)
@@ -145,14 +145,14 @@ draw_llvm_sampler_member(const struct lp_sampler_dynamic_state *base,
    LLVMValueRef ptr;
    LLVMValueRef res;
 
-   debug_assert(unit < PIPE_MAX_SAMPLERS);
+   debug_assert(sampler_unit < PIPE_MAX_SAMPLERS);
 
    /* context[0] */
    indices[0] = lp_build_const_int32(gallivm, 0);
    /* context[0].samplers */
    indices[1] = lp_build_const_int32(gallivm, DRAW_JIT_CTX_SAMPLERS);
    /* context[0].samplers[unit] */
-   indices[2] = lp_build_const_int32(gallivm, unit);
+   indices[2] = lp_build_const_int32(gallivm, sampler_unit);
    /* context[0].samplers[unit].member */
    indices[3] = lp_build_const_int32(gallivm, member_index);
 
@@ -163,7 +163,7 @@ draw_llvm_sampler_member(const struct lp_sampler_dynamic_state *base,
    else
       res = ptr;
 
-   lp_build_name(res, "context.sampler%u.%s", unit, member_name);
+   lp_build_name(res, "context.sampler%u.%s", sampler_unit, member_name);
 
    return res;
 }
@@ -182,9 +182,9 @@ draw_llvm_sampler_member(const struct lp_sampler_dynamic_state *base,
    static LLVMValueRef \
    draw_llvm_texture_##_name( const struct lp_sampler_dynamic_state *base, \
                               struct gallivm_state *gallivm,               \
-                              unsigned unit)                            \
+                              unsigned texture_unit)                       \
    { \
-      return draw_llvm_texture_member(base, gallivm, unit, _index, #_name, _emit_load ); \
+      return draw_llvm_texture_member(base, gallivm, texture_unit, _index, #_name, _emit_load ); \
    }
 
 
@@ -203,9 +203,9 @@ DRAW_LLVM_TEXTURE_MEMBER(mip_offsets, DRAW_JIT_TEXTURE_MIP_OFFSETS, FALSE)
    static LLVMValueRef \
    draw_llvm_sampler_##_name( const struct lp_sampler_dynamic_state *base, \
                               struct gallivm_state *gallivm,               \
-                              unsigned unit)                            \
+                              unsigned sampler_unit)                       \
    { \
-      return draw_llvm_sampler_member(base, gallivm, unit, _index, #_name, _emit_load ); \
+      return draw_llvm_sampler_member(base, gallivm, sampler_unit, _index, #_name, _emit_load ); \
    }
 
 
@@ -268,19 +268,21 @@ static void
 draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
                                       struct gallivm_state *gallivm,
                                       struct lp_type type,
-                                      unsigned unit,
+                                      unsigned texture_unit,
+                                      boolean need_nr_mips,
                                       LLVMValueRef explicit_lod, /* optional */
                                       LLVMValueRef *sizes_out)
 {
    struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base;
 
-   assert(unit < PIPE_MAX_SAMPLERS);
+   assert(texture_unit < PIPE_MAX_SHADER_SAMPLER_VIEWS);
 
    lp_build_size_query_soa(gallivm,
-                           &sampler->dynamic_state.static_state[unit].texture_state,
+                           &sampler->dynamic_state.static_state[texture_unit].texture_state,
                            &sampler->dynamic_state.base,
                            type,
-                           unit,
+                           texture_unit,
+                           need_nr_mips,
                            explicit_lod,
                            sizes_out);
 }