mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-28 10:41:52 +01:00
rasterizer_cache: Handle texture cubes with duplicate faces (#6710)
This commit is contained in:
parent
a9e390b1b1
commit
b5e1a27a7e
@ -10,6 +10,7 @@
|
||||
#include "common/alignment.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/microprofile.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/settings.h"
|
||||
#include "core/memory.h"
|
||||
#include "video_core/custom_textures/custom_tex_manager.h"
|
||||
@ -1367,24 +1368,26 @@ void RasterizerCache<T>::UnregisterSurface(SurfaceId surface_id) {
|
||||
surfaces.erase(vector_it);
|
||||
});
|
||||
|
||||
if (True(surface.flags & SurfaceFlagBits::Tracked)) {
|
||||
auto it = texture_cube_cache.begin();
|
||||
while (it != texture_cube_cache.end()) {
|
||||
std::array<SurfaceId, 6>& face_ids = it->second.face_ids;
|
||||
const auto array_it = std::find(face_ids.begin(), face_ids.end(), surface_id);
|
||||
if (array_it != face_ids.end()) {
|
||||
*array_it = SurfaceId{};
|
||||
}
|
||||
if (std::none_of(face_ids.begin(), face_ids.end(), [](SurfaceId id) { return id; })) {
|
||||
slot_surfaces.erase(it->second.surface_id);
|
||||
it = texture_cube_cache.erase(it);
|
||||
continue;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
SCOPE_EXIT({ slot_surfaces.erase(surface_id); });
|
||||
|
||||
if (False(surface.flags & SurfaceFlagBits::Tracked)) {
|
||||
return;
|
||||
}
|
||||
|
||||
slot_surfaces.erase(surface_id);
|
||||
std::erase_if(texture_cube_cache, [&](auto& pair) {
|
||||
TextureCube& cube = pair.second;
|
||||
for (SurfaceId& face_id : cube.face_ids) {
|
||||
if (face_id == surface_id) {
|
||||
face_id = SurfaceId{};
|
||||
}
|
||||
}
|
||||
if (std::none_of(cube.face_ids.begin(), cube.face_ids.end(),
|
||||
[](SurfaceId id) { return id; })) {
|
||||
slot_surfaces.erase(cube.surface_id);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
Loading…
Reference in New Issue
Block a user