rsx: Optimizations

- Replace a few more vectors with simple_array<T>
- Avoid unnecessary string comparisons in backends. We already know referenced textures from the program analysers!
This commit is contained in:
kd-11 2018-10-20 12:30:03 +03:00 committed by kd-11
parent 677b16f5c6
commit b0a6b72ce8
5 changed files with 10 additions and 8 deletions

View file

@ -400,7 +400,7 @@ void GLGSRender::end()
for (int i = 0; i < rsx::limits::fragment_textures_count; ++i)
{
if (m_program->uniforms.has_location(rsx::constants::fragment_texture_names[i]))
if (current_fp_metadata.referenced_textures_mask & (1 << i))
{
auto sampler_state = static_cast<gl::texture_cache::sampled_image_descriptor*>(fs_sampler_state[i].get());
auto &tex = rsx::method_registers.fragment_textures[i];
@ -436,7 +436,7 @@ void GLGSRender::end()
for (int i = 0; i < rsx::limits::vertex_textures_count; ++i)
{
if (m_program->uniforms.has_location(rsx::constants::vertex_texture_names[i]))
if (current_vp_metadata.referenced_textures_mask & (1 << i))
{
auto sampler_state = static_cast<gl::texture_cache::sampled_image_descriptor*>(vs_sampler_state[i].get());
glActiveTexture(GL_TEXTURE0 + rsx::limits::fragment_textures_count + i);

View file

@ -242,7 +242,7 @@ namespace rsx
if ((cmd & RSX_METHOD_NOP_MASK) == RSX_METHOD_NOP_CMD)
{
if (commands.back().reg != RSX_METHOD_NOP_CMD)
if (commands.empty() || commands.back().reg != RSX_METHOD_NOP_CMD)
{
// Insert one NOP only
commands.push_back({ RSX_METHOD_NOP_CMD, 0, get_pointer });
@ -601,6 +601,7 @@ namespace rsx
{
m_internal_get = m_ctrl->get;
read_ahead(m_fifo_info, m_queue, m_internal_get);
//optimize(m_fifo_info, m_queue);
m_ctrl->get = m_internal_get;
m_ctrl_tag++;

View file

@ -1266,7 +1266,7 @@ void VKGSRender::end()
auto ds = std::get<1>(m_rtts.m_bound_depth_stencil);
//Clear any 'dirty' surfaces - possible is a recycled cache surface is used
std::vector<VkClearAttachment> buffers_to_clear;
rsx::simple_array<VkClearAttachment> buffers_to_clear;
buffers_to_clear.reserve(4);
//Check for memory clears
@ -1510,7 +1510,7 @@ void VKGSRender::end()
for (int i = 0; i < rsx::limits::fragment_textures_count; ++i)
{
if (m_program->has_uniform(rsx::constants::fragment_texture_names[i]))
if (current_fp_metadata.referenced_textures_mask & (1 << i))
{
if (!rsx::method_registers.fragment_textures[i].enabled())
{
@ -1540,7 +1540,7 @@ void VKGSRender::end()
for (int i = 0; i < rsx::limits::vertex_textures_count; ++i)
{
if (m_program->has_uniform(rsx::constants::vertex_texture_names[i]))
if (current_vp_metadata.referenced_textures_mask & (1 << i))
{
if (!rsx::method_registers.vertex_textures[i].enabled())
{

View file

@ -142,7 +142,7 @@ struct command_buffer_chunk: public vk::command_buffer
struct occlusion_data
{
std::vector<u32> indices;
rsx::simple_array<u32> indices;
command_buffer_chunk* command_buffer_to_wait = nullptr;
};

View file

@ -2505,7 +2505,8 @@ public:
}
}
void reset_queries(vk::command_buffer &cmd, std::vector<u32> &list)
template<template<class> class _List>
void reset_queries(vk::command_buffer &cmd, _List<u32> &list)
{
for (const auto index : list)
reset_query(cmd, index);