c1f2680ddcafb73887d4e6de26b45ae602c58a36
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"
41 * Map an index in [0,15] to an x,y position, multiplied by 4.
42 * This is used to get the position of each subtile in a 4x4
43 * grid of edge step values.
44 * Note: we can use some bit twiddling to compute these values instead
45 * of using a look-up table, but there's no measurable performance
48 static const int pos_table4
[16][2] = {
68 static const int pos_table16
[16][2] = {
89 * Shade all pixels in a 4x4 block.
92 block_full_4(struct lp_rasterizer_task
*task
,
93 const struct lp_rast_triangle
*tri
,
96 lp_rast_shade_quads_all(task
, &tri
->inputs
, x
, y
);
101 * Shade all pixels in a 16x16 block.
104 block_full_16(struct lp_rasterizer_task
*task
,
105 const struct lp_rast_triangle
*tri
,
111 for (iy
= 0; iy
< 16; iy
+= 4)
112 for (ix
= 0; ix
< 16; ix
+= 4)
113 block_full_4(task
, tri
, x
+ ix
, y
+ iy
);
117 static INLINE
unsigned
118 build_mask(int c
, const int *step
)
123 for (i
= 0; i
< 16; i
++) {
124 mask
|= ((c
+ step
[i
]) >> 31) & (1 << i
);
133 #include "lp_rast_tri_tmp.h"
137 #include "lp_rast_tri_tmp.h"
141 #include "lp_rast_tri_tmp.h"
145 #include "lp_rast_tri_tmp.h"
149 #include "lp_rast_tri_tmp.h"
153 #include "lp_rast_tri_tmp.h"
157 #include "lp_rast_tri_tmp.h"