VideoCommon: update the IndexGenerator logic to take a flag that avoids primitive restarts when the editor is in progress, GLTF files don't support primitive restarts and running without is easier than trying to calculate a new set of indices

This commit is contained in:
iwubcode 2024-01-13 00:35:10 -06:00
commit 3f38247c4e
2 changed files with 7 additions and 4 deletions

View file

@ -262,11 +262,14 @@ u16* AddPoints_VSExpand(u16* index_ptr, u32 num_verts, u32 index)
}
} // Anonymous namespace
void IndexGenerator::Init()
void IndexGenerator::Init(bool editor_enabled)
{
using OpcodeDecoder::Primitive;
if (g_backend_info.bSupportsPrimitiveRestart)
// When editor is enabled, we can't take shortcuts
// as we might want to save meshes to a file
// Some formats don't allow primitive restart
if (g_backend_info.bSupportsPrimitiveRestart && !editor_enabled)
{
m_primitive_table[Primitive::GX_DRAW_QUADS] = AddQuads<true>;
m_primitive_table[Primitive::GX_DRAW_QUADS_2] = AddQuads_nonstandard<true>;
@ -282,7 +285,7 @@ void IndexGenerator::Init()
m_primitive_table[Primitive::GX_DRAW_TRIANGLE_STRIP] = AddStrip<false>;
m_primitive_table[Primitive::GX_DRAW_TRIANGLE_FAN] = AddFan<false>;
}
if (g_Config.UseVSForLinePointExpand())
if (g_Config.UseVSForLinePointExpand() && !editor_enabled)
{
if (g_backend_info.bSupportsPrimitiveRestart)
{

View file

@ -13,7 +13,7 @@
class IndexGenerator
{
public:
void Init();
void Init(bool editor_enabled);
void Start(u16* index_ptr);
void AddIndices(OpcodeDecoder::Primitive primitive, u32 num_vertices);