diff options
| author | 2020-04-01 21:37:32 -0300 | |
|---|---|---|
| committer | 2020-04-01 21:48:55 -0300 | |
| commit | 2339fe199f3b08faa33b15048aa7158a2e0eff00 (patch) | |
| tree | 28e28e8c22dfb27609f1926ea538a64dd4a6463f /src/video_core/renderer_vulkan | |
| parent | Merge pull request #3591 from ReinUsesLisp/vk-wrapper-part2 (diff) | |
| download | yuzu-2339fe199f3b08faa33b15048aa7158a2e0eff00.tar.gz yuzu-2339fe199f3b08faa33b15048aa7158a2e0eff00.tar.xz yuzu-2339fe199f3b08faa33b15048aa7158a2e0eff00.zip | |
shader_decompiler: Remove FragCoord.w hack and change IPA implementation
Credits go to gdkchan and Ryujinx. The pull request used for this can
be found here: https://github.com/Ryujinx/Ryujinx/pull/1082
yuzu was already using the header for interpolation, but it was missing
the FragCoord.w multiplication described in the linked pull request.
This commit finally removes the FragCoord.w == 1.0f hack from the shader
decompiler.
While we are at it, this commit renames some enumerations to match
Nvidia's documentation (linked below) and fixes component declaration
order in the shader program header (z and w were swapped).
https://github.com/NVIDIA/open-gpu-doc/blob/master/Shader-Program-Header/Shader-Program-Header.html
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index d67f08cf9..b9f9e2714 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |||
| @@ -35,7 +35,7 @@ namespace { | |||
| 35 | using Sirit::Id; | 35 | using Sirit::Id; |
| 36 | using Tegra::Engines::ShaderType; | 36 | using Tegra::Engines::ShaderType; |
| 37 | using Tegra::Shader::Attribute; | 37 | using Tegra::Shader::Attribute; |
| 38 | using Tegra::Shader::AttributeUse; | 38 | using Tegra::Shader::PixelImap; |
| 39 | using Tegra::Shader::Register; | 39 | using Tegra::Shader::Register; |
| 40 | using namespace VideoCommon::Shader; | 40 | using namespace VideoCommon::Shader; |
| 41 | 41 | ||
| @@ -752,16 +752,16 @@ private: | |||
| 752 | if (stage != ShaderType::Fragment) { | 752 | if (stage != ShaderType::Fragment) { |
| 753 | continue; | 753 | continue; |
| 754 | } | 754 | } |
| 755 | switch (header.ps.GetAttributeUse(location)) { | 755 | switch (header.ps.GetPixelImap(location)) { |
| 756 | case AttributeUse::Constant: | 756 | case PixelImap::Constant: |
| 757 | Decorate(id, spv::Decoration::Flat); | 757 | Decorate(id, spv::Decoration::Flat); |
| 758 | break; | 758 | break; |
| 759 | case AttributeUse::ScreenLinear: | 759 | case PixelImap::Perspective: |
| 760 | Decorate(id, spv::Decoration::NoPerspective); | ||
| 761 | break; | ||
| 762 | case AttributeUse::Perspective: | ||
| 763 | // Default | 760 | // Default |
| 764 | break; | 761 | break; |
| 762 | case PixelImap::ScreenLinear: | ||
| 763 | Decorate(id, spv::Decoration::NoPerspective); | ||
| 764 | break; | ||
| 765 | default: | 765 | default: |
| 766 | UNREACHABLE_MSG("Unused attribute being fetched"); | 766 | UNREACHABLE_MSG("Unused attribute being fetched"); |
| 767 | } | 767 | } |
| @@ -1145,9 +1145,6 @@ private: | |||
| 1145 | switch (attribute) { | 1145 | switch (attribute) { |
| 1146 | case Attribute::Index::Position: { | 1146 | case Attribute::Index::Position: { |
| 1147 | if (stage == ShaderType::Fragment) { | 1147 | if (stage == ShaderType::Fragment) { |
| 1148 | if (element == 3) { | ||
| 1149 | return {Constant(t_float, 1.0f), Type::Float}; | ||
| 1150 | } | ||
| 1151 | return {OpLoad(t_float, AccessElement(t_in_float, frag_coord, element)), | 1148 | return {OpLoad(t_float, AccessElement(t_in_float, frag_coord, element)), |
| 1152 | Type::Float}; | 1149 | Type::Float}; |
| 1153 | } | 1150 | } |