if (bld->coverage_samples > 1) {
LLVMValueRef xoffset = lp_build_const_vec(gallivm, coeff_bld->type, bld->pos_offset);
LLVMValueRef yoffset = lp_build_const_vec(gallivm, coeff_bld->type, bld->pos_offset);
- if (loc == TGSI_INTERPOLATE_LOC_SAMPLE) {
+ if (loc == TGSI_INTERPOLATE_LOC_SAMPLE || (attrib == 0 && chan == 2 && sample_id)) {
LLVMValueRef x_val_idx = LLVMBuildMul(gallivm->builder, sample_id, lp_build_const_int32(gallivm, 2), "");
LLVMValueRef y_val_idx = LLVMBuildAdd(gallivm->builder, x_val_idx, lp_build_const_int32(gallivm, 1), "");
void
lp_build_interp_soa_update_pos_dyn(struct lp_build_interp_soa_context *bld,
struct gallivm_state *gallivm,
- LLVMValueRef quad_start_index)
+ LLVMValueRef quad_start_index,
+ LLVMValueRef sample_id)
{
if (bld->simple_interp) {
- attribs_update_simple(bld, gallivm, quad_start_index, NULL, NULL, 0, 1);
+ attribs_update_simple(bld, gallivm, quad_start_index, NULL, sample_id, 0, 1);
}
else {
attribs_update(bld, gallivm, quad_start_index, 0, 1);
void
lp_build_interp_soa_update_pos_dyn(struct lp_build_interp_soa_context *bld,
struct gallivm_state *gallivm,
- LLVMValueRef quad_start_index);
+ LLVMValueRef quad_start_index,
+ LLVMValueRef sample_id);
#endif /* LP_BLD_INTERP_H */
if (!(depth_mode & EARLY_DEPTH_TEST) && !simple_shader)
lp_build_mask_check(&mask);
- lp_build_interp_soa_update_pos_dyn(interp, gallivm, loop_state.counter);
- z = interp->pos[2];
-
/* Create storage for recombining sample masks after early Z pass. */
LLVMValueRef s_mask_or = lp_build_alloca(gallivm, lp_build_int_vec_type(gallivm, type), "cov_mask_early_depth");
LLVMBuildStore(builder, LLVMConstNull(lp_build_int_vec_type(gallivm, type)), s_mask_or);
s_mask = LLVMBuildAnd(builder, s_mask, mask_val, "");
}
+
+ /* for multisample Z needs to be interpolated at sample points for testing. */
+ lp_build_interp_soa_update_pos_dyn(interp, gallivm, loop_state.counter, key->multisample ? sample_loop_state.counter : NULL);
+ z = interp->pos[2];
+
depth_ptr = depth_base_ptr;
if (key->multisample) {
LLVMValueRef sample_offset = LLVMBuildMul(builder, sample_loop_state.counter, depth_sample_stride, "");
/* recombined all the coverage masks in the shader exec mask. */
tmp_s_mask_or = LLVMBuildLoad(builder, s_mask_or, "");
lp_build_mask_update(&mask, tmp_s_mask_or);
+
+ /* for multisample Z needs to be re interpolated at pixel center */
+ lp_build_interp_soa_update_pos_dyn(interp, gallivm, loop_state.counter, NULL);
}
lp_build_interp_soa_update_inputs_dyn(interp, gallivm, loop_state.counter, NULL, NULL);