diff options
author | Marek Olšák <[email protected]> | 2015-09-28 17:21:10 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-10-03 22:06:09 +0200 |
commit | 9652bfcf2d2f3be5158ed88b49917bb5a2d8323d (patch) | |
tree | 331a3d8f4592abc15f464825efa3c7d4a018fbe9 /src/gallium/drivers/radeonsi/si_state_shaders.c | |
parent | 214de2d815360aa3986eb52a3b3060c33523f1b3 (diff) |
radeonsi: implement the simple case of force_persample_interp
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state_shaders.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 43985330f6b..aeb28797ace 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1067,6 +1067,36 @@ static void si_emit_spi_ps_input(struct si_context *sctx, struct r600_atom *atom G_0286CC_LINEAR_CENTROID_ENA(input_ena) || G_0286CC_LINE_STIPPLE_TEX_ENA(input_ena)); + if (sctx->force_persample_interp) { + unsigned num_persp = G_0286CC_PERSP_SAMPLE_ENA(input_ena) + + G_0286CC_PERSP_CENTER_ENA(input_ena) + + G_0286CC_PERSP_CENTROID_ENA(input_ena); + unsigned num_linear = G_0286CC_LINEAR_SAMPLE_ENA(input_ena) + + G_0286CC_LINEAR_CENTER_ENA(input_ena) + + G_0286CC_LINEAR_CENTROID_ENA(input_ena); + + /* If only one set of (i,j) coordinates is used, we can disable + * CENTER/CENTROID, enable SAMPLE and it will load SAMPLE coordinates + * where CENTER/CENTROID are expected, effectively forcing per-sample + * interpolation. + */ + if (num_persp == 1) { + input_ena &= C_0286CC_PERSP_CENTER_ENA; + input_ena &= C_0286CC_PERSP_CENTROID_ENA; + input_ena |= G_0286CC_PERSP_SAMPLE_ENA(1); + } + if (num_linear == 1) { + input_ena &= C_0286CC_LINEAR_CENTER_ENA; + input_ena &= C_0286CC_LINEAR_CENTROID_ENA; + input_ena |= G_0286CC_LINEAR_SAMPLE_ENA(1); + } + + /* If at least 2 sets of coordinates are used, we can't use this + * trick and have to select SAMPLE using a conditional assignment + * in the shader with "force_persample_interp" being a shader constant. + */ + } + radeon_set_context_reg_seq(cs, R_0286CC_SPI_PS_INPUT_ENA, 2); radeon_emit(cs, input_ena); radeon_emit(cs, input_ena); @@ -1543,8 +1573,11 @@ bool si_update_shaders(struct si_context *sctx) si_mark_atom_dirty(sctx, &sctx->spi_map); } - if (si_pm4_state_changed(sctx, ps)) + if (si_pm4_state_changed(sctx, ps) || + sctx->force_persample_interp != rs->force_persample_interp) { + sctx->force_persample_interp = rs->force_persample_interp; si_mark_atom_dirty(sctx, &sctx->spi_ps_input); + } if (si_pm4_state_changed(sctx, ls) || si_pm4_state_changed(sctx, hs) || |