really turn the vertex format jit off, when it's off

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@994 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-10-28 21:38:55 +00:00
parent 22e1ecbb51
commit 6a2bacac8c
1 changed files with 9 additions and 0 deletions

View File

@ -41,23 +41,29 @@
// Here's some global state. We only use this to keep track of what we've sent to the OpenGL state
// machine.
#ifdef USE_JIT
DECLARE_IMPORT(glNormalPointer);
DECLARE_IMPORT(glVertexPointer);
DECLARE_IMPORT(glColorPointer);
DECLARE_IMPORT(glTexCoordPointer);
#endif
NativeVertexFormat::NativeVertexFormat()
{
#ifdef USE_JIT
m_compiledCode = (u8 *)AllocateExecutableMemory(COMPILED_CODE_SIZE, false);
if (m_compiledCode) {
memset(m_compiledCode, 0, COMPILED_CODE_SIZE);
}
#endif
}
NativeVertexFormat::~NativeVertexFormat()
{
#ifdef USE_JIT
FreeMemoryPages(m_compiledCode, COMPILED_CODE_SIZE);
m_compiledCode = 0;
#endif
}
inline GLuint VarToGL(VarType t)
@ -69,6 +75,7 @@ inline GLuint VarToGL(VarType t)
case VAR_UNSIGNED_SHORT: return GL_UNSIGNED_SHORT;
case VAR_FLOAT: return GL_FLOAT;
}
return 0;
}
void NativeVertexFormat::Initialize(const PortableVertexDeclaration &vtx_decl)
@ -80,6 +87,7 @@ void NativeVertexFormat::Initialize(const PortableVertexDeclaration &vtx_decl)
PanicAlert("Uneven vertex stride: %i", vtx_decl.stride);
}
#ifdef USE_JIT
// Alright, we have our vertex declaration. Compile some crazy code to set it quickly using GL.
u8 *old_code_ptr = GetWritableCodePtr();
SetCodePtr(m_compiledCode);
@ -142,6 +150,7 @@ void NativeVertexFormat::Initialize(const PortableVertexDeclaration &vtx_decl)
}
SetCodePtr(old_code_ptr);
#endif
this->vtx_decl = vtx_decl;
}