• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
3  Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
4  develop this 3D driver.
5 
6  Permission is hereby granted, free of charge, to any person obtaining
7  a copy of this software and associated documentation files (the
8  "Software"), to deal in the Software without restriction, including
9  without limitation the rights to use, copy, modify, merge, publish,
10  distribute, sublicense, and/or sell copies of the Software, and to
11  permit persons to whom the Software is furnished to do so, subject to
12  the following conditions:
13 
14  The above copyright notice and this permission notice (including the
15  next paragraph) shall be included in all copies or substantial
16  portions of the Software.
17 
18  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21  IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 
26  **********************************************************************/
27  /*
28   * Authors:
29   *   Keith Whitwell <keith@tungstengraphics.com>
30   */
31 
32 
33 #ifndef BRW_GS_H
34 #define BRW_GS_H
35 
36 
37 #include "brw_context.h"
38 #include "brw_eu.h"
39 
40 #define MAX_GS_VERTS (4)
41 
42 struct brw_gs_prog_key {
43    GLbitfield64 attrs;
44 
45    /**
46     * Hardware primitive type being drawn, e.g. _3DPRIM_TRILIST.
47     */
48    GLuint primitive:8;
49 
50    GLuint pv_first:1;
51    GLuint need_gs_prog:1;
52    GLuint userclip_active:1;
53    GLuint rasterizer_discard:1;
54 
55    /**
56     * Number of varyings that are output to transform feedback.
57     */
58    GLuint num_transform_feedback_bindings:7; /* 0-BRW_MAX_SOL_BINDINGS */
59 
60    /**
61     * Map from the index of a transform feedback binding table entry to the
62     * gl_vert_result that should be streamed out through that binding table
63     * entry.
64     */
65    unsigned char transform_feedback_bindings[BRW_MAX_SOL_BINDINGS];
66 
67    /**
68     * Map from the index of a transform feedback binding table entry to the
69     * swizzles that should be used when streaming out data through that
70     * binding table entry.
71     */
72    unsigned char transform_feedback_swizzles[BRW_MAX_SOL_BINDINGS];
73 };
74 
75 struct brw_gs_compile {
76    struct brw_compile func;
77    struct brw_gs_prog_key key;
78    struct brw_gs_prog_data prog_data;
79 
80    struct {
81       struct brw_reg R0;
82 
83       /**
84        * Register holding streamed vertex buffer pointers -- see the Sandy
85        * Bridge PRM, volume 2 part 1, section 4.4.2 (GS Thread Payload
86        * [DevSNB]).  These pointers are delivered in GRF 1.
87        */
88       struct brw_reg SVBI;
89 
90       struct brw_reg vertex[MAX_GS_VERTS];
91       struct brw_reg header;
92       struct brw_reg temp;
93 
94       /**
95        * Register holding destination indices for streamed buffer writes.
96        * Only used for SOL programs.
97        */
98       struct brw_reg destination_indices;
99    } reg;
100 
101    /* Number of registers used to store vertex data */
102    GLuint nr_regs;
103 
104    struct brw_vue_map vue_map;
105 };
106 
107 #define ATTR_SIZE  (4*4)
108 
109 void brw_gs_quads( struct brw_gs_compile *c, struct brw_gs_prog_key *key );
110 void brw_gs_quad_strip( struct brw_gs_compile *c, struct brw_gs_prog_key *key );
111 void brw_gs_lines( struct brw_gs_compile *c );
112 void gen6_sol_program(struct brw_gs_compile *c, struct brw_gs_prog_key *key,
113                       unsigned num_verts, bool check_edge_flag);
114 
115 #endif
116