summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorGravatar bunnei2018-08-11 19:56:28 -0400
committerGravatar GitHub2018-08-11 19:56:28 -0400
commit403dfd68fc41cec2261915d1647305c016a93440 (patch)
treeb6490574200d79a0a8de65f5e491616b08517d59 /src/video_core/renderer_opengl
parentMerge pull request #1009 from bunnei/rg8-rgba8-snorm (diff)
parentgl_shader_decompiler: Improve handling of unknown input/output attributes. (diff)
downloadyuzu-403dfd68fc41cec2261915d1647305c016a93440.tar.gz
yuzu-403dfd68fc41cec2261915d1647305c016a93440.tar.xz
yuzu-403dfd68fc41cec2261915d1647305c016a93440.zip
Merge pull request #1010 from bunnei/unk-vert-attrib-shader
gl_shader_decompiler: Improve handling of unknown input/output attributes.
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp18
1 files changed, 10 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 8954deb81..85297bd00 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -358,7 +358,12 @@ public:
358 void SetOutputAttributeToRegister(Attribute::Index attribute, u64 elem, const Register& reg) { 358 void SetOutputAttributeToRegister(Attribute::Index attribute, u64 elem, const Register& reg) {
359 std::string dest = GetOutputAttribute(attribute) + GetSwizzle(elem); 359 std::string dest = GetOutputAttribute(attribute) + GetSwizzle(elem);
360 std::string src = GetRegisterAsFloat(reg); 360 std::string src = GetRegisterAsFloat(reg);
361 shader.AddLine(dest + " = " + src + ';'); 361
362 if (!dest.empty()) {
363 // Can happen with unknown/unimplemented output attributes, in which case we ignore the
364 // instruction for now.
365 shader.AddLine(dest + " = " + src + ';');
366 }
362 } 367 }
363 368
364 /// Generates code representing a uniform (C buffer) register, interpreted as the input type. 369 /// Generates code representing a uniform (C buffer) register, interpreted as the input type.
@@ -534,20 +539,16 @@ private:
534 // shader. 539 // shader.
535 ASSERT(stage == Maxwell3D::Regs::ShaderStage::Vertex); 540 ASSERT(stage == Maxwell3D::Regs::ShaderStage::Vertex);
536 return "vec4(0, 0, uintBitsToFloat(gl_InstanceID), uintBitsToFloat(gl_VertexID))"; 541 return "vec4(0, 0, uintBitsToFloat(gl_InstanceID), uintBitsToFloat(gl_VertexID))";
537 case Attribute::Index::Unknown_63:
538 // TODO(bunnei): Figure out what this is used for. Super Mario Odyssey uses this.
539 LOG_CRITICAL(HW_GPU, "Unhandled input attribute Unknown_63");
540 UNREACHABLE();
541 break;
542 default: 542 default:
543 const u32 index{static_cast<u32>(attribute) - 543 const u32 index{static_cast<u32>(attribute) -
544 static_cast<u32>(Attribute::Index::Attribute_0)}; 544 static_cast<u32>(Attribute::Index::Attribute_0)};
545 if (attribute >= Attribute::Index::Attribute_0) { 545 if (attribute >= Attribute::Index::Attribute_0 &&
546 attribute <= Attribute::Index::Attribute_31) {
546 declr_input_attribute.insert(attribute); 547 declr_input_attribute.insert(attribute);
547 return "input_attribute_" + std::to_string(index); 548 return "input_attribute_" + std::to_string(index);
548 } 549 }
549 550
550 LOG_CRITICAL(HW_GPU, "Unhandled input attribute: {}", index); 551 LOG_CRITICAL(HW_GPU, "Unhandled input attribute: {}", static_cast<u32>(attribute));
551 UNREACHABLE(); 552 UNREACHABLE();
552 } 553 }
553 554
@@ -569,6 +570,7 @@ private:
569 570
570 LOG_CRITICAL(HW_GPU, "Unhandled output attribute: {}", index); 571 LOG_CRITICAL(HW_GPU, "Unhandled output attribute: {}", index);
571 UNREACHABLE(); 572 UNREACHABLE();
573 return {};
572 } 574 }
573 } 575 }
574 576