mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-27 16:02:37 +00:00
graphics: simplify texture cleanup and swizzle decoding
This commit is contained in:
1 parent
2b3993a595
commit
fde550ef66
2 files changed
+6
-13
No files matched your search
+1
-5
@@ -187,15 +187,11 @@ TextureCache::TextureCache(GraphicContext& graphics, CommandScheduler& scheduler
|
|||||||
}
|
}
|
||||||
|
|
||||||
TextureCache::~TextureCache() {
|
TextureCache::~TextureCache() {
|
||||||
std::vector<ImageId> registered;
|
|
||||||
m_slot_images.ForEach([&](ImageId id, const Image& image) {
|
m_slot_images.ForEach([&](ImageId id, const Image& image) {
|
||||||
if (image.registered) {
|
if (image.registered) {
|
||||||
registered.push_back(id);
|
UnregisterImage(id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for (const auto id: registered) {
|
|
||||||
UnregisterImage(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextureCache::SameBacking(const ImageInfo& cached, const ImageInfo& requested,
|
bool TextureCache::SameBacking(const ImageInfo& cached, const ImageInfo& requested,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "graphics/guest_gpu/gpu_format.h"
|
#include "graphics/guest_gpu/gpu_format.h"
|
||||||
#include "graphics/host_gpu/renderer/image/tiler.h"
|
#include "graphics/host_gpu/renderer/image/tiler.h"
|
||||||
#include "graphics/host_gpu/vulkanCommon.h"
|
#include "graphics/host_gpu/vulkanCommon.h"
|
||||||
|
#include "graphics/shader/shader.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <bit>
|
#include <bit>
|
||||||
@@ -104,18 +105,14 @@ vk::ComponentSwizzle TextureGetComponentSwizzle(uint8_t s) {
|
|||||||
return vk::ComponentSwizzle::eIdentity;
|
return vk::ComponentSwizzle::eIdentity;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t TextureGetDstSel(uint32_t swizzle, uint32_t channel) {
|
|
||||||
return (swizzle >> (channel * 3u)) & 0x7u;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
vk::ComponentMapping TextureGetComponentMapping(uint32_t swizzle) {
|
vk::ComponentMapping TextureGetComponentMapping(uint32_t swizzle) {
|
||||||
vk::ComponentMapping components {};
|
vk::ComponentMapping components {};
|
||||||
components.r = TextureGetComponentSwizzle(static_cast<uint8_t>(TextureGetDstSel(swizzle, 0)));
|
components.r = TextureGetComponentSwizzle(GetDstSel(swizzle, 0));
|
||||||
components.g = TextureGetComponentSwizzle(static_cast<uint8_t>(TextureGetDstSel(swizzle, 1)));
|
components.g = TextureGetComponentSwizzle(GetDstSel(swizzle, 1));
|
||||||
components.b = TextureGetComponentSwizzle(static_cast<uint8_t>(TextureGetDstSel(swizzle, 2)));
|
components.b = TextureGetComponentSwizzle(GetDstSel(swizzle, 2));
|
||||||
components.a = TextureGetComponentSwizzle(static_cast<uint8_t>(TextureGetDstSel(swizzle, 3)));
|
components.a = TextureGetComponentSwizzle(GetDstSel(swizzle, 3));
|
||||||
return components;
|
return components;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user