summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-08-22 14:08:32 -0700
committerJason Ekstrand <[email protected]>2017-11-07 10:37:52 -0800
commitad127afcfd5e7d6fb98e7cf2ae02333249d31fb2 (patch)
treee62fb9354c95e2bcbf234dd06739ffd9f4b477e2 /src/compiler/nir
parent28da82f9783091cb3e79586962f98a5bc165cff8 (diff)
nir: Add a ssa_dest_init_for_type helper
This would be useful a number of places Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 1f4ec2cb866..7ee4bfcc557 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2228,6 +2228,15 @@ void nir_ssa_dest_init(nir_instr *instr, nir_dest *dest,
void nir_ssa_def_init(nir_instr *instr, nir_ssa_def *def,
unsigned num_components, unsigned bit_size,
const char *name);
+static inline void
+nir_ssa_dest_init_for_type(nir_instr *instr, nir_dest *dest,
+ const struct glsl_type *type,
+ const char *name)
+{
+ assert(glsl_type_is_vector_or_scalar(type));
+ nir_ssa_dest_init(instr, dest, glsl_get_components(type),
+ glsl_get_bit_size(type), name);
+}
void nir_ssa_def_rewrite_uses(nir_ssa_def *def, nir_src new_src);
void nir_ssa_def_rewrite_uses_after(nir_ssa_def *def, nir_src new_src,
nir_instr *after_me);