i965/gen6/gs: implement transform feedback support in gen6_gs_visitor
[mesa.git] / src / mesa / drivers / dri / i965 / gen6_gs_visitor.h
1 /*
2 * Copyright © 2014 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 */
24
25 #ifndef GEN6_GS_VISITOR_H
26 #define GEN6_GS_VISITOR_H
27
28 #include "brw_vec4.h"
29 #include "brw_vec4_gs_visitor.h"
30
31 #ifdef __cplusplus
32
33 namespace brw {
34
35 class gen6_gs_visitor : public vec4_gs_visitor
36 {
37 public:
38 gen6_gs_visitor(struct brw_context *brw,
39 struct brw_gs_compile *c,
40 struct gl_shader_program *prog,
41 void *mem_ctx,
42 bool no_spills) :
43 vec4_gs_visitor(brw, c, prog, mem_ctx, no_spills) {}
44
45 protected:
46 virtual void emit_prolog();
47 virtual void emit_thread_end();
48 virtual void visit(ir_emit_vertex *);
49 virtual void visit(ir_end_primitive *);
50 virtual void emit_urb_write_header(int mrf);
51 virtual void emit_urb_write_opcode(bool complete,
52 int base_mrf,
53 int last_mrf,
54 int urb_offset);
55 virtual void setup_payload();
56
57 private:
58 void xfb_write();
59 void xfb_buffer_output();
60 void xfb_program(unsigned num_verts);
61
62 src_reg vertex_output;
63 src_reg vertex_output_offset;
64 src_reg temp;
65 src_reg first_vertex;
66 src_reg prim_count;
67 src_reg primitive_id;
68
69 /* Transform Feedback members */
70 src_reg xfb_output;
71 src_reg xfb_output_offset;
72 src_reg sol_prim_written;
73 src_reg svbi;
74 src_reg max_svbi;
75 src_reg destination_indices;
76 unsigned current_vertex;
77 };
78
79 } /* namespace brw */
80
81 #endif /* __cplusplus */
82
83 #endif /* GEN6_GS_VISITOR_H */