diff options
| author | 2019-12-11 19:43:43 -0400 | |
|---|---|---|
| committer | 2019-12-11 19:53:17 -0400 | |
| commit | c0ee0aa1a8266b0f5c5568cf1af3cb6247156720 (patch) | |
| tree | 05f7f369b89ae7793f539350104081aacfbd2f8e /src | |
| parent | Shader_Ir: Correct TLD4S encoding and implement f16 flag. (diff) | |
| download | yuzu-c0ee0aa1a8266b0f5c5568cf1af3cb6247156720.tar.gz yuzu-c0ee0aa1a8266b0f5c5568cf1af3cb6247156720.tar.xz yuzu-c0ee0aa1a8266b0f5c5568cf1af3cb6247156720.zip | |
Shader_IR: Correct TLD4S Depth Compare.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/shader/decode/texture.cpp | 17 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 45c2d464f..d1ae4be6d 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -1091,7 +1091,8 @@ 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 && !sepparate_dc ? 1 : 0) - 1); | 1094 | expr += coord_constructors.at(count + (has_array ? 1 : 0) + |
| 1095 | (has_shadow && !sepparate_dc ? 1 : 0) - 1); | ||
| 1095 | expr += '('; | 1096 | expr += '('; |
| 1096 | for (std::size_t i = 0; i < count; ++i) { | 1097 | for (std::size_t i = 0; i < count; ++i) { |
| 1097 | expr += Visit(operation[i]).AsFloat(); | 1098 | expr += Visit(operation[i]).AsFloat(); |
| @@ -1712,14 +1713,13 @@ private: | |||
| 1712 | 1713 | ||
| 1713 | const auto type = meta->sampler.IsShadow() ? Type::Float : Type::Int; | 1714 | const auto type = meta->sampler.IsShadow() ? Type::Float : Type::Int; |
| 1714 | if (meta->sampler.IsShadow()) { | 1715 | if (meta->sampler.IsShadow()) { |
| 1715 | return {GenerateTexture(operation, "Gather", | 1716 | return {GenerateTexture(operation, "Gather", {TextureAoffi{}}, true) + |
| 1716 | {TextureAoffi{}}, true) + | ||
| 1717 | GetSwizzle(meta->element), | 1717 | GetSwizzle(meta->element), |
| 1718 | Type::Float}; | 1718 | Type::Float}; |
| 1719 | } else { | 1719 | } else { |
| 1720 | return {GenerateTexture(operation, "Gather", | 1720 | return {GenerateTexture(operation, "Gather", |
| 1721 | {TextureAoffi{}, TextureArgument{type, meta->component}}, | 1721 | {TextureAoffi{}, TextureArgument{type, meta->component}}, |
| 1722 | true) + | 1722 | false) + |
| 1723 | GetSwizzle(meta->element), | 1723 | GetSwizzle(meta->element), |
| 1724 | Type::Float}; | 1724 | Type::Float}; |
| 1725 | } | 1725 | } |
diff --git a/src/video_core/shader/decode/texture.cpp b/src/video_core/shader/decode/texture.cpp index 9aef5ddd5..994c05611 100644 --- a/src/video_core/shader/decode/texture.cpp +++ b/src/video_core/shader/decode/texture.cpp | |||
| @@ -107,8 +107,8 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { | |||
| 107 | break; | 107 | break; |
| 108 | } | 108 | } |
| 109 | case OpCode::Id::TLD4S: { | 109 | case OpCode::Id::TLD4S: { |
| 110 | UNIMPLEMENTED_IF_MSG(instr.tld4s.UsesMiscMode(TextureMiscMode::AOFFI), | 110 | const bool uses_aoffi = instr.tld4s.UsesMiscMode(TextureMiscMode::AOFFI); |
| 111 | "AOFFI is not implemented"); | 111 | UNIMPLEMENTED_IF_MSG(uses_aoffi, "AOFFI is not implemented"); |
| 112 | 112 | ||
| 113 | const bool depth_compare = instr.tld4s.UsesMiscMode(TextureMiscMode::DC); | 113 | const bool depth_compare = instr.tld4s.UsesMiscMode(TextureMiscMode::DC); |
| 114 | const Node op_a = GetRegister(instr.gpr8); | 114 | const Node op_a = GetRegister(instr.gpr8); |
| @@ -116,15 +116,22 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { | |||
| 116 | 116 | ||
| 117 | // TODO(Subv): Figure out how the sampler type is encoded in the TLD4S instruction. | 117 | // TODO(Subv): Figure out how the sampler type is encoded in the TLD4S instruction. |
| 118 | std::vector<Node> coords; | 118 | std::vector<Node> coords; |
| 119 | Node dc_reg; | ||
| 119 | if (depth_compare) { | 120 | if (depth_compare) { |
| 120 | // Note: TLD4S coordinate encoding works just like TEXS's | 121 | // Note: TLD4S coordinate encoding works just like TEXS's |
| 121 | const Node op_y = GetRegister(instr.gpr8.Value() + 1); | 122 | const Node op_y = GetRegister(instr.gpr8.Value() + 1); |
| 122 | coords.push_back(op_a); | 123 | coords.push_back(op_a); |
| 123 | coords.push_back(op_y); | 124 | coords.push_back(op_y); |
| 124 | coords.push_back(op_b); | 125 | dc_reg = uses_aoffi ? GetRegister(instr.gpr20.Value() + 1) : op_b; |
| 125 | } else { | 126 | } else { |
| 126 | coords.push_back(op_a); | 127 | coords.push_back(op_a); |
| 127 | coords.push_back(op_b); | 128 | if (uses_aoffi) { |
| 129 | const Node op_y = GetRegister(instr.gpr8.Value() + 1); | ||
| 130 | coords.push_back(op_y); | ||
| 131 | } else { | ||
| 132 | coords.push_back(op_b); | ||
| 133 | } | ||
| 134 | dc_reg = {}; | ||
| 128 | } | 135 | } |
| 129 | const Node component = Immediate(static_cast<u32>(instr.tld4s.component)); | 136 | const Node component = Immediate(static_cast<u32>(instr.tld4s.component)); |
| 130 | 137 | ||
| @@ -134,7 +141,7 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) { | |||
| 134 | Node4 values; | 141 | Node4 values; |
| 135 | for (u32 element = 0; element < values.size(); ++element) { | 142 | for (u32 element = 0; element < values.size(); ++element) { |
| 136 | auto coords_copy = coords; | 143 | auto coords_copy = coords; |
| 137 | MetaTexture meta{sampler, {}, {}, {}, {}, {}, {}, component, element}; | 144 | MetaTexture meta{sampler, {}, dc_reg, {}, {}, {}, {}, component, element}; |
| 138 | values[element] = Operation(OperationCode::TextureGather, meta, std::move(coords_copy)); | 145 | values[element] = Operation(OperationCode::TextureGather, meta, std::move(coords_copy)); |
| 139 | } | 146 | } |
| 140 | 147 | ||