#include "sfn_instruction_misc.h"
namespace r600 {
+EmitVertex::EmitVertex(int stream, bool cut):
+ Instruction (emit_vtx),
+ m_stream(stream),
+ m_cut(cut)
+{
+
+}
+
+bool EmitVertex::is_equal_to(const Instruction& lhs) const
+{
+ auto& oth = static_cast<const EmitVertex&>(lhs);
+ return oth.m_stream == m_stream &&
+ oth.m_cut == m_cut;
+}
+
+void EmitVertex::do_print(std::ostream& os) const
+{
+ os << (m_cut ? "EMIT_CUT_VERTEX @" : "EMIT_VERTEX @") << m_stream;
+}
WaitAck::WaitAck(int nack):
Instruction (wait_ack),
namespace r600 {
+class EmitVertex : public Instruction {
+public:
+ EmitVertex(int stream, bool cut);
+ ECFOpCode op() const {return m_cut ? cf_cut_vertex: cf_emit_vertex;}
+ int stream() const { return m_stream;}
+private:
+
+ bool is_equal_to(const Instruction& lhs) const override;
+ void do_print(std::ostream& os) const override;
+ int m_stream;
+ bool m_cut;
+};
+
class WaitAck : public Instruction {
public:
WaitAck(int nack);
bool emit_if_start(const IfInstruction & if_instr);
bool emit_else(const ElseInstruction & else_instr);
bool emit_endif(const IfElseEndInstruction & endif_instr);
+ bool emit_emit_vertex(const EmitVertex &instr);
bool emit_loop_begin(const LoopBeginInstruction& instr);
bool emit_loop_end(const LoopEndInstruction& instr);
return emit_streamout(static_cast<const StreamOutIntruction&>(*i));
case Instruction::ring:
return emit_memringwrite(static_cast<const MemRingOutIntruction&>(*i));
+ case Instruction::emit_vtx:
+ return emit_emit_vertex(static_cast<const EmitVertex&>(*i));
case Instruction::wait_ack:
return emit_wait_ack(static_cast<const WaitAck&>(*i));
case Instruction::mem_wr_scratch:
return true;
}
+bool AssemblyFromShaderLegacyImpl::emit_emit_vertex(const EmitVertex &instr)
+{
+ int r = r600_bytecode_add_cfinst(m_bc, instr.op());
+ if (!r)
+ m_bc->cf_last->count = instr.stream();
+ assert(m_bc->cf_last->count < 4);
+
+ return r == 0;
+}
+
bool AssemblyFromShaderLegacyImpl::emit_wait_ack(const WaitAck& instr)
{
int r = r600_bytecode_add_cfinst(m_bc, instr.op());