Mesa (master): softpipe: use any_swizzle() helper in sp_tex_sample.c
Brian Paul
brianp at kemper.freedesktop.org
Tue May 1 20:18:54 UTC 2012
Module: Mesa
Branch: master
Commit: 07f5dabc01e9a85073ffd333c37549ec5ae75c7a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=07f5dabc01e9a85073ffd333c37549ec5ae75c7a
Author: Brian Paul <brianp at vmware.com>
Date: Wed Apr 25 10:50:06 2012 -0600
softpipe: use any_swizzle() helper in sp_tex_sample.c
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
---
src/gallium/drivers/softpipe/sp_tex_sample.c | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 6f4294f..d4c0175 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -2468,6 +2468,19 @@ get_linear_wrap(unsigned mode)
}
+/**
+ * Is swizzling needed for the given state key?
+ */
+static INLINE bool
+any_swizzle(union sp_sampler_key key)
+{
+ return (key.bits.swizzle_r != PIPE_SWIZZLE_RED ||
+ key.bits.swizzle_g != PIPE_SWIZZLE_GREEN ||
+ key.bits.swizzle_b != PIPE_SWIZZLE_BLUE ||
+ key.bits.swizzle_a != PIPE_SWIZZLE_ALPHA);
+}
+
+
static compute_lambda_func
get_lambda_func(const union sp_sampler_key key)
{
@@ -2655,10 +2668,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler,
const struct pipe_resource *texture = samp->view->texture;
int j, c;
const float *tx;
- bool need_swizzle = (samp->key.bits.swizzle_r != PIPE_SWIZZLE_RED ||
- samp->key.bits.swizzle_g != PIPE_SWIZZLE_GREEN ||
- samp->key.bits.swizzle_b != PIPE_SWIZZLE_BLUE ||
- samp->key.bits.swizzle_a != PIPE_SWIZZLE_ALPHA);
+ const bool need_swizzle = any_swizzle(samp->key);
int width, height, depth, layers;
addr.value = 0;
@@ -2853,10 +2863,7 @@ sp_create_sampler_variant( const struct pipe_sampler_state *sampler,
samp->sample_target = samp->compare;
}
- if (key.bits.swizzle_r != PIPE_SWIZZLE_RED ||
- key.bits.swizzle_g != PIPE_SWIZZLE_GREEN ||
- key.bits.swizzle_b != PIPE_SWIZZLE_BLUE ||
- key.bits.swizzle_a != PIPE_SWIZZLE_ALPHA) {
+ if (any_swizzle(key)) {
samp->base.get_samples = sample_swizzle;
}
else {
More information about the mesa-commit
mailing list