summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-12-11 16:10:12 -0400
committerGravatar FernandoS272019-12-11 19:53:16 -0400
commit84a158c977c5c87880fac13ad48648e1bda3e079 (patch)
tree4c95f5decb0169a9746ecec374e4c18a0f7ff0a2 /src
parentShader_Ir: default failed tracks on bindless samplers to null values. (diff)
downloadyuzu-84a158c977c5c87880fac13ad48648e1bda3e079.tar.gz
yuzu-84a158c977c5c87880fac13ad48648e1bda3e079.tar.xz
yuzu-84a158c977c5c87880fac13ad48648e1bda3e079.zip
Gl_Shader_compiler: Correct Depth Compare for Texture Gather operations.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index fa7049bbe..45c2d464f 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -1076,7 +1076,7 @@ private:
1076 } 1076 }
1077 1077
1078 std::string GenerateTexture(Operation operation, const std::string& function_suffix, 1078 std::string GenerateTexture(Operation operation, const std::string& function_suffix,
1079 const std::vector<TextureIR>& extras) { 1079 const std::vector<TextureIR>& extras, bool sepparate_dc = false) {
1080 constexpr std::array coord_constructors = {"float", "vec2", "vec3", "vec4"}; 1080 constexpr std::array coord_constructors = {"float", "vec2", "vec3", "vec4"};
1081 1081
1082 const auto meta = std::get_if<MetaTexture>(&operation.GetMeta()); 1082 const auto meta = std::get_if<MetaTexture>(&operation.GetMeta());
@@ -1091,7 +1091,7 @@ private:
1091 expr += "Offset"; 1091 expr += "Offset";
1092 } 1092 }
1093 expr += '(' + GetSampler(meta->sampler) + ", "; 1093 expr += '(' + GetSampler(meta->sampler) + ", ";
1094 expr += coord_constructors.at(count + (has_array ? 1 : 0) + (has_shadow ? 1 : 0) - 1); 1094 expr += coord_constructors.at(count + (has_array ? 1 : 0) + (has_shadow && !sepparate_dc ? 1 : 0) - 1);
1095 expr += '('; 1095 expr += '(';
1096 for (std::size_t i = 0; i < count; ++i) { 1096 for (std::size_t i = 0; i < count; ++i) {
1097 expr += Visit(operation[i]).AsFloat(); 1097 expr += Visit(operation[i]).AsFloat();
@@ -1104,9 +1104,14 @@ private:
1104 expr += ", float(" + Visit(meta->array).AsInt() + ')'; 1104 expr += ", float(" + Visit(meta->array).AsInt() + ')';
1105 } 1105 }
1106 if (has_shadow) { 1106 if (has_shadow) {
1107 expr += ", " + Visit(meta->depth_compare).AsFloat(); 1107 if (sepparate_dc) {
1108 expr += "), " + Visit(meta->depth_compare).AsFloat();
1109 } else {
1110 expr += ", " + Visit(meta->depth_compare).AsFloat() + ')';
1111 }
1112 } else {
1113 expr += ')';
1108 } 1114 }
1109 expr += ')';
1110 1115
1111 for (const auto& variant : extras) { 1116 for (const auto& variant : extras) {
1112 if (const auto argument = std::get_if<TextureArgument>(&variant)) { 1117 if (const auto argument = std::get_if<TextureArgument>(&variant)) {
@@ -1706,10 +1711,18 @@ private:
1706 ASSERT(meta); 1711 ASSERT(meta);
1707 1712
1708 const auto type = meta->sampler.IsShadow() ? Type::Float : Type::Int; 1713 const auto type = meta->sampler.IsShadow() ? Type::Float : Type::Int;
1709 return {GenerateTexture(operation, "Gather", 1714 if (meta->sampler.IsShadow()) {
1710 {TextureAoffi{}, TextureArgument{type, meta->component}}) + 1715 return {GenerateTexture(operation, "Gather",
1711 GetSwizzle(meta->element), 1716 {TextureAoffi{}}, true) +
1712 Type::Float}; 1717 GetSwizzle(meta->element),
1718 Type::Float};
1719 } else {
1720 return {GenerateTexture(operation, "Gather",
1721 {TextureAoffi{}, TextureArgument{type, meta->component}},
1722 true) +
1723 GetSwizzle(meta->element),
1724 Type::Float};
1725 }
1713 } 1726 }
1714 1727
1715 Expression TextureQueryDimensions(Operation operation) { 1728 Expression TextureQueryDimensions(Operation operation) {