Lines Matching defs:deref
641 } deref;
1020 write_deref(write_ctx *ctx, const nir_deref_instr *deref)
1022 assert(deref->deref_type < 8);
1027 header.deref.instr_type = deref->instr.type;
1028 header.deref.deref_type = deref->deref_type;
1030 if (deref->deref_type == nir_deref_type_cast) {
1031 header.deref.modes = encode_deref_modes(deref->modes);
1032 header.deref.cast_type_same_as_last = deref->type == ctx->last_type;
1036 if (deref->deref_type == nir_deref_type_var) {
1037 var_idx = write_lookup_object(ctx, deref->var);
1042 if (deref->deref_type == nir_deref_type_array ||
1043 deref->deref_type == nir_deref_type_ptr_as_array) {
1044 header.deref.packed_src_ssa_16bit =
1045 deref->parent.is_ssa && deref->arr.index.is_ssa &&
1048 header.deref.in_bounds = deref->arr.in_bounds;
1051 write_dest(ctx, &deref->dest, header, deref->instr.type);
1053 switch (deref->deref_type) {
1060 write_src(ctx, &deref->parent);
1061 blob_write_uint32(ctx->blob, deref->strct.index);
1066 if (header.deref.packed_src_ssa_16bit) {
1068 write_lookup_object(ctx, deref->parent.ssa));
1070 write_lookup_object(ctx, deref->arr.index.ssa));
1072 write_src(ctx, &deref->parent);
1073 write_src(ctx, &deref->arr.index);
1078 write_src(ctx, &deref->parent);
1079 blob_write_uint32(ctx->blob, deref->cast.ptr_stride);
1080 blob_write_uint32(ctx->blob, deref->cast.align_mul);
1081 blob_write_uint32(ctx->blob, deref->cast.align_offset);
1082 if (!header.deref.cast_type_same_as_last) {
1083 encode_type_to_blob(ctx->blob, deref->type);
1084 ctx->last_type = deref->type;
1089 write_src(ctx, &deref->parent);
1093 unreachable("Invalid deref type");
1100 nir_deref_type deref_type = header.deref.deref_type;
1101 nir_deref_instr *deref = nir_deref_instr_create(ctx->nir, deref_type);
1103 read_dest(ctx, &deref->dest, &deref->instr, header);
1107 switch (deref->deref_type) {
1110 deref->var = read_lookup_object(ctx, header.deref_var.object_idx);
1112 deref->var = read_object(ctx);
1114 deref->type = deref->var->type;
1118 read_src(ctx, &deref->parent, &deref->instr);
1119 parent = nir_src_as_deref(deref->parent);
1120 deref->strct.index = blob_read_uint32(ctx->blob);
1121 deref->type = glsl_get_struct_field(parent->type, deref->strct.index);
1126 if (header.deref.packed_src_ssa_16bit) {
1127 deref->parent.is_ssa = true;
1128 deref->parent.ssa = read_lookup_object(ctx, blob_read_uint16(ctx->blob));
1129 deref->arr.index.is_ssa = true;
1130 deref->arr.index.ssa = read_lookup_object(ctx, blob_read_uint16(ctx->blob));
1132 read_src(ctx, &deref->parent, &deref->instr);
1133 read_src(ctx, &deref->arr.index, &deref->instr);
1136 deref->arr.in_bounds = header.deref.in_bounds;
1138 parent = nir_src_as_deref(deref->parent);
1139 if (deref->deref_type == nir_deref_type_array)
1140 deref->type = glsl_get_array_element(parent->type);
1142 deref->type = parent->type;
1146 read_src(ctx, &deref->parent, &deref->instr);
1147 deref->cast.ptr_stride = blob_read_uint32(ctx->blob);
1148 deref->cast.align_mul = blob_read_uint32(ctx->blob);
1149 deref->cast.align_offset = blob_read_uint32(ctx->blob);
1150 if (header.deref.cast_type_same_as_last) {
1151 deref->type = ctx->last_type;
1153 deref->type = decode_type_from_blob(ctx->blob);
1154 ctx->last_type = deref->type;
1159 read_src(ctx, &deref->parent, &deref->instr);
1160 parent = nir_src_as_deref(deref->parent);
1161 deref->type = glsl_get_array_element(parent->type);
1165 unreachable("Invalid deref type");
1169 deref->modes = deref->var->data.mode;
1170 } else if (deref->deref_type == nir_deref_type_cast) {
1171 deref->modes = decode_deref_modes(header.deref.modes);
1173 assert(deref->parent.is_ssa);
1174 deref->modes = nir_instr_as_deref(deref->parent.ssa->parent_instr)->modes;
1177 return deref;