mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
vk: Fix image view search and destroy
This commit is contained in:
parent
64616f1408
commit
7530b3c971
2 changed files with 12 additions and 4 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "image.h"
|
||||
#include "image_helpers.h"
|
||||
|
||||
#include "../VKResourceManager.h"
|
||||
#include <memory>
|
||||
|
||||
namespace vk
|
||||
|
@ -391,11 +392,11 @@ namespace vk
|
|||
}
|
||||
}
|
||||
|
||||
const auto storage_key = remap_encoding | (mask << 16);
|
||||
const u64 storage_key = remap_encoding | (static_cast<u64>(mask) << 32);
|
||||
auto found = views.find(storage_key);
|
||||
if (found != views.end() &&
|
||||
found->second->info.subresourceRange.aspectMask & mask)
|
||||
if (found != views.end())
|
||||
{
|
||||
ensure(found->second->info.subresourceRange.aspectMask & mask);
|
||||
return found->second.get();
|
||||
}
|
||||
|
||||
|
@ -434,6 +435,13 @@ namespace vk
|
|||
new_layout.a != native_component_map.a)
|
||||
{
|
||||
native_component_map = new_layout;
|
||||
|
||||
// Safely discard existing views
|
||||
auto gc = vk::get_resource_manager();
|
||||
for (auto& p : views)
|
||||
{
|
||||
gc->dispose(p.second);
|
||||
}
|
||||
views.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace vk
|
|||
class viewable_image : public image
|
||||
{
|
||||
protected:
|
||||
std::unordered_map<u32, std::unique_ptr<vk::image_view>> views;
|
||||
std::unordered_map<u64, std::unique_ptr<vk::image_view>> views;
|
||||
viewable_image* clone();
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Reference in a new issue