mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-09 09:39:44 +00:00
vk: Fix some sampler load crashes
This commit is contained in:
parent
bf78b197a3
commit
98c0944419
3 changed files with 11 additions and 10 deletions
|
@ -136,6 +136,7 @@ namespace vk
|
||||||
|
|
||||||
if (const auto found = m_sampler_pool.find(key))
|
if (const auto found = m_sampler_pool.find(key))
|
||||||
{
|
{
|
||||||
|
found->add_ref();
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,9 +146,8 @@ namespace vk
|
||||||
min_filter, mag_filter, mipmap_mode, border_color,
|
min_filter, mag_filter, mipmap_mode, border_color,
|
||||||
depth_compare, depth_compare_mode);
|
depth_compare, depth_compare_mode);
|
||||||
|
|
||||||
result->add_ref();
|
auto ret = m_sampler_pool.emplace(key, result);
|
||||||
auto ret = result.get();
|
ret->add_ref();
|
||||||
m_sampler_pool.emplace(key, result);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ namespace vk
|
||||||
m_custom_color_sampler_pool.clear();
|
m_custom_color_sampler_pool.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::sampler* sampler_pool_t::find(const sampler_pool_key_t& key) const
|
cached_sampler_object_t* sampler_pool_t::find(const sampler_pool_key_t& key) const
|
||||||
{
|
{
|
||||||
if (!key.border_color_key) [[ likely ]]
|
if (!key.border_color_key) [[ likely ]]
|
||||||
{
|
{
|
||||||
|
@ -174,17 +174,18 @@ namespace vk
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void 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)
|
||||||
{
|
{
|
||||||
object->key = key;
|
object->key = key;
|
||||||
|
|
||||||
if (!key.border_color_key) [[ likely ]]
|
if (!key.border_color_key) [[ likely ]]
|
||||||
{
|
{
|
||||||
m_generic_sampler_pool.emplace(key.base_key, std::move(object));
|
const auto [iterator, _unused] = m_generic_sampler_pool.emplace(key.base_key, std::move(object));
|
||||||
return;
|
return iterator->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_custom_color_sampler_pool.emplace (key.base_key, std::move(object));
|
const auto [iterator, _unused] = m_custom_color_sampler_pool.emplace(key.base_key, std::move(object));
|
||||||
|
return iterator->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::unique_ptr<cached_sampler_object_t>> sampler_pool_t::collect(std::function<bool(const cached_sampler_object_t&)> predicate)
|
std::vector<std::unique_ptr<cached_sampler_object_t>> sampler_pool_t::collect(std::function<bool(const cached_sampler_object_t&)> predicate)
|
||||||
|
|
|
@ -80,9 +80,9 @@ namespace vk
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
vk::sampler* find(const sampler_pool_key_t& key) const;
|
cached_sampler_object_t* find(const sampler_pool_key_t& key) const;
|
||||||
|
|
||||||
void emplace(const sampler_pool_key_t& key, std::unique_ptr<cached_sampler_object_t>& object);
|
cached_sampler_object_t* emplace(const sampler_pool_key_t& key, std::unique_ptr<cached_sampler_object_t>& object);
|
||||||
|
|
||||||
std::vector<std::unique_ptr<cached_sampler_object_t>> collect(std::function<bool(const cached_sampler_object_t&)> predicate);
|
std::vector<std::unique_ptr<cached_sampler_object_t>> collect(std::function<bool(const cached_sampler_object_t&)> predicate);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue