use VAO in VertexManager

to use VAO, we must use VBO, so some legency code was removed:

- ARB_map_buffer_range must be available (OGL 3.0), don't call glBufferSubData if not
- ARB_draw_elements_base_vertex also (OGL 3.2), else we have to set the pointers every time
- USE_JIT was removed, it was broken and it isn't needed any more

And the index and vertex buffers are now synchronized, so that there will be one VAO per
NativeVertexFormat and Buffer.
This commit is contained in:
degasus
2012-12-15 14:43:01 +01:00
parent 0809ba79ae
commit ba8264c2ac
4 changed files with 193 additions and 439 deletions

View File

@ -26,7 +26,6 @@ namespace OGL
{
class GLVertexFormat : public NativeVertexFormat
{
u8 *m_compiledCode;
PortableVertexDeclaration vtx_decl;
public:
@ -35,8 +34,8 @@ namespace OGL
virtual void Initialize(const PortableVertexDeclaration &_vtx_decl);
virtual void SetupVertexPointers();
virtual void SetupVertexPointersOffset(u32 offset);
virtual void EnableComponents(u32 components);
GLuint *VAO;
};
// Handles the OpenGL details of drawing lots of vertices quickly.
@ -49,21 +48,21 @@ public:
NativeVertexFormat* CreateNativeVertexFormat();
void CreateDeviceObjects();
void DestroyDeviceObjects();
// NativeVertexFormat use this
u32 m_buffers_count;
u32 m_current_buffer;
GLuint* m_vertex_buffers;
GLuint* m_index_buffers;
GLuint m_last_vao;
private:
void DrawVertexArray();
void DrawVertexBufferObject();
void DrawVertexBufferObjectBase(u32 stride);
void Draw(u32 stride);
void vFlush();
void PrepareDrawBuffers(u32 stride);
u32 m_vertex_buffer_cursor;
u32 m_vertex_buffer_size;
u32 m_index_buffer_cursor;
u32 m_index_buffer_size;
u32 m_buffers_count;
u32 m_current_vertex_buffer;
u32 m_current_index_buffer;
GLuint* m_vertex_buffers;
GLuint* m_index_buffers;
NativeVertexFormat *m_CurrentVertexFmt;
};