OpenGL - Don't cache pointer to compiled code - cache pointer to NativeVertexFormat instead.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@950 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-10-25 09:59:00 +00:00
parent 63793c7f4f
commit f14fca914d
3 changed files with 25 additions and 18 deletions

View File

@ -39,7 +39,7 @@
#include <fstream>
extern void (*fnSetupVertexPointers)();
NativeVertexFormat *g_nativeVertexFmt;
//these don't need to be saved
static float posScale;
@ -137,9 +137,6 @@ int VertexLoader::ComputeVertexSize()
m_VtxDesc.Hex = VertexManager::GetVtxDesc().Hex;
}
if (fnSetupVertexPointers != NULL && fnSetupVertexPointers == (void (*)())(void*)m_NativeFmt.m_compiledCode)
VertexManager::Flush();
m_AttrDirty = AD_DIRTY;
m_VertexSize = 0;
// Position Matrix Index
@ -518,13 +515,18 @@ void VertexLoader::RunVertices(int primitive, int count)
{
DVSTARTPROFILE();
// Flush if our vertex format is different from the currently set.
// TODO - this check should be moved.
if (g_nativeVertexFmt != NULL && g_nativeVertexFmt != &m_NativeFmt)
{
VertexManager::Flush();
// Also move the Set() here?
}
// This has dirty handling - won't actually recompute unless necessary.
ComputeVertexSize();
// Figure out a better check. Also, jitting fnSetupVertexPointers seems pretty silly - not likely to be a bottleneck.
if (fnSetupVertexPointers != NULL && fnSetupVertexPointers != (void (*)())(void*)m_NativeFmt.m_compiledCode)
VertexManager::Flush();
if (bpmem.genMode.cullmode == 3 && primitive < 5)
{
// if cull mode is none, ignore triangles and quads
@ -535,7 +537,7 @@ void VertexLoader::RunVertices(int primitive, int count)
// This has dirty handling - won't actually recompute unless necessary.
PrepareForVertexFormat();
fnSetupVertexPointers = (void (*)())(void*)m_NativeFmt.m_compiledCode;
g_nativeVertexFmt = &m_NativeFmt;
VertexManager::EnableComponents(m_NativeFmt.m_components);