Mesa (master): r600: Fix interpolateAtCentroid
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 4 08:28:56 UTC 2019
Module: Mesa
Branch: master
Commit: 7cbb44aa6ae417d32bd9fd5c2c858ade9a9acfd8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7cbb44aa6ae417d32bd9fd5c2c858ade9a9acfd8
Author: Gert Wollny <gert.wollny at collabora.com>
Date: Wed Aug 28 10:48:04 2019 +0200
r600: Fix interpolateAtCentroid
If the instruction interpolateAtCentroid is used the extra interpolator
must also be enabled in the state.
Fixes: fs-interpolateatcentroid-block
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
---
src/gallium/drivers/r600/evergreen_state.c | 6 ++++++
src/gallium/drivers/r600/r600_shader.c | 1 +
src/gallium/drivers/r600/r600_shader.h | 1 +
src/gallium/drivers/r600/sb/sb_bc_parser.cpp | 7 ++++++-
4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index cfeab815584..b8315612fdd 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -3364,6 +3364,12 @@ void evergreen_update_ps_state(struct pipe_context *ctx, struct r600_pipe_shader
spi_baryc_cntl |= spi_baryc_enable_bit[k];
have_perspective |= k < 3;
have_linear |= !(k < 3);
+ if (rshader->input[i].uses_interpolate_at_centroid) {
+ k = eg_get_interpolator_index(
+ rshader->input[i].interpolate,
+ TGSI_INTERPOLATE_LOC_CENTROID);
+ spi_baryc_cntl |= spi_baryc_enable_bit[k];
+ }
}
}
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index fc826470d69..85e584baff5 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -6973,6 +6973,7 @@ static int tgsi_interp_egcm(struct r600_shader_ctx *ctx)
}
else {
location = TGSI_INTERPOLATE_LOC_CENTROID;
+ ctx->shader->input[input].uses_interpolate_at_centroid = 1;
}
k = eg_get_interpolator_index(ctx->shader->input[input].interpolate, location);
diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h
index 3b3e667ec56..b7046b39d4c 100644
--- a/src/gallium/drivers/r600/r600_shader.h
+++ b/src/gallium/drivers/r600/r600_shader.h
@@ -54,6 +54,7 @@ struct r600_shader_io {
unsigned back_color_input;
unsigned write_mask;
int ring_offset;
+ unsigned uses_interpolate_at_centroid;
};
struct r600_shader_atomic {
diff --git a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
index 90e6df745a7..6b19d61babe 100644
--- a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
+++ b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp
@@ -171,8 +171,13 @@ int bc_parser::parse_decls() {
sh->add_input(in.gpr, preloaded, /*in.write_mask*/ 0x0F);
if (ps_interp && in.spi_sid) {
int k = eg_get_interpolator_index(in.interpolate, in.interpolate_location);
- if (k >= 0)
+ if (k >= 0) {
ij_interpolators[k] |= true;
+ if (in.uses_interpolate_at_centroid) {
+ k = eg_get_interpolator_index(in.interpolate, TGSI_INTERPOLATE_LOC_CENTROID);
+ ij_interpolators[k] |= true;
+ }
+ }
}
}
More information about the mesa-commit
mailing list