diff options
author | Eric Anholt <[email protected]> | 2015-01-21 15:55:23 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2015-01-23 16:37:16 -0800 |
commit | b2001278169b1f943c0bb6edb2d6985348beab4a (patch) | |
tree | edfffead2b420b1a14aa4f1d5c7811129776843d /src/glsl/nir/nir.c | |
parent | 15063d2ad0945004ef387511d0c805bbe734bc5f (diff) |
nir: Make some helpers for copying ALU src/dests.
There aren't many users yet, but I wanted to do this from my scalarizing
pass.
v2: Constify the src arguments.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir.c')
-rw-r--r-- | src/glsl/nir/nir.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index 16ad2da945c..0f9bfd947cf 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -175,6 +175,24 @@ nir_dest nir_dest_copy(nir_dest dest, void *mem_ctx) return ret; } +void +nir_alu_src_copy(nir_alu_src *dest, const nir_alu_src *src, void *mem_ctx) +{ + dest->src = nir_src_copy(src->src, mem_ctx); + dest->abs = src->abs; + dest->negate = src->negate; + for (unsigned i = 0; i < 4; i++) + dest->swizzle[i] = src->swizzle[i]; +} + +void +nir_alu_dest_copy(nir_alu_dest *dest, const nir_alu_dest *src, void *mem_ctx) +{ + dest->dest = nir_dest_copy(src->dest, mem_ctx); + dest->write_mask = src->write_mask; + dest->saturate = src->saturate; +} + static inline void block_add_pred(nir_block *block, nir_block *pred) { |