zink: lower dmod on AMD hardware
this hardware won't return the correct value from dmod instructions,
so lower it to ensure that cts passes
nobody else will ever hit this, so perf isn't an issue and regular fmod
can be left alone
fixes (amd):
KHR-GL46.gpu_shader_fp64.builtin.mod_d*
Fixes: 5fae35fb17
('zink: fix 64bit float shader ops ')
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15306>
This commit is contained in:

committed by
Marge Bot

parent
1845957a31
commit
c24bca2d3a
@@ -353,6 +353,21 @@ zink_screen_init_compiler(struct zink_screen *screen)
|
||||
screen->nir_options.lower_flrp64 = true;
|
||||
screen->nir_options.lower_ffma64 = true;
|
||||
}
|
||||
|
||||
/*
|
||||
The OpFRem and OpFMod instructions use cheap approximations of remainder,
|
||||
and the error can be large due to the discontinuity in trunc() and floor().
|
||||
This can produce mathematically unexpected results in some cases, such as
|
||||
FMod(x,x) computing x rather than 0, and can also cause the result to have
|
||||
a different sign than the infinitely precise result.
|
||||
|
||||
-Table 84. Precision of core SPIR-V Instructions
|
||||
* for drivers that are known to have imprecise fmod for doubles, lower dmod
|
||||
*/
|
||||
if (screen->info.driver_props.driverID == VK_DRIVER_ID_MESA_RADV ||
|
||||
screen->info.driver_props.driverID == VK_DRIVER_ID_AMD_OPEN_SOURCE ||
|
||||
screen->info.driver_props.driverID == VK_DRIVER_ID_AMD_PROPRIETARY)
|
||||
screen->nir_options.lower_doubles_options = nir_lower_dmod;
|
||||
}
|
||||
|
||||
const void *
|
||||
|
Reference in New Issue
Block a user