2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:29:41 -06:00
|
|
|
// 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
|
|
|
|
2017-02-18 01:14:30 -07:00
|
|
|
#include <memory>
|
2017-02-01 08:56:13 -07:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "Common/GL/GLUtil.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
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
class GLVertexFormat : public NativeVertexFormat
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GLVertexFormat(const PortableVertexDeclaration& vtx_decl);
|
|
|
|
~GLVertexFormat();
|
2012-10-26 08:34:02 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
GLuint VAO;
|
|
|
|
};
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
// Handles the OpenGL details of drawing lots of vertices quickly.
|
|
|
|
// Other functionality is moving out.
|
2015-11-01 14:54:41 -07:00
|
|
|
class VertexManager : public VertexManagerBase
|
2008-12-07 21:46:09 -07:00
|
|
|
{
|
2010-10-02 18:41:06 -06:00
|
|
|
public:
|
2016-06-24 02:43:46 -06:00
|
|
|
VertexManager();
|
|
|
|
~VertexManager();
|
2017-02-18 01:14:30 -07:00
|
|
|
|
|
|
|
std::unique_ptr<NativeVertexFormat>
|
|
|
|
CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) override;
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
void CreateDeviceObjects() override;
|
|
|
|
void DestroyDeviceObjects() override;
|
|
|
|
|
2017-09-02 16:05:49 -06:00
|
|
|
GLuint GetVertexBufferHandle() const;
|
|
|
|
GLuint GetIndexBufferHandle() const;
|
2016-06-24 02:43:46 -06:00
|
|
|
|
2014-01-23 05:41:53 -07:00
|
|
|
protected:
|
2016-06-24 02:43:46 -06:00
|
|
|
void ResetBuffer(u32 stride) override;
|
2014-12-26 01:25:24 -07:00
|
|
|
|
2010-10-02 18:41:06 -06:00
|
|
|
private:
|
2016-06-24 02:43:46 -06:00
|
|
|
void Draw(u32 stride);
|
2016-12-27 17:37:41 -07:00
|
|
|
void vFlush() override;
|
2016-06-24 02:43:46 -06:00
|
|
|
void PrepareDrawBuffers(u32 stride);
|
2015-01-23 18:37:20 -07:00
|
|
|
|
2017-09-02 16:05:49 -06:00
|
|
|
GLuint m_vertex_buffers;
|
|
|
|
GLuint m_index_buffers;
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// Alternative buffers in CPU memory for primatives we are going to discard.
|
|
|
|
std::vector<u8> m_cpu_v_buffer;
|
|
|
|
std::vector<u16> m_cpu_i_buffer;
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
2010-10-02 18:41:06 -06:00
|
|
|
}
|