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

Author: José Fonseca <[email protected]>
Date:   Sat Mar  6 10:23:07 2010 +0000

gallivm: Add some notes about sampler static state construction.

Recover some logic to make state canonical, although it is admittedly very
shy compared with what could be done.

We really need an helper module to make state canonical.

---

 src/gallium/auxiliary/gallivm/lp_bld_sample.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index 6a026e4..29cadcc 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -62,6 +62,18 @@ lp_sampler_static_state(struct lp_sampler_static_state 
*state,
    if(!sampler)
       return;
 
+   /*
+    * We don't copy sampler state over unless it is actually enabled, to avoid
+    * spurious recompiles, as the sampler static state is part of the shader
+    * key.
+    *
+    * Ideally the state tracker or cso_cache module would make all state
+    * canonical, but until that happens it's better to be safe than sorry here.
+    *
+    * XXX: Actually there's much more than can be done here, especially
+    * regarding 1D/2D/3D/CUBE textures, wrap modes, etc.
+    */
+
    state->format            = texture->format;
    state->target            = texture->target;
    state->pot_width         = util_is_pot(texture->width0);
@@ -74,8 +86,12 @@ lp_sampler_static_state(struct lp_sampler_static_state 
*state,
    state->min_img_filter    = sampler->min_img_filter;
    state->min_mip_filter    = sampler->min_mip_filter;
    state->mag_img_filter    = sampler->mag_img_filter;
+
    state->compare_mode      = sampler->compare_mode;
-   state->compare_func      = sampler->compare_func;
+   if (sampler->compare_mode != PIPE_TEX_COMPARE_NONE) {
+      state->compare_func   = sampler->compare_func;
+   }
+
    state->normalized_coords = sampler->normalized_coords;
    state->lod_bias          = sampler->lod_bias;
    state->min_lod           = sampler->min_lod;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to