e417be935b02e1f4af6e6850e54c39a691ee0ed6
[mesa.git] / src / gallium / drivers / llvmpipe / lp_rast.h
1
2 #ifndef LP_RAST_H
3 #define LP_RAST_H
4
5 /* Initially create and program a single rasterizer directly. Later
6 * will want multiple of these, one or two per core. At that stage
7 * will probably pass command buffers into the rasterizers rather than
8 * individual function calls like this.
9 */
10 struct lp_rasterizer;
11
12 struct lp_rast_state {
13 /* State for the shader:
14 */
15 struct lp_jit_context jc;
16
17 /* The shader itself. Probably we also need to pass a pointer to
18 * the tile color/z/stencil data somehow:
19 */
20 lp_jit_frag_func shader;
21
22 };
23
24 /* Coefficients necessary to run the shader at a given location:
25 */
26 struct lp_rast_shader_inputs {
27
28 /* Current rasterizer state:
29 */
30 const struct lp_rast_state *state;
31
32 /* Attribute interpolation:
33 */
34 struct tgsi_interp_coef position_coef;
35 struct tgsi_interp_coef *coef;
36 };
37
38
39 /* Rasterization information for a triangle known to be in this bin,
40 * plus inputs to run the shader:
41 */
42 struct lp_rast_triangle {
43 /* one-pixel sized trivial accept offsets for each plane */
44 float ei1;
45 float ei2;
46 float ei3;
47
48 /* one-pixel sized trivial reject offsets for each plane */
49 float eo1;
50 float eo2;
51 float eo3;
52
53 /* y deltas for vertex pairs */
54 float dy12;
55 float dy23;
56 float dy31;
57
58 /* x deltas for vertex pairs */
59 float dx12;
60 float dx23;
61 float dx31;
62
63 /* State to run the shader: */
64 struct lp_rast_shader_inputs inputs;
65 };
66
67
68
69 struct lp_rasterizer *lp_rast_create( void );
70
71 void lp_rast_bind_surfaces( struct lp_rasterizer *,
72 struct pipe_surface *color,
73 struct pipe_surface *zstencil,
74 const float *clear_color,
75 double clear_depth,
76 unsigned clear_stencil);
77
78 /* Begining of each tile:
79 */
80 void lp_rast_start_tile( struct lp_rasterizer *,
81 unsigned x,
82 unsigned y );
83
84
85
86 union lp_rast_cmd_arg {
87 const struct lp_rast_shader_inputs *shade_tile;
88 const struct lp_rast_triangle *triangle;
89 const struct lp_rast_state *set_state;
90 };
91
92
93 /* Binnable Commands:
94 */
95 void lp_rast_clear_color( struct lp_rasterizer *,
96 const union lp_rast_cmd_arg *);
97
98 void lp_rast_clear_zstencil( struct lp_rasterizer *,
99 const union lp_rast_cmd_arg *);
100
101 void lp_rast_load_color( struct lp_rasterizer *,
102 const union lp_rast_cmd_arg *);
103
104 void lp_rast_load_zstencil( struct lp_rasterizer *,
105 const union lp_rast_cmd_arg *);
106
107 void lp_rast_set_state( struct lp_rasterizer *,
108 const union lp_rast_cmd_arg * );
109
110 void lp_rast_triangle( struct lp_rasterizer *,
111 const union lp_rast_cmd_arg * );
112
113 void lp_rast_shade_tile( struct lp_rasterizer *,
114 const union lp_rast_cmd_arg * );
115
116 void lp_rast_store_color( struct lp_rasterizer *,
117 const union lp_rast_cmd_arg *);
118
119 void lp_rast_store_zstencil( struct lp_rasterizer *,
120 const union lp_rast_cmd_arg *);
121
122
123 /* Shutdown:
124 */
125 void lp_rast_destroy( struct lp_rasterizer * );
126
127
128 #endif