[Mesa-dev] [PATCH 02/12] nir/builder: only read meaningful channels in nir_swizzle()
Connor Abbott
cwabbott0 at gmail.com
Fri Aug 14 15:30:11 PDT 2015
This way the caller doesn't have to initialize all 4 channels when they
aren't using them.
Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
---
src/glsl/nir/nir_builder.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h
index 1745453..9592b8a 100644
--- a/src/glsl/nir/nir_builder.h
+++ b/src/glsl/nir/nir_builder.h
@@ -235,7 +235,7 @@ nir_swizzle(nir_builder *build, nir_ssa_def *src, unsigned swiz[4],
{
nir_alu_src alu_src = { NIR_SRC_INIT };
alu_src.src = nir_src_for_ssa(src);
- for (int i = 0; i < 4; i++)
+ for (int i = 0; i < num_components; i++)
alu_src.swizzle[i] = swiz[i];
return use_fmov ? nir_fmov_alu(build, alu_src, num_components) :
--
2.4.3
More information about the mesa-dev
mailing list