Mesa (main): ir3: Use non-persp interpolation when appropriate for interpolateAtOffset.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jul 11 17:25:59 UTC 2022
Module: Mesa
Branch: main
Commit: 4822058b1c254a537093b2a23b591dd01dc97a9b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4822058b1c254a537093b2a23b591dd01dc97a9b
Author: Emma Anholt <emma at anholt.net>
Date: Thu Jun 30 14:10:50 2022 -0700
ir3: Use non-persp interpolation when appropriate for interpolateAtOffset.
Fixes dEQP-VK.draw.renderpass.linear_interpolation.offset_min_4_samples.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17322>
---
src/freedreno/ci/freedreno-a618-fails.txt | 2 --
src/freedreno/ci/freedreno-a630-fails.txt | 2 --
.../ir3/ir3_nir_lower_load_barycentric_at_offset.c | 42 ++++++++++++++--------
3 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/src/freedreno/ci/freedreno-a618-fails.txt b/src/freedreno/ci/freedreno-a618-fails.txt
index 4d99b38ac49..fa40ed4fc1d 100644
--- a/src/freedreno/ci/freedreno-a618-fails.txt
+++ b/src/freedreno/ci/freedreno-a618-fails.txt
@@ -26,5 +26,3 @@ dEQP-VK.pipeline.monolithic.color_write_enable_maxa.cwe_after_bind.attachments5_
dEQP-VK.pipeline.monolithic.color_write_enable_maxa.cwe_after_bind.attachments5_more3,Crash
dEQP-VK.pipeline.monolithic.color_write_enable_maxa.cwe_after_bind.attachments6_more0,Crash
dEQP-VK.pipeline.monolithic.color_write_enable_maxa.cwe_after_bind.attachments6_more1,Crash
-
-dEQP-VK.draw.renderpass.linear_interpolation.offset_min_4_samples,Fail
diff --git a/src/freedreno/ci/freedreno-a630-fails.txt b/src/freedreno/ci/freedreno-a630-fails.txt
index 58d582da393..dcd40383ceb 100644
--- a/src/freedreno/ci/freedreno-a630-fails.txt
+++ b/src/freedreno/ci/freedreno-a630-fails.txt
@@ -457,5 +457,3 @@ dEQP-VK.pipeline.monolithic.color_write_enable_maxa.cwe_after_bind.attachments5_
dEQP-VK.pipeline.monolithic.color_write_enable_maxa.cwe_after_bind.attachments5_more3,Crash
dEQP-VK.pipeline.monolithic.color_write_enable_maxa.cwe_after_bind.attachments6_more0,Crash
dEQP-VK.pipeline.monolithic.color_write_enable_maxa.cwe_after_bind.attachments6_more1,Crash
-
-dEQP-VK.draw.renderpass.linear_interpolation.offset_min_4_samples,Fail
diff --git a/src/freedreno/ir3/ir3_nir_lower_load_barycentric_at_offset.c b/src/freedreno/ir3/ir3_nir_lower_load_barycentric_at_offset.c
index 9b3dfac2f5b..3591df9fce5 100644
--- a/src/freedreno/ir3/ir3_nir_lower_load_barycentric_at_offset.c
+++ b/src/freedreno/ir3/ir3_nir_lower_load_barycentric_at_offset.c
@@ -46,24 +46,36 @@ ir3_nir_lower_load_barycentric_at_offset_instr(nir_builder *b, nir_instr *instr,
if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
b->shader->info.fs.needs_quad_helper_invocations = true;
- nir_ssa_def *center_w = nir_frcp(b, nir_load_persp_center_rhw_ir3(b, 32));
+ if (interp_mode != INTERP_MODE_SMOOTH) {
+ /* Offset our pixel center ij by the offset argument (units of pixels)
+ * times the derivatives of ij in screen space.
+ */
+ nir_ssa_def *new_ij = ij;
+ new_ij = nir_ffma(b, chan(off, 0), nir_fddx(b, ij), new_ij);
+ new_ij = nir_ffma(b, chan(off, 1), nir_fddy(b, ij), new_ij);
- /* scaled ij -- ij comes in multiplied by by 1/center_w so multiply that back
- * out, plus add center_w as the 3rd component for taking the derivatives.
- *
- * We actually suspect that we should be using rhw here instead of center_w,
- * but no tests seem to distinguish between the two.
- */
- nir_ssa_def *sij =
- nir_vec3(b, nir_fmul(b, chan(ij, 0), center_w), nir_fmul(b, chan(ij, 1), center_w), center_w);
+ return new_ij;
+ } else {
+ nir_ssa_def *center_w = nir_frcp(b, nir_load_persp_center_rhw_ir3(b, 32));
- /* Get the offset value from pixel center for ij, and also for w. */
- nir_ssa_def *pos = sij;
- pos = nir_ffma(b, chan(off, 0), nir_fddx(b, sij), pos);
- pos = nir_ffma(b, chan(off, 1), nir_fddy(b, sij), pos);
+ /* scaled ij -- ij comes in multiplied by by 1/center_w so multiply that
+ * back out, plus add center_w as the 3rd component for taking the
+ * derivatives.
+ *
+ * We actually suspect that we should be using rhw here instead of center_w,
+ * but no tests seem to distinguish between the two.
+ */
+ nir_ssa_def *sij =
+ nir_vec3(b, nir_fmul(b, chan(ij, 0), center_w), nir_fmul(b, chan(ij, 1), center_w), center_w);
- /* convert back into screen space, dividing by the offset 1/w */
- return nir_fmul(b, nir_channels(b, pos, 0x3), nir_frcp(b, chan(pos, 2)));
+ /* Get the offset value from pixel center for ij, and also for w. */
+ nir_ssa_def *pos = sij;
+ pos = nir_ffma(b, chan(off, 0), nir_fddx(b, sij), pos);
+ pos = nir_ffma(b, chan(off, 1), nir_fddy(b, sij), pos);
+
+ /* convert back into screen space, dividing by the offset 1/w */
+ return nir_fmul(b, nir_channels(b, pos, 0x3), nir_frcp(b, chan(pos, 2)));
+ }
}
static bool
More information about the mesa-commit
mailing list