aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2020-06-23 18:29:22 +0200
committerMarge Bot <[email protected]>2020-06-25 12:09:08 +0000
commitc84f11e7b67cfa3c01780210ca31665b658e5ebd (patch)
treeb7ba850882592d199b8625f4df1857ae7e32fdf2 /src/amd/vulkan
parent82b46667836647226387442b2feb9d7f1475bd36 (diff)
radv: lower 64-bit drcp/dsqrt/drsq for fixing precision issues
The hardware precision of v_rcp_f64, v_sqrt_f64 and v_rsq_f64 is less than what Vulkan requires. This lowers using the Goldschmidt's algorithm to improve precision. Fixes dEQP-VK.glsl.builtin.precision_double.* on both compiler backends. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Daniel Schürmann <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5609>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r--src/amd/vulkan/radv_shader.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 78227890b46..a53100fd48b 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -86,6 +86,10 @@ static const struct nir_shader_compiler_options nir_options_llvm = {
nir_lower_divmod64 |
nir_lower_minmax64 |
nir_lower_iabs64,
+ .lower_doubles_options = nir_lower_drcp |
+ nir_lower_dsqrt |
+ nir_lower_drsq |
+ nir_lower_ddiv,
};
static const struct nir_shader_compiler_options nir_options_aco = {
@@ -122,6 +126,10 @@ static const struct nir_shader_compiler_options nir_options_aco = {
nir_lower_divmod64 |
nir_lower_minmax64 |
nir_lower_iabs64,
+ .lower_doubles_options = nir_lower_drcp |
+ nir_lower_dsqrt |
+ nir_lower_drsq |
+ nir_lower_ddiv,
};
bool
@@ -466,6 +474,11 @@ radv_shader_compile_to_nir(struct radv_device *device,
NIR_PASS_V(nir, radv_nir_lower_ycbcr_textures, layout);
if (device->instance->debug_flags & RADV_DEBUG_DISCARD_TO_DEMOTE)
NIR_PASS_V(nir, nir_lower_discard_to_demote);
+
+ nir_lower_doubles_options lower_doubles =
+ nir->options->lower_doubles_options;
+
+ NIR_PASS_V(nir, nir_lower_doubles, NULL, lower_doubles);
}
/* Vulkan uses the separate-shader linking model */