mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-20 22:05:06 +00:00
rsx/vk: Fix bug with custom border color sampler storage
- If an app used multiple border colors, only the first one was being applied.
This commit is contained in:
parent
b30a44c136
commit
0faa8945bc
3 changed files with 21 additions and 13 deletions
|
|
@ -275,7 +275,7 @@ void VKGSRender::load_texture_env()
|
||||||
|
|
||||||
auto get_border_color = [&](const rsx::Texture auto& tex)
|
auto get_border_color = [&](const rsx::Texture auto& tex)
|
||||||
{
|
{
|
||||||
return m_device->get_custom_border_color_support().require_border_color_remap
|
return m_device->get_custom_border_color_support().require_border_color_remap
|
||||||
? tex.remapped_border_color()
|
? tex.remapped_border_color()
|
||||||
: rsx::decode_border_color(tex.border_color());
|
: rsx::decode_border_color(tex.border_color());
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -182,16 +182,8 @@ namespace vk
|
||||||
return found == m_generic_sampler_pool.end() ? nullptr : found->second.get();
|
return found == m_generic_sampler_pool.end() ? nullptr : found->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto block = m_custom_color_sampler_pool.equal_range(key.base_key);
|
const auto found = m_custom_color_sampler_pool.find(key);
|
||||||
for (auto it = block.first; it != block.second; ++it)
|
return found == m_custom_color_sampler_pool.end() ? nullptr : found->second.get();
|
||||||
{
|
|
||||||
if (it->second->key.border_color_key == key.border_color_key)
|
|
||||||
{
|
|
||||||
return it->second.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cached_sampler_object_t* sampler_pool_t::emplace(const sampler_pool_key_t& key, std::unique_ptr<cached_sampler_object_t>& object)
|
cached_sampler_object_t* sampler_pool_t::emplace(const sampler_pool_key_t& key, std::unique_ptr<cached_sampler_object_t>& object)
|
||||||
|
|
@ -204,7 +196,7 @@ namespace vk
|
||||||
return iterator->second.get();
|
return iterator->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto [iterator, _unused] = m_custom_color_sampler_pool.emplace(key.base_key, std::move(object));
|
const auto [iterator, _unused] = m_custom_color_sampler_pool.emplace(key, std::move(object));
|
||||||
return iterator->second.get();
|
return iterator->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,22 @@ namespace vk
|
||||||
{
|
{
|
||||||
u64 base_key;
|
u64 base_key;
|
||||||
u64 border_color_key;
|
u64 border_color_key;
|
||||||
|
|
||||||
|
bool operator == (const sampler_pool_key_t& that) const
|
||||||
|
{
|
||||||
|
return this->base_key == that.base_key &&
|
||||||
|
this->border_color_key == that.border_color_key;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sampler_pool_key_hash
|
||||||
|
{
|
||||||
|
size_t operator()(const vk::sampler_pool_key_t& k) const noexcept
|
||||||
|
{
|
||||||
|
usz result = k.base_key;
|
||||||
|
result ^= k.border_color_key + 0x9e3779b97f4a7c15ULL + (result << 6) + (result >> 2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cached_sampler_object_t : public vk::sampler, public rsx::ref_counted
|
struct cached_sampler_object_t : public vk::sampler, public rsx::ref_counted
|
||||||
|
|
@ -75,7 +91,7 @@ namespace vk
|
||||||
class sampler_pool_t
|
class sampler_pool_t
|
||||||
{
|
{
|
||||||
std::unordered_map<u64, std::unique_ptr<cached_sampler_object_t>> m_generic_sampler_pool;
|
std::unordered_map<u64, std::unique_ptr<cached_sampler_object_t>> m_generic_sampler_pool;
|
||||||
std::unordered_map<u64, std::unique_ptr<cached_sampler_object_t>> m_custom_color_sampler_pool;
|
std::unordered_map<sampler_pool_key_t, std::unique_ptr<cached_sampler_object_t>, sampler_pool_key_hash> m_custom_color_sampler_pool;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue