r600/sfn: add emitVertex instructions

More preparation for GS support

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3225>
This commit is contained in:
Gert Wollny
2019-12-27 17:49:27 +01:00
committed by Marge Bot
parent f7ec616bed
commit 5c7124e134
3 changed files with 45 additions and 0 deletions
@@ -27,6 +27,25 @@
#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),
@@ -31,6 +31,19 @@
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);
@@ -53,6 +53,7 @@ private:
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);
@@ -167,6 +168,8 @@ bool AssemblyFromShaderLegacyImpl::emit(const Instruction::Pointer i)
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:
@@ -772,6 +775,16 @@ bool AssemblyFromShaderLegacyImpl::emit_vtx(const FetchInstruction& fetch_instr)
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());