virtual void visit(ir_loop *);
virtual void visit(ir_if *);
virtual void visit(ir_discard *);
+ virtual void visit(ir_demote *);
virtual void visit(ir_loop_jump *);
virtual void visit(ir_return *);
virtual void visit(ir_call *);
nir_builder_instr_insert(&b, &discard->instr);
}
+void
+nir_visitor::visit(ir_demote *ir)
+{
+ nir_intrinsic_instr *demote =
+ nir_intrinsic_instr_create(this->shader, nir_intrinsic_demote);
+
+ nir_builder_instr_insert(&b, &demote->instr);
+}
+
void
nir_visitor::visit(ir_emit_vertex *ir)
{
ir_type_loop_jump,
ir_type_return,
ir_type_discard,
+ ir_type_demote,
ir_type_emit_vertex,
ir_type_end_primitive,
ir_type_barrier,
/*@}*/
+/**
+ * IR instruction representing demote statements from
+ * GL_EXT_demote_to_helper_invocation.
+ */
+class ir_demote : public ir_instruction {
+public:
+ ir_demote()
+ : ir_instruction(ir_type_demote)
+ {
+ }
+
+ virtual ir_demote *clone(void *mem_ctx, struct hash_table *ht) const;
+
+ virtual void accept(ir_visitor *v)
+ {
+ v->visit(this);
+ }
+
+ virtual ir_visitor_status accept(ir_hierarchical_visitor *);
+};
+
+
/**
* Texture sampling opcodes used in ir_texture
*/
return new(mem_ctx) ir_discard(new_condition);
}
+ir_demote *
+ir_demote::clone(void *mem_ctx, struct hash_table *ht) const
+{
+ return new(mem_ctx) ir_demote();
+}
+
ir_loop_jump *
ir_loop_jump::clone(void *mem_ctx, struct hash_table *ht) const
{
return visit_continue;
}
+ir_visitor_status
+ir_hierarchical_visitor::visit_enter(ir_demote *ir)
+{
+ if (this->callback_enter != NULL)
+ this->callback_enter(ir, this->data_enter);
+
+ return visit_continue;
+}
+
+ir_visitor_status
+ir_hierarchical_visitor::visit_leave(ir_demote *ir)
+{
+ if (this->callback_leave != NULL)
+ this->callback_leave(ir, this->data_leave);
+
+ return visit_continue;
+}
+
ir_visitor_status
ir_hierarchical_visitor::visit_enter(ir_if *ir)
{
virtual ir_visitor_status visit_leave(class ir_return *);
virtual ir_visitor_status visit_enter(class ir_discard *);
virtual ir_visitor_status visit_leave(class ir_discard *);
+ virtual ir_visitor_status visit_enter(class ir_demote *);
+ virtual ir_visitor_status visit_leave(class ir_demote *);
virtual ir_visitor_status visit_enter(class ir_if *);
virtual ir_visitor_status visit_leave(class ir_if *);
virtual ir_visitor_status visit_enter(class ir_emit_vertex *);
}
+ir_visitor_status
+ir_demote::accept(ir_hierarchical_visitor *v)
+{
+ ir_visitor_status s = v->visit_enter(this);
+
+ if (s != visit_continue)
+ return (s == visit_continue_with_parent) ? visit_continue : s;
+
+ return v->visit_leave(this);
+}
+
+
ir_visitor_status
ir_if::accept(ir_hierarchical_visitor *v)
{
}
+void
+ir_print_visitor::visit(ir_demote *ir)
+{
+ fprintf(f, "(demote)");
+}
+
+
void
ir_print_visitor::visit(ir_if *ir)
{
virtual void visit(ir_call *);
virtual void visit(ir_return *);
virtual void visit(ir_discard *);
+ virtual void visit(ir_demote *);
virtual void visit(ir_if *);
virtual void visit(ir_loop *);
virtual void visit(ir_loop_jump *);
virtual void visit(class ir_call *) = 0;
virtual void visit(class ir_return *) = 0;
virtual void visit(class ir_discard *) = 0;
+ virtual void visit(class ir_demote *) = 0;
virtual void visit(class ir_if *) = 0;
virtual void visit(class ir_loop *) = 0;
virtual void visit(class ir_loop_jump *) = 0;
virtual void visit(class ir_assignment *) {}
virtual void visit(class ir_constant *) {}
virtual void visit(class ir_call *) {}
+ virtual void visit(class ir_demote *) {}
virtual void visit(class ir_emit_vertex *) {}
virtual void visit(class ir_end_primitive *) {}
virtual void visit(class ir_barrier *) {}
virtual void visit(ir_call *);
virtual void visit(ir_return *);
virtual void visit(ir_discard *);
+ virtual void visit(ir_demote *);
virtual void visit(ir_texture *);
virtual void visit(ir_if *);
virtual void visit(ir_emit_vertex *);
emit(ir, OPCODE_KIL, undef_dst, this->result);
}
+void
+ir_to_mesa_visitor::visit(ir_demote *ir)
+{
+ assert(!"demote statement unsupported");
+}
+
void
ir_to_mesa_visitor::visit(ir_if *ir)
{
virtual void visit(ir_call *);
virtual void visit(ir_return *);
virtual void visit(ir_discard *);
+ virtual void visit(ir_demote *);
virtual void visit(ir_texture *);
virtual void visit(ir_if *);
virtual void visit(ir_emit_vertex *);
}
}
+void
+glsl_to_tgsi_visitor::visit(ir_demote *ir)
+{
+ assert(!"demote statement unsupported");
+}
+
void
glsl_to_tgsi_visitor::visit(ir_if *ir)
{