mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-23 15:22:45 +01:00
Merge pull request #1010 from bunnei/unk-vert-attrib-shader
gl_shader_decompiler: Improve handling of unknown input/output attributes.
This commit is contained in:
commit
403dfd68fc
2 changed files with 11 additions and 10 deletions
|
@ -74,12 +74,11 @@ union Attribute {
|
||||||
enum class Index : u64 {
|
enum class Index : u64 {
|
||||||
Position = 7,
|
Position = 7,
|
||||||
Attribute_0 = 8,
|
Attribute_0 = 8,
|
||||||
|
Attribute_31 = 39,
|
||||||
// This attribute contains a tuple of (~, ~, InstanceId, VertexId) when inside a vertex
|
// This attribute contains a tuple of (~, ~, InstanceId, VertexId) when inside a vertex
|
||||||
// shader, and a tuple of (TessCoord.x, TessCoord.y, TessCoord.z, ~) when inside a Tess Eval
|
// shader, and a tuple of (TessCoord.x, TessCoord.y, TessCoord.z, ~) when inside a Tess Eval
|
||||||
// shader.
|
// shader.
|
||||||
TessCoordInstanceIDVertexID = 47,
|
TessCoordInstanceIDVertexID = 47,
|
||||||
// TODO(bunnei): Figure out what this is used for. Super Mario Odyssey uses this.
|
|
||||||
Unknown_63 = 63,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
|
|
@ -358,8 +358,13 @@ public:
|
||||||
void SetOutputAttributeToRegister(Attribute::Index attribute, u64 elem, const Register& reg) {
|
void SetOutputAttributeToRegister(Attribute::Index attribute, u64 elem, const Register& reg) {
|
||||||
std::string dest = GetOutputAttribute(attribute) + GetSwizzle(elem);
|
std::string dest = GetOutputAttribute(attribute) + GetSwizzle(elem);
|
||||||
std::string src = GetRegisterAsFloat(reg);
|
std::string src = GetRegisterAsFloat(reg);
|
||||||
|
|
||||||
|
if (!dest.empty()) {
|
||||||
|
// Can happen with unknown/unimplemented output attributes, in which case we ignore the
|
||||||
|
// instruction for now.
|
||||||
shader.AddLine(dest + " = " + src + ';');
|
shader.AddLine(dest + " = " + src + ';');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Generates code representing a uniform (C buffer) register, interpreted as the input type.
|
/// Generates code representing a uniform (C buffer) register, interpreted as the input type.
|
||||||
std::string GetUniform(u64 index, u64 offset, GLSLRegister::Type type) {
|
std::string GetUniform(u64 index, u64 offset, GLSLRegister::Type type) {
|
||||||
|
@ -534,20 +539,16 @@ private:
|
||||||
// shader.
|
// shader.
|
||||||
ASSERT(stage == Maxwell3D::Regs::ShaderStage::Vertex);
|
ASSERT(stage == Maxwell3D::Regs::ShaderStage::Vertex);
|
||||||
return "vec4(0, 0, uintBitsToFloat(gl_InstanceID), uintBitsToFloat(gl_VertexID))";
|
return "vec4(0, 0, uintBitsToFloat(gl_InstanceID), uintBitsToFloat(gl_VertexID))";
|
||||||
case Attribute::Index::Unknown_63:
|
|
||||||
// TODO(bunnei): Figure out what this is used for. Super Mario Odyssey uses this.
|
|
||||||
LOG_CRITICAL(HW_GPU, "Unhandled input attribute Unknown_63");
|
|
||||||
UNREACHABLE();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
const u32 index{static_cast<u32>(attribute) -
|
const u32 index{static_cast<u32>(attribute) -
|
||||||
static_cast<u32>(Attribute::Index::Attribute_0)};
|
static_cast<u32>(Attribute::Index::Attribute_0)};
|
||||||
if (attribute >= Attribute::Index::Attribute_0) {
|
if (attribute >= Attribute::Index::Attribute_0 &&
|
||||||
|
attribute <= Attribute::Index::Attribute_31) {
|
||||||
declr_input_attribute.insert(attribute);
|
declr_input_attribute.insert(attribute);
|
||||||
return "input_attribute_" + std::to_string(index);
|
return "input_attribute_" + std::to_string(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_CRITICAL(HW_GPU, "Unhandled input attribute: {}", index);
|
LOG_CRITICAL(HW_GPU, "Unhandled input attribute: {}", static_cast<u32>(attribute));
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,6 +570,7 @@ private:
|
||||||
|
|
||||||
LOG_CRITICAL(HW_GPU, "Unhandled output attribute: {}", index);
|
LOG_CRITICAL(HW_GPU, "Unhandled output attribute: {}", index);
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue