@@ -285,7 +285,7 @@ static bool g_vulkan = false;
285285static constexpr bool g_vulkan = true ;
286286#endif
287287
288- static bool g_mesaTriangleStripWorkaround = false ;
288+ static bool g_triangleStripWorkaround = false ;
289289
290290static constexpr bool g_hardwareResolve = true ;
291291static constexpr bool g_hardwareDepthResolve = true ;
@@ -1702,13 +1702,9 @@ bool Video::CreateHostDevice(const char *sdlVideoDriver)
17021702
17031703 g_vulkan = (interfaceFunction == CreateVulkanInterfaceWrapper);
17041704#endif
1705-
1706- if (interfaceFunction == CreateVulkanInterfaceWrapper)
1707- {
1708- // Enable triangle strip workaround if we are on the Mesa RADV driver, as it currently has a bug where
1709- // restart indices cause triangles to be culled incorrectly. Converting them to degenerate triangles fixes it.
1710- g_mesaTriangleStripWorkaround = deviceDescription.name .find (" (RADV " ) != std::string::npos;
1711- }
1705+ // Enable triangle strip workaround if we are on AMD, as there is a bug where
1706+ // restart indices cause triangles to be culled incorrectly. Converting them to degenerate triangles fixes it.
1707+ g_triangleStripWorkaround = (deviceDescription.vendor == RenderDeviceVendor::AMD);
17121708
17131709 break ;
17141710 }
@@ -2329,7 +2325,7 @@ static void DrawProfiler()
23292325 ImGui::Text (" Present Wait: %s" , g_capabilities.presentWait ? " Supported" : " Unsupported" );
23302326 ImGui::Text (" Triangle Fan: %s" , g_capabilities.triangleFan ? " Supported" : " Unsupported" );
23312327 ImGui::Text (" Dynamic Depth Bias: %s" , g_capabilities.dynamicDepthBias ? " Supported" : " Unsupported" );
2332- ImGui::Text (" Triangle Strip Workaround: %s" , g_mesaTriangleStripWorkaround ? " Enabled" : " Disabled" );
2328+ ImGui::Text (" Triangle Strip Workaround: %s" , g_triangleStripWorkaround ? " Enabled" : " Disabled" );
23332329 ImGui::NewLine ();
23342330
23352331 ImGui::Text (" API: %s" , g_vulkan ? " Vulkan" : " D3D12" );
@@ -7428,8 +7424,8 @@ bool FxShadowMapMidAsmHook(PPCRegister& r4, PPCRegister& r5, PPCRegister& r6, PP
74287424 }
74297425}
74307426
7431- // There is a driver bug on Mesa where restart indices cause incorrect culling and prevent some triangles from being rendered.
7432- // Restart indices can be converted to degenerate triangles as a workaround until this issue gets fixed .
7427+ // There is a bug on AMD where restart indices cause incorrect culling and prevent some triangles from being rendered.
7428+ // This seems to happen on both Windows AMD drivers and Mesa. Converting restart indices to degenerate triangles fixes it .
74337429static void ConvertToDegenerateTriangles (uint16_t * indices, uint32_t indexCount, uint16_t *& newIndices, uint32_t & newIndexCount)
74347430{
74357431 newIndices = reinterpret_cast <uint16_t *>(g_userHeap.Alloc (indexCount * sizeof (uint16_t ) * 3 ));
@@ -7482,7 +7478,7 @@ PPC_FUNC(sub_82E44AF8)
74827478 uint16_t * newIndicesToFree = nullptr ;
74837479
74847480 auto databaseData = reinterpret_cast <Hedgehog::Database::CDatabaseData*>(base + ctx.r3 .u32 );
7485- if (g_mesaTriangleStripWorkaround && !databaseData->IsMadeOne ())
7481+ if (g_triangleStripWorkaround && !databaseData->IsMadeOne ())
74867482 {
74877483 auto meshResource = reinterpret_cast <MeshResource*>(base + ctx.r4 .u32 );
74887484
@@ -7545,7 +7541,7 @@ PPC_FUNC(sub_82E3AFC8)
75457541 uint16_t * newIndices = nullptr ;
75467542
75477543 auto databaseData = reinterpret_cast <Hedgehog::Database::CDatabaseData*>(base + ctx.r3 .u32 );
7548- if (g_mesaTriangleStripWorkaround && !databaseData->IsMadeOne ())
7544+ if (g_triangleStripWorkaround && !databaseData->IsMadeOne ())
75497545 {
75507546 auto lightAndIndexBufferResource = reinterpret_cast <LightAndIndexBufferResourceV1*>(base + ctx.r4 .u32 );
75517547
@@ -7584,7 +7580,7 @@ PPC_FUNC(sub_82E3B1C0)
75847580 uint16_t * newIndices = nullptr ;
75857581
75867582 auto databaseData = reinterpret_cast <Hedgehog::Database::CDatabaseData*>(base + ctx.r3 .u32 );
7587- if (g_mesaTriangleStripWorkaround && !databaseData->IsMadeOne ())
7583+ if (g_triangleStripWorkaround && !databaseData->IsMadeOne ())
75887584 {
75897585 auto lightAndIndexBufferResource = reinterpret_cast <LightAndIndexBufferResourceV5*>(base + ctx.r4 .u32 );
75907586
0 commit comments