}
static SpvId
-get_src_uint_ssa(struct ntv_context *ctx, const nir_ssa_def *ssa)
+get_src_ssa(struct ntv_context *ctx, const nir_ssa_def *ssa)
{
assert(ssa->index < ctx->num_defs);
assert(ctx->defs[ssa->index] != 0);
}
static SpvId
-get_src_uint_reg(struct ntv_context *ctx, const nir_reg_src *reg)
+get_src_reg(struct ntv_context *ctx, const nir_reg_src *reg)
{
assert(reg->reg);
assert(!reg->indirect);
}
static SpvId
-get_src_uint(struct ntv_context *ctx, nir_src *src)
+get_src(struct ntv_context *ctx, nir_src *src)
{
if (src->is_ssa)
- return get_src_uint_ssa(ctx, src->ssa);
+ return get_src_ssa(ctx, src->ssa);
else
- return get_src_uint_reg(ctx, &src->reg);
+ return get_src_reg(ctx, &src->reg);
}
static SpvId
-get_alu_src_uint(struct ntv_context *ctx, nir_alu_instr *alu, unsigned src)
+get_alu_src_raw(struct ntv_context *ctx, nir_alu_instr *alu, unsigned src)
{
assert(!alu->src[src].negate);
assert(!alu->src[src].abs);
- SpvId def = get_src_uint(ctx, &alu->src[src].src);
+ SpvId def = get_src(ctx, &alu->src[src].src);
unsigned used_channels = 0;
bool need_swizzle = false;
}
static void
-store_ssa_def_uint(struct ntv_context *ctx, nir_ssa_def *ssa, SpvId result)
+store_ssa_def(struct ntv_context *ctx, nir_ssa_def *ssa, SpvId result)
{
assert(result != 0);
assert(ssa->index < ctx->num_defs);
}
static void
-store_dest_uint(struct ntv_context *ctx, nir_dest *dest, SpvId result)
+store_dest_raw(struct ntv_context *ctx, nir_dest *dest, SpvId result)
{
if (dest->is_ssa)
- store_ssa_def_uint(ctx, &dest->ssa, result);
+ store_ssa_def(ctx, &dest->ssa, result);
else
store_reg_def(ctx, &dest->reg, result);
}
unreachable("unsupported nir_alu_type");
}
- store_dest_uint(ctx, dest, result);
+ store_dest_raw(ctx, dest, result);
}
static SpvId
static SpvId
get_alu_src(struct ntv_context *ctx, nir_alu_instr *alu, unsigned src)
{
- SpvId uint_value = get_alu_src_uint(ctx, alu, src);
+ SpvId uint_value = get_alu_src_raw(ctx, alu, src);
unsigned num_components = alu_instr_src_components(alu, src);
unsigned bit_size = nir_src_bit_size(alu->src[src].src);
store_alu_result(struct ntv_context *ctx, nir_alu_instr *alu, SpvId result)
{
assert(!alu->dest.saturate);
- return store_dest(ctx, &alu->dest.dest, result, nir_op_infos[alu->op].output_type);
+ return store_dest(ctx, &alu->dest.dest, result,
+ nir_op_infos[alu->op].output_type);
}
static SpvId
if (bit_size == 1)
constant = bvec_to_uvec(ctx, constant, num_components);
- store_ssa_def_uint(ctx, &load_const->def, constant);
+ store_ssa_def(ctx, &load_const->def, constant);
}
static void
static void
emit_load_deref(struct ntv_context *ctx, nir_intrinsic_instr *intr)
{
- /* uint is a bit of a lie here; it's really just a pointer */
- SpvId ptr = get_src_uint(ctx, intr->src);
+ SpvId ptr = get_src(ctx, intr->src);
nir_variable *var = nir_intrinsic_get_var(intr, 0);
SpvId result = spirv_builder_emit_load(&ctx->builder,
static void
emit_store_deref(struct ntv_context *ctx, nir_intrinsic_instr *intr)
{
- /* uint is a bit of a lie here; it's really just a pointer */
- SpvId ptr = get_src_uint(ctx, &intr->src[0]);
- SpvId src = get_src_uint(ctx, &intr->src[1]);
+ SpvId ptr = get_src(ctx, &intr->src[0]);
+ SpvId src = get_src(ctx, &intr->src[1]);
nir_variable *var = nir_intrinsic_get_var(intr, 0);
SpvId type = get_glsl_type(ctx, glsl_without_array(var->type));
SpvId type = get_uvec_type(ctx, undef->def.bit_size,
undef->def.num_components);
- store_ssa_def_uint(ctx, &undef->def,
- spirv_builder_emit_undef(&ctx->builder, type));
+ store_ssa_def(ctx, &undef->def,
+ spirv_builder_emit_undef(&ctx->builder, type));
}
static SpvId
get_src_float(struct ntv_context *ctx, nir_src *src)
{
- SpvId def = get_src_uint(ctx, src);
+ SpvId def = get_src(ctx, src);
unsigned num_components = nir_src_num_components(*src);
unsigned bit_size = nir_src_bit_size(*src);
return bitcast_to_fvec(ctx, def, bit_size, num_components);
static SpvId
get_src_int(struct ntv_context *ctx, nir_src *src)
{
- SpvId def = get_src_uint(ctx, src);
+ SpvId def = get_src(ctx, src);
unsigned num_components = nir_src_num_components(*src);
unsigned bit_size = nir_src_bit_size(*src);
return bitcast_to_ivec(ctx, def, bit_size, num_components);
unreachable("Unsupported nir_variable_mode\n");
}
- SpvId index = get_src_uint(ctx, &deref->arr.index);
+ SpvId index = get_src(ctx, &deref->arr.index);
SpvId ptr_type = spirv_builder_type_pointer(&ctx->builder,
storage_class,
SpvId result = spirv_builder_emit_access_chain(&ctx->builder,
ptr_type,
- get_src_uint(ctx, &deref->parent),
+ get_src(ctx, &deref->parent),
&index, 1);
/* uint is a bit of a lie here, it's really just an opaque type */
store_dest(ctx, &deref->dest, result, nir_type_uint);
static SpvId
get_src_bool(struct ntv_context *ctx, nir_src *src)
{
- SpvId def = get_src_uint(ctx, src);
+ SpvId def = get_src(ctx, src);
assert(nir_src_bit_size(*src) == 1);
unsigned num_components = nir_src_num_components(*src);
return uvec_to_bvec(ctx, def, num_components);