llvmpipe/fs: pass explicit mask_type into interp code.

This is so it is known for explicit pointer support

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18876>
This commit is contained in:
Dave Airlie
2022-09-26 17:36:58 +10:00
committed by Marge Bot
parent 637652a97f
commit 694104b776
3 changed files with 16 additions and 7 deletions
+9 -5
View File
@@ -157,6 +157,7 @@ static void
calc_centroid_offsets(struct lp_build_interp_soa_context *bld,
struct gallivm_state *gallivm,
LLVMValueRef loop_iter,
LLVMTypeRef mask_type,
LLVMValueRef mask_store,
LLVMValueRef pix_center_offset,
LLVMValueRef *centroid_x, LLVMValueRef *centroid_y)
@@ -171,7 +172,7 @@ calc_centroid_offsets(struct lp_build_interp_soa_context *bld,
LLVMValueRef s_mask_idx = LLVMBuildMul(builder, bld->num_loop, lp_build_const_int32(gallivm, s), "");
s_mask_idx = LLVMBuildAdd(builder, s_mask_idx, loop_iter, "");
sample_cov = lp_build_pointer_get(builder, mask_store, s_mask_idx);
sample_cov = lp_build_pointer_get2(builder, mask_type, mask_store, s_mask_idx);
if (s == bld->coverage_samples - 1)
s_mask_and = sample_cov;
else
@@ -284,6 +285,7 @@ static void
attribs_update_simple(struct lp_build_interp_soa_context *bld,
struct gallivm_state *gallivm,
LLVMValueRef loop_iter,
LLVMTypeRef mask_type,
LLVMValueRef mask_store,
LLVMValueRef sample_id,
int start,
@@ -376,7 +378,7 @@ attribs_update_simple(struct lp_build_interp_soa_context *bld,
xoffset = lp_build_broadcast_scalar(coeff_bld, x_val_idx);
yoffset = lp_build_broadcast_scalar(coeff_bld, y_val_idx);
} else if (loc == TGSI_INTERPOLATE_LOC_CENTROID) {
calc_centroid_offsets(bld, gallivm, loop_iter, mask_store,
calc_centroid_offsets(bld, gallivm, loop_iter, mask_type, mask_store,
pix_center_offset, &xoffset, &yoffset);
}
chan_pixoffx = lp_build_add(coeff_bld, chan_pixoffx, xoffset);
@@ -508,6 +510,7 @@ LLVMValueRef
lp_build_interp_soa(struct lp_build_interp_soa_context *bld,
struct gallivm_state *gallivm,
LLVMValueRef loop_iter,
LLVMTypeRef mask_type,
LLVMValueRef mask_store,
unsigned attrib, unsigned chan,
enum tgsi_interpolate_loc loc,
@@ -579,7 +582,7 @@ lp_build_interp_soa(struct lp_build_interp_soa_context *bld,
/* for centroid find covered samples for this quad. */
/* if all samples are covered use pixel centers */
if (bld->coverage_samples > 1) {
calc_centroid_offsets(bld, gallivm, loop_iter, mask_store,
calc_centroid_offsets(bld, gallivm, loop_iter, mask_type, mask_store,
pix_center_offset, &centroid_x_offset,
&centroid_y_offset);
@@ -793,10 +796,11 @@ void
lp_build_interp_soa_update_inputs_dyn(struct lp_build_interp_soa_context *bld,
struct gallivm_state *gallivm,
LLVMValueRef quad_start_index,
LLVMTypeRef mask_type,
LLVMValueRef mask_store,
LLVMValueRef sample_id)
{
attribs_update_simple(bld, gallivm, quad_start_index, mask_store, sample_id, 1, bld->num_attribs);
attribs_update_simple(bld, gallivm, quad_start_index, mask_type, mask_store, sample_id, 1, bld->num_attribs);
}
void
@@ -805,6 +809,6 @@ lp_build_interp_soa_update_pos_dyn(struct lp_build_interp_soa_context *bld,
LLVMValueRef quad_start_index,
LLVMValueRef sample_id)
{
attribs_update_simple(bld, gallivm, quad_start_index, NULL, sample_id, 0, 1);
attribs_update_simple(bld, gallivm, quad_start_index, NULL, NULL, sample_id, 0, 1);
}
@@ -138,6 +138,7 @@ void
lp_build_interp_soa_update_inputs_dyn(struct lp_build_interp_soa_context *bld,
struct gallivm_state *gallivm,
LLVMValueRef quad_start_index,
LLVMTypeRef mask_type,
LLVMValueRef mask_store,
LLVMValueRef sample_id);
@@ -151,6 +152,7 @@ LLVMValueRef
lp_build_interp_soa(struct lp_build_interp_soa_context *bld,
struct gallivm_state *gallivm,
LLVMValueRef loop_iter,
LLVMTypeRef mask_type,
LLVMValueRef mask_store,
unsigned attrib, unsigned chan,
unsigned loc,
+5 -2
View File
@@ -434,6 +434,7 @@ struct lp_build_fs_llvm_iface {
struct lp_build_fs_iface base;
struct lp_build_interp_soa_context *interp;
struct lp_build_for_loop_state *loop_state;
LLVMTypeRef mask_type;
LLVMValueRef mask_store;
LLVMValueRef sample_id;
LLVMValueRef color_ptr_ptr;
@@ -463,7 +464,7 @@ fs_interp(const struct lp_build_fs_iface *iface,
loc = TGSI_INTERPOLATE_LOC_SAMPLE;
return lp_build_interp_soa(interp, bld->gallivm, fs_iface->loop_state->counter,
fs_iface->mask_store,
fs_iface->mask_type, fs_iface->mask_store,
attrib, chan, loc, attrib_indir, offsets);
}
@@ -1005,7 +1006,8 @@ generate_fs_loop(struct gallivm_state *gallivm,
}
system_values.sample_pos = sample_pos_array;
lp_build_interp_soa_update_inputs_dyn(interp, gallivm, loop_state.counter, mask_store, sample_loop_state.counter);
lp_build_interp_soa_update_inputs_dyn(interp, gallivm, loop_state.counter,
mask_type, mask_store, sample_loop_state.counter);
struct lp_build_fs_llvm_iface fs_iface = {
.base.interp_fn = fs_interp,
@@ -1013,6 +1015,7 @@ generate_fs_loop(struct gallivm_state *gallivm,
.interp = interp,
.loop_state = &loop_state,
.sample_id = system_values.sample_id,
.mask_type = mask_type,
.mask_store = mask_store,
.color_ptr_ptr = color_ptr_ptr,
.color_stride_ptr = color_stride_ptr,