summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-05-03 02:45:53 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-05-03 02:46:37 +0200
commitd4df803b2b6bab96321ca69651e4132545b433eb (patch)
tree7dea03e4bb3ac0a730076c814fbe7a8e6b2372f9
parentgl_shader_decompiler: Skip physical unused attributes (diff)
downloadyuzu-d4df803b2b6bab96321ca69651e4132545b433eb.tar
yuzu-d4df803b2b6bab96321ca69651e4132545b433eb.tar.gz
yuzu-d4df803b2b6bab96321ca69651e4132545b433eb.tar.bz2
yuzu-d4df803b2b6bab96321ca69651e4132545b433eb.tar.lz
yuzu-d4df803b2b6bab96321ca69651e4132545b433eb.tar.xz
yuzu-d4df803b2b6bab96321ca69651e4132545b433eb.tar.zst
yuzu-d4df803b2b6bab96321ca69651e4132545b433eb.zip
-rw-r--r--src/video_core/engines/shader_bytecode.h1
-rw-r--r--src/video_core/shader/decode/other.cpp13
2 files changed, 9 insertions, 5 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index e4a9471b8..7bbc556da 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -596,6 +596,7 @@ union Instruction {
} alu;
union {
+ BitField<38, 1, u64> idx;
BitField<51, 1, u64> saturate;
BitField<52, 2, IpaSampleMode> sample_mode;
BitField<54, 2, IpaInterpMode> interp_mode;
diff --git a/src/video_core/shader/decode/other.cpp b/src/video_core/shader/decode/other.cpp
index 776bdb931..fa17c45b5 100644
--- a/src/video_core/shader/decode/other.cpp
+++ b/src/video_core/shader/decode/other.cpp
@@ -130,15 +130,18 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) {
break;
}
case OpCode::Id::IPA: {
- const auto& attribute = instr.attribute.fmt28;
+ const bool is_physical = instr.ipa.idx && instr.gpr8.Value() != 0xff;
+
+ const auto attribute = instr.attribute.fmt28;
const Tegra::Shader::IpaMode input_mode{instr.ipa.interp_mode.Value(),
instr.ipa.sample_mode.Value()};
- const Node attr = GetInputAttribute(attribute.index, attribute.element);
- Node value = attr;
+ Node value = is_physical ? GetPhysicalInputAttribute(instr.gpr8)
+ : GetInputAttribute(attribute.index, attribute.element);
const Tegra::Shader::Attribute::Index index = attribute.index.Value();
- if (index >= Tegra::Shader::Attribute::Index::Attribute_0 &&
- index <= Tegra::Shader::Attribute::Index::Attribute_31) {
+ const bool is_generic = index >= Tegra::Shader::Attribute::Index::Attribute_0 &&
+ index <= Tegra::Shader::Attribute::Index::Attribute_31;
+ if (is_generic || is_physical) {
// TODO(Blinkhawk): There are cases where a perspective attribute use PASS.
// In theory by setting them as perspective, OpenGL does the perspective correction.
// A way must figured to reverse the last step of it.