2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
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
|
|
|
|
2019-02-14 18:59:50 -07:00
|
|
|
#include <array>
|
2017-02-18 01:14:30 -07:00
|
|
|
#include <memory>
|
2017-02-01 08:56:13 -07:00
|
|
|
|
|
|
|
#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
|
|
|
|
{
|
2017-09-08 03:42:56 -06:00
|
|
|
class StreamBuffer;
|
2012-10-26 08:34:02 -06:00
|
|
|
class GLVertexFormat : public NativeVertexFormat
|
|
|
|
{
|
|
|
|
public:
|
2015-11-21 02:32:07 -07:00
|
|
|
GLVertexFormat(const PortableVertexDeclaration& vtx_decl);
|
2012-10-26 08:34:02 -06:00
|
|
|
~GLVertexFormat();
|
|
|
|
|
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
|
|
|
|
2008-10-25 06:35:55 -06:00
|
|
|
// Handles the OpenGL details of drawing lots of vertices quickly.
|
|
|
|
// Other functionality is moving out.
|
2019-02-14 18:59:50 -07:00
|
|
|
class VertexManager final : public VertexManagerBase
|
2008-10-17 05:30:14 -06:00
|
|
|
{
|
2010-10-02 18:41:06 -06:00
|
|
|
public:
|
|
|
|
VertexManager();
|
2019-02-14 18:59:50 -07:00
|
|
|
~VertexManager() override;
|
2017-02-18 01:14:30 -07:00
|
|
|
|
2019-02-14 18:59:50 -07:00
|
|
|
bool Initialize() override;
|
2017-02-18 01:14:30 -07:00
|
|
|
|
2018-11-27 00:16:53 -07:00
|
|
|
void UploadUtilityUniforms(const void* uniforms, u32 uniforms_size) override;
|
2019-02-14 18:59:50 -07:00
|
|
|
bool UploadTexelBuffer(const void* data, u32 data_size, TexelBufferFormat format,
|
|
|
|
u32* out_offset) override;
|
|
|
|
bool UploadTexelBuffer(const void* data, u32 data_size, TexelBufferFormat format, u32* out_offset,
|
|
|
|
const void* palette_data, u32 palette_size,
|
|
|
|
TexelBufferFormat palette_format, u32* out_palette_offset) override;
|
2016-06-24 02:43:46 -06:00
|
|
|
|
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:
|
2019-02-14 18:59:50 -07:00
|
|
|
void ResetBuffer(u32 vertex_stride) override;
|
2018-11-27 00:16:53 -07:00
|
|
|
void CommitBuffer(u32 num_vertices, u32 vertex_stride, u32 num_indices, u32* out_base_vertex,
|
|
|
|
u32* out_base_index) override;
|
2019-02-14 18:59:50 -07:00
|
|
|
void UploadUniforms() override;
|
2014-12-26 01:25:24 -07:00
|
|
|
|
2010-10-02 18:41:06 -06:00
|
|
|
private:
|
2018-11-27 00:16:53 -07:00
|
|
|
std::unique_ptr<StreamBuffer> m_vertex_buffer;
|
|
|
|
std::unique_ptr<StreamBuffer> m_index_buffer;
|
2019-02-14 18:59:50 -07:00
|
|
|
std::unique_ptr<StreamBuffer> m_texel_buffer;
|
|
|
|
std::array<GLuint, NUM_TEXEL_BUFFER_FORMATS> m_texel_buffer_views{};
|
2008-10-17 05:30:14 -06:00
|
|
|
};
|
2018-11-27 00:16:53 -07:00
|
|
|
} // namespace OGL
|