rsx: Apply Clang-Tidy fix "modernize-make-unique"

This commit is contained in:
scribam 2019-06-08 08:47:51 +02:00 committed by kd-11
parent b91bcdbbca
commit a02a8642b0
8 changed files with 54 additions and 54 deletions

View File

@ -29,12 +29,12 @@ u64 GLGSRender::get_cycles()
GLGSRender::GLGSRender() : GSRender()
{
m_shaders_cache.reset(new gl::shader_cache(m_prog_buffer, "opengl", "v1.6"));
m_shaders_cache = std::make_unique<gl::shader_cache>(m_prog_buffer, "opengl", "v1.6");
if (g_cfg.video.disable_vertex_cache)
m_vertex_cache.reset(new gl::null_vertex_cache());
m_vertex_cache = std::make_unique<gl::null_vertex_cache>();
else
m_vertex_cache.reset(new gl::weak_vertex_cache());
m_vertex_cache = std::make_unique<gl::weak_vertex_cache>();
supports_multidraw = true;
supports_native_ui = (bool)g_cfg.misc.use_native_interface;
@ -828,25 +828,25 @@ void GLGSRender::on_init_thread()
LOG_WARNING(RSX, "Using legacy openGL buffers.");
manually_flush_ring_buffers = true;
m_attrib_ring_buffer.reset(new gl::legacy_ring_buffer());
m_transform_constants_buffer.reset(new gl::legacy_ring_buffer());
m_fragment_constants_buffer.reset(new gl::legacy_ring_buffer());
m_fragment_env_buffer.reset(new gl::legacy_ring_buffer());
m_vertex_env_buffer.reset(new gl::legacy_ring_buffer());
m_texture_parameters_buffer.reset(new gl::legacy_ring_buffer());
m_vertex_layout_buffer.reset(new gl::legacy_ring_buffer());
m_index_ring_buffer.reset(new gl::legacy_ring_buffer());
m_attrib_ring_buffer = std::make_unique<gl::legacy_ring_buffer>();
m_transform_constants_buffer = std::make_unique<gl::legacy_ring_buffer>();
m_fragment_constants_buffer = std::make_unique<gl::legacy_ring_buffer>();
m_fragment_env_buffer = std::make_unique<gl::legacy_ring_buffer>();
m_vertex_env_buffer = std::make_unique<gl::legacy_ring_buffer>();
m_texture_parameters_buffer = std::make_unique<gl::legacy_ring_buffer>();
m_vertex_layout_buffer = std::make_unique<gl::legacy_ring_buffer>();
m_index_ring_buffer = std::make_unique<gl::legacy_ring_buffer>();
}
else
{
m_attrib_ring_buffer.reset(new gl::ring_buffer());
m_transform_constants_buffer.reset(new gl::ring_buffer());
m_fragment_constants_buffer.reset(new gl::ring_buffer());
m_fragment_env_buffer.reset(new gl::ring_buffer());
m_vertex_env_buffer.reset(new gl::ring_buffer());
m_texture_parameters_buffer.reset(new gl::ring_buffer());
m_vertex_layout_buffer.reset(new gl::ring_buffer());
m_index_ring_buffer.reset(new gl::ring_buffer());
m_attrib_ring_buffer = std::make_unique<gl::ring_buffer>();
m_transform_constants_buffer = std::make_unique<gl::ring_buffer>();
m_fragment_constants_buffer = std::make_unique<gl::ring_buffer>();
m_fragment_env_buffer = std::make_unique<gl::ring_buffer>();
m_vertex_env_buffer = std::make_unique<gl::ring_buffer>();
m_texture_parameters_buffer = std::make_unique<gl::ring_buffer>();
m_vertex_layout_buffer = std::make_unique<gl::ring_buffer>();
m_index_ring_buffer = std::make_unique<gl::ring_buffer>();
}
m_attrib_ring_buffer->create(gl::buffer::target::texture, 256 * 0x100000);
@ -860,7 +860,7 @@ void GLGSRender::on_init_thread()
if (gl_caps.vendor_AMD)
{
m_identity_index_buffer.reset(new gl::buffer);
m_identity_index_buffer = std::make_unique<gl::buffer>();
m_identity_index_buffer->create(gl::buffer::target::element_array, 1 * 0x100000);
// Initialize with 256k identity entries
@ -1708,7 +1708,7 @@ void GLGSRender::flip(int buffer, bool emu_flip)
if (!m_flip_tex_color || m_flip_tex_color->size2D() != sizei{ (int)buffer_width, (int)buffer_height })
{
m_flip_tex_color.reset(new gl::texture(GL_TEXTURE_2D, buffer_width, buffer_height, 1, 1, GL_RGBA8));
m_flip_tex_color = std::make_unique<gl::texture>(GL_TEXTURE_2D, buffer_width, buffer_height, 1, 1, GL_RGBA8);
}
m_flip_tex_color->copy_from(vm::base(absolute_address), gl::texture::format::bgra, gl::texture::type::uint_8_8_8_8, unpack_settings);

View File

@ -225,7 +225,7 @@ struct gl_render_target_traits
const auto new_w = rsx::apply_resolution_scale(prev.width, true, ref->get_surface_width());
const auto new_h = rsx::apply_resolution_scale(prev.height, true, ref->get_surface_height());
sink.reset(new gl::render_target(new_w, new_h, internal_format));
sink = std::make_unique<gl::render_target>(new_w, new_h, internal_format);
sink->add_ref();
sink->memory_usage_flags = rsx::surface_usage_flags::storage;

View File

@ -522,24 +522,24 @@ VKGSRender::VKGSRender() : GSRender()
if (g_cfg.video.overlay)
{
auto key = vk::get_renderpass_key(m_swapchain->get_surface_format());
m_text_writer.reset(new vk::text_writer());
m_text_writer = std::make_unique<vk::text_writer>();
m_text_writer->init(*m_device, vk::get_renderpass(*m_device, key));
}
m_depth_converter.reset(new vk::depth_convert_pass());
m_depth_converter = std::make_unique<vk::depth_convert_pass>();
m_depth_converter->create(*m_device);
m_attachment_clear_pass.reset(new vk::attachment_clear_pass());
m_attachment_clear_pass = std::make_unique<vk::attachment_clear_pass>();
m_attachment_clear_pass->create(*m_device);
m_prog_buffer.reset(new VKProgramBuffer());
m_prog_buffer = std::make_unique<VKProgramBuffer>();
if (g_cfg.video.disable_vertex_cache)
m_vertex_cache.reset(new vk::null_vertex_cache());
m_vertex_cache = std::make_unique<vk::null_vertex_cache>();
else
m_vertex_cache.reset(new vk::weak_vertex_cache());
m_vertex_cache = std::make_unique<vk::weak_vertex_cache>();
m_shaders_cache.reset(new vk::shader_cache(*m_prog_buffer, "vulkan", "v1.7"));
m_shaders_cache = std::make_unique<vk::shader_cache>(*m_prog_buffer, "vulkan", "v1.7");
open_command_buffer();
@ -561,7 +561,7 @@ VKGSRender::VKGSRender() : GSRender()
m_texture_cache.initialize((*m_device), m_swapchain->get_graphics_queue(),
m_texture_upload_buffer_ring_info);
m_ui_renderer.reset(new vk::ui_overlay_renderer());
m_ui_renderer = std::make_unique<vk::ui_overlay_renderer>();
m_ui_renderer->create(*m_current_command_buffer, m_texture_upload_buffer_ring_info);
supports_multidraw = true;

View File

@ -159,11 +159,11 @@ namespace vk
if (g_null_image_view)
return g_null_image_view.get();
g_null_texture.reset(new image(*g_current_renderer, g_current_renderer->get_memory_mapping().device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
g_null_texture = std::make_unique<image>(*g_current_renderer, g_current_renderer->get_memory_mapping().device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
VK_IMAGE_TYPE_2D, VK_FORMAT_B8G8R8A8_UNORM, 4, 4, 1, 1, 1, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, 0));
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, 0);
g_null_image_view.reset(new image_view(*g_current_renderer, g_null_texture.get()));
g_null_image_view = std::make_unique<image_view>(*g_current_renderer, g_null_texture.get());
// Initialize memory to transparent black
VkClearColorValue clear_color = {};

View File

@ -1290,7 +1290,7 @@ namespace vk
fmt::throw_exception("No compatible memory type was found!" HERE);
}
memory.reset(new memory_block(m_device, memory_reqs.size, memory_reqs.alignment, memory_type_index));
memory = std::make_unique<memory_block>(m_device, memory_reqs.size, memory_reqs.alignment, memory_type_index);
vkBindBufferMemory(dev, value, memory->get_vk_device_memory(), memory->get_vk_device_memory_offset());
}
@ -3156,13 +3156,13 @@ public:
{
LOG_WARNING(RSX, "Buffer usage %u is not heap-compatible using this driver, explicit staging buffer in use", (u32)usage);
shadow.reset(new buffer(*device, size, memory_index, memory_flags, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, 0));
shadow = std::make_unique<buffer>(*device, size, memory_index, memory_flags, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, 0);
usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;
memory_flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
memory_index = memory_map.device_local;
}
heap.reset(new buffer(*device, size, memory_index, memory_flags, usage, 0));
heap = std::make_unique<buffer>(*device, size, memory_index, memory_flags, usage, 0);
}
void destroy()

View File

@ -192,7 +192,7 @@ namespace rsx
VkFormat requested_format = fmt.first;
std::unique_ptr<vk::render_target> rtt;
rtt.reset(new vk::render_target(device, device.get_memory_mapping().device_local,
rtt = std::make_unique<vk::render_target>(device, device.get_memory_mapping().device_local,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
VK_IMAGE_TYPE_2D,
requested_format,
@ -201,7 +201,7 @@ namespace rsx
VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT,
0));
0);
change_image_layout(cmd, rtt.get(), VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, vk::get_image_subresource_range(0, 0, 1, 1, VK_IMAGE_ASPECT_COLOR_BIT));
@ -234,7 +234,7 @@ namespace rsx
const auto scale = rsx::get_resolution_scale();
std::unique_ptr<vk::render_target> ds;
ds.reset(new vk::render_target(device, device.get_memory_mapping().device_local,
ds = std::make_unique<vk::render_target>(device, device.get_memory_mapping().device_local,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
VK_IMAGE_TYPE_2D,
requested_format,
@ -243,7 +243,7 @@ namespace rsx
VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT| VK_IMAGE_USAGE_TRANSFER_SRC_BIT| VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT,
0));
0);
ds->set_format(format);
@ -277,7 +277,7 @@ namespace rsx
const auto new_h = rsx::apply_resolution_scale(prev.height, true, ref->get_surface_height());
auto& dev = cmd.get_command_pool().get_owner();
sink.reset(new vk::render_target(dev, dev.get_memory_mapping().device_local,
sink = std::make_unique<vk::render_target>(dev, dev.get_memory_mapping().device_local,
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
VK_IMAGE_TYPE_2D,
ref->format(),
@ -286,7 +286,7 @@ namespace rsx
VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_TILING_OPTIMAL,
ref->info.usage,
ref->info.flags));
ref->info.flags);
sink->add_ref();
sink->format_info = ref->format_info;

View File

@ -259,8 +259,8 @@ namespace vk
//At worst case, 1 char = 16*16*8 bytes (average about 24*8), so ~256K for 128 chars. Allocating 512k for verts
//uniform params are 8k in size, allocating for 120 lines (max lines at 4k, one column per row. Can be expanded
m_vertex_buffer.reset( new vk::buffer(dev, 524288, dev.get_memory_mapping().host_visible_coherent, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, 0));
m_uniforms_buffer.reset(new vk::buffer(dev, 983040, dev.get_memory_mapping().host_visible_coherent, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 0));
m_vertex_buffer = std::make_unique<vk::buffer>(dev, 524288, dev.get_memory_mapping().host_visible_coherent, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, 0);
m_uniforms_buffer = std::make_unique<vk::buffer>(dev, 983040, dev.get_memory_mapping().host_visible_coherent, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 0);
m_render_pass = render_pass;
m_uniform_buffer_size = 983040;

View File

@ -186,7 +186,7 @@ namespace vk
if (!dma_buffer)
{
auto memory_type = m_device->get_memory_mapping().host_visible_coherent;
dma_buffer.reset(new vk::buffer(*m_device, align(get_section_size(), 256), memory_type, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_BUFFER_USAGE_TRANSFER_DST_BIT, 0));
dma_buffer = std::make_unique<vk::buffer>(*m_device, align(get_section_size(), 256), memory_type, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_BUFFER_USAGE_TRANSFER_DST_BIT, 0);
}
if (context == rsx::texture_upload_context::framebuffer_storage)
@ -690,11 +690,11 @@ namespace vk
VkFormat dst_format = vk::get_compatible_sampler_format(m_formats_support, gcm_format);
VkImageAspectFlags aspect = vk::get_aspect_flags(dst_format);
image.reset(new vk::viewable_image(*vk::get_current_renderer(), m_memory_types.device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
image = std::make_unique<vk::viewable_image>(*vk::get_current_renderer(), m_memory_types.device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
image_type,
dst_format,
w, h, 1, 1, 1, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, image_flags));
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, image_flags);
//This method is almost exclusively used to work on framebuffer resources
//Keep the original swizzle layout unless there is data format conversion
@ -717,7 +717,7 @@ namespace vk
view_swizzle = vk::apply_swizzle_remap({view_swizzle.a, view_swizzle.r, view_swizzle.g, view_swizzle.b}, remap_vector);
VkImageSubresourceRange view_range = { aspect & ~(VK_IMAGE_ASPECT_STENCIL_BIT), 0, 1, 0, 1 };
view.reset(new vk::image_view(*vk::get_current_renderer(), image.get(), view_swizzle, view_range));
view = std::make_unique<vk::image_view>(*vk::get_current_renderer(), image.get(), view_swizzle, view_range);
if (copy)
{
@ -764,14 +764,14 @@ namespace vk
VkFormat dst_format = vk::get_compatible_sampler_format(m_formats_support, gcm_format);
VkImageAspectFlags dst_aspect = vk::get_aspect_flags(dst_format);
image.reset(new vk::viewable_image(*vk::get_current_renderer(), m_memory_types.device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
image = std::make_unique<vk::viewable_image>(*vk::get_current_renderer(), m_memory_types.device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
VK_IMAGE_TYPE_2D,
dst_format,
size, size, 1, 1, 6, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT));
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT);
VkImageSubresourceRange view_range = { dst_aspect & ~(VK_IMAGE_ASPECT_STENCIL_BIT), 0, 1, 0, 6 };
view.reset(new vk::image_view(*vk::get_current_renderer(), image.get(), image->native_component_map, view_range));
view = std::make_unique<vk::image_view>(*vk::get_current_renderer(), image.get(), image->native_component_map, view_range);
VkImageSubresourceRange dst_range = { dst_aspect, 0, 1, 0, 6 };
vk::change_image_layout(cmd, image.get(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, dst_range);
@ -808,14 +808,14 @@ namespace vk
VkFormat dst_format = vk::get_compatible_sampler_format(m_formats_support, gcm_format);
VkImageAspectFlags dst_aspect = vk::get_aspect_flags(dst_format);
image.reset(new vk::viewable_image(*vk::get_current_renderer(), m_memory_types.device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
image = std::make_unique<vk::viewable_image>(*vk::get_current_renderer(), m_memory_types.device_local, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
VK_IMAGE_TYPE_3D,
dst_format,
width, height, depth, 1, 1, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, 0));
VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, 0);
VkImageSubresourceRange view_range = { dst_aspect & ~(VK_IMAGE_ASPECT_STENCIL_BIT), 0, 1, 0, 1 };
view.reset(new vk::image_view(*vk::get_current_renderer(), image.get(), image->native_component_map, view_range));
view = std::make_unique<vk::image_view>(*vk::get_current_renderer(), image.get(), image->native_component_map, view_range);
VkImageSubresourceRange dst_range = { dst_aspect, 0, 1, 0, 1 };
vk::change_image_layout(cmd, image.get(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, dst_range);