llvmpipe: improve the in/out test a little
Instead of: s = c + step m = s > 0 Do: m = step > c (with negated c)
This commit is contained in:
parent
7f2ba80025
commit
b9d33db0a4
|
@ -281,11 +281,10 @@ void lp_rast_shade_tile( struct lp_rasterizer *rast,
|
||||||
const union lp_rast_cmd_arg arg )
|
const union lp_rast_cmd_arg arg )
|
||||||
{
|
{
|
||||||
/* Set c1,c2,c3 to large values so the in/out test always passes */
|
/* Set c1,c2,c3 to large values so the in/out test always passes */
|
||||||
const int32_t c1 = INT_MAX/2, c2 = INT_MAX/2, c3 = INT_MAX/2;
|
const int32_t c1 = INT_MIN/2, c2 = INT_MIN/2, c3 = INT_MIN/2;
|
||||||
const struct lp_rast_shader_inputs *inputs = arg.shade_tile;
|
const struct lp_rast_shader_inputs *inputs = arg.shade_tile;
|
||||||
const unsigned tile_x = rast->tasks[thread_index].x;
|
const unsigned tile_x = rast->tasks[thread_index].x;
|
||||||
const unsigned tile_y = rast->tasks[thread_index].y;
|
const unsigned tile_y = rast->tasks[thread_index].y;
|
||||||
const unsigned mask = ~0;
|
|
||||||
unsigned x, y;
|
unsigned x, y;
|
||||||
|
|
||||||
LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
|
LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
|
||||||
|
|
|
@ -90,7 +90,7 @@ block_full_4( struct lp_rasterizer_task *rast_task,
|
||||||
int x, int y )
|
int x, int y )
|
||||||
{
|
{
|
||||||
/* Set c1,c2,c3 to large values so the in/out test always passes */
|
/* Set c1,c2,c3 to large values so the in/out test always passes */
|
||||||
const int32_t c1 = INT_MAX/2, c2 = INT_MAX/2, c3 = INT_MAX/2;
|
const int32_t c1 = INT_MIN/2, c2 = INT_MIN/2, c3 = INT_MIN/2;
|
||||||
lp_rast_shade_quads(rast_task->rast,
|
lp_rast_shade_quads(rast_task->rast,
|
||||||
rast_task->thread_index,
|
rast_task->thread_index,
|
||||||
&tri->inputs,
|
&tri->inputs,
|
||||||
|
@ -133,7 +133,7 @@ do_block_4( struct lp_rasterizer_task *rast_task,
|
||||||
rast_task->thread_index,
|
rast_task->thread_index,
|
||||||
&tri->inputs,
|
&tri->inputs,
|
||||||
x, y,
|
x, y,
|
||||||
c1, c2, c3);
|
-c1, -c2, -c3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -196,12 +196,9 @@ generate_tri_edge_mask(LLVMBuilderRef builder,
|
||||||
c0_vec = splat(c0)
|
c0_vec = splat(c0)
|
||||||
c1_vec = splat(c1)
|
c1_vec = splat(c1)
|
||||||
c2_vec = splat(c2)
|
c2_vec = splat(c2)
|
||||||
s0_vec = c0_vec + step0_ptr[i]
|
m0_vec = step0_ptr[i] > c0_vec
|
||||||
s1_vec = c1_vec + step1_ptr[i]
|
m1_vec = step1_ptr[i] > c1_vec
|
||||||
s2_vec = c2_vec + step2_ptr[i]
|
m2_vec = step2_ptr[i] > c2_vec
|
||||||
m0_vec = s0_vec > {0,0,0,0}
|
|
||||||
m1_vec = s1_vec > {0,0,0,0}
|
|
||||||
m2_vec = s2_vec > {0,0,0,0}
|
|
||||||
mask = m0_vec & m1_vec & m2_vec
|
mask = m0_vec & m1_vec & m2_vec
|
||||||
*/
|
*/
|
||||||
struct lp_type i32_type;
|
struct lp_type i32_type;
|
||||||
|
@ -211,7 +208,6 @@ generate_tri_edge_mask(LLVMBuilderRef builder,
|
||||||
LLVMValueRef c0_vec, c1_vec, c2_vec;
|
LLVMValueRef c0_vec, c1_vec, c2_vec;
|
||||||
LLVMValueRef step0_vec, step1_vec, step2_vec;
|
LLVMValueRef step0_vec, step1_vec, step2_vec;
|
||||||
LLVMValueRef m0_vec, m1_vec, m2_vec;
|
LLVMValueRef m0_vec, m1_vec, m2_vec;
|
||||||
LLVMValueRef s0_vec, s1_vec, s2_vec;
|
|
||||||
LLVMValueRef m;
|
LLVMValueRef m;
|
||||||
|
|
||||||
LLVMValueRef zeros;
|
LLVMValueRef zeros;
|
||||||
|
@ -240,21 +236,13 @@ generate_tri_edge_mask(LLVMBuilderRef builder,
|
||||||
step1_vec = LLVMBuildLoad(builder, LLVMBuildGEP(builder, step1_ptr, &index, 1, ""), "");
|
step1_vec = LLVMBuildLoad(builder, LLVMBuildGEP(builder, step1_ptr, &index, 1, ""), "");
|
||||||
step2_vec = LLVMBuildLoad(builder, LLVMBuildGEP(builder, step2_ptr, &index, 1, ""), "");
|
step2_vec = LLVMBuildLoad(builder, LLVMBuildGEP(builder, step2_ptr, &index, 1, ""), "");
|
||||||
|
|
||||||
/** XXX with a little work, we could remove the add here and just
|
m0_vec = lp_build_compare(builder, i32_type, PIPE_FUNC_GREATER, step0_vec, c0_vec);
|
||||||
* compare c0_vec > step0_vec.
|
m1_vec = lp_build_compare(builder, i32_type, PIPE_FUNC_GREATER, step1_vec, c1_vec);
|
||||||
*/
|
m2_vec = lp_build_compare(builder, i32_type, PIPE_FUNC_GREATER, step2_vec, c2_vec);
|
||||||
s0_vec = LLVMBuildAdd(builder, c0_vec, step0_vec, "");
|
|
||||||
s1_vec = LLVMBuildAdd(builder, c1_vec, step1_vec, "");
|
|
||||||
s2_vec = LLVMBuildAdd(builder, c2_vec, step2_vec, "");
|
|
||||||
m0_vec = lp_build_compare(builder, i32_type, PIPE_FUNC_GREATER, s0_vec, zeros);
|
|
||||||
m1_vec = lp_build_compare(builder, i32_type, PIPE_FUNC_GREATER, s1_vec, zeros);
|
|
||||||
m2_vec = lp_build_compare(builder, i32_type, PIPE_FUNC_GREATER, s2_vec, zeros);
|
|
||||||
|
|
||||||
m = LLVMBuildAnd(builder, m0_vec, m1_vec, "");
|
m = LLVMBuildAnd(builder, m0_vec, m1_vec, "");
|
||||||
m = LLVMBuildAnd(builder, m, m2_vec, "");
|
m = LLVMBuildAnd(builder, m, m2_vec, "");
|
||||||
|
|
||||||
lp_build_name(m, "m");
|
|
||||||
|
|
||||||
*mask = m;
|
*mask = m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue