summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-08-10 12:34:51 -0400
committerGravatar bunnei2018-08-11 19:26:45 -0400
commit0b668d5ff355c0ac2c33d40429e6cc6d872d0e4f (patch)
tree724eb624370130fbb2318d6a54d40c2b11cb73e3 /src
parentMerge pull request #1016 from lioncash/video (diff)
downloadyuzu-0b668d5ff355c0ac2c33d40429e6cc6d872d0e4f.tar.gz
yuzu-0b668d5ff355c0ac2c33d40429e6cc6d872d0e4f.tar.xz
yuzu-0b668d5ff355c0ac2c33d40429e6cc6d872d0e4f.zip
gl_shader_decompiler: Improve handling of unknown input/output attributes.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/shader_bytecode.h3
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp18
2 files changed, 11 insertions, 10 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index 3e409c2e1..24396c6c9 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -74,12 +74,11 @@ union Attribute {
74 enum class Index : u64 { 74 enum class Index : u64 {
75 Position = 7, 75 Position = 7,
76 Attribute_0 = 8, 76 Attribute_0 = 8,
77 Attribute_31 = 39,
77 // This attribute contains a tuple of (~, ~, InstanceId, VertexId) when inside a vertex 78 // This attribute contains a tuple of (~, ~, InstanceId, VertexId) when inside a vertex
78 // shader, and a tuple of (TessCoord.x, TessCoord.y, TessCoord.z, ~) when inside a Tess Eval 79 // shader, and a tuple of (TessCoord.x, TessCoord.y, TessCoord.z, ~) when inside a Tess Eval
79 // shader. 80 // shader.
80 TessCoordInstanceIDVertexID = 47, 81 TessCoordInstanceIDVertexID = 47,
81 // TODO(bunnei): Figure out what this is used for. Super Mario Odyssey uses this.
82 Unknown_63 = 63,
83 }; 82 };
84 83
85 union { 84 union {
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 32f06f409..06bfe799c 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -349,7 +349,12 @@ public:
349 void SetOutputAttributeToRegister(Attribute::Index attribute, u64 elem, const Register& reg) { 349 void SetOutputAttributeToRegister(Attribute::Index attribute, u64 elem, const Register& reg) {
350 std::string dest = GetOutputAttribute(attribute) + GetSwizzle(elem); 350 std::string dest = GetOutputAttribute(attribute) + GetSwizzle(elem);
351 std::string src = GetRegisterAsFloat(reg); 351 std::string src = GetRegisterAsFloat(reg);
352 shader.AddLine(dest + " = " + src + ';'); 352
353 if (!dest.empty()) {
354 // Can happen with unknown/unimplemented output attributes, in which case we ignore the
355 // instruction for now.
356 shader.AddLine(dest + " = " + src + ';');
357 }
353 } 358 }
354 359
355 /// Generates code representing a uniform (C buffer) register, interpreted as the input type. 360 /// Generates code representing a uniform (C buffer) register, interpreted as the input type.
@@ -525,20 +530,16 @@ private:
525 // shader. 530 // shader.
526 ASSERT(stage == Maxwell3D::Regs::ShaderStage::Vertex); 531 ASSERT(stage == Maxwell3D::Regs::ShaderStage::Vertex);
527 return "vec4(0, 0, uintBitsToFloat(gl_InstanceID), uintBitsToFloat(gl_VertexID))"; 532 return "vec4(0, 0, uintBitsToFloat(gl_InstanceID), uintBitsToFloat(gl_VertexID))";
528 case Attribute::Index::Unknown_63:
529 // TODO(bunnei): Figure out what this is used for. Super Mario Odyssey uses this.
530 LOG_CRITICAL(HW_GPU, "Unhandled input attribute Unknown_63");
531 UNREACHABLE();
532 break;
533 default: 533 default:
534 const u32 index{static_cast<u32>(attribute) - 534 const u32 index{static_cast<u32>(attribute) -
535 static_cast<u32>(Attribute::Index::Attribute_0)}; 535 static_cast<u32>(Attribute::Index::Attribute_0)};
536 if (attribute >= Attribute::Index::Attribute_0) { 536 if (attribute >= Attribute::Index::Attribute_0 &&
537 attribute <= Attribute::Index::Attribute_31) {
537 declr_input_attribute.insert(attribute); 538 declr_input_attribute.insert(attribute);
538 return "input_attribute_" + std::to_string(index); 539 return "input_attribute_" + std::to_string(index);
539 } 540 }
540 541
541 LOG_CRITICAL(HW_GPU, "Unhandled input attribute: {}", index); 542 LOG_CRITICAL(HW_GPU, "Unhandled input attribute: {}", static_cast<u32>(attribute));
542 UNREACHABLE(); 543 UNREACHABLE();
543 } 544 }
544 545
@@ -560,6 +561,7 @@ private:
560 561
561 LOG_CRITICAL(HW_GPU, "Unhandled output attribute: {}", index); 562 LOG_CRITICAL(HW_GPU, "Unhandled output attribute: {}", index);
562 UNREACHABLE(); 563 UNREACHABLE();
564 return {};
563 } 565 }
564 } 566 }
565 567