diff options
| author | 2023-04-05 01:29:46 +0200 | |
|---|---|---|
| committer | 2023-04-08 16:12:30 +0200 | |
| commit | 780240e6979b198e7bd10feaad5399b8b4b63762 (patch) | |
| tree | c145f48c66cf003e618cefc63496e3f5b7637f56 /src/shader_recompiler/profile.h | |
| parent | Merge pull request #10024 from german77/crysis (diff) | |
| download | yuzu-780240e6979b198e7bd10feaad5399b8b4b63762.tar.gz yuzu-780240e6979b198e7bd10feaad5399b8b4b63762.tar.xz yuzu-780240e6979b198e7bd10feaad5399b8b4b63762.zip | |
shader_recompiler: Add subpixel offset for correct rounding at `ImageGather`
On AMD a subpixel offset of 1/512 of the texel size is applied to the texture coordinates at a ImageGather call to ensure the rounding at the texel centers is done the same way as in Maxwell or other Nvidia architectures.
See https://www.reedbeta.com/blog/texture-gathers-and-coordinate-precision/ for more details why this might be necessary.
This should fix shadow artifacts at object edges in Zelda: Breath of the Wild (#9957, #6956).
Diffstat (limited to '')
| -rw-r--r-- | src/shader_recompiler/profile.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/shader_recompiler/profile.h b/src/shader_recompiler/profile.h index 253e0d0bd..31390e869 100644 --- a/src/shader_recompiler/profile.h +++ b/src/shader_recompiler/profile.h | |||
| @@ -52,6 +52,10 @@ struct Profile { | |||
| 52 | bool need_declared_frag_colors{}; | 52 | bool need_declared_frag_colors{}; |
| 53 | /// Prevents fast math optimizations that may cause inaccuracies | 53 | /// Prevents fast math optimizations that may cause inaccuracies |
| 54 | bool need_fastmath_off{}; | 54 | bool need_fastmath_off{}; |
| 55 | /// Some GPU vendors use a lower fixed point format of 16.8 when calculating pixel coordinates | ||
| 56 | /// in the ImageGather instruction than the Maxwell architecture does. Applying an offset does | ||
| 57 | /// fix this mismatching rounding behaviour. | ||
| 58 | bool need_gather_subpixel_offset{}; | ||
| 55 | 59 | ||
| 56 | /// OpFClamp is broken and OpFMax + OpFMin should be used instead | 60 | /// OpFClamp is broken and OpFMax + OpFMin should be used instead |
| 57 | bool has_broken_spirv_clamp{}; | 61 | bool has_broken_spirv_clamp{}; |