nir_dest *dest = get_instr_dest(this->result);
assert(dest->is_ssa);
- nir_src src;
+ nir_src src = NIR_SRC_INIT;
src.is_ssa = true;
src.ssa = &dest->ssa;
bool is_ssa;
} nir_src;
+#define NIR_SRC_INIT (nir_src) { { { NULL } } }
+
typedef struct {
union {
nir_reg_dest reg;
bool is_ssa;
} nir_dest;
+#define NIR_DEST_INIT (nir_dest) { { { NULL } } }
+
static inline nir_src
nir_src_for_ssa(nir_ssa_def *def)
{
- nir_src src;
+ nir_src src = NIR_SRC_INIT;
src.is_ssa = true;
src.ssa = def;
static inline nir_src
nir_src_for_reg(nir_register *reg)
{
- nir_src src;
+ nir_src src = NIR_SRC_INIT;
src.is_ssa = false;
src.reg.reg = reg;
static inline nir_dest
nir_dest_for_reg(nir_register *reg)
{
- nir_dest dest;
+ nir_dest dest = NIR_DEST_INIT;
- dest.is_ssa = false;
dest.reg.reg = reg;
- dest.reg.indirect = NULL;
- dest.reg.base_offset = 0;
return dest;
}
nir_swizzle(nir_builder *build, nir_ssa_def *src, unsigned swiz[4],
unsigned num_components, bool use_fmov)
{
- nir_alu_src alu_src;
- memset(&alu_src, 0, sizeof(alu_src));
+ nir_alu_src alu_src = { NIR_SRC_INIT };
alu_src.src = nir_src_for_ssa(src);
for (int i = 0; i < 4; i++)
alu_src.swizzle[i] = swiz[i];
if (src.is_ssa && src.ssa->num_components == num_components)
return src.ssa;
- nir_alu_src alu;
- memset(&alu, 0, sizeof(alu));
+ nir_alu_src alu = { NIR_SRC_INIT };
alu.src = src;
for (int j = 0; j < 4; j++)
alu.swizzle[j] = j;
instr->sampler_array_size = glsl_get_length(deref->type);
- nir_src empty;
- memset(&empty, 0, sizeof empty);
- nir_instr_rewrite_src(&instr->instr, &deref_array->indirect, empty);
+ nir_instr_rewrite_src(&instr->instr, &deref_array->indirect,
+ NIR_SRC_INIT);
if (deref_array->deref.child)
ralloc_strcat(&name, "[0]");
/* Now move the later tex sources down the array so that the projector
* disappears.
*/
- nir_src dead;
- memset(&dead, 0, sizeof dead);
- nir_instr_rewrite_src(&tex->instr, &tex->src[proj_index].src, dead);
+ nir_instr_rewrite_src(&tex->instr, &tex->src[proj_index].src,
+ NIR_SRC_INIT);
memmove(&tex->src[proj_index],
&tex->src[proj_index + 1],
(tex->num_srcs - proj_index) * sizeof(*tex->src));
const nir_search_variable *var = nir_search_value_as_variable(value);
assert(state->variables_seen & (1 << var->variable));
- nir_alu_src val;
+ nir_alu_src val = { NIR_SRC_INIT };
nir_alu_src_copy(&val, &state->variables[var->variable], mem_ctx);
assert(!var->is_constant);