diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2021-03-10 16:19:59 +0100 |
---|---|---|
committer | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2021-03-22 12:35:35 +0100 |
commit | abc64caef9f131638afe3ef18601905b19bd943c (patch) | |
tree | f76dde96a34f5a371cf94997565166233f6c54dd /src/amd | |
parent | b2c1ed262d98d636d1712ca6ed2e9e797419f409 (diff) |
radv: gather if the FS uses perspective or linear interpolations
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9515>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/vulkan/radv_shader.h | 1 | ||||
-rw-r--r-- | src/amd/vulkan/radv_shader_info.c | 22 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 77ee992d4ef..70b6da71cbf 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -321,6 +321,7 @@ struct radv_shader_info { bool post_depth_coverage; bool reads_sample_mask_in; uint8_t depth_layout; + bool uses_persp_or_linear_interp; } ps; struct { bool uses_grid_size; diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index eb3201e14d3..12b594eaf54 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -132,8 +132,28 @@ gather_intrinsic_info(const nir_shader *nir, const nir_intrinsic_instr *instr, struct radv_shader_info *info) { switch (instr->intrinsic) { + case nir_intrinsic_load_barycentric_sample: + case nir_intrinsic_load_barycentric_pixel: + case nir_intrinsic_load_barycentric_centroid: { + enum glsl_interp_mode mode = nir_intrinsic_interp_mode(instr); + switch (mode) { + case INTERP_MODE_NONE: + case INTERP_MODE_SMOOTH: + case INTERP_MODE_NOPERSPECTIVE: + info->ps.uses_persp_or_linear_interp = true; + break; + default: + break; + } + break; + } + case nir_intrinsic_load_barycentric_at_offset: case nir_intrinsic_load_barycentric_at_sample: - info->ps.needs_sample_positions = true; + if (nir_intrinsic_interp_mode(instr) != INTERP_MODE_FLAT) + info->ps.uses_persp_or_linear_interp = true; + + if (instr->intrinsic == nir_intrinsic_load_barycentric_at_sample) + info->ps.needs_sample_positions = true; break; case nir_intrinsic_load_draw_id: info->vs.needs_draw_id = true; |