Mesa (gallium-0.1): ureg: return imm1f values as scalars
Keith Whitwell
keithw at kemper.freedesktop.org
Fri Aug 28 17:38:40 UTC 2009
Module: Mesa
Branch: gallium-0.1
Commit: e90b6e2aff74594ae016429420664e15a5e2c2cb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e90b6e2aff74594ae016429420664e15a5e2c2cb
Author: Keith Whitwell <keithw at vmware.com>
Date: Fri Aug 28 17:25:41 2009 +0100
ureg: return imm1f values as scalars
Instead of IMM[5].wxxx, where .x is some random value, return the more
useful IMM[5].wwww
---
src/gallium/auxiliary/tgsi/tgsi_ureg.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index ee71bd8..cb50ab0 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -412,7 +412,7 @@ struct ureg_src ureg_DECL_immediate( struct ureg_program *ureg,
const float *v,
unsigned nr )
{
- unsigned i;
+ unsigned i, j;
unsigned swizzle = 0;
/* Could do a first pass where we examine all existing immediates
@@ -441,6 +441,12 @@ struct ureg_src ureg_DECL_immediate( struct ureg_program *ureg,
set_bad( ureg );
out:
+ /* Make sure that all referenced elements are from this immediate.
+ * Has the effect of making size-one immediates into scalars.
+ */
+ for (j = nr; j < 4; j++)
+ swizzle |= (swizzle & 0x3) << (j * 2);
+
return ureg_swizzle( ureg_src_register( TGSI_FILE_IMMEDIATE, i ),
(swizzle >> 0) & 0x3,
(swizzle >> 2) & 0x3,
More information about the mesa-commit
mailing list