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 "program/program.h"
38#include "brw_context.h"
39#include "brw_eu.h"
40
41
42#define SF_POINTS    0
43#define SF_LINES     1
44#define SF_TRIANGLES 2
45#define SF_UNFILLED_TRIS   3
46
47struct brw_sf_prog_key {
48   GLbitfield64 attrs;
49   uint8_t point_sprite_coord_replace;
50   GLuint primitive:2;
51   GLuint do_twoside_color:1;
52   GLuint do_flat_shading:1;
53   GLuint frontface_ccw:1;
54   GLuint do_point_sprite:1;
55   GLuint do_point_coord:1;
56   GLuint sprite_origin_lower_left:1;
57   GLuint userclip_active:1;
58};
59
60struct brw_sf_compile {
61   struct brw_compile func;
62   struct brw_sf_prog_key key;
63   struct brw_sf_prog_data prog_data;
64
65   struct brw_reg pv;
66   struct brw_reg det;
67   struct brw_reg dx0;
68   struct brw_reg dx2;
69   struct brw_reg dy0;
70   struct brw_reg dy2;
71
72   /* z and 1/w passed in seperately:
73    */
74   struct brw_reg z[3];
75   struct brw_reg inv_w[3];
76
77   /* The vertices:
78    */
79   struct brw_reg vert[3];
80
81    /* Temporaries, allocated after last vertex reg.
82    */
83   struct brw_reg inv_det;
84   struct brw_reg a1_sub_a0;
85   struct brw_reg a2_sub_a0;
86   struct brw_reg tmp;
87
88   struct brw_reg m1Cx;
89   struct brw_reg m2Cy;
90   struct brw_reg m3C0;
91
92   GLuint nr_verts;
93   GLuint nr_attr_regs;
94   GLuint nr_setup_regs;
95   int urb_entry_read_offset;
96
97   struct brw_vue_map vue_map;
98};
99
100
101void brw_emit_tri_setup( struct brw_sf_compile *c, bool allocate );
102void brw_emit_line_setup( struct brw_sf_compile *c, bool allocate );
103void brw_emit_point_setup( struct brw_sf_compile *c, bool allocate );
104void brw_emit_point_sprite_setup( struct brw_sf_compile *c, bool allocate );
105void brw_emit_anyprim_setup( struct brw_sf_compile *c );
106int brw_sf_compute_urb_entry_read_offset(struct intel_context *intel);
107
108#endif
109