Cleanup the output of the pipeline analyzer

This commit is contained in:
Henrik Rydgård
2026-07-10 14:02:15 +02:00
parent 254e10fd4e
commit 7e61f82826
3 changed files with 14 additions and 10 deletions
+8 -4
View File
@@ -19,11 +19,13 @@ std::string ShaderID::ToDebugString() const {
return StringFromFormat("%08x:%08x", d >> 32, d & 0xFFFFFFFF); return StringFromFormat("%08x:%08x", d >> 32, d & 0xFFFFFFFF);
} }
std::string VShaderID::Description() const { std::string VShaderID::Description(bool includeID) const {
char buffer[512]; char buffer[512];
StringWriter desc(buffer, sizeof(buffer)); StringWriter desc(buffer, sizeof(buffer));
desc.W(ToDebugString()).C(" "); if (includeID) {
desc.W(ToDebugString()).C(" ");
}
if (Bit(VS_BIT_IS_THROUGH)) desc.C("THR "); if (Bit(VS_BIT_IS_THROUGH)) desc.C("THR ");
if (Bit(VS_BIT_USE_HW_TRANSFORM)) desc.C("HWX "); else desc.C("SWX "); if (Bit(VS_BIT_USE_HW_TRANSFORM)) desc.C("HWX "); else desc.C("SWX ");
if (Bit(VS_BIT_HAS_NORMAL)) desc.C("N "); if (Bit(VS_BIT_HAS_NORMAL)) desc.C("N ");
@@ -176,11 +178,13 @@ static bool MatrixNeedsProjection(const float m[12], GETexProjMapMode mode) {
return m[2] != 0.0f || m[5] != 0.0f || (m[8] != 0.0f && mode != GE_PROJMAP_UV) || m[11] != 1.0f; return m[2] != 0.0f || m[5] != 0.0f || (m[8] != 0.0f && mode != GE_PROJMAP_UV) || m[11] != 1.0f;
} }
std::string FShaderID::Description() const { std::string FShaderID::Description(bool includeID) const {
char buffer[512]; char buffer[512];
StringWriter desc(buffer, sizeof(buffer)); StringWriter desc(buffer, sizeof(buffer));
if (includeID) {
desc.W(ToDebugString()).C(" ");
}
desc.W(ToDebugString()).C(" ");
if (Bit(FS_BIT_CLEARMODE)) desc.C("Clear "); if (Bit(FS_BIT_CLEARMODE)) desc.C("Clear ");
if (Bit(FS_BIT_DO_TEXTURE)) { if (Bit(FS_BIT_DO_TEXTURE)) {
desc.W(Bit(FS_BIT_3D_TEXTURE) ? "Tex3D" : "Tex"); desc.W(Bit(FS_BIT_3D_TEXTURE) ? "Tex3D" : "Tex");
+2 -2
View File
@@ -208,7 +208,7 @@ struct VShaderID : public ShaderID {
// Generates a compact string that describes the shader. Useful in a list to get an overview // Generates a compact string that describes the shader. Useful in a list to get an overview
// of the current flora of shaders. // of the current flora of shaders.
std::string Description() const; std::string Description(bool includeID = true) const;
}; };
struct FShaderID : public ShaderID { struct FShaderID : public ShaderID {
@@ -235,7 +235,7 @@ struct FShaderID : public ShaderID {
ShaderID::SetBits((int)bit, count, value); ShaderID::SetBits((int)bit, count, value);
} }
std::string Description() const; std::string Description(bool includeID = true) const;
}; };
static_assert(sizeof(VShaderID) == sizeof(uint64_t), "VShaderID size mismatch"); static_assert(sizeof(VShaderID) == sizeof(uint64_t), "VShaderID size mismatch");
+4 -4
View File
@@ -536,10 +536,10 @@ void ShaderListScreen::AddPipelineAnalysis(UI::LinearLayout *tabContent) {
if (IsSameExceptForShaders(keyA, keyB)) { if (IsSameExceptForShaders(keyA, keyB)) {
// Found a pair of pipelines that are identical except for the shaders. // Found a pair of pipelines that are identical except for the shaders.
if (keyA.vid != keyB.vid) { if (keyA.vid != keyB.vid) {
toBeMerged += "VShader: " + keyA.vid.Description() + " vs " + keyB.vid.Description() + "\n"; toBeMerged += "VShader: " + keyA.vid.Description(false) + " vs " + keyB.vid.Description(false) + "\n";
} }
if (keyA.fid != keyB.fid) { if (keyA.fid != keyB.fid) {
toBeMerged += "FShader: " + keyA.fid.Description() + " vs " + keyB.fid.Description() + "\n"; toBeMerged += "FShader: " + keyA.fid.Description(false) + " vs " + keyB.fid.Description(false) + "\n";
} }
} }
if (IsSameExceptForVertexFormat(keyA, keyB)) { if (IsSameExceptForVertexFormat(keyA, keyB)) {
@@ -553,8 +553,8 @@ void ShaderListScreen::AddPipelineAnalysis(UI::LinearLayout *tabContent) {
} }
} }
if (!toBeMerged.empty()) { if (!toBeMerged.empty()) {
tabContent->Add(new UI::TextView(keys[i].GetDescription(SHADER_STRING_SHORT_DESC), FLAG_DYNAMIC_ASCII | FLAG_WRAP_TEXT, true)); tabContent->Add(new UI::TextView(keys[i].GetDescription(SHADER_STRING_SHORT_DESC), FLAG_DYNAMIC_ASCII, true));
tabContent->Add(new UI::TextView(toBeMerged, FLAG_DYNAMIC_ASCII | FLAG_WRAP_TEXT, true)); tabContent->Add(new UI::TextView(toBeMerged, FLAG_DYNAMIC_ASCII, true));
} }
} }
#endif #endif