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 GFX6_GS_VISITOR_H 26 #define GFX6_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 gfx6_gs_visitor : public vec4_gs_visitor 36 { 37 public: gfx6_gs_visitor(const struct brw_compiler * comp,void * log_data,struct brw_gs_compile * c,struct brw_gs_prog_data * prog_data,const nir_shader * shader,void * mem_ctx,bool no_spills,bool debug_enabled)38 gfx6_gs_visitor(const struct brw_compiler *comp, 39 void *log_data, 40 struct brw_gs_compile *c, 41 struct brw_gs_prog_data *prog_data, 42 const nir_shader *shader, 43 void *mem_ctx, 44 bool no_spills, 45 bool debug_enabled) : 46 vec4_gs_visitor(comp, log_data, c, prog_data, shader, mem_ctx, no_spills, 47 debug_enabled) 48 { 49 } 50 51 protected: 52 virtual void emit_prolog(); 53 virtual void emit_thread_end(); 54 virtual void gs_emit_vertex(int stream_id); 55 virtual void gs_end_primitive(); 56 virtual void emit_urb_write_header(int mrf); 57 virtual void setup_payload(); 58 59 private: 60 void xfb_write(); 61 void xfb_program(unsigned vertex, unsigned num_verts); 62 int get_vertex_output_offset_for_varying(int vertex, int varying); 63 void emit_snb_gs_urb_write_opcode(bool complete, 64 int base_mrf, 65 int last_mrf, 66 int urb_offset); 67 68 src_reg vertex_output; 69 src_reg vertex_output_offset; 70 src_reg temp; 71 src_reg first_vertex; 72 src_reg prim_count; 73 src_reg primitive_id; 74 75 /* Transform Feedback members */ 76 src_reg sol_prim_written; 77 src_reg svbi; 78 src_reg max_svbi; 79 src_reg destination_indices; 80 }; 81 82 } /* namespace brw */ 83 84 #endif /* __cplusplus */ 85 86 #endif /* GFX6_GS_VISITOR_H */ 87