2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 05:29:41 +02:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2014-02-10 19:54:46 +01:00
|
|
|
#pragma once
|
2008-12-08 05:46:09 +01:00
|
|
|
|
2015-09-18 18:40:00 +02:00
|
|
|
#include "Common/GL/GLExtensions/GLExtensions.h"
|
|
|
|
|
2014-02-17 11:18:15 +01:00
|
|
|
#include "VideoCommon/CPMemory.h"
|
2014-10-21 08:01:38 +02:00
|
|
|
#include "VideoCommon/NativeVertexFormat.h"
|
2014-02-17 11:18:15 +01:00
|
|
|
#include "VideoCommon/VertexManagerBase.h"
|
2010-10-03 02:41:06 +02:00
|
|
|
|
|
|
|
namespace OGL
|
|
|
|
{
|
2012-10-26 16:34:02 +02:00
|
|
|
class GLVertexFormat : public NativeVertexFormat
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GLVertexFormat();
|
|
|
|
~GLVertexFormat();
|
|
|
|
|
2015-07-30 12:47:02 +02:00
|
|
|
void Initialize(const PortableVertexDeclaration &_vtx_decl) override;
|
|
|
|
void SetupVertexPointers() override;
|
2013-10-29 06:23:17 +01:00
|
|
|
|
2012-12-15 17:28:58 +01:00
|
|
|
GLuint VAO;
|
2012-10-26 16:34:02 +02:00
|
|
|
};
|
2008-12-08 05:46:09 +01:00
|
|
|
|
|
|
|
// Handles the OpenGL details of drawing lots of vertices quickly.
|
|
|
|
// Other functionality is moving out.
|
2015-11-01 22:54:41 +01:00
|
|
|
class VertexManager : public VertexManagerBase
|
2008-12-08 05:46:09 +01:00
|
|
|
{
|
2010-10-03 02:41:06 +02:00
|
|
|
public:
|
|
|
|
VertexManager();
|
2012-10-26 16:34:02 +02:00
|
|
|
~VertexManager();
|
2013-10-29 06:34:26 +01:00
|
|
|
NativeVertexFormat* CreateNativeVertexFormat() override;
|
|
|
|
void CreateDeviceObjects() override;
|
|
|
|
void DestroyDeviceObjects() override;
|
2013-10-29 06:23:17 +01:00
|
|
|
|
2012-12-15 14:43:01 +01:00
|
|
|
// NativeVertexFormat use this
|
2012-12-15 17:28:58 +01:00
|
|
|
GLuint m_vertex_buffers;
|
2013-10-29 06:23:17 +01:00
|
|
|
GLuint m_index_buffers;
|
2012-12-15 14:43:01 +01:00
|
|
|
GLuint m_last_vao;
|
2014-01-23 13:41:53 +01:00
|
|
|
protected:
|
2015-07-30 12:47:02 +02:00
|
|
|
void ResetBuffer(u32 stride) override;
|
2014-12-26 09:25:24 +01:00
|
|
|
|
2010-10-03 02:41:06 +02:00
|
|
|
private:
|
2012-12-15 14:43:01 +01:00
|
|
|
void Draw(u32 stride);
|
2014-02-03 16:56:17 +01:00
|
|
|
void vFlush(bool useDstAlpha) override;
|
2012-10-26 16:34:02 +02:00
|
|
|
void PrepareDrawBuffers(u32 stride);
|
2015-01-24 02:37:20 +01:00
|
|
|
|
|
|
|
// Alternative buffers in CPU memory for primatives we are going to discard.
|
2015-01-24 21:12:52 +01:00
|
|
|
std::vector<u8> m_cpu_v_buffer;
|
|
|
|
std::vector<u16> m_cpu_i_buffer;
|
2008-12-08 05:46:09 +01:00
|
|
|
};
|
|
|
|
|
2010-10-03 02:41:06 +02:00
|
|
|
}
|