From 36c84bcd7709d760fe30151d2c78a8d3c300978a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 31 Jul 2017 21:12:07 -0600 Subject: [PATCH] svga: add support for interpolation at sample position Vs. sampling at the centroid or the fragment center. Note that this does not fix failures with the Piglit arb_sample_shading-interpolate-at-sample-position or arb_sample_shading-ignore-centroid-qualifier.exe tests at this time. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c index 1b6e9cf..fa27edc 100644 --- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c +++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c @@ -1958,13 +1958,25 @@ translate_interpolation(const struct svga_shader_emitter_v10 *emit, case TGSI_INTERPOLATE_CONSTANT: return VGPU10_INTERPOLATION_CONSTANT; case TGSI_INTERPOLATE_LINEAR: - return interpolate_loc == TGSI_INTERPOLATE_LOC_CENTROID ? - VGPU10_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID : - VGPU10_INTERPOLATION_LINEAR_NOPERSPECTIVE; + if (interpolate_loc == TGSI_INTERPOLATE_LOC_CENTROID) { + return VGPU10_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID; + } else if (interpolate_loc == TGSI_INTERPOLATE_LOC_SAMPLE && + emit->version >= 41) { + return VGPU10_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE; + } else { + return VGPU10_INTERPOLATION_LINEAR_NOPERSPECTIVE; + } + break; case TGSI_INTERPOLATE_PERSPECTIVE: - return interpolate_loc == TGSI_INTERPOLATE_LOC_CENTROID ? - VGPU10_INTERPOLATION_LINEAR_CENTROID : - VGPU10_INTERPOLATION_LINEAR; + if (interpolate_loc == TGSI_INTERPOLATE_LOC_CENTROID) { + return VGPU10_INTERPOLATION_LINEAR_CENTROID; + } else if (interpolate_loc == TGSI_INTERPOLATE_LOC_SAMPLE && + emit->version >= 41) { + return VGPU10_INTERPOLATION_LINEAR_SAMPLE; + } else { + return VGPU10_INTERPOLATION_LINEAR; + } + break; default: assert(!"Unexpected interpolation mode"); return VGPU10_INTERPOLATION_CONSTANT; @@ -2192,7 +2204,9 @@ emit_input_declaration(struct svga_shader_emitter_v10 *emit, interpMode == VGPU10_INTERPOLATION_LINEAR || interpMode == VGPU10_INTERPOLATION_LINEAR_CENTROID || interpMode == VGPU10_INTERPOLATION_LINEAR_NOPERSPECTIVE || - interpMode == VGPU10_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID); + interpMode == VGPU10_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID || + interpMode == VGPU10_INTERPOLATION_LINEAR_SAMPLE || + interpMode == VGPU10_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE); check_register_index(emit, opcodeType, index); -- 2.7.4