vk: Reuse discarded memory whenever possible instead of recreating new

objects
- Memory allocations are surprisingly expensive when spammed
This commit is contained in:
kd-11 2019-07-01 14:09:44 +03:00 committed by kd-11
parent 71e809a78b
commit ad10eb391e
5 changed files with 155 additions and 88 deletions

View file

@ -796,3 +796,17 @@ size_t get_texture_size(const rsx::vertex_texture &texture)
return get_texture_size(texture.format(), texture.width(), texture.height(), texture.depth(),
texture.pitch(), texture.get_exact_mipmap_count(), texture.cubemap() ? 6 : 1);
}
u32 get_remap_encoding(const std::pair<std::array<u8, 4>, std::array<u8, 4>>& remap)
{
u32 encode = 0;
encode |= (remap.first[0] << 0);
encode |= (remap.first[1] << 2);
encode |= (remap.first[2] << 4);
encode |= (remap.first[3] << 6);
encode |= (remap.second[0] << 8);
encode |= (remap.second[1] << 10);
encode |= (remap.second[2] << 12);
encode |= (remap.second[3] << 14);
return encode;
}