• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #pragma once
26 
27 #include "elk_vec4.h"
28 #include "elk_vec4_gs_visitor.h"
29 
30 #ifdef __cplusplus
31 
32 namespace elk {
33 
34 class gfx6_gs_visitor : public vec4_gs_visitor
35 {
36 public:
gfx6_gs_visitor(const struct elk_compiler * comp,const struct elk_compile_params * params,struct elk_gs_compile * c,struct elk_gs_prog_data * prog_data,const nir_shader * shader,bool no_spills,bool debug_enabled)37    gfx6_gs_visitor(const struct elk_compiler *comp,
38                    const struct elk_compile_params *params,
39                    struct elk_gs_compile *c,
40                    struct elk_gs_prog_data *prog_data,
41                    const nir_shader *shader,
42                    bool no_spills,
43                    bool debug_enabled) :
44       vec4_gs_visitor(comp, params, c, prog_data, shader, no_spills, debug_enabled)
45       {
46       }
47 
48 protected:
49    virtual void emit_prolog();
50    virtual void emit_thread_end();
51    virtual void gs_emit_vertex(int stream_id);
52    virtual void gs_end_primitive();
53    virtual void emit_urb_write_header(int mrf);
54    virtual void setup_payload();
55 
56 private:
57    void xfb_write();
58    void xfb_program(unsigned vertex, unsigned num_verts);
59    int get_vertex_output_offset_for_varying(int vertex, int varying);
60    void emit_snb_gs_urb_write_opcode(bool complete,
61                                      int base_mrf,
62                                      int last_mrf,
63                                      int urb_offset);
64 
65    src_reg vertex_output;
66    src_reg vertex_output_offset;
67    src_reg temp;
68    src_reg first_vertex;
69    src_reg prim_count;
70    src_reg primitive_id;
71 
72    /* Transform Feedback members */
73    src_reg sol_prim_written;
74    src_reg svbi;
75    src_reg max_svbi;
76    src_reg destination_indices;
77 };
78 
79 } /* namespace elk */
80 
81 #endif /* __cplusplus */
82