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
|
|
|
|
2017-02-18 09:14:30 +01:00
|
|
|
#include <memory>
|
2017-02-01 16:56:13 +01:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
#include "Common/GL/GLUtil.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
|
|
|
|
{
|
2017-09-08 11:42:56 +02:00
|
|
|
class StreamBuffer;
|
2016-06-24 10:43:46 +02:00
|
|
|
class GLVertexFormat : public NativeVertexFormat
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GLVertexFormat(const PortableVertexDeclaration& vtx_decl);
|
|
|
|
~GLVertexFormat();
|
2012-10-26 16:34:02 +02:00
|
|
|
|
2016-06-24 10:43:46 +02:00
|
|
|
GLuint VAO;
|
|
|
|
};
|
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:
|
2016-06-24 10:43:46 +02:00
|
|
|
VertexManager();
|
|
|
|
~VertexManager();
|
2017-02-18 09:14:30 +01:00
|
|
|
|
|
|
|
std::unique_ptr<NativeVertexFormat>
|
|
|
|
CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) override;
|
|
|
|
|
2018-11-27 08:16:53 +01:00
|
|
|
void UploadUtilityUniforms(const void* uniforms, u32 uniforms_size) override;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2017-09-03 00:05:49 +02:00
|
|
|
GLuint GetVertexBufferHandle() const;
|
|
|
|
GLuint GetIndexBufferHandle() const;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2014-01-23 13:41:53 +01:00
|
|
|
protected:
|
2018-11-27 08:16:53 +01:00
|
|
|
void CreateDeviceObjects() override;
|
|
|
|
void DestroyDeviceObjects() override;
|
|
|
|
void ResetBuffer(u32 vertex_stride, bool cull_all) override;
|
|
|
|
void CommitBuffer(u32 num_vertices, u32 vertex_stride, u32 num_indices, u32* out_base_vertex,
|
|
|
|
u32* out_base_index) override;
|
|
|
|
void UploadConstants() override;
|
|
|
|
void DrawCurrentBatch(u32 base_index, u32 num_indices, u32 base_vertex) override;
|
2014-12-26 09:25:24 +01:00
|
|
|
|
2010-10-03 02:41:06 +02:00
|
|
|
private:
|
2018-11-27 08:16:53 +01:00
|
|
|
std::unique_ptr<StreamBuffer> m_vertex_buffer;
|
|
|
|
std::unique_ptr<StreamBuffer> m_index_buffer;
|
2017-09-03 00:05:49 +02:00
|
|
|
|
2016-06-24 10:43:46 +02: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-08 05:46:09 +01:00
|
|
|
};
|
2018-11-27 08:16:53 +01:00
|
|
|
} // namespace OGL
|