}
static void
-store_dest_value(struct ntd_context *ctx, nir_dest *dest, unsigned chan,
- const struct dxil_value *value)
-{
- assert(value);
- store_ssa_def(ctx, &dest->ssa, chan, value);
-}
-
-static void
-store_dest(struct ntd_context *ctx, nir_dest *dest, unsigned chan,
+store_def(struct ntd_context *ctx, nir_def *def, unsigned chan,
const struct dxil_value *value)
{
const struct dxil_type *type = dxil_value_get_type(value);
ctx->mod.feats.min_precision = true;
if (type == ctx->mod.int64_type)
ctx->mod.feats.int64_ops = true;
- store_dest_value(ctx, dest, chan, value);
+ store_ssa_def(ctx, def, chan, value);
}
static void
store_alu_dest(struct ntd_context *ctx, nir_alu_instr *alu, unsigned chan,
const struct dxil_value *value)
{
- store_dest(ctx, &alu->dest.dest, chan, value);
+ store_def(ctx, &alu->dest.dest.ssa, chan, value);
}
static const struct dxil_value *
const struct dxil_value *v = dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
if (!v)
return false;
- store_dest(ctx, &alu->dest.dest, 0, v);
+ store_def(ctx, &alu->dest.dest.ssa, 0, v);
return true;
}
if (!hi || !lo)
return false;
- store_dest(ctx, &alu->dest.dest, 0, hi);
- store_dest(ctx, &alu->dest.dest, 1, lo);
+ store_def(ctx, &alu->dest.dest.ssa, 0, hi);
+ store_def(ctx, &alu->dest.dest.ssa, 1, lo);
return true;
}
if (!globalid)
return false;
- store_dest(ctx, &intr->dest, i, globalid);
+ store_def(ctx, &intr->dest.ssa, i, globalid);
}
}
return true;
*threadidingroup = emit_threadidingroup_call(ctx, idx);
if (!threadidingroup)
return false;
- store_dest(ctx, &intr->dest, i, threadidingroup);
+ store_def(ctx, &intr->dest.ssa, i, threadidingroup);
}
}
return true;
*flattenedthreadidingroup = emit_flattenedthreadidingroup_call(ctx);
if (!flattenedthreadidingroup)
return false;
- store_dest(ctx, &intr->dest, 0, flattenedthreadidingroup);
+ store_def(ctx, &intr->dest.ssa, 0, flattenedthreadidingroup);
return true;
}
const struct dxil_value *groupid = emit_groupid_call(ctx, idx);
if (!groupid)
return false;
- store_dest(ctx, &intr->dest, i, groupid);
+ store_def(ctx, &intr->dest.ssa, i, groupid);
}
}
return true;
{
const struct dxil_value *value = call_unary_external_function(ctx, name, dxil_intr,
get_overload(type, intr->dest.ssa.bit_size));
- store_dest(ctx, &intr->dest, 0, value);
+ store_def(ctx, &intr->dest.ssa, 0, value);
return true;
}
call_unary_external_function(ctx, "dx.op.sampleIndex", DXIL_INTR_SAMPLE_INDEX, DXIL_I32), 0), 0);
}
- store_dest(ctx, &intr->dest, 0, value);
+ store_def(ctx, &intr->dest.ssa, 0, value);
return true;
}
const struct dxil_value *value =
dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
- store_dest(ctx, &intr->dest, i, value);
+ store_def(ctx, &intr->dest.ssa, i, value);
}
for (unsigned i = num_coords; i < intr->dest.ssa.num_components; ++i) {
const struct dxil_value *value = dxil_module_get_float_const(&ctx->mod, 0.0f);
- store_dest(ctx, &intr->dest, i, value);
+ store_def(ctx, &intr->dest.ssa, i, value);
}
return true;
dxil_emit_extractval(&ctx->mod, load, i);
if (!val)
return false;
- store_dest(ctx, &intr->dest, i, val);
+ store_def(ctx, &intr->dest.ssa, i, val);
}
if (nir_dest_bit_size(intr->dest) == 16)
ctx->mod.feats.native_low_precision = true;
unsigned first_component = nir_intrinsic_has_component(intr) ?
nir_intrinsic_component(intr) : 0;
for (unsigned i = 0; i < nir_dest_num_components(intr->dest); i++)
- store_dest(ctx, &intr->dest, i,
+ store_def(ctx, &intr->dest.ssa, i,
dxil_emit_extractval(&ctx->mod, agg, i + first_component));
if (nir_dest_bit_size(intr->dest) == 16)
const struct dxil_value *retval = dxil_emit_call(&ctx->mod, func, args, num_args);
if (!retval)
return false;
- store_dest(ctx, &intr->dest, i, retval);
+ store_def(ctx, &intr->dest.ssa, i, retval);
}
return true;
}
const struct dxil_value *retval = dxil_emit_call(&ctx->mod, func, args, num_args);
if (!retval)
return false;
- store_dest(ctx, &intr->dest, i, retval);
+ store_def(ctx, &intr->dest.ssa, i, retval);
}
return true;
}
if (!retval)
return false;
- store_dest(ctx, &intr->dest, 0, retval);
+ store_def(ctx, &intr->dest.ssa, 0, retval);
return true;
}
if (!retval)
return false;
- store_dest(ctx, &intr->dest, 0, retval);
+ store_def(ctx, &intr->dest.ssa, 0, retval);
return true;
}
if (!retval)
return false;
- store_dest(ctx, &intr->dest, 0, retval);
+ store_def(ctx, &intr->dest.ssa, 0, retval);
return true;
}
const struct dxil_value *component = dxil_emit_extractval(&ctx->mod, load_result, i);
if (!component)
return false;
- store_dest(ctx, &intr->dest, i, component);
+ store_def(ctx, &intr->dest.ssa, i, component);
}
if (util_format_get_nr_components(nir_intrinsic_format(intr)) > 1)
if (!retval)
return false;
- store_dest(ctx, &intr->dest, 0, retval);
+ store_def(ctx, &intr->dest.ssa, 0, retval);
return true;
}
if (!retval)
return false;
- store_dest(ctx, &intr->dest, 0, retval);
+ store_def(ctx, &intr->dest.ssa, 0, retval);
return true;
}
for (unsigned i = 0; i < nir_dest_num_components(intr->dest); ++i) {
const struct dxil_value *retval = dxil_emit_extractval(&ctx->mod, dimensions, i);
- store_dest(ctx, &intr->dest, i, retval);
+ store_def(ctx, &intr->dest.ssa, i, retval);
}
return true;
return false;
const struct dxil_value *retval = dxil_emit_extractval(&ctx->mod, dimensions, 0);
- store_dest(ctx, &intr->dest, 0, retval);
+ store_def(ctx, &intr->dest.ssa, 0, retval);
return true;
}
if (!retval)
return false;
- store_dest(ctx, &intr->dest, 0, retval);
+ store_def(ctx, &intr->dest.ssa, 0, retval);
return true;
}
if (!retval)
return false;
- store_dest(ctx, &intr->dest, 0, retval);
+ store_def(ctx, &intr->dest.ssa, 0, retval);
return true;
}
return false;
}
- store_dest(ctx, &intr->dest, 0, index_value);
- store_dest(ctx, &intr->dest, 1, dxil_module_get_int32_const(&ctx->mod, 0));
+ store_def(ctx, &intr->dest.ssa, 0, index_value);
+ store_def(ctx, &intr->dest.ssa, 1, dxil_module_get_int32_const(&ctx->mod, 0));
return true;
}
handle = emit_annotate_handle(ctx, unannotated_handle, res_props);
}
- store_dest_value(ctx, &intr->dest, 0, handle);
- store_dest(ctx, &intr->dest, 1, get_src(ctx, &intr->src[0], 1, nir_type_uint32));
+ store_ssa_def(ctx, &intr->dest.ssa, 0, handle);
+ store_def(ctx, &intr->dest.ssa, 1, get_src(ctx, &intr->src[0], 1, nir_type_uint32));
return true;
}
const struct dxil_value *coord = dxil_emit_binop(&ctx->mod, DXIL_BINOP_ADD,
dxil_emit_extractval(&ctx->mod, v, i),
dxil_module_get_float_const(&ctx->mod, 0.5f), 0);
- store_dest(ctx, &intr->dest, i, coord);
+ store_def(ctx, &intr->dest.ssa, i, coord);
}
return true;
}
return emit_load_unary_external_function(ctx, intr, "dx.op.sampleIndex",
DXIL_INTR_SAMPLE_INDEX, nir_type_int);
- store_dest(ctx, &intr->dest, 0, dxil_module_get_int32_const(&ctx->mod, 0));
+ store_def(ctx, &intr->dest.ssa, 0, dxil_module_get_int32_const(&ctx->mod, 0));
return true;
}
const struct dxil_value *ret = dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
if (!ret)
return false;
- store_dest(ctx, &intr->dest, 0, ret);
+ store_def(ctx, &intr->dest.ssa, 0, ret);
return true;
}
const struct dxil_value *ret = dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
if (!ret)
return false;
- store_dest(ctx, &intr->dest, 0, ret);
+ store_def(ctx, &intr->dest.ssa, 0, ret);
return true;
}
const struct dxil_value *ret = dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
if (!ret)
return false;
- store_dest(ctx, &intr->dest, 0, ret);
+ store_def(ctx, &intr->dest.ssa, 0, ret);
return true;
}
const struct dxil_value *ret = dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
if (!ret)
return false;
- store_dest(ctx, &intr->dest, 0, ret);
+ store_def(ctx, &intr->dest.ssa, 0, ret);
return true;
}
if (!ret)
return false;
for (uint32_t i = 0; i < 4; ++i)
- store_dest(ctx, &intr->dest, i, dxil_emit_extractval(&ctx->mod, ret, i));
+ store_def(ctx, &intr->dest.ssa, i, dxil_emit_extractval(&ctx->mod, ret, i));
return true;
}
const struct dxil_value *ret = dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
if (!ret)
return false;
- store_dest(ctx, &intr->dest, 0, ret);
+ store_def(ctx, &intr->dest.ssa, 0, ret);
return true;
}
const struct dxil_value *ret = dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
if (!ret)
return false;
- store_dest(ctx, &intr->dest, 0, ret);
+ store_def(ctx, &intr->dest.ssa, 0, ret);
return true;
}
const struct dxil_value *ret = dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
if (!ret)
return false;
- store_dest(ctx, &intr->dest, 0, ret);
+ store_def(ctx, &intr->dest.ssa, 0, ret);
return true;
}
/* Just store the values, we'll use these to build a GEP in the load or store */
switch (instr->deref_type) {
case nir_deref_type_var:
- store_dest(ctx, &instr->dest, 0, dxil_module_get_int_const(&ctx->mod, 0, instr->dest.ssa.bit_size));
+ store_def(ctx, &instr->dest.ssa, 0, dxil_module_get_int_const(&ctx->mod, 0, instr->dest.ssa.bit_size));
return true;
case nir_deref_type_array:
- store_dest(ctx, &instr->dest, 0, get_src(ctx, &instr->arr.index, 0, nir_type_int));
+ store_def(ctx, &instr->dest.ssa, 0, get_src(ctx, &instr->arr.index, 0, nir_type_int));
return true;
case nir_deref_type_struct:
- store_dest(ctx, &instr->dest, 0, dxil_module_get_int_const(&ctx->mod, instr->strct.index, 32));
+ store_def(ctx, &instr->dest.ssa, 0, dxil_module_get_int_const(&ctx->mod, instr->strct.index, 32));
return true;
default:
unreachable("Other deref types not supported");
/* Haven't finished chasing the deref chain yet, just store the value */
if (glsl_type_is_array(type)) {
- store_dest(ctx, &instr->dest, 0, binding);
+ store_def(ctx, &instr->dest.ssa, 0, binding);
return true;
}
if (!handle)
return false;
- store_dest_value(ctx, &instr->dest, 0, handle);
+ store_ssa_def(ctx, &instr->dest.ssa, 0, handle);
return true;
}
struct dxil_instr *phi = vphi->comp[i] = dxil_emit_phi(&ctx->mod, type);
if (!phi)
return false;
- store_dest_value(ctx, &instr->dest, i, dxil_instr_get_return_value(phi));
+ store_ssa_def(ctx, &instr->dest.ssa, i, dxil_instr_get_return_value(phi));
}
_mesa_hash_table_insert(ctx->phis, instr, vphi);
return true;
case nir_texop_lod:
sample = emit_texture_lod(ctx, ¶ms, true);
- store_dest(ctx, &instr->dest, 0, sample);
+ store_def(ctx, &instr->dest.ssa, 0, sample);
sample = emit_texture_lod(ctx, ¶ms, false);
- store_dest(ctx, &instr->dest, 1, sample);
+ store_def(ctx, &instr->dest.ssa, 1, sample);
return true;
case nir_texop_query_levels: {
params.lod_or_sample = dxil_module_get_int_const(&ctx->mod, 0, 32);
sample = emit_texture_size(ctx, ¶ms);
const struct dxil_value *retval = dxil_emit_extractval(&ctx->mod, sample, 3);
- store_dest(ctx, &instr->dest, 0, retval);
+ store_def(ctx, &instr->dest.ssa, 0, retval);
return true;
}
params.lod_or_sample = int_undef;
sample = emit_texture_size(ctx, ¶ms);
const struct dxil_value *retval = dxil_emit_extractval(&ctx->mod, sample, 3);
- store_dest(ctx, &instr->dest, 0, retval);
+ store_def(ctx, &instr->dest.ssa, 0, retval);
return true;
}
for (unsigned i = 0; i < nir_dest_num_components(instr->dest); ++i) {
const struct dxil_value *retval = dxil_emit_extractval(&ctx->mod, sample, i);
- store_dest(ctx, &instr->dest, i, retval);
+ store_def(ctx, &instr->dest.ssa, i, retval);
}
return true;