mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-08 01:00:11 +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.h"
|
||||||
#include "image_helpers.h"
|
#include "image_helpers.h"
|
||||||
|
|
||||||
|
#include "../VKResourceManager.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace vk
|
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);
|
auto found = views.find(storage_key);
|
||||||
if (found != views.end() &&
|
if (found != views.end())
|
||||||
found->second->info.subresourceRange.aspectMask & mask)
|
|
||||||
{
|
{
|
||||||
|
ensure(found->second->info.subresourceRange.aspectMask & mask);
|
||||||
return found->second.get();
|
return found->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,6 +435,13 @@ namespace vk
|
||||||
new_layout.a != native_component_map.a)
|
new_layout.a != native_component_map.a)
|
||||||
{
|
{
|
||||||
native_component_map = new_layout;
|
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();
|
views.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ namespace vk
|
||||||
class viewable_image : public image
|
class viewable_image : public image
|
||||||
{
|
{
|
||||||
protected:
|
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();
|
viewable_image* clone();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue