int num_components = load->num_components;
if (num_components) {
- assert(node->op == ppir_op_load_varying || node->op == ppir_op_load_coords);
+ assert(node->op == ppir_op_load_varying ||
+ node->op == ppir_op_load_coords ||
+ node->op == ppir_op_load_fragcoord);
f->imm.dest = index >> 2;
f->imm.mask = dest->write_mask << (index & 0x3);
f->imm.index = load->index >> 2;
else
f->imm.index = load->index >> alignment;
+
+ if (node->op == ppir_op_load_fragcoord) {
+ f->imm.source_type = 2;
+ f->imm.perspective = 3;
+ }
}
else {
assert(node->op == ppir_op_load_coords);
lnode->index = nir_intrinsic_base(instr) * 4 + nir_intrinsic_component(instr);
return &lnode->node;
+ case nir_intrinsic_load_frag_coord:
+ if (!instr->dest.is_ssa)
+ mask = u_bit_consecutive(0, instr->num_components);
+
+ lnode = ppir_node_create_dest(block, ppir_op_load_fragcoord, &instr->dest, mask);
+ if (!lnode)
+ return NULL;
+
+ lnode->num_components = instr->num_components;
+ return &lnode->node;
+
case nir_intrinsic_load_uniform:
if (!instr->dest.is_ssa)
mask = u_bit_consecutive(0, instr->num_components);
PPIR_INSTR_SLOT_VARYING, PPIR_INSTR_SLOT_END
},
},
+ [ppir_op_load_fragcoord] = {
+ .name = "ld_fragcoord",
+ .type = ppir_node_type_load,
+ .slots = (int []) {
+ PPIR_INSTR_SLOT_VARYING, PPIR_INSTR_SLOT_END
+ },
+ },
[ppir_op_load_uniform] = {
.name = "ld_uni",
.type = ppir_node_type_load,
load->dest.type = ppir_target_pipeline;
load->dest.pipeline = ppir_pipeline_reg_uniform;
}
- else if (node->op == ppir_op_load_varying) {
+ else if (node->op == ppir_op_load_varying ||
+ node->op == ppir_op_load_fragcoord) {
/* delay the load varying dup to scheduler */
if (!create_new_instr(block, node))
return false;
ppir_op_load_uniform,
ppir_op_load_varying,
ppir_op_load_coords,
+ ppir_op_load_fragcoord,
ppir_op_load_texture,
ppir_op_load_temp,
{
bool progress;
+ NIR_PASS_V(s, nir_lower_fragcoord_wtrans);
NIR_PASS_V(s, nir_lower_io, nir_var_all, type_size, 0);
NIR_PASS_V(s, nir_lower_regs_to_ssa);
NIR_PASS_V(s, nir_lower_bool_to_float);
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 1;
+ case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL:
+ return 1;
+
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: