From: Kenneth Graunke Date: Tue, 3 Sep 2013 23:55:37 +0000 (-0700) Subject: glsl: Expose IR builder support for arbitrary swizzling. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a6c0efa116e7427e3ee5f24db2000e3edb66047;p=mesa.git glsl: Expose IR builder support for arbitrary swizzling. IR builder already offers a lot of swizzling functions, such as swizzle_xxxx, swizzle_z, or swizzle_for_size. The swizzle_xxxx style is convenient if you statically know which components you want. swizzle_for_size is great if you want to select the first few components. However, if you want to select components based on, say, a loop counter, none of those are sufficient. IR builder actually already had support for arbitrary swizzling, but didn't expose it. This patch exposes that API. Signed-off-by: Kenneth Graunke Reviewed-by: Matt Turner Reviewed-by: Paul Berry --- diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h index 6d32d7a68b9..091cf400b4a 100644 --- a/src/glsl/ir_builder.h +++ b/src/glsl/ir_builder.h @@ -171,6 +171,7 @@ ir_expression *u2i(operand a); ir_expression *b2i(operand a); ir_expression *i2b(operand a); +ir_swizzle *swizzle(operand a, int swizzle, int components); /** * Swizzle away later components, but preserve the ordering. */