Mesa (master): llvmpipe/interp: fix interpolating frag pos for sample shading
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue May 19 00:45:21 UTC 2020
Module: Mesa
Branch: master
Commit: 6b7e03175d9ef0d73ce01896cc8b385978aeba6d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b7e03175d9ef0d73ce01896cc8b385978aeba6d
Author: Dave Airlie <airlied at redhat.com>
Date: Thu Apr 16 16:10:34 2020 +1000
llvmpipe/interp: fix interpolating frag pos for sample shading
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5050>
---
src/gallium/drivers/llvmpipe/lp_bld_interp.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.c b/src/gallium/drivers/llvmpipe/lp_bld_interp.c
index 6f40d854297..4aa3350ef54 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_interp.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.c
@@ -289,13 +289,22 @@ attribs_update_simple(struct lp_build_interp_soa_context *bld,
case LP_INTERP_LINEAR:
if (attrib == 0 && chan == 0) {
dadx = coeff_bld->one;
- if (bld->pos_offset) {
+ if (sample_id) {
+ LLVMValueRef x_val_idx = LLVMBuildMul(gallivm->builder, sample_id, lp_build_const_int32(gallivm, 2), "");
+ x_val_idx = lp_build_array_get(gallivm, bld->sample_pos_array, x_val_idx);
+ a = lp_build_broadcast_scalar(coeff_bld, x_val_idx);
+ } else if (bld->pos_offset) {
a = lp_build_const_vec(gallivm, coeff_bld->type, bld->pos_offset);
}
}
else if (attrib == 0 && chan == 1) {
dady = coeff_bld->one;
- if (bld->pos_offset) {
+ if (sample_id) {
+ LLVMValueRef y_val_idx = LLVMBuildMul(gallivm->builder, sample_id, lp_build_const_int32(gallivm, 2), "");
+ y_val_idx = LLVMBuildAdd(gallivm->builder, y_val_idx, lp_build_const_int32(gallivm, 1), "");
+ y_val_idx = lp_build_array_get(gallivm, bld->sample_pos_array, y_val_idx);
+ a = lp_build_broadcast_scalar(coeff_bld, y_val_idx);
+ } else if (bld->pos_offset) {
a = lp_build_const_vec(gallivm, coeff_bld->type, bld->pos_offset);
}
}
More information about the mesa-commit
mailing list