Merge commit 'origin/gallium-master-merge'
[mesa.git] / src / gallium / drivers / i965simple / 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 #include "brw_context.h"
37 #include "brw_eu.h"
38
39
40 #define SF_POINTS 0
41 #define SF_LINES 1
42 #define SF_TRIANGLES 2
43 #define SF_UNFILLED_TRIS 3
44
45
46
47 struct brw_sf_prog_key {
48 unsigned vp_output_count:5;
49 unsigned fp_input_count:5;
50
51 unsigned primitive:2;
52 unsigned do_twoside_color:1;
53 unsigned do_flat_shading:1;
54 unsigned frontface_ccw:1;
55 unsigned do_point_sprite:1;
56
57 /* Interpolation masks;
58 */
59 unsigned linear_mask;
60 unsigned persp_mask;
61 unsigned const_mask;
62
63
64 // int SpriteOrigin;
65 };
66
67 struct brw_sf_point_tex {
68 boolean CoordReplace;
69 };
70
71 struct brw_sf_compile {
72 struct brw_compile func;
73 struct brw_sf_prog_key key;
74 struct brw_sf_prog_data prog_data;
75
76 struct brw_reg pv;
77 struct brw_reg det;
78 struct brw_reg dx0;
79 struct brw_reg dx2;
80 struct brw_reg dy0;
81 struct brw_reg dy2;
82
83 /* z and 1/w passed in seperately:
84 */
85 struct brw_reg z[3];
86 struct brw_reg inv_w[3];
87
88 /* The vertices:
89 */
90 struct brw_reg vert[3];
91
92 /* Temporaries, allocated after last vertex reg.
93 */
94 struct brw_reg inv_det;
95 struct brw_reg a1_sub_a0;
96 struct brw_reg a2_sub_a0;
97 struct brw_reg tmp;
98
99 struct brw_reg m1Cx;
100 struct brw_reg m2Cy;
101 struct brw_reg m3C0;
102
103 unsigned nr_verts;
104 unsigned nr_attrs;
105 unsigned nr_attr_regs;
106 unsigned nr_setup_attrs;
107 unsigned nr_setup_regs;
108 #if 0
109 ubyte attr_to_idx[VERT_RESULT_MAX];
110 ubyte idx_to_attr[VERT_RESULT_MAX];
111 struct brw_sf_point_tex point_attrs[VERT_RESULT_MAX];
112 #endif
113 };
114
115
116 void brw_emit_tri_setup( struct brw_sf_compile *c );
117 void brw_emit_line_setup( struct brw_sf_compile *c );
118 void brw_emit_point_setup( struct brw_sf_compile *c );
119 void brw_emit_point_sprite_setup( struct brw_sf_compile *c );
120 void brw_emit_anyprim_setup( struct brw_sf_compile *c );
121
122 #endif