dolphin/Source/Core/VideoBackends/D3D12/VertexManager.h
Lioncash 1fa81f24d3 VertexManagerBase: Make CreateNativeVertexFormat return a unique_ptr
Much safer as opposed to just returning raw allocated memory.
2017-02-18 03:16:24 -05:00

50 lines
1.1 KiB
C++

// Copyright 2008 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <memory>
#include "VideoCommon/VertexManagerBase.h"
namespace DX12
{
class D3DStreamBuffer;
class VertexManager final : public VertexManagerBase
{
public:
VertexManager();
~VertexManager();
std::unique_ptr<NativeVertexFormat>
CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) override;
void CreateDeviceObjects() override;
void DestroyDeviceObjects() override;
void SetIndexBuffer();
protected:
void ResetBuffer(u32 stride) override;
private:
void PrepareDrawBuffers(u32 stride);
void Draw(u32 stride);
void vFlush() override;
u32 m_vertex_draw_offset;
u32 m_index_draw_offset;
std::unique_ptr<D3DStreamBuffer> m_vertex_stream_buffer;
std::unique_ptr<D3DStreamBuffer> m_index_stream_buffer;
bool m_vertex_stream_buffer_reallocated = false;
bool m_index_stream_buffer_reallocated = false;
std::vector<u8> m_index_cpu_buffer;
std::vector<u8> m_vertex_cpu_buffer;
};
} // namespace