Mesa (master): gallivm: check for level=0 case in lp_build_minify()

Brian Paul brianp at kemper.freedesktop.org
Thu Sep 30 09:54:00 PDT 2010


Module: Mesa
Branch: master
Commit: 874f3a57ce5ae41ced103bf5a549a2eb663db6c5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=874f3a57ce5ae41ced103bf5a549a2eb663db6c5

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Sep 30 10:52:26 2010 -0600

gallivm: check for level=0 case in lp_build_minify()

This lets us avoid the shift and max() operations.

---

 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 d9fbbbe..6e53bca 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;
+   }
 }
 
 



More information about the mesa-commit mailing list