Squashed commit of the following:
[mesa.git] / src / gallium / auxiliary / util / u_sampler.c
index 3e45a2fa70dd3e1ec9765a702842c8ef3f19cc23..e77f562ea222a2cec01a2f38636d14acad873b3d 100644 (file)
@@ -32,7 +32,7 @@
 
 static void
 default_template(struct pipe_sampler_view *view,
-                 const struct pipe_texture *texture,
+                 const struct pipe_resource *texture,
                  enum pipe_format format,
                  unsigned expand_green_blue)
 {
@@ -41,21 +41,24 @@ default_template(struct pipe_sampler_view *view,
 
    view->format = format;
    view->first_level = 0;
-   view->num_levels = texture->last_level + 1;
+   view->last_level = texture->last_level;
    view->swizzle_r = PIPE_SWIZZLE_RED;
    view->swizzle_g = PIPE_SWIZZLE_GREEN;
    view->swizzle_b = PIPE_SWIZZLE_BLUE;
    view->swizzle_a = PIPE_SWIZZLE_ALPHA;
 
-   /* Override default green and blue component expansion to the requested one.
+   /* Override default green and blue component expansion to the requested
+    * one.
     *
-    * Gallium expands nonexistent components to (0,0,0,1), DX9 expands to (1,1,1,1).
-    * Since alpha is always expanded to 1, and red is always present, we only really
-    * care about green and blue components.
+    * Gallium expands nonexistent components to (0,0,0,1), DX9 expands
+    * to (1,1,1,1).  Since alpha is always expanded to 1, and red is
+    * always present, we only really care about green and blue
+    * components.
     *
-    * To make it look less hackish, one would have to add UTIL_FORMAT_SWIZZLE_EXPAND
-    * to indicate components for expansion and then override without exceptions or
-    * favoring one component over another.
+    * To make it look less hackish, one would have to add
+    * UTIL_FORMAT_SWIZZLE_EXPAND to indicate components for expansion
+    * and then override without exceptions or favoring one component
+    * over another.
     */
    if (format != PIPE_FORMAT_A8_UNORM) {
       const struct util_format_description *desc = util_format_description(format);
@@ -74,7 +77,7 @@ default_template(struct pipe_sampler_view *view,
 
 void
 u_sampler_view_default_template(struct pipe_sampler_view *view,
-                                const struct pipe_texture *texture,
+                                const struct pipe_resource *texture,
                                 enum pipe_format format)
 {
    /* Expand to (0, 0, 0, 1) */
@@ -86,7 +89,7 @@ u_sampler_view_default_template(struct pipe_sampler_view *view,
 
 void
 u_sampler_view_default_dx9_template(struct pipe_sampler_view *view,
-                                    const struct pipe_texture *texture,
+                                    const struct pipe_resource *texture,
                                     enum pipe_format format)
 {
    /* Expand to (1, 1, 1, 1) */