1#ifndef SFN_EMITSSBOINSTRUCTION_H
2#define SFN_EMITSSBOINSTRUCTION_H
3
4#include "sfn_emitinstruction.h"
5#include "sfn_instruction_gds.h"
6#include "sfn_value_gpr.h"
7
8namespace r600 {
9
10class EmitSSBOInstruction: public EmitInstruction {
11public:
12   EmitSSBOInstruction(ShaderFromNirProcessor& processor);
13
14   void set_ssbo_offset(int offset);
15
16   void set_require_rat_return_address();
17   bool load_rat_return_address();
18   bool load_atomic_inc_limits();
19
20private:
21   bool do_emit(nir_instr *instr);
22
23   bool emit_atomic(const nir_intrinsic_instr* instr);
24   bool emit_unary_atomic(const nir_intrinsic_instr* instr);
25   bool emit_atomic_inc(const nir_intrinsic_instr* instr);
26   bool emit_atomic_pre_dec(const nir_intrinsic_instr* instr);
27
28   bool emit_load_ssbo(const nir_intrinsic_instr* instr);
29   bool emit_store_ssbo(const nir_intrinsic_instr* instr);
30
31   bool emit_image_size(const nir_intrinsic_instr *intrin);
32   bool emit_image_load(const nir_intrinsic_instr *intrin);
33   bool emit_image_store(const nir_intrinsic_instr *intrin);
34   bool emit_ssbo_atomic_op(const nir_intrinsic_instr *intrin);
35   bool emit_buffer_size(const nir_intrinsic_instr *intrin);
36
37   bool fetch_return_value(const nir_intrinsic_instr *intrin);
38
39   bool make_stores_ack_and_waitack();
40
41   ESDOp get_opcode(nir_intrinsic_op opcode) const;
42   ESDOp get_opcode_wo(const nir_intrinsic_op opcode) const;
43
44   RatInstruction::ERatOp get_rat_opcode(const nir_intrinsic_op opcode, pipe_format format) const;
45   RatInstruction::ERatOp get_rat_opcode_wo(const nir_intrinsic_op opcode, pipe_format format) const;
46
47
48   GPRVector make_dest(const nir_intrinsic_instr* instr);
49
50   PGPRValue m_atomic_update;
51
52   bool m_require_rat_return_address;
53   GPRVector m_rat_return_address;
54   int m_ssbo_image_offset;
55   std::vector<RatInstruction *> m_store_ops;
56};
57
58}
59
60#endif // SFN_EMITSSBOINSTRUCTION_H
61