aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-04-01 21:37:32 -0300
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-04-01 21:48:55 -0300
commit2339fe199f3b08faa33b15048aa7158a2e0eff00 (patch)
tree28e28e8c22dfb27609f1926ea538a64dd4a6463f /src/video_core/renderer_vulkan
parentbaf91c920c7df131c9099721bad960556e74d86d (diff)
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.cpp17
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 {
using Sirit::Id;
using Tegra::Engines::ShaderType;
using Tegra::Shader::Attribute;
-using Tegra::Shader::AttributeUse;
+using Tegra::Shader::PixelImap;
using Tegra::Shader::Register;
using namespace VideoCommon::Shader;
@@ -752,16 +752,16 @@ private:
if (stage != ShaderType::Fragment) {
continue;
}
- switch (header.ps.GetAttributeUse(location)) {
- case AttributeUse::Constant:
+ switch (header.ps.GetPixelImap(location)) {
+ case PixelImap::Constant:
Decorate(id, spv::Decoration::Flat);
break;
- case AttributeUse::ScreenLinear:
- Decorate(id, spv::Decoration::NoPerspective);
- break;
- case AttributeUse::Perspective:
+ case PixelImap::Perspective:
// Default
break;
+ case PixelImap::ScreenLinear:
+ Decorate(id, spv::Decoration::NoPerspective);
+ break;
default:
UNREACHABLE_MSG("Unused attribute being fetched");
}
@@ -1145,9 +1145,6 @@ private:
switch (attribute) {
case Attribute::Index::Position: {
if (stage == ShaderType::Fragment) {
- if (element == 3) {
- return {Constant(t_float, 1.0f), Type::Float};
- }
return {OpLoad(t_float, AccessElement(t_in_float, frag_coord, element)),
Type::Float};
}