summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/gallivm/lp_bld_sample.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-10-08 19:48:16 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-10-08 19:48:16 +0100
commit3fde8167a5d9c1e845053ae4e6a9cd49628adc71 (patch)
treed2038c9c08512c07f236069e10a5252f17f05280 /src/gallium/auxiliary/gallivm/lp_bld_sample.c
parent438390418d27838bcfcb5bbb4c486db45dbaa44d (diff)
gallivm: Help for combined extraction and broadcasting.
Doesn't change generated code quality, but saves some typing.
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_sample.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index 6a684a9a0b..7a64392d3c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -639,7 +639,6 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
const unsigned dims = bld->dims;
LLVMValueRef ilevel_vec;
LLVMValueRef size_vec;
- LLVMValueRef width, height, depth;
LLVMTypeRef i32t = LLVMInt32Type();
ilevel_vec = lp_build_broadcast_scalar(&bld->int_size_bld, ilevel);
@@ -649,18 +648,19 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
*/
size_vec = lp_build_minify(&bld->int_size_bld, bld->int_size, ilevel_vec);
- if (dims <= 1) {
- width = size_vec;
- }
- else {
- width = LLVMBuildExtractElement(bld->builder, size_vec,
- LLVMConstInt(i32t, 0, 0), "");
- }
- *out_width_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, width);
+ *out_width_vec = lp_build_extract_broadcast(bld->builder,
+ bld->int_size_type,
+ bld->int_coord_type,
+ size_vec,
+ LLVMConstInt(i32t, 0, 0));
if (dims >= 2) {
- height = LLVMBuildExtractElement(bld->builder, size_vec,
- LLVMConstInt(i32t, 1, 0), "");
- *out_height_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, height);
+
+ *out_height_vec = lp_build_extract_broadcast(bld->builder,
+ bld->int_size_type,
+ bld->int_coord_type,
+ size_vec,
+ LLVMConstInt(i32t, 1, 0));
+
*row_stride_vec = lp_build_get_level_stride_vec(bld,
bld->row_stride_array,
ilevel);
@@ -669,9 +669,11 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
bld->img_stride_array,
ilevel);
if (dims == 3) {
- depth = LLVMBuildExtractElement(bld->builder, size_vec,
- LLVMConstInt(i32t, 2, 0), "");
- *out_depth_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, depth);
+ *out_depth_vec = lp_build_extract_broadcast(bld->builder,
+ bld->int_size_type,
+ bld->int_coord_type,
+ size_vec,
+ LLVMConstInt(i32t, 2, 0));
}
}
}