diff options
author | Rob Clark <[email protected]> | 2015-09-18 13:23:36 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2015-09-18 21:07:50 -0400 |
commit | e4dfcdcbecee9d11709e85524222d748d0e27112 (patch) | |
tree | 798754df3e9990e79a065b62bbc60b1f5b25ae81 /src/glsl/nir/nir_builder.h | |
parent | c71cb670ba786a4bc443d23e6aa4b866e069dcd2 (diff) |
nir/build: add nir_vec() helper
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_builder.h')
-rw-r--r-- | src/glsl/nir/nir_builder.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h index 47533302a6d..8db5fcf039d 100644 --- a/src/glsl/nir/nir_builder.h +++ b/src/glsl/nir/nir_builder.h @@ -173,6 +173,24 @@ nir_##op(nir_builder *build, nir_ssa_def *src0, \ #include "nir_builder_opcodes.h" +static inline nir_ssa_def * +nir_vec(nir_builder *build, nir_ssa_def **comp, unsigned num_components) +{ + switch (num_components) { + case 4: + return nir_vec4(build, comp[0], comp[1], comp[2], comp[3]); + case 3: + return nir_vec3(build, comp[0], comp[1], comp[2]); + case 2: + return nir_vec2(build, comp[0], comp[1]); + case 1: + return comp[0]; + default: + unreachable("bad component count"); + return NULL; + } +} + /** * Similar to nir_fmov, but takes a nir_alu_src instead of a nir_ssa_def. */ |