gallivm: Simplify lp_build_mipmap_level_sizes' interface.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 8 Oct 2010 12:24:39 +0000 (13:24 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 8 Oct 2010 13:06:37 +0000 (14:06 +0100)
src/gallium/auxiliary/gallivm/lp_bld_sample.c
src/gallium/auxiliary/gallivm/lp_bld_sample.h
src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c

index a6a64f38c8421893564d67b1916deeeb8c93bc55..c4ed79e0e7ef39e8da36f352a115541f1a37b4ec 100644 (file)
@@ -513,61 +513,34 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
                             LLVMValueRef width_vec,
                             LLVMValueRef height_vec,
                             LLVMValueRef depth_vec,
-                            LLVMValueRef ilevel0,
-                            LLVMValueRef ilevel1,
+                            LLVMValueRef ilevel,
                             LLVMValueRef row_stride_array,
                             LLVMValueRef img_stride_array,
-                            LLVMValueRef *width0_vec,
-                            LLVMValueRef *width1_vec,
-                            LLVMValueRef *height0_vec,
-                            LLVMValueRef *height1_vec,
-                            LLVMValueRef *depth0_vec,
-                            LLVMValueRef *depth1_vec,
-                            LLVMValueRef *row_stride0_vec,
-                            LLVMValueRef *row_stride1_vec,
-                            LLVMValueRef *img_stride0_vec,
-                            LLVMValueRef *img_stride1_vec)
+                            LLVMValueRef *out_width_vec,
+                            LLVMValueRef *out_height_vec,
+                            LLVMValueRef *out_depth_vec,
+                            LLVMValueRef *row_stride_vec,
+                            LLVMValueRef *img_stride_vec)
 {
-   const unsigned mip_filter = bld->static_state->min_mip_filter;
-   LLVMValueRef ilevel0_vec, ilevel1_vec;
+   LLVMValueRef ilevel_vec;
 
-   ilevel0_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel0);
-   if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR)
-      ilevel1_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel1);
+   ilevel_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel);
 
    /*
-    * Compute width, height, depth at mipmap level 'ilevel0'
+    * Compute width, height, depth at mipmap level 'ilevel'
     */
-   *width0_vec = lp_build_minify(bld, width_vec, ilevel0_vec);
+   *out_width_vec = lp_build_minify(bld, width_vec, ilevel_vec);
    if (dims >= 2) {
-      *height0_vec = lp_build_minify(bld, height_vec, ilevel0_vec);
-      *row_stride0_vec = lp_build_get_level_stride_vec(bld,
+      *out_height_vec = lp_build_minify(bld, height_vec, ilevel_vec);
+      *row_stride_vec = lp_build_get_level_stride_vec(bld,
                                                        row_stride_array,
-                                                       ilevel0);
+                                                       ilevel);
       if (dims == 3 || bld->static_state->target == PIPE_TEXTURE_CUBE) {
-         *img_stride0_vec = lp_build_get_level_stride_vec(bld,
+         *img_stride_vec = lp_build_get_level_stride_vec(bld,
                                                           img_stride_array,
-                                                          ilevel0);
+                                                          ilevel);
          if (dims == 3) {
-            *depth0_vec = lp_build_minify(bld, depth_vec, ilevel0_vec);
-         }
-      }
-   }
-   if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
-      /* compute width, height, depth for second mipmap level at 'ilevel1' */
-      *width1_vec = lp_build_minify(bld, width_vec, ilevel1_vec);
-      if (dims >= 2) {
-         *height1_vec = lp_build_minify(bld, height_vec, ilevel1_vec);
-         *row_stride1_vec = lp_build_get_level_stride_vec(bld,
-                                                          row_stride_array,
-                                                          ilevel1);
-         if (dims == 3 || bld->static_state->target == PIPE_TEXTURE_CUBE) {
-            *img_stride1_vec = lp_build_get_level_stride_vec(bld,
-                                                             img_stride_array,
-                                                             ilevel1);
-            if (dims == 3) {
-               *depth1_vec = lp_build_minify(bld, depth_vec, ilevel1_vec);
-            }
+            *out_depth_vec = lp_build_minify(bld, depth_vec, ilevel_vec);
          }
       }
    }
index 1dd78a07a2457b3ce6a498d7c2b610748e44e808..76f428d4be19f6dbefcefb3e64a883bc92311631 100644 (file)
@@ -327,20 +327,14 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
                             LLVMValueRef width_vec,
                             LLVMValueRef height_vec,
                             LLVMValueRef depth_vec,
-                            LLVMValueRef ilevel0,
-                            LLVMValueRef ilevel1,
+                            LLVMValueRef ilevel,
                             LLVMValueRef row_stride_array,
                             LLVMValueRef img_stride_array,
-                            LLVMValueRef *width0_vec,
-                            LLVMValueRef *width1_vec,
-                            LLVMValueRef *height0_vec,
-                            LLVMValueRef *height1_vec,
-                            LLVMValueRef *depth0_vec,
-                            LLVMValueRef *depth1_vec,
-                            LLVMValueRef *row_stride0_vec,
-                            LLVMValueRef *row_stride1_vec,
-                            LLVMValueRef *img_stride0_vec,
-                            LLVMValueRef *img_stride1_vec);
+                            LLVMValueRef *out_width_vec,
+                            LLVMValueRef *out_height_vec,
+                            LLVMValueRef *out_depth_vec,
+                            LLVMValueRef *row_stride_vec,
+                            LLVMValueRef *img_stride_vec);
 
 
 void
index d42b5f612710c9d064498934e6c7788d096b9c8c..5c5669bb8b7f207feb56ed6df5d1f385da1a1f0e 100644 (file)
@@ -1002,13 +1002,17 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
 
    /* compute image size(s) of source mipmap level(s) */
    lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec,
-                               ilevel0, ilevel1,
+                               ilevel0,
                                row_stride_array, img_stride_array,
-                               &width0_vec, &width1_vec,
-                               &height0_vec, &height1_vec,
-                               &depth0_vec, &depth1_vec,
-                               &row_stride0_vec, &row_stride1_vec,
-                               &img_stride0_vec, &img_stride1_vec);
+                               &width0_vec, &height0_vec, &depth0_vec,
+                               &row_stride0_vec, &img_stride0_vec);
+   if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
+      lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec,
+                                  ilevel1,
+                                  row_stride_array, img_stride_array,
+                                  &width1_vec, &height1_vec, &depth1_vec,
+                                  &row_stride1_vec, &img_stride1_vec);
+   }
 
    /*
     * Get pointer(s) to image data for mipmap level(s).
index c7947f06e816019bacf54f82a2b2e3b498ebc8e2..1883c198e57c913a9e9937f458f32f4f7c777556 100644 (file)
@@ -975,13 +975,17 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
 
    /* compute image size(s) of source mipmap level(s) */
    lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec,
-                               ilevel0, ilevel1,
+                               ilevel0,
                                row_stride_array, img_stride_array,
-                               &width0_vec, &width1_vec,
-                               &height0_vec, &height1_vec,
-                               &depth0_vec, &depth1_vec,
-                               &row_stride0_vec, &row_stride1_vec,
-                               &img_stride0_vec, &img_stride1_vec);
+                               &width0_vec, &height0_vec, &depth0_vec,
+                               &row_stride0_vec, &img_stride0_vec);
+   if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
+      lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec,
+                                  ilevel1,
+                                  row_stride_array, img_stride_array,
+                                  &width1_vec, &height1_vec, &depth1_vec,
+                                  &row_stride1_vec, &img_stride1_vec);
+   }
 
    /*
     * Get pointer(s) to image data for mipmap level(s).