{
ppir_load_texture_node *load_tex = ppir_node_to_load_texture(node);
- if (ppir_node_has_single_pred(node)) {
- ppir_node *pred = ppir_node_first_pred(node);
- if (pred->op == ppir_op_load_varying) {
- /* If ldtex is the only successor of load_varying node
- * we're good. Just change load_varying op type to load_coords.
- */
- if (ppir_node_has_single_succ(pred)) {
- pred->op = ppir_op_load_coords;
- return true;
- }
- }
- }
-
- /* Otherwise we need to create load_coords node */
+ /* Create load_coords node */
ppir_load_node *load = ppir_node_create(block, ppir_op_load_coords, -1, 0);
if (!load)
return false;
ppir_debug("%s create load_coords node %d for %d\n",
__FUNCTION__, load->node.index, node->index);
- ppir_dest *dest = &load->dest;
- dest->type = ppir_target_ssa;
- dest->ssa.num_components = load_tex->src_coords.ssa->num_components;
- dest->ssa.live_in = INT_MAX;
- dest->ssa.live_out = 0;
- dest->write_mask = u_bit_consecutive(0, dest->ssa.num_components);
+ load->dest.type = ppir_target_pipeline;
+ load->dest.pipeline = ppir_pipeline_reg_discard;
load->src = load_tex->src_coords;
- ppir_src *src = &load_tex->src_coords;
- src->type = ppir_target_ssa;
- src->ssa = &dest->ssa;
-
ppir_node_foreach_pred_safe(node, dep) {
ppir_node *pred = dep->pred;
ppir_node_remove_dep(dep);
case GLSL_SAMPLER_DIM_EXTERNAL:
break;
default:
- ppir_debug("unsupported sampler dim: %d\n", instr->sampler_dim);
+ ppir_error("unsupported sampler dim: %d\n", instr->sampler_dim);
return NULL;
}
for (int i = 0; i < instr->coord_components; i++)
node->src_coords.swizzle[i] = i;
- assert(instr->num_srcs == 1);
for (int i = 0; i < instr->num_srcs; i++) {
switch (instr->src[i].src_type) {
case nir_tex_src_coord:
u_bit_consecutive(0, instr->coord_components));
break;
default:
- ppir_debug("unknown texture source");
+ ppir_error("unsupported texture source type\n");
+ assert(0);
return NULL;
}
}
ppir_dest *dest = ppir_node_get_dest(ldtex);
ppir_node *move = NULL;
- ppir_load_node *load = ppir_node_to_load(load_coords);
- load->dest.type = ppir_target_pipeline;
- load->dest.pipeline = ppir_pipeline_reg_discard;
-
- ppir_load_texture_node *load_texture = ppir_node_to_load_texture(ldtex);
- load_texture->src_coords.type = ppir_target_pipeline;
- load_texture->src_coords.pipeline = ppir_pipeline_reg_discard;
-
/* Insert load_coords to ldtex instruction */
if (!ppir_instr_insert_node(ldtex->instr, load_coords))
return false;
typedef struct {
ppir_node node;
ppir_dest dest;
- ppir_src src_coords;
+ ppir_src src_coords; /* not to be used after lowering */
int sampler;
int sampler_dim;
} ppir_load_texture_node;
reg->live_out = node->instr->seq;
break;
}
- case ppir_node_type_load_texture:
- {
- ppir_load_texture_node *load_tex = ppir_node_to_load_texture(node);
- ppir_reg *reg = get_src_reg(&load_tex->src_coords);
- if (reg && node->instr->seq > reg->live_out)
- reg->live_out = node->instr->seq;
- break;
- }
case ppir_node_type_branch:
{
ppir_branch_node *branch = ppir_node_to_branch(node);
printf("%d", ppir_target_get_src_reg_index(&load->src));
break;
}
- case ppir_node_type_load_texture:
- {
- ppir_load_texture_node *load_tex = ppir_node_to_load_texture(node);
- printf("%d", ppir_target_get_src_reg_index(&load_tex->src_coords));
- break;
- }
case ppir_node_type_branch:
{
ppir_branch_node *branch = ppir_node_to_branch(node);
}
break;
}
- case ppir_node_type_load_texture:
- {
- ppir_load_texture_node *load_tex = ppir_node_to_load_texture(node);
- reg = get_src_reg(&load_tex->src_coords);
- if (reg == chosen) {
- ppir_update_spilled_src(comp, block, node, &load_tex->src_coords,
- NULL);
- }
- break;
- }
case ppir_node_type_branch:
{
ppir_branch_node *branch = ppir_node_to_branch(node);