return dxil_get_metadata_node(m, fields, ARRAY_SIZE(fields));
}
-static const struct dxil_type *
-get_glsl_basetype(struct dxil_module *m, enum glsl_base_type type)
-{
- switch (type) {
- case GLSL_TYPE_BOOL:
- return dxil_module_get_int_type(m, 1);
-
- case GLSL_TYPE_UINT:
- case GLSL_TYPE_INT:
- return dxil_module_get_int_type(m, 32);
-
- default:
- debug_printf("type: %s\n", glsl_get_type_name(glsl_scalar_type(type)));
- unreachable("unexpected GLSL type");
- }
-}
-
-static const struct dxil_type *
-get_glsl_type(struct dxil_module *m, const struct glsl_type *type)
-{
- assert(type);
-
- if (glsl_type_is_scalar(type))
- return get_glsl_basetype(m, glsl_get_base_type(type));
-
- if (glsl_type_is_array(type))
- return dxil_module_get_array_type(m,
- get_glsl_type(m, glsl_get_array_element(type)),
- glsl_get_length(type));
-
- unreachable("unexpected glsl type");
-}
-
#define MAX_SRVS 128
#define MAX_UAVS 64
assert(!glsl_type_is_unsized_array(type));
const struct glsl_type *without = glsl_without_array(type);
unsigned stride = glsl_get_explicit_stride(without);
- enum glsl_base_type without_base = glsl_get_base_type(without);
for (unsigned elt = 0; elt < glsl_get_length(type); elt++) {
if (!var_fill_const_array(ctx, c->elements[elt], without,
emit_global_consts(struct ntd_context *ctx, nir_shader *s)
{
nir_foreach_variable_with_modes(var, s, nir_var_shader_temp) {
- struct dxil_value *ret;
bool err;
assert(var->constant_initializer);
static bool
emit_ubo_var(struct ntd_context *ctx, nir_variable *var)
{
- unsigned size = get_dword_size(var->type);
- unsigned binding = var->data.binding;
return emit_cbv(ctx, var->data.binding, get_dword_size(var->type), var->name);
}
}
}
-static const struct dxil_value *
-get_src_ptr(struct ntd_context *ctx, nir_src *src, unsigned chan,
- nir_alu_type type)
-{
- /* May implement pointer casting */
- assert(src->is_ssa);
- return get_src_ssa(ctx, src->ssa, chan);
-}
-
static const struct dxil_type *
get_alu_src_type(struct ntd_context *ctx, nir_alu_instr *alu, unsigned src)
{
return dxil_module_get_undef(m, int32_type);
}
-static const struct dxil_value *
-offset_to_index(struct dxil_module *m, const struct dxil_value *offset,
- unsigned bit_size)
-{
- unsigned shift_amt = util_logbase2(bit_size / 8);
- const struct dxil_value *shift =
- dxil_module_get_int32_const(m, shift_amt);
- if (!shift)
- return NULL;
-
- return dxil_emit_binop(m, DXIL_BINOP_LSHR, offset, shift, 0);
-}
-
-static const struct dxil_value *
-index_to_offset(struct dxil_module *m, const struct dxil_value *index,
- unsigned bit_size)
-{
- unsigned shift_amt = util_logbase2(bit_size / 8);
- const struct dxil_value *shift =
- dxil_module_get_int32_const(m, shift_amt);
- if (!shift)
- return NULL;
-
- return dxil_emit_binop(m, DXIL_BINOP_SHL, index, shift, 0);
-}
-
static const struct dxil_value *
emit_gep_for_index(struct ntd_context *ctx, const nir_variable *var,
const struct dxil_value *index)
static bool
emit_load_scratch(struct ntd_context *ctx, nir_intrinsic_instr *intr)
{
- const struct dxil_value *zero, *one, *index;
+ const struct dxil_value *zero, *index;
unsigned bit_size = nir_dest_bit_size(intr->dest);
unsigned align = bit_size / 8;