summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-10-08 13:24:39 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-10-08 14:06:37 +0100
commit05fe33b71cd913876184d1aa4086e4e3f8636eb1 (patch)
treeee532c61354d2b60ff37ce75c86d84bfd9f6a01b
parent4eb222a3e654812ac1466b438a7d43f07ca6a508 (diff)
gallivm: Simplify lp_build_mipmap_level_sizes' interface.
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.c59
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.h18
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c16
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c16
4 files changed, 42 insertions, 67 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index a6a64f38c84..c4ed79e0e7e 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -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);
}
}
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index 1dd78a07a24..76f428d4be1 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -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
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
index d42b5f61271..5c5669bb8b7 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c
@@ -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).
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index c7947f06e81..1883c198e57 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -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).