#include "lp_perf.h"
#include "lp_rast_priv.h"
-
-
-
/**
* Shade all pixels in a 4x4 block.
*/
block_full_4(task, tri, x + ix, y + iy);
}
-#if !defined(PIPE_ARCH_SSE)
-
static INLINE unsigned
-build_mask_linear(int c, int dcdx, int dcdy)
+build_mask_linear(int64_t c, int64_t dcdx, int64_t dcdy)
{
- int mask = 0;
-
- int c0 = c;
- int c1 = c0 + dcdy;
- int c2 = c1 + dcdy;
- int c3 = c2 + dcdy;
-
- mask |= ((c0 + 0 * dcdx) >> 31) & (1 << 0);
- mask |= ((c0 + 1 * dcdx) >> 31) & (1 << 1);
- mask |= ((c0 + 2 * dcdx) >> 31) & (1 << 2);
- mask |= ((c0 + 3 * dcdx) >> 31) & (1 << 3);
- mask |= ((c1 + 0 * dcdx) >> 31) & (1 << 4);
- mask |= ((c1 + 1 * dcdx) >> 31) & (1 << 5);
- mask |= ((c1 + 2 * dcdx) >> 31) & (1 << 6);
- mask |= ((c1 + 3 * dcdx) >> 31) & (1 << 7);
- mask |= ((c2 + 0 * dcdx) >> 31) & (1 << 8);
- mask |= ((c2 + 1 * dcdx) >> 31) & (1 << 9);
- mask |= ((c2 + 2 * dcdx) >> 31) & (1 << 10);
- mask |= ((c2 + 3 * dcdx) >> 31) & (1 << 11);
- mask |= ((c3 + 0 * dcdx) >> 31) & (1 << 12);
- mask |= ((c3 + 1 * dcdx) >> 31) & (1 << 13);
- mask |= ((c3 + 2 * dcdx) >> 31) & (1 << 14);
- mask |= ((c3 + 3 * dcdx) >> 31) & (1 << 15);
+ unsigned mask = 0;
+
+ int64_t c0 = c;
+ int64_t c1 = c0 + dcdy;
+ int64_t c2 = c1 + dcdy;
+ int64_t c3 = c2 + dcdy;
+
+ mask |= ((c0 + 0 * dcdx) >> FIXED_SHIFT) & (1 << 0);
+ mask |= ((c0 + 1 * dcdx) >> FIXED_SHIFT) & (1 << 1);
+ mask |= ((c0 + 2 * dcdx) >> FIXED_SHIFT) & (1 << 2);
+ mask |= ((c0 + 3 * dcdx) >> FIXED_SHIFT) & (1 << 3);
+ mask |= ((c1 + 0 * dcdx) >> FIXED_SHIFT) & (1 << 4);
+ mask |= ((c1 + 1 * dcdx) >> FIXED_SHIFT) & (1 << 5);
+ mask |= ((c1 + 2 * dcdx) >> FIXED_SHIFT) & (1 << 6);
+ mask |= ((c1 + 3 * dcdx) >> FIXED_SHIFT) & (1 << 7);
+ mask |= ((c2 + 0 * dcdx) >> FIXED_SHIFT) & (1 << 8);
+ mask |= ((c2 + 1 * dcdx) >> FIXED_SHIFT) & (1 << 9);
+ mask |= ((c2 + 2 * dcdx) >> FIXED_SHIFT) & (1 << 10);
+ mask |= ((c2 + 3 * dcdx) >> FIXED_SHIFT) & (1 << 11);
+ mask |= ((c3 + 0 * dcdx) >> FIXED_SHIFT) & (1 << 12);
+ mask |= ((c3 + 1 * dcdx) >> FIXED_SHIFT) & (1 << 13);
+ mask |= ((c3 + 2 * dcdx) >> FIXED_SHIFT) & (1 << 14);
+ mask |= ((c3 + 3 * dcdx) >> FIXED_SHIFT) & (1 << 15);
return mask;
}
static INLINE void
-build_masks(int c,
- int cdiff,
- int dcdx,
- int dcdy,
+build_masks(int64_t c,
+ int64_t cdiff,
+ int64_t dcdx,
+ int64_t dcdy,
unsigned *outmask,
unsigned *partmask)
{
lp_rast_triangle_3(task, arg2);
}
+void
+lp_rast_triangle_3_4(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ lp_rast_triangle_3_16(task, arg);
+}
+
void
lp_rast_triangle_4_16(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
lp_rast_triangle_4(task, arg2);
}
+#if !defined(PIPE_ARCH_SSE)
+
void
-lp_rast_triangle_3_4(struct lp_rasterizer_task *task,
+lp_rast_triangle_32_3_16(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ union lp_rast_cmd_arg arg2;
+ arg2.triangle.tri = arg.triangle.tri;
+ arg2.triangle.plane_mask = (1<<3)-1;
+ lp_rast_triangle_32_3(task, arg2);
+}
+
+void
+lp_rast_triangle_32_4_16(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ union lp_rast_cmd_arg arg2;
+ arg2.triangle.tri = arg.triangle.tri;
+ arg2.triangle.plane_mask = (1<<4)-1;
+ lp_rast_triangle_32_4(task, arg2);
+}
+
+void
+lp_rast_triangle_32_3_4(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
- lp_rast_triangle_3_16(task, arg);
+ lp_rast_triangle_32_3_16(task, arg);
}
#else
static INLINE void
-build_masks(int c,
- int cdiff,
- int dcdx,
- int dcdy,
- unsigned *outmask,
- unsigned *partmask)
+build_masks_32(int c,
+ int cdiff,
+ int dcdx,
+ int dcdy,
+ unsigned *outmask,
+ unsigned *partmask)
{
__m128i cstep0 = _mm_setr_epi32(c, c+dcdx, c+dcdx*2, c+dcdx*3);
__m128i xdcdy = _mm_set1_epi32(dcdy);
static INLINE unsigned
-build_mask_linear(int c, int dcdx, int dcdy)
+build_mask_linear_32(int c, int dcdx, int dcdy)
{
__m128i cstep0 = _mm_setr_epi32(c, c+dcdx, c+dcdx*2, c+dcdx*3);
__m128i xdcdy = _mm_set1_epi32(dcdy);
void
-lp_rast_triangle_3_16(struct lp_rasterizer_task *task,
+lp_rast_triangle_32_3_16(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
const struct lp_rast_triangle *tri = arg.triangle.tri;
struct { unsigned mask:16; unsigned i:8; unsigned j:8; } out[16];
unsigned nr = 0;
- __m128i p0 = _mm_load_si128((__m128i *)&plane[0]); /* c, dcdx, dcdy, eo */
- __m128i p1 = _mm_load_si128((__m128i *)&plane[1]); /* c, dcdx, dcdy, eo */
- __m128i p2 = _mm_load_si128((__m128i *)&plane[2]); /* c, dcdx, dcdy, eo */
+ __m128i p0 = lp_plane_to_m128i(&plane[0]); /* c, dcdx, dcdy, eo */
+ __m128i p1 = lp_plane_to_m128i(&plane[1]); /* c, dcdx, dcdy, eo */
+ __m128i p2 = lp_plane_to_m128i(&plane[2]); /* c, dcdx, dcdy, eo */
__m128i zero = _mm_setzero_si128();
__m128i c;
void
-lp_rast_triangle_3_4(struct lp_rasterizer_task *task,
+lp_rast_triangle_32_3_4(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
const struct lp_rast_triangle *tri = arg.triangle.tri;
unsigned x = (arg.triangle.plane_mask & 0xff) + task->x;
unsigned y = (arg.triangle.plane_mask >> 8) + task->y;
- __m128i p0 = _mm_load_si128((__m128i *)&plane[0]); /* c, dcdx, dcdy, eo */
- __m128i p1 = _mm_load_si128((__m128i *)&plane[1]); /* c, dcdx, dcdy, eo */
- __m128i p2 = _mm_load_si128((__m128i *)&plane[2]); /* c, dcdx, dcdy, eo */
+ __m128i p0 = lp_plane_to_m128i(&plane[0]); /* c, dcdx, dcdy, eo */
+ __m128i p1 = lp_plane_to_m128i(&plane[1]); /* c, dcdx, dcdy, eo */
+ __m128i p2 = lp_plane_to_m128i(&plane[2]); /* c, dcdx, dcdy, eo */
__m128i zero = _mm_setzero_si128();
__m128i c;
#endif
-
+#define BUILD_MASKS(c, cdiff, dcdx, dcdy, omask, pmask) build_masks(c, cdiff, dcdx, dcdy, omask, pmask)
+#define BUILD_MASK_LINEAR(c, dcdx, dcdy) build_mask_linear(c, dcdx, dcdy)
#define TAG(x) x##_1
#define NR_PLANES 1
#define TAG(x) x##_4
#define NR_PLANES 4
-#define TRI_16 lp_rast_triangle_4_16
+/*#define TRI_16 lp_rast_triangle_4_16*/
#include "lp_rast_tri_tmp.h"
#define TAG(x) x##_5
#define NR_PLANES 8
#include "lp_rast_tri_tmp.h"
+#ifdef PIPE_ARCH_SSE
+#undef BUILD_MASKS
+#undef BUILD_MASK_LINEAR
+#define BUILD_MASKS(c, cdiff, dcdx, dcdy, omask, pmask) build_masks_32((int)c, (int)cdiff, dcdx, dcdy, omask, pmask)
+#define BUILD_MASK_LINEAR(c, dcdx, dcdy) build_mask_linear_32((int)c, dcdx, dcdy)
+#endif
+
+#define TAG(x) x##_32_1
+#define NR_PLANES 1
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_32_2
+#define NR_PLANES 2
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_32_3
+#define NR_PLANES 3
+/*#define TRI_4 lp_rast_triangle_3_4*/
+/*#define TRI_16 lp_rast_triangle_3_16*/
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_32_4
+#define NR_PLANES 4
+#ifdef PIPE_ARCH_SSE
+#define TRI_16 lp_rast_triangle_32_4_16
+#endif
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_32_5
+#define NR_PLANES 5
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_32_6
+#define NR_PLANES 6
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_32_7
+#define NR_PLANES 7
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_32_8
+#define NR_PLANES 8
+#include "lp_rast_tri_tmp.h"
+