aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-10-07 22:03:59 +0100
committerJosé Fonseca <[email protected]>2010-10-07 22:08:42 +0100
commit321ec1a22468c1f23bbbf7d5c9de53d4687fec0c (patch)
tree45b2a7251680689197d783690b0524d0414d4150 /src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
parent51f9cc4759c23b74a2e4d9c79b0a5df27d403f54 (diff)
gallivm: Vectorize the rho computation.
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 4f9bf6763e6..74362abf455 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1141,7 +1141,9 @@ lp_build_sample_soa(LLVMBuilderRef builder,
LLVMValueRef explicit_lod, /* optional */
LLVMValueRef texel_out[4])
{
+ unsigned dims = texture_dims(static_state->target);
struct lp_build_sample_context bld;
+ LLVMTypeRef i32t = LLVMInt32Type();
LLVMValueRef width, width_vec;
LLVMValueRef height, height_vec;
LLVMValueRef depth, depth_vec;
@@ -1171,6 +1173,9 @@ lp_build_sample_soa(LLVMBuilderRef builder,
bld.coord_type = type;
bld.uint_coord_type = lp_uint_type(type);
bld.int_coord_type = lp_int_type(type);
+ bld.float_size_type = lp_type_float(32);
+ bld.float_size_type.length = dims > 1 ? 4 : 1;
+ bld.uint_size_type = lp_uint_type(bld.float_size_type);
bld.texel_type = type;
float_vec_type = lp_type_float_vec(32);
@@ -1181,6 +1186,8 @@ lp_build_sample_soa(LLVMBuilderRef builder,
lp_build_context_init(&bld.coord_bld, builder, bld.coord_type);
lp_build_context_init(&bld.uint_coord_bld, builder, bld.uint_coord_type);
lp_build_context_init(&bld.int_coord_bld, builder, bld.int_coord_type);
+ lp_build_context_init(&bld.uint_size_bld, builder, bld.uint_size_type);
+ lp_build_context_init(&bld.float_size_bld, builder, bld.float_size_type);
lp_build_context_init(&bld.texel_bld, builder, bld.texel_type);
/* Get the dynamic state */
@@ -1196,6 +1203,23 @@ lp_build_sample_soa(LLVMBuilderRef builder,
t = coords[1];
r = coords[2];
+ /* width, height, depth as single uint vector */
+ if (dims <= 1) {
+ bld.uint_size = width;
+ }
+ else {
+ bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size_bld.undef,
+ width, LLVMConstInt(i32t, 0, 0), "");
+ if (dims >= 2) {
+ bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size,
+ height, LLVMConstInt(i32t, 1, 0), "");
+ if (dims >= 3) {
+ bld.uint_size = LLVMBuildInsertElement(builder, bld.uint_size,
+ depth, LLVMConstInt(i32t, 2, 0), "");
+ }
+ }
+ }
+
/* width, height, depth as uint vectors */
width_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, width);
height_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, height);