f->lod_bias_en = ldtex->lod_bias_en;
f->explicit_lod = ldtex->explicit_lod;
if (ldtex->lod_bias_en)
- ppir_target_get_src_reg_index(&ldtex->lod_bias);
+ ppir_target_get_src_reg_index(&ldtex->src[1]);
switch (ldtex->sampler_dim) {
case GLSL_SAMPLER_DIM_2D:
return false;
list_addtail(&load->node.list, &node->list);
- load->src = load_tex->src_coords;
+ load->src = load_tex->src[0];
load->num_src = 1;
if (load_tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE)
load->num_components = 3;
}
assert(load);
- load_tex->src_coords.type = load->dest.type = ppir_target_pipeline;
- load_tex->src_coords.pipeline = load->dest.pipeline = ppir_pipeline_reg_discard;
+ load_tex->src[0].type = load->dest.type = ppir_target_pipeline;
+ load_tex->src[0].pipeline = load->dest.pipeline = ppir_pipeline_reg_discard;
if (ppir_node_has_single_src_succ(node)) {
ppir_node *succ = ppir_node_first_succ(node);
node->sampler_dim = instr->sampler_dim;
for (int i = 0; i < instr->coord_components; i++)
- node->src_coords.swizzle[i] = i;
+ node->src[0].swizzle[i] = i;
for (int i = 0; i < instr->num_srcs; i++) {
switch (instr->src[i].src_type) {
case nir_tex_src_coord:
- ppir_node_add_src(block->comp, &node->node, &node->src_coords, &instr->src[i].src,
+ ppir_node_add_src(block->comp, &node->node, &node->src[0], &instr->src[i].src,
u_bit_consecutive(0, instr->coord_components));
+ node->num_src++;
break;
case nir_tex_src_bias:
case nir_tex_src_lod:
node->lod_bias_en = true;
node->explicit_lod = (instr->src[i].src_type == nir_tex_src_lod);
- ppir_node_add_src(block->comp, &node->node, &node->lod_bias, &instr->src[i].src, 1);
+ ppir_node_add_src(block->comp, &node->node, &node->src[1], &instr->src[i].src, 1);
+ node->num_src++;
break;
default:
ppir_error("unsupported texture source type\n");
case ppir_node_type_load_texture:
{
ppir_load_texture_node *load_texture = ppir_node_to_load_texture(parent);
- _ppir_node_replace_child(&load_texture->src_coords, old_child, new_child);
+ for (int i = 0; i < load_texture->num_src; i++)
+ _ppir_node_replace_child(ppir_node_get_src(parent, i), old_child, new_child);
break;
}
case ppir_node_type_store:
typedef struct {
ppir_node node;
ppir_dest dest;
- ppir_src src_coords; /* not to be used after lowering */
+ ppir_src src[2]; /* src[0] temporarily stores src_coords,
+ not to be used after lowering */
+ int num_src;
int sampler;
int sampler_dim;
bool lod_bias_en;
bool explicit_lod;
- ppir_src lod_bias;
} ppir_load_texture_node;
typedef struct {
case ppir_node_type_load:
return ppir_node_to_load(node)->num_src;
case ppir_node_type_load_texture:
+ return ppir_node_to_load_texture(node)->num_src;
case ppir_node_type_store:
return 1;
default:
case ppir_node_type_branch:
return &ppir_node_to_branch(node)->src[idx];
case ppir_node_type_load_texture:
- return &ppir_node_to_load_texture(node)->src_coords;
+ return &ppir_node_to_load_texture(node)->src[idx];
case ppir_node_type_load:
return &ppir_node_to_load(node)->src;
case ppir_node_type_store: