Merge branch 'mesa_7_7_branch'
[mesa.git] / src / gallium / drivers / i965 / brw_sf.h
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_SF_H
34 #define BRW_SF_H
35
36
37 #include "brw_context.h"
38 #include "brw_eu.h"
39
40
41 #define SF_POINTS 0
42 #define SF_LINES 1
43 #define SF_TRIANGLES 2
44 #define SF_UNFILLED_TRIS 3
45
46 struct brw_sf_prog_key {
47
48 /* Bitmask of linear and perspective interpolated inputs, 0..nr
49 */
50 GLuint persp_attrs:32;
51 GLuint linear_attrs:32;
52 GLuint point_coord_replace_attrs:32;
53
54 GLuint nr_attrs:8;
55 GLuint primitive:2;
56 GLuint do_twoside_color:1;
57 GLuint do_flat_shading:1;
58 GLuint frontface_ccw:1;
59 GLuint do_point_sprite:1;
60 GLuint sprite_origin_lower_left:1;
61 GLuint pad:17;
62
63 GLuint attr_col0:8;
64 GLuint attr_col1:8;
65 GLuint attr_bfc0:8;
66 GLuint attr_bfc1:8;
67 };
68
69 struct brw_sf_point_tex {
70 GLboolean CoordReplace;
71 };
72
73 struct brw_sf_compile {
74 struct brw_compile func;
75 struct brw_sf_prog_key key;
76 struct brw_sf_prog_data prog_data;
77
78 struct brw_reg pv;
79 struct brw_reg det;
80 struct brw_reg dx0;
81 struct brw_reg dx2;
82 struct brw_reg dy0;
83 struct brw_reg dy2;
84
85 /* z and 1/w passed in seperately:
86 */
87 struct brw_reg z[3];
88 struct brw_reg inv_w[3];
89
90 /* The vertices:
91 */
92 struct brw_reg vert[3];
93
94 /* Temporaries, allocated after last vertex reg.
95 */
96 struct brw_reg inv_det;
97 struct brw_reg a1_sub_a0;
98 struct brw_reg a2_sub_a0;
99 struct brw_reg tmp;
100
101 struct brw_reg m1Cx;
102 struct brw_reg m2Cy;
103 struct brw_reg m3C0;
104
105 GLuint nr_verts;
106 GLuint nr_attrs;
107 GLuint nr_attr_regs;
108 GLuint nr_setup_attrs;
109 GLuint nr_setup_regs;
110
111 GLuint point_coord_replace_mask;
112 };
113
114
115 void brw_emit_null_setup( struct brw_sf_compile *c );
116 void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate );
117 void brw_emit_line_setup( struct brw_sf_compile *c, GLboolean allocate );
118 void brw_emit_point_setup( struct brw_sf_compile *c, GLboolean allocate );
119 void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate );
120 void brw_emit_anyprim_setup( struct brw_sf_compile *c );
121
122 #endif