Revert 5 i965 patches: 8e27a4d2, 373143ed, c5bdf9be, 6f56e142, 88e3d404
[mesa.git] / src / mesa / drivers / dri / i965 / brw_sampler_state.c
index b34e9f331d1d46475455b6e18fead0754ec3b59e..544aa57b6d141db6041e1a9432893af5beeab9cd 100644 (file)
@@ -145,7 +145,7 @@ brw_emit_sampler_state(struct brw_context *brw,
    }
 }
 
-uint32_t
+static uint32_t
 translate_wrap_mode(struct brw_context *brw, GLenum wrap, bool using_nearest)
 {
    switch( wrap ) {
@@ -188,7 +188,7 @@ translate_wrap_mode(struct brw_context *brw, GLenum wrap, bool using_nearest)
 /**
  * Upload SAMPLER_BORDER_COLOR_STATE.
  */
-void
+static void
 upload_default_color(struct brw_context *brw,
                      const struct gl_sampler_object *sampler,
                      int unit,
@@ -352,7 +352,7 @@ brw_update_sampler_state(struct brw_context *brw,
       mip_filter = BRW_MIPFILTER_LINEAR;
       break;
    default:
-      break;
+      unreachable("not reached");
    }
 
    /* Select mag filter. */
@@ -424,10 +424,11 @@ brw_update_sampler_state(struct brw_context *brw,
         intel_translate_shadow_compare_func(sampler->CompareFunc);
    }
 
-   const unsigned min_lod = U_FIXED(CLAMP(sampler->MinLod, 0, 13), 6);
-   const unsigned max_lod = U_FIXED(CLAMP(sampler->MaxLod, 0, 13), 6);
+   const int lod_bits = brw->gen >= 7 ? 8 : 6;
+   const unsigned min_lod = U_FIXED(CLAMP(sampler->MinLod, 0, 13), lod_bits);
+   const unsigned max_lod = U_FIXED(CLAMP(sampler->MaxLod, 0, 13), lod_bits);
    const int lod_bias =
-      S_FIXED(CLAMP(texUnit->LodBias + sampler->LodBias, -16, 15), 6);
+      S_FIXED(CLAMP(texUnit->LodBias + sampler->LodBias, -16, 15), lod_bits);
    const unsigned base_level = U_FIXED(0, 1);
 
    uint32_t border_color_offset;
@@ -477,15 +478,8 @@ brw_upload_sampler_state_table(struct brw_context *brw,
       if (SamplersUsed & (1 << s)) {
          const unsigned unit = prog->SamplerUnits[s];
          if (ctx->Texture.Unit[unit]._Current) {
-            if (brw->gen >= 7) {
-               gen7_update_sampler_state(brw, unit,
-                                         (struct gen7_sampler_state *)
-                                         sampler_state);
-            } else {
-               brw_update_sampler_state(brw, unit,
-                                        sampler_state,
-                                        batch_offset_for_sampler_state);
-            }
+            brw_update_sampler_state(brw, unit, sampler_state,
+                                     batch_offset_for_sampler_state);
          }
       }