ppir_load_texture_node *ldtex = ppir_node_to_load_texture(node);
f->index = ldtex->sampler;
- f->lod_bias_en = 0;
+
+ 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);
switch (ldtex->sampler_dim) {
case GLSL_SAMPLER_DIM_2D:
case ppir_op_const:
child = ppir_node_clone(node->block, child);
break;
- case ppir_op_load_varying:
- if ((node->op != ppir_op_load_texture)) {
+ case ppir_op_load_varying: {
+ bool is_load_coords = false;
+ if (node->op == ppir_op_load_texture) {
+ nir_tex_src *nts = (nir_tex_src *)ns;
+ if (nts->src_type == nir_tex_src_coord)
+ is_load_coords = true;
+ }
+
+ if (!is_load_coords) {
/* Clone varying loads for each block */
if (child->block != node->block) {
child = ppir_node_clone(node->block, child);
/* At least one successor is load_texture, promote it to load_coords
* to ensure that is has exactly one successor */
child->op = ppir_op_load_coords;
+ }
/* Fallthrough */
case ppir_op_load_uniform:
case ppir_op_load_coords:
nir_tex_instr *instr = nir_instr_as_tex(ni);
ppir_load_texture_node *node;
- if (instr->op != nir_texop_tex) {
+ switch (instr->op) {
+ case nir_texop_tex:
+ case nir_texop_txb:
+ case nir_texop_txl:
+ break;
+ default:
ppir_error("unsupported texop %d\n", instr->op);
return NULL;
}
ppir_node_add_src(block->comp, &node->node, &node->src_coords, &instr->src[i].src,
u_bit_consecutive(0, instr->coord_components));
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);
+ break;
default:
ppir_error("unsupported texture source type\n");
assert(0);