1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00

rsx: Use clear() instead of resize(0)

The result is the same but clear [1] has slightly less code than resize [2] and signals better the intent IMHO.

[1] fb7fb646fa/libstdc%2B%2B-v3/include/bits/stl_vector.h (L1495)
[2] fb7fb646fa/libstdc%2B%2B-v3/include/bits/stl_vector.h (L934)
This commit is contained in:
scribam 2019-06-01 14:41:02 +02:00 committed by Ivan
parent f90f68d129
commit 78c7ef3039
5 changed files with 12 additions and 12 deletions

View File

@ -263,7 +263,7 @@ namespace rsx
m_size = 0;
m_array_idx = 0;
m_capacity = 0;
m_data.resize(0);
m_data.clear();
m_data_it = m_data.end();
}

View File

@ -535,7 +535,7 @@ namespace gl
void clear_temporary_subresources()
{
m_temporary_surfaces.resize(0);
m_temporary_surfaces.clear();
}
gl::texture_view* create_temporary_subresource_impl(gl::command_context& cmd, gl::texture* src, GLenum sized_internal_fmt, GLenum dst_type, u32 gcm_format,

View File

@ -1244,7 +1244,7 @@ namespace rsx
current_vertex_program.output_mask = rsx::method_registers.vertex_attrib_output_mask();
current_vertex_program.skip_vertex_input_check = skip_vertex_inputs;
current_vertex_program.rsx_vertex_inputs.resize(0);
current_vertex_program.rsx_vertex_inputs.clear();
current_vertex_program.data.reserve(512 * 4);
current_vertex_program.jump_table.clear();
current_vertex_program.texture_dimensions = 0;
@ -2615,7 +2615,7 @@ namespace rsx
m_statistics_map[m_statistics_tag_id] = 1;
verify(HERE), m_pending_writes.front().sink == 0;
m_pending_writes.resize(0);
m_pending_writes.clear();
for (auto &query : m_occlusion_query_data)
{
@ -2752,7 +2752,7 @@ namespace rsx
if (!has_unclaimed)
{
verify(HERE), processed == m_pending_writes.size();
m_pending_writes.resize(0);
m_pending_writes.clear();
}
else
{
@ -2928,7 +2928,7 @@ namespace rsx
}
else
{
m_pending_writes.resize(0);
m_pending_writes.clear();
}
ptimer->async_tasks_pending -= processed;

View File

@ -269,9 +269,9 @@ namespace rsx
void clear()
{
interleaved_blocks.resize(0);
volatile_blocks.resize(0);
referenced_registers.resize(0);
interleaved_blocks.clear();
volatile_blocks.clear();
referenced_registers.clear();
}
bool validate() const

View File

@ -2192,7 +2192,7 @@ public:
for (auto &img : swapchain_images)
img.discard(dev);
swapchain_images.resize(0);
swapchain_images.clear();
}
destroySwapchainKHR(dev, old_swapchain, nullptr);
@ -2285,7 +2285,7 @@ public:
}
m_instance = nullptr;
m_vk_instances.resize(0);
m_vk_instances.clear();
}
void enable_debugging()
@ -3216,7 +3216,7 @@ public:
{
verify (HERE), shadow, heap;
vkCmdCopyBuffer(cmd, shadow->value, heap->value, (u32)dirty_ranges.size(), dirty_ranges.data());
dirty_ranges.resize(0);
dirty_ranges.clear();
insert_buffer_memory_barrier(cmd, heap->value, 0, heap->size(),
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_VERTEX_SHADER_BIT,