2013-04-17 21:29:41 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-10-21 00:01:38 -06:00
|
|
|
#include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "VideoCommon/CPMemory.h"
|
2014-10-21 00:01:38 -06:00
|
|
|
#include "VideoCommon/NativeVertexFormat.h"
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "VideoCommon/VertexManagerBase.h"
|
2010-10-02 18:41:06 -06:00
|
|
|
|
|
|
|
namespace OGL
|
|
|
|
{
|
2012-10-26 08:34:02 -06:00
|
|
|
class GLVertexFormat : public NativeVertexFormat
|
|
|
|
{
|
|
|
|
PortableVertexDeclaration vtx_decl;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GLVertexFormat();
|
|
|
|
~GLVertexFormat();
|
|
|
|
|
2013-10-28 23:34:26 -06:00
|
|
|
virtual void Initialize(const PortableVertexDeclaration &_vtx_decl) override;
|
|
|
|
virtual void SetupVertexPointers() override;
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2012-12-15 09:28:58 -07:00
|
|
|
GLuint VAO;
|
2012-10-26 08:34:02 -06:00
|
|
|
};
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
// Handles the OpenGL details of drawing lots of vertices quickly.
|
|
|
|
// Other functionality is moving out.
|
2010-10-02 18:41:06 -06:00
|
|
|
class VertexManager : public ::VertexManager
|
2008-12-07 21:46:09 -07:00
|
|
|
{
|
2010-10-02 18:41:06 -06:00
|
|
|
public:
|
|
|
|
VertexManager();
|
2012-10-26 08:34:02 -06:00
|
|
|
~VertexManager();
|
2013-10-28 23:34:26 -06:00
|
|
|
NativeVertexFormat* CreateNativeVertexFormat() override;
|
|
|
|
void CreateDeviceObjects() override;
|
|
|
|
void DestroyDeviceObjects() override;
|
2013-10-28 23:23:17 -06:00
|
|
|
|
2012-12-15 06:43:01 -07:00
|
|
|
// NativeVertexFormat use this
|
2012-12-15 09:28:58 -07:00
|
|
|
GLuint m_vertex_buffers;
|
2013-10-28 23:23:17 -06:00
|
|
|
GLuint m_index_buffers;
|
2012-12-15 06:43:01 -07:00
|
|
|
GLuint m_last_vao;
|
2014-01-23 05:41:53 -07:00
|
|
|
protected:
|
2014-03-07 17:54:44 -07:00
|
|
|
virtual void ResetBuffer(u32 stride) override;
|
2014-12-25 00:34:22 -07:00
|
|
|
u16* GetIndexBuffer() { return &LocalIBuffer[0]; }
|
|
|
|
u8* GetVertexBuffer() { return &LocalVBuffer[0]; }
|
2010-10-02 18:41:06 -06:00
|
|
|
private:
|
2012-12-15 06:43:01 -07:00
|
|
|
void Draw(u32 stride);
|
2014-02-03 08:56:17 -07:00
|
|
|
void vFlush(bool useDstAlpha) override;
|
2012-10-26 08:34:02 -06:00
|
|
|
void PrepareDrawBuffers(u32 stride);
|
2014-12-25 00:34:22 -07:00
|
|
|
|
|
|
|
std::vector<u8> LocalVBuffer;
|
|
|
|
std::vector<u16> LocalIBuffer;
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
2010-10-02 18:41:06 -06:00
|
|
|
}
|