nir: Remove old-school deref chain support
Acked-by: Rob Clark <robdclark@gmail.com> Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Acked-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -915,62 +915,6 @@ typedef enum {
|
||||
nir_deref_type_cast,
|
||||
} nir_deref_type;
|
||||
|
||||
typedef struct nir_deref {
|
||||
nir_deref_type deref_type;
|
||||
struct nir_deref *child;
|
||||
const struct glsl_type *type;
|
||||
} nir_deref;
|
||||
|
||||
typedef struct {
|
||||
nir_deref deref;
|
||||
|
||||
nir_variable *var;
|
||||
} nir_deref_var;
|
||||
|
||||
/* This enum describes how the array is referenced. If the deref is
|
||||
* direct then the base_offset is used. If the deref is indirect then
|
||||
* offset is given by base_offset + indirect. If the deref is a wildcard
|
||||
* then the deref refers to all of the elements of the array at the same
|
||||
* time. Wildcard dereferences are only ever allowed in copy_var
|
||||
* intrinsics and the source and destination derefs must have matching
|
||||
* wildcards.
|
||||
*/
|
||||
typedef enum {
|
||||
nir_deref_array_type_direct,
|
||||
nir_deref_array_type_indirect,
|
||||
nir_deref_array_type_wildcard,
|
||||
} nir_deref_array_type;
|
||||
|
||||
typedef struct {
|
||||
nir_deref deref;
|
||||
|
||||
nir_deref_array_type deref_array_type;
|
||||
unsigned base_offset;
|
||||
nir_src indirect;
|
||||
} nir_deref_array;
|
||||
|
||||
typedef struct {
|
||||
nir_deref deref;
|
||||
|
||||
unsigned index;
|
||||
} nir_deref_struct;
|
||||
|
||||
NIR_DEFINE_CAST(nir_deref_as_var, nir_deref, nir_deref_var, deref,
|
||||
deref_type, nir_deref_type_var)
|
||||
NIR_DEFINE_CAST(nir_deref_as_array, nir_deref, nir_deref_array, deref,
|
||||
deref_type, nir_deref_type_array)
|
||||
NIR_DEFINE_CAST(nir_deref_as_struct, nir_deref, nir_deref_struct, deref,
|
||||
deref_type, nir_deref_type_struct)
|
||||
|
||||
/* Returns the last deref in the chain. */
|
||||
static inline nir_deref *
|
||||
nir_deref_tail(nir_deref *deref)
|
||||
{
|
||||
while (deref->child)
|
||||
deref = deref->child;
|
||||
return deref;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
nir_instr instr;
|
||||
|
||||
@@ -1045,9 +989,6 @@ nir_deref_instr_get_variable(const nir_deref_instr *instr)
|
||||
|
||||
bool nir_deref_instr_remove_if_unused(nir_deref_instr *instr);
|
||||
|
||||
nir_deref_var *
|
||||
nir_deref_instr_to_deref(nir_deref_instr *instr, void *mem_ctx);
|
||||
|
||||
typedef struct {
|
||||
nir_instr instr;
|
||||
|
||||
@@ -1106,8 +1047,6 @@ typedef struct {
|
||||
|
||||
int const_index[NIR_INTRINSIC_MAX_CONST_INDEX];
|
||||
|
||||
nir_deref_var *variables[2];
|
||||
|
||||
nir_src src[];
|
||||
} nir_intrinsic_instr;
|
||||
|
||||
@@ -1236,9 +1175,6 @@ typedef struct {
|
||||
*/
|
||||
unsigned dest_components;
|
||||
|
||||
/** the number of inputs/outputs that are variables */
|
||||
unsigned num_variables;
|
||||
|
||||
/** the number of constant indices used by the intrinsic */
|
||||
unsigned num_indices;
|
||||
|
||||
@@ -1383,12 +1319,6 @@ typedef struct {
|
||||
/** The size of the texture array or 0 if it's not an array */
|
||||
unsigned texture_array_size;
|
||||
|
||||
/** The texture deref
|
||||
*
|
||||
* If this is null, use texture_index instead.
|
||||
*/
|
||||
nir_deref_var *texture;
|
||||
|
||||
/** The sampler index
|
||||
*
|
||||
* The following operations do not require a sampler and, as such, this
|
||||
@@ -1405,12 +1335,6 @@ typedef struct {
|
||||
* then the sampler index is given by sampler_index + sampler_offset.
|
||||
*/
|
||||
unsigned sampler_index;
|
||||
|
||||
/** The sampler deref
|
||||
*
|
||||
* If this is null, use sampler_index instead.
|
||||
*/
|
||||
nir_deref_var *sampler;
|
||||
} nir_tex_instr;
|
||||
|
||||
static inline unsigned
|
||||
@@ -2141,19 +2065,8 @@ typedef struct nir_shader {
|
||||
* access plus one
|
||||
*/
|
||||
unsigned num_inputs, num_uniforms, num_outputs, num_shared;
|
||||
|
||||
/* temporary, tracking for which derefs instructions have been lowered
|
||||
* to deref chains
|
||||
*/
|
||||
unsigned lowered_derefs;
|
||||
} nir_shader;
|
||||
|
||||
#define nir_assert_lowered_derefs(shader, mask) \
|
||||
assert(((shader)->lowered_derefs & (mask)) == (mask))
|
||||
|
||||
#define nir_assert_unlowered_derefs(shader, mask) \
|
||||
assert(!((shader)->lowered_derefs & (mask)))
|
||||
|
||||
static inline nir_function_impl *
|
||||
nir_shader_get_entrypoint(nir_shader *shader)
|
||||
{
|
||||
@@ -2246,14 +2159,6 @@ nir_ssa_undef_instr *nir_ssa_undef_instr_create(nir_shader *shader,
|
||||
unsigned num_components,
|
||||
unsigned bit_size);
|
||||
|
||||
nir_deref_var *nir_deref_var_create(void *mem_ctx, nir_variable *var);
|
||||
nir_deref_array *nir_deref_array_create(void *mem_ctx);
|
||||
nir_deref_struct *nir_deref_struct_create(void *mem_ctx, unsigned field_index);
|
||||
|
||||
typedef bool (*nir_deref_foreach_leaf_cb)(nir_deref_var *deref, void *state);
|
||||
bool nir_deref_foreach_leaf(nir_deref_var *deref,
|
||||
nir_deref_foreach_leaf_cb cb, void *state);
|
||||
|
||||
nir_const_value nir_alu_binop_identity(nir_op binop, unsigned bit_size);
|
||||
|
||||
/**
|
||||
@@ -2485,8 +2390,6 @@ void nir_instr_move_src(nir_instr *dest_instr, nir_src *dest, nir_src *src);
|
||||
void nir_if_rewrite_condition(nir_if *if_stmt, nir_src new_src);
|
||||
void nir_instr_rewrite_dest(nir_instr *instr, nir_dest *dest,
|
||||
nir_dest new_dest);
|
||||
void nir_instr_rewrite_deref(nir_instr *instr, nir_deref_var **deref,
|
||||
nir_deref_var *new_deref);
|
||||
|
||||
void nir_ssa_dest_init(nir_instr *instr, nir_dest *dest,
|
||||
unsigned num_components, unsigned bit_size,
|
||||
@@ -2581,8 +2484,6 @@ nir_shader *nir_shader_clone(void *mem_ctx, const nir_shader *s);
|
||||
nir_function_impl *nir_function_impl_clone(const nir_function_impl *fi);
|
||||
nir_constant *nir_constant_clone(const nir_constant *c, nir_variable *var);
|
||||
nir_variable *nir_variable_clone(const nir_variable *c, nir_shader *shader);
|
||||
nir_deref *nir_deref_clone(const nir_deref *deref, void *mem_ctx);
|
||||
nir_deref_var *nir_deref_var_clone(const nir_deref_var *deref, void *mem_ctx);
|
||||
|
||||
nir_shader *nir_shader_serialize_deserialize(void *mem_ctx, nir_shader *s);
|
||||
|
||||
@@ -2690,19 +2591,6 @@ bool nir_inline_functions(nir_shader *shader);
|
||||
|
||||
bool nir_propagate_invariant(nir_shader *shader);
|
||||
|
||||
enum nir_lower_deref_flags {
|
||||
nir_lower_load_store_derefs = (1 << 0),
|
||||
nir_lower_texture_derefs = (1 << 1),
|
||||
nir_lower_interp_derefs = (1 << 2),
|
||||
nir_lower_atomic_counter_derefs = (1 << 3),
|
||||
nir_lower_atomic_derefs = (1 << 4),
|
||||
nir_lower_image_derefs = (1 << 5),
|
||||
nir_lower_all_derefs = (1 << 6) - 1,
|
||||
};
|
||||
|
||||
bool nir_lower_deref_instrs(nir_shader *shader,
|
||||
enum nir_lower_deref_flags flags);
|
||||
|
||||
void nir_lower_var_copy_instr(nir_intrinsic_instr *copy, nir_shader *shader);
|
||||
void nir_lower_deref_copy_instr(struct nir_builder *b,
|
||||
nir_intrinsic_instr *copy);
|
||||
|
Reference in New Issue
Block a user