D3D12: Get rid of safe deletion macros

Anything these macros provided can be obsoleted by using
the correct standard library types.
This commit is contained in:
Lioncash
2016-02-16 01:21:22 -05:00
parent 626fcf4c15
commit 6b08194728
9 changed files with 63 additions and 58 deletions

View File

@ -2,11 +2,12 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "D3DBase.h"
#include "D3DCommandListManager.h"
#include "D3DStreamBuffer.h"
#include <memory>
#include "ShaderConstantsManager.h"
#include "VideoBackends/D3D12/D3DBase.h"
#include "VideoBackends/D3D12/D3DCommandListManager.h"
#include "VideoBackends/D3D12/D3DStreamBuffer.h"
#include "VideoBackends/D3D12/ShaderConstantsManager.h"
#include "VideoCommon/GeometryShaderManager.h"
#include "VideoCommon/PixelShaderManager.h"
@ -25,7 +26,7 @@ enum SHADER_STAGE
SHADER_STAGE_COUNT = 3
};
static std::array<D3DStreamBuffer*, SHADER_STAGE_COUNT> s_shader_constant_stream_buffers = {};
static std::array<std::unique_ptr<D3DStreamBuffer>, SHADER_STAGE_COUNT> s_shader_constant_stream_buffers;
static const unsigned int s_shader_constant_buffer_padded_sizes[SHADER_STAGE_COUNT] = {
(sizeof(GeometryShaderConstants) + 0xff) & ~0xff,
@ -37,14 +38,14 @@ void ShaderConstantsManager::Init()
{
// Allow a large maximum size, as we want to minimize stalls here
std::generate(std::begin(s_shader_constant_stream_buffers), std::end(s_shader_constant_stream_buffers), []() {
return new D3DStreamBuffer(2 * 1024 * 1024, 64 * 1024 * 1024, nullptr);
return std::make_unique<D3DStreamBuffer>(2 * 1024 * 1024, 64 * 1024 * 1024, nullptr);
});
}
void ShaderConstantsManager::Shutdown()
{
for (auto& it : s_shader_constant_stream_buffers)
SAFE_DELETE(it);
for (auto& buffer : s_shader_constant_stream_buffers)
buffer.reset();
}
bool ShaderConstantsManager::LoadAndSetGeometryShaderConstants()