diff options
author | Brian Paul <[email protected]> | 2010-09-30 10:52:26 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-09-30 10:53:30 -0600 |
commit | 874f3a57ce5ae41ced103bf5a549a2eb663db6c5 (patch) | |
tree | 0f3044a489256423e10b320747b4355aa940f262 /src/gallium/auxiliary | |
parent | 4e6f5e8d43ee87c6f8cdc75de2eeb96f70beb013 (diff) |
gallivm: check for level=0 case in lp_build_minify()
This lets us avoid the shift and max() operations.
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index d9fbbbe70f7..6e53bca269a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -362,9 +362,16 @@ lp_build_minify(struct lp_build_sample_context *bld, LLVMValueRef base_size, LLVMValueRef level) { - LLVMValueRef size = LLVMBuildLShr(bld->builder, base_size, level, "minify"); - size = lp_build_max(&bld->int_coord_bld, size, bld->int_coord_bld.one); - return size; + if (level == bld->int_coord_bld.zero) { + /* if we're using mipmap level zero, no minification is needed */ + return base_size; + } + else { + LLVMValueRef size = + LLVMBuildLShr(bld->builder, base_size, level, "minify"); + size = lp_build_max(&bld->int_coord_bld, size, bld->int_coord_bld.one); + return size; + } } |