From bb2fc8ecbb9fe2e54b0a657ebd24702ab27f7e8c Mon Sep 17 00:00:00 2001 From: degasus Date: Thu, 5 Jun 2014 17:55:21 +0200 Subject: VideoCommon: Cache native vertex formats We are used to have a 1:1 mapping of GX vertex formats and the native (OGL + D3D) ones, but there are by far more GX ones. This new cache maps them directly so that we don't flush on GX vertex format changes as long as the native one doesn't change. The idea is stolen from galop1n. --- Source/Core/VideoCommon/VertexLoader.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'Source/Core/VideoCommon/VertexLoader.cpp') diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index 83f9aaa081..bdf58899e4 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -463,7 +463,6 @@ VertexLoader::VertexLoader(const TVtxDesc &vtx_desc, const VAT &vtx_attr) m_compiledCode = nullptr; m_numLoadedVertices = 0; m_VertexSize = 0; - m_NativeFmt = nullptr; loop_counter = 0; VertexLoader_Normal::Init(); VertexLoader_Position::Init(); @@ -488,7 +487,6 @@ VertexLoader::~VertexLoader() #ifdef USE_VERTEX_LOADER_JIT FreeCodeSpace(); #endif - delete m_NativeFmt; } void VertexLoader::CompileVertexTranslator() @@ -773,9 +771,7 @@ void VertexLoader::CompileVertexTranslator() ABI_PopAllCalleeSavedRegsAndAdjustStack(); RET(); #endif - m_NativeFmt = g_vertex_manager->CreateNativeVertexFormat(); - m_NativeFmt->m_components = components; - m_NativeFmt->Initialize(vtx_decl); + m_NativeFmt = VertexLoaderManager::GetNativeVertexFormat(vtx_decl, components); } void VertexLoader::WriteCall(TPipelineFunction func) @@ -825,9 +821,6 @@ void VertexLoader::SetupRunVertices(int vtx_attr_group, int primitive, int const // Flush if our vertex format is different from the currently set. if (g_nativeVertexFmt != nullptr && g_nativeVertexFmt != m_NativeFmt) { - // We really must flush here. It's possible that the native representations - // of the two vtx formats are the same, but we have no way to easily check that - // now. VertexManager::Flush(); // Also move the Set() here? } -- cgit v1.2.3