diff options
author | Brian Paul <[email protected]> | 2009-12-16 17:08:13 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-12-17 08:17:04 -0700 |
commit | b9d33db0a4cb818154b713a27834f66025b14672 (patch) | |
tree | dba2f1ad9f604f920527302211b6482ce869abbb /src/gallium/drivers | |
parent | 7f2ba80025e4b534db72427a206e6a542fc2f520 (diff) |
llvmpipe: improve the in/out test a little
Instead of:
s = c + step
m = s > 0
Do:
m = step > c (with negated c)
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast_tri.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_fs.c | 24 |
3 files changed, 9 insertions, 22 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index b1bd27d3406..015865a6d6f 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -281,11 +281,10 @@ void lp_rast_shade_tile( struct lp_rasterizer *rast, const union lp_rast_cmd_arg arg ) { /* 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 unsigned tile_x = rast->tasks[thread_index].x; const unsigned tile_y = rast->tasks[thread_index].y; - const unsigned mask = ~0; unsigned x, y; LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__); diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 9b1861223ae..d6e8d6d5ab5 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -90,7 +90,7 @@ block_full_4( struct lp_rasterizer_task *rast_task, int x, int y ) { /* 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, rast_task->thread_index, &tri->inputs, @@ -133,7 +133,7 @@ do_block_4( struct lp_rasterizer_task *rast_task, rast_task->thread_index, &tri->inputs, x, y, - c1, c2, c3); + -c1, -c2, -c3); } diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 4af37e365ec..15b175a2c47 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -196,12 +196,9 @@ generate_tri_edge_mask(LLVMBuilderRef builder, c0_vec = splat(c0) c1_vec = splat(c1) c2_vec = splat(c2) - s0_vec = c0_vec + step0_ptr[i] - s1_vec = c1_vec + step1_ptr[i] - s2_vec = c2_vec + step2_ptr[i] - m0_vec = s0_vec > {0,0,0,0} - m1_vec = s1_vec > {0,0,0,0} - m2_vec = s2_vec > {0,0,0,0} + m0_vec = step0_ptr[i] > c0_vec + m1_vec = step1_ptr[i] > c1_vec + m2_vec = step2_ptr[i] > c2_vec mask = m0_vec & m1_vec & m2_vec */ struct lp_type i32_type; @@ -211,7 +208,6 @@ generate_tri_edge_mask(LLVMBuilderRef builder, LLVMValueRef c0_vec, c1_vec, c2_vec; LLVMValueRef step0_vec, step1_vec, step2_vec; LLVMValueRef m0_vec, m1_vec, m2_vec; - LLVMValueRef s0_vec, s1_vec, s2_vec; LLVMValueRef m; LLVMValueRef zeros; @@ -240,21 +236,13 @@ generate_tri_edge_mask(LLVMBuilderRef builder, step1_vec = LLVMBuildLoad(builder, LLVMBuildGEP(builder, step1_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 - * compare c0_vec > step0_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); + m0_vec = lp_build_compare(builder, i32_type, PIPE_FUNC_GREATER, step0_vec, c0_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); m = LLVMBuildAnd(builder, m0_vec, m1_vec, ""); m = LLVMBuildAnd(builder, m, m2_vec, ""); - lp_build_name(m, "m"); - *mask = m; } |