[Mesa-dev] [PATCH 6/8] radeonsi: interpolate varyings at sample when full sample shading is enabled
Marek Olšák
maraeo at gmail.com
Wed May 7 07:00:34 PDT 2014
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/drivers/radeonsi/si_shader.c | 24 ++++++++++++------------
src/gallium/drivers/radeonsi/si_shader.h | 1 +
src/gallium/drivers/radeonsi/si_state.c | 2 ++
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index d8b7b9c..5bd3057 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -423,27 +423,27 @@ static void declare_input_fs(
shader->input[input_index].param_offset);
switch (decl->Interp.Interpolate) {
- case TGSI_INTERPOLATE_COLOR:
- if (si_shader_ctx->shader->key.ps.flatshade) {
- interp_param = 0;
- } else {
- if (decl->Interp.Centroid)
- interp_param = LLVMGetParam(main_fn, SI_PARAM_PERSP_CENTROID);
- else
- interp_param = LLVMGetParam(main_fn, SI_PARAM_PERSP_CENTER);
- }
- break;
case TGSI_INTERPOLATE_CONSTANT:
interp_param = 0;
break;
case TGSI_INTERPOLATE_LINEAR:
- if (decl->Interp.Centroid)
+ if (si_shader_ctx->shader->key.ps.interp_at_sample)
+ interp_param = LLVMGetParam(main_fn, SI_PARAM_LINEAR_SAMPLE);
+ else if (decl->Interp.Centroid)
interp_param = LLVMGetParam(main_fn, SI_PARAM_LINEAR_CENTROID);
else
interp_param = LLVMGetParam(main_fn, SI_PARAM_LINEAR_CENTER);
break;
+ case TGSI_INTERPOLATE_COLOR:
+ if (si_shader_ctx->shader->key.ps.flatshade) {
+ interp_param = 0;
+ break;
+ }
+ /* fall through to perspective */
case TGSI_INTERPOLATE_PERSPECTIVE:
- if (decl->Interp.Centroid)
+ if (si_shader_ctx->shader->key.ps.interp_at_sample)
+ interp_param = LLVMGetParam(main_fn, SI_PARAM_PERSP_SAMPLE);
+ else if (decl->Interp.Centroid)
interp_param = LLVMGetParam(main_fn, SI_PARAM_PERSP_CENTROID);
else
interp_param = LLVMGetParam(main_fn, SI_PARAM_PERSP_CENTER);
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index 82382ec..14b5187 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -160,6 +160,7 @@ union si_shader_key {
unsigned color_two_side:1;
unsigned alpha_func:3;
unsigned flatshade:1;
+ unsigned interp_at_sample:1;
unsigned alpha_to_one:1;
} ps;
struct {
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 3c1af06..09bf947 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2115,6 +2115,8 @@ static INLINE void si_shader_selector_key(struct pipe_context *ctx,
if (sctx->queued.named.rasterizer) {
key->ps.color_two_side = sctx->queued.named.rasterizer->two_side;
key->ps.flatshade = sctx->queued.named.rasterizer->flatshade;
+ key->ps.interp_at_sample = sctx->framebuffer.nr_samples > 1 &&
+ sctx->ps_iter_samples == sctx->framebuffer.nr_samples;
if (sctx->queued.named.blend) {
key->ps.alpha_to_one = sctx->queued.named.blend->alpha_to_one &&
--
1.9.1
More information about the mesa-dev
mailing list