diff options
| author | 2018-12-16 09:34:24 -0800 | |
|---|---|---|
| committer | 2018-12-17 07:53:48 -0800 | |
| commit | a6daed74f58a37bfddd32bc1e0503013cd32df13 (patch) | |
| tree | 587be4617c3b8a96ae2cc4590368c8043c13b0eb /src | |
| parent | Merge pull request #1905 from bunnei/ignore-empty-gpu-lists (diff) | |
| download | yuzu-a6daed74f58a37bfddd32bc1e0503013cd32df13.tar.gz yuzu-a6daed74f58a37bfddd32bc1e0503013cd32df13.tar.xz yuzu-a6daed74f58a37bfddd32bc1e0503013cd32df13.zip | |
Fix arrayed shadow sampler array slice/depth comparison ordering, as well as invalid GLSL LOD selection.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index a5cfa0070..708c7b4e9 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -1591,23 +1591,21 @@ private: | |||
| 1591 | process_mode == Tegra::Shader::TextureProcessMode::LL || | 1591 | process_mode == Tegra::Shader::TextureProcessMode::LL || |
| 1592 | process_mode == Tegra::Shader::TextureProcessMode::LLA; | 1592 | process_mode == Tegra::Shader::TextureProcessMode::LLA; |
| 1593 | 1593 | ||
| 1594 | // LOD selection (either via bias or explicit textureLod) not supported in GL for | ||
| 1595 | // sampler2DArrayShadow and samplerCubeArrayShadow. | ||
| 1594 | const bool gl_lod_supported = !( | 1596 | const bool gl_lod_supported = !( |
| 1595 | (texture_type == Tegra::Shader::TextureType::Texture2D && is_array && depth_compare) || | 1597 | (texture_type == Tegra::Shader::TextureType::Texture2D && is_array && depth_compare) || |
| 1596 | (texture_type == Tegra::Shader::TextureType::TextureCube && !is_array && | 1598 | (texture_type == Tegra::Shader::TextureType::TextureCube && is_array && depth_compare)); |
| 1597 | depth_compare)); | ||
| 1598 | 1599 | ||
| 1599 | const std::string read_method = lod_needed && gl_lod_supported ? "textureLod(" : "texture("; | 1600 | const std::string read_method = lod_needed && gl_lod_supported ? "textureLod(" : "texture("; |
| 1600 | std::string texture = read_method + sampler + ", coord"; | 1601 | std::string texture = read_method + sampler + ", coord"; |
| 1601 | 1602 | ||
| 1602 | if (process_mode != Tegra::Shader::TextureProcessMode::None) { | 1603 | UNIMPLEMENTED_IF(process_mode != Tegra::Shader::TextureProcessMode::None && |
| 1604 | !gl_lod_supported); | ||
| 1605 | |||
| 1606 | if (process_mode != Tegra::Shader::TextureProcessMode::None && gl_lod_supported) { | ||
| 1603 | if (process_mode == Tegra::Shader::TextureProcessMode::LZ) { | 1607 | if (process_mode == Tegra::Shader::TextureProcessMode::LZ) { |
| 1604 | if (gl_lod_supported) { | 1608 | texture += ", 0.0"; |
| 1605 | texture += ", 0"; | ||
| 1606 | } else { | ||
| 1607 | // Lod 0 is emulated by a big negative bias | ||
| 1608 | // in scenarios that are not supported by glsl | ||
| 1609 | texture += ", -1000"; | ||
| 1610 | } | ||
| 1611 | } else { | 1609 | } else { |
| 1612 | // If present, lod or bias are always stored in the register indexed by the | 1610 | // If present, lod or bias are always stored in the register indexed by the |
| 1613 | // gpr20 | 1611 | // gpr20 |
| @@ -1645,15 +1643,15 @@ private: | |||
| 1645 | if (depth_compare && !is_array && texture_type == Tegra::Shader::TextureType::Texture1D) { | 1643 | if (depth_compare && !is_array && texture_type == Tegra::Shader::TextureType::Texture1D) { |
| 1646 | coord += ",0.0"; | 1644 | coord += ",0.0"; |
| 1647 | } | 1645 | } |
| 1646 | if (is_array) { | ||
| 1647 | coord += ',' + regs.GetRegisterAsInteger(array_register); | ||
| 1648 | } | ||
| 1648 | if (depth_compare) { | 1649 | if (depth_compare) { |
| 1649 | // Depth is always stored in the register signaled by gpr20 | 1650 | // Depth is always stored in the register signaled by gpr20 |
| 1650 | // or in the next register if lod or bias are used | 1651 | // or in the next register if lod or bias are used |
| 1651 | const u64 depth_register = instr.gpr20.Value() + (lod_bias_enabled ? 1 : 0); | 1652 | const u64 depth_register = instr.gpr20.Value() + (lod_bias_enabled ? 1 : 0); |
| 1652 | coord += ',' + regs.GetRegisterAsFloat(depth_register); | 1653 | coord += ',' + regs.GetRegisterAsFloat(depth_register); |
| 1653 | } | 1654 | } |
| 1654 | if (is_array) { | ||
| 1655 | coord += ',' + regs.GetRegisterAsInteger(array_register); | ||
| 1656 | } | ||
| 1657 | coord += ");"; | 1655 | coord += ");"; |
| 1658 | return std::make_pair( | 1656 | return std::make_pair( |
| 1659 | coord, GetTextureCode(instr, texture_type, process_mode, depth_compare, is_array, 0)); | 1657 | coord, GetTextureCode(instr, texture_type, process_mode, depth_compare, is_array, 0)); |
| @@ -1686,15 +1684,15 @@ private: | |||
| 1686 | } | 1684 | } |
| 1687 | } | 1685 | } |
| 1688 | 1686 | ||
| 1687 | if (is_array) { | ||
| 1688 | coord += ',' + regs.GetRegisterAsInteger(array_register); | ||
| 1689 | } | ||
| 1689 | if (depth_compare) { | 1690 | if (depth_compare) { |
| 1690 | // Depth is always stored in the register signaled by gpr20 | 1691 | // Depth is always stored in the register signaled by gpr20 |
| 1691 | // or in the next register if lod or bias are used | 1692 | // or in the next register if lod or bias are used |
| 1692 | const u64 depth_register = instr.gpr20.Value() + (lod_bias_enabled ? 1 : 0); | 1693 | const u64 depth_register = instr.gpr20.Value() + (lod_bias_enabled ? 1 : 0); |
| 1693 | coord += ',' + regs.GetRegisterAsFloat(depth_register); | 1694 | coord += ',' + regs.GetRegisterAsFloat(depth_register); |
| 1694 | } | 1695 | } |
| 1695 | if (is_array) { | ||
| 1696 | coord += ',' + regs.GetRegisterAsInteger(array_register); | ||
| 1697 | } | ||
| 1698 | coord += ");"; | 1696 | coord += ");"; |
| 1699 | 1697 | ||
| 1700 | return std::make_pair(coord, | 1698 | return std::make_pair(coord, |