980c18c0240e3fe8fd1628d895c71dfe9055530b
1 /**************************************************************************
3 * Copyright 2007-2009 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * 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, sub license, 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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 * Rasterization for binned triangles within a tile
33 #include "util/u_math.h"
36 #include "lp_rast_priv.h"
37 #include "lp_tile_soa.h"
43 * Shade all pixels in a 4x4 block.
46 block_full_4(struct lp_rasterizer_task
*task
,
47 const struct lp_rast_triangle
*tri
,
50 lp_rast_shade_quads_all(task
, &tri
->inputs
, x
, y
);
55 * Shade all pixels in a 16x16 block.
58 block_full_16(struct lp_rasterizer_task
*task
,
59 const struct lp_rast_triangle
*tri
,
65 for (iy
= 0; iy
< 16; iy
+= 4)
66 for (ix
= 0; ix
< 16; ix
+= 4)
67 block_full_4(task
, tri
, x
+ ix
, y
+ iy
);
71 static INLINE
unsigned
72 build_mask(int c
, int dcdx
, int dcdy
)
81 mask
|= ((c0
+ 0 * dcdy
) >> 31) & (1 << 0);
82 mask
|= ((c0
+ 1 * dcdy
) >> 31) & (1 << 2);
83 mask
|= ((c0
+ 2 * dcdy
) >> 31) & (1 << 8);
84 mask
|= ((c0
+ 3 * dcdy
) >> 31) & (1 << 10);
85 mask
|= ((c1
+ 0 * dcdy
) >> 31) & (1 << 1);
86 mask
|= ((c1
+ 1 * dcdy
) >> 31) & (1 << 3);
87 mask
|= ((c1
+ 2 * dcdy
) >> 31) & (1 << 9);
88 mask
|= ((c1
+ 3 * dcdy
) >> 31) & (1 << 11);
89 mask
|= ((c2
+ 0 * dcdy
) >> 31) & (1 << 4);
90 mask
|= ((c2
+ 1 * dcdy
) >> 31) & (1 << 6);
91 mask
|= ((c2
+ 2 * dcdy
) >> 31) & (1 << 12);
92 mask
|= ((c2
+ 3 * dcdy
) >> 31) & (1 << 14);
93 mask
|= ((c3
+ 0 * dcdy
) >> 31) & (1 << 5);
94 mask
|= ((c3
+ 1 * dcdy
) >> 31) & (1 << 7);
95 mask
|= ((c3
+ 2 * dcdy
) >> 31) & (1 << 13);
96 mask
|= ((c3
+ 3 * dcdy
) >> 31) & (1 << 15);
101 static INLINE
unsigned
102 build_mask_linear(int c
, int dcdx
, int dcdy
)
111 mask
|= ((c0
+ 0 * dcdx
) >> 31) & (1 << 0);
112 mask
|= ((c0
+ 1 * dcdx
) >> 31) & (1 << 1);
113 mask
|= ((c0
+ 2 * dcdx
) >> 31) & (1 << 2);
114 mask
|= ((c0
+ 3 * dcdx
) >> 31) & (1 << 3);
115 mask
|= ((c1
+ 0 * dcdx
) >> 31) & (1 << 4);
116 mask
|= ((c1
+ 1 * dcdx
) >> 31) & (1 << 5);
117 mask
|= ((c1
+ 2 * dcdx
) >> 31) & (1 << 6);
118 mask
|= ((c1
+ 3 * dcdx
) >> 31) & (1 << 7);
119 mask
|= ((c2
+ 0 * dcdx
) >> 31) & (1 << 8);
120 mask
|= ((c2
+ 1 * dcdx
) >> 31) & (1 << 9);
121 mask
|= ((c2
+ 2 * dcdx
) >> 31) & (1 << 10);
122 mask
|= ((c2
+ 3 * dcdx
) >> 31) & (1 << 11);
123 mask
|= ((c3
+ 0 * dcdx
) >> 31) & (1 << 12);
124 mask
|= ((c3
+ 1 * dcdx
) >> 31) & (1 << 13);
125 mask
|= ((c3
+ 2 * dcdx
) >> 31) & (1 << 14);
126 mask
|= ((c3
+ 3 * dcdx
) >> 31) & (1 << 15);
134 #include "lp_rast_tri_tmp.h"
138 #include "lp_rast_tri_tmp.h"
142 #include "lp_rast_tri_tmp.h"
146 #include "lp_rast_tri_tmp.h"
150 #include "lp_rast_tri_tmp.h"
154 #include "lp_rast_tri_tmp.h"
158 #include "lp_rast_tri_tmp.h"