summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_state_fs.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2010-10-06 22:25:48 +0100
committerKeith Whitwell <keithw@vmware.com>2010-10-09 11:42:48 +0100
commit8009886b0092df2783472deaac1bcaad4a802c19 (patch)
tree93de97caaaf48c510b785a3e09ecccfca1f4f16a /src/gallium/drivers/llvmpipe/lp_state_fs.c
parentd0bfb3c5144a9434efd4d53ced149d42016b5bdc (diff)
llvmpipe: defer attribute interpolation until after mask and ztest
Don't calculate 1/w for quads which aren't visible...
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_state_fs.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 3ce8be5a0a..0530c61323 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -262,7 +262,7 @@ generate_fs(struct llvmpipe_context *lp,
struct lp_type type,
LLVMValueRef context_ptr,
unsigned i,
- const struct lp_build_interp_soa_context *interp,
+ struct lp_build_interp_soa_context *interp,
struct lp_build_sampler_soa *sampler,
LLVMValueRef *pmask,
LLVMValueRef (*color)[4],
@@ -276,7 +276,7 @@ generate_fs(struct llvmpipe_context *lp,
LLVMTypeRef vec_type;
LLVMValueRef consts_ptr;
LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS];
- LLVMValueRef z = interp->pos[2];
+ LLVMValueRef z;
LLVMValueRef stencil_refs[2];
struct lp_build_flow_context *flow;
struct lp_build_mask_context mask;
@@ -307,7 +307,6 @@ generate_fs(struct llvmpipe_context *lp,
lp_build_flow_scope_declare(flow, &color[cbuf][chan]);
}
}
- lp_build_flow_scope_declare(flow, &z);
/* do triangle edge testing */
if (partial_mask) {
@@ -321,6 +320,13 @@ generate_fs(struct llvmpipe_context *lp,
/* 'mask' will control execution based on quad's pixel alive/killed state */
lp_build_mask_begin(&mask, flow, type, *pmask);
+ lp_build_interp_soa_update_pos(interp, i);
+
+ /* Try to avoid the 1/w for quads where mask is zero. TODO: avoid
+ * this for depth-fail quads also.
+ */
+ z = interp->pos[2];
+
early_depth_stencil_test =
(key->depth.enabled || key->stencil[0].enabled) &&
!key->alpha.enabled &&
@@ -332,6 +338,8 @@ generate_fs(struct llvmpipe_context *lp,
type, &mask,
stencil_refs, z, depth_ptr, facing, counter);
+ lp_build_interp_soa_update_inputs(interp, i);
+
lp_build_tgsi_soa(builder, tokens, type, &mask,
consts_ptr, interp->pos, interp->inputs,
outputs, sampler, &shader->info);
@@ -621,9 +629,6 @@ generate_fragment(struct llvmpipe_context *lp,
LLVMValueRef out_color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS];
LLVMValueRef depth_ptr_i;
- if(i != 0)
- lp_build_interp_soa_update(&interp, i);
-
depth_ptr_i = LLVMBuildGEP(builder, depth_ptr, &index, 1, "");
generate_fs(lp, shader, key,