mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-27 12:45:50 +00:00
VertexManagerBase: Make CreateNativeVertexFormat return a unique_ptr
Much safer as opposed to just returning raw allocated memory.
This commit is contained in:
parent
82734fffaa
commit
1fa81f24d3
15 changed files with 36 additions and 21 deletions
|
@ -81,7 +81,7 @@ public:
|
|||
|
||||
if (!native)
|
||||
{
|
||||
native.reset(g_vertex_manager->CreateNativeVertexFormat(native_vtx_decl));
|
||||
native = g_vertex_manager->CreateNativeVertexFormat(native_vtx_decl);
|
||||
}
|
||||
|
||||
desc.InputLayout = reinterpret_cast<D3DVertexFormat*>(native.get())->GetActiveInputLayout12();
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
|
||||
namespace DX12
|
||||
{
|
||||
NativeVertexFormat*
|
||||
std::unique_ptr<NativeVertexFormat>
|
||||
VertexManager::CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl)
|
||||
{
|
||||
return new D3DVertexFormat(vtx_decl);
|
||||
return std::make_unique<D3DVertexFormat>(vtx_decl);
|
||||
}
|
||||
|
||||
static const constexpr DXGI_FORMAT d3d_format_lookup[5 * 4 * 2] = {
|
||||
|
|
|
@ -17,7 +17,9 @@ public:
|
|||
VertexManager();
|
||||
~VertexManager();
|
||||
|
||||
NativeVertexFormat* CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) override;
|
||||
std::unique_ptr<NativeVertexFormat>
|
||||
CreateNativeVertexFormat(const PortableVertexDeclaration& vtx_decl) override;
|
||||
|
||||
void CreateDeviceObjects() override;
|
||||
void DestroyDeviceObjects() override;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue