gallivm: Fetch the lod from the dynamic state when min_lod == max_lod.
authorJosé Fonseca <jfonseca@vmware.com>
Sat, 25 Sep 2010 11:13:45 +0000 (12:13 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sat, 25 Sep 2010 11:21:19 +0000 (12:21 +0100)
src/gallium/auxiliary/gallivm/lp_bld_sample.c
src/gallium/auxiliary/gallivm/lp_bld_sample.h

index 44f44ff1aa4ef4397b994f067578a65fe12ffd79..d9fbc0f3057da84602db778700d07d3058e7c5c1 100644 (file)
@@ -104,7 +104,6 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
     */
    if (sampler->min_lod == sampler->max_lod) {
       state->min_max_lod_equal = 1;
-      state->min_max_lod = sampler->min_lod;
    }
 
    state->compare_mode      = sampler->compare_mode;
@@ -145,18 +144,19 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
                       LLVMValueRef depth)
 
 {
+   LLVMValueRef min_lod =
+      bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit);
+
    if (bld->static_state->min_max_lod_equal) {
       /* User is forcing sampling from a particular mipmap level.
        * This is hit during mipmap generation.
        */
-      return LLVMConstReal(LLVMFloatType(), bld->static_state->min_max_lod);
+      return min_lod;
    }
    else {
       struct lp_build_context *float_bld = &bld->float_bld;
       LLVMValueRef sampler_lod_bias =
          bld->dynamic_state->lod_bias(bld->dynamic_state, bld->builder, unit);
-      LLVMValueRef min_lod =
-         bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit);
       LLVMValueRef max_lod =
          bld->dynamic_state->max_lod(bld->dynamic_state, bld->builder, unit);
       LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
index 9a19e87571ed231f45ea992a0ae674c172da743c..43ed24bdc69b7369a23a76cc4e4116c454b6dcec 100644 (file)
@@ -83,7 +83,6 @@ struct lp_sampler_static_state
    unsigned compare_func:3;
    unsigned normalized_coords:1;
    unsigned min_max_lod_equal:1;  /**< min_lod == max_lod ? */
-   float min_max_lod;             /**< only valid when min_max_lod_equal=1 */
 
    /* Aero hacks */
    unsigned force_nearest_s:1;