• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
3  Intel funded Tungsten Graphics 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 <keithw@vmware.com>
30   */
31 
32 
33 #ifndef BRW_GS_H
34 #define BRW_GS_H
35 
36 
37 #include "brw_context.h"
38 #include "compiler/brw_eu.h"
39 
40 #define MAX_GS_VERTS (4)
41 
42 struct brw_ff_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 
53    /**
54     * Number of varyings that are output to transform feedback.
55     */
56    GLuint num_transform_feedback_bindings:7; /* 0-BRW_MAX_SOL_BINDINGS */
57 
58    /**
59     * Map from the index of a transform feedback binding table entry to the
60     * gl_varying_slot that should be streamed out through that binding table
61     * entry.
62     */
63    unsigned char transform_feedback_bindings[BRW_MAX_SOL_BINDINGS];
64 
65    /**
66     * Map from the index of a transform feedback binding table entry to the
67     * swizzles that should be used when streaming out data through that
68     * binding table entry.
69     */
70    unsigned char transform_feedback_swizzles[BRW_MAX_SOL_BINDINGS];
71 };
72 
73 struct brw_ff_gs_compile {
74    struct brw_codegen func;
75    struct brw_ff_gs_prog_key key;
76    struct brw_ff_gs_prog_data prog_data;
77 
78    struct {
79       struct brw_reg R0;
80 
81       /**
82        * Register holding streamed vertex buffer pointers -- see the Sandy
83        * Bridge PRM, volume 2 part 1, section 4.4.2 (GS Thread Payload
84        * [DevSNB]).  These pointers are delivered in GRF 1.
85        */
86       struct brw_reg SVBI;
87 
88       struct brw_reg vertex[MAX_GS_VERTS];
89       struct brw_reg header;
90       struct brw_reg temp;
91 
92       /**
93        * Register holding destination indices for streamed buffer writes.
94        * Only used for SOL programs.
95        */
96       struct brw_reg destination_indices;
97    } reg;
98 
99    /* Number of registers used to store vertex data */
100    GLuint nr_regs;
101 
102    struct brw_vue_map vue_map;
103 };
104 
105 void brw_ff_gs_quads(struct brw_ff_gs_compile *c,
106                      struct brw_ff_gs_prog_key *key);
107 void brw_ff_gs_quad_strip(struct brw_ff_gs_compile *c,
108                           struct brw_ff_gs_prog_key *key);
109 void brw_ff_gs_lines(struct brw_ff_gs_compile *c);
110 void gen6_sol_program(struct brw_ff_gs_compile *c,
111                       struct brw_ff_gs_prog_key *key,
112                       unsigned num_verts, bool check_edge_flag);
113 
114 void
115 brw_upload_ff_gs_prog(struct brw_context *brw);
116 
117 void
118 brw_codegen_ff_gs_prog(struct brw_context *brw,
119                        struct brw_ff_gs_prog_key *key);
120 
121 #endif
122