mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
GPU/TextureCache: Dump textures asynchronously
Saves lagging the emulation.
This commit is contained in:
parent
95797b05f1
commit
6437a5db60
@ -2809,7 +2809,7 @@ void GPUTextureCache::DumpTexture(TextureReplacementType type, u32 offset_x, u32
|
|||||||
SmallString filename = name.ToString();
|
SmallString filename = name.ToString();
|
||||||
filename.append(".png");
|
filename.append(".png");
|
||||||
|
|
||||||
const std::string path = Path::Combine(dump_directory, filename);
|
std::string path = Path::Combine(dump_directory, filename);
|
||||||
if (FileSystem::FileExists(path.c_str()))
|
if (FileSystem::FileExists(path.c_str()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2819,6 +2819,7 @@ void GPUTextureCache::DumpTexture(TextureReplacementType type, u32 offset_x, u32
|
|||||||
GPUTextureCache::DecodeTexture(mode, &g_vram[rect.top * VRAM_WIDTH + rect.left], palette_data, image.GetPixels(),
|
GPUTextureCache::DecodeTexture(mode, &g_vram[rect.top * VRAM_WIDTH + rect.left], palette_data, image.GetPixels(),
|
||||||
image.GetPitch(), width, height, GPUTexture::Format::RGBA8);
|
image.GetPitch(), width, height, GPUTexture::Format::RGBA8);
|
||||||
|
|
||||||
|
System::QueueAsyncTask([path = std::move(path), image = std::move(image), width, height, semitransparent]() mutable {
|
||||||
// TODO: Vectorize this.
|
// TODO: Vectorize this.
|
||||||
u32* image_pixels = reinterpret_cast<u32*>(image.GetPixels());
|
u32* image_pixels = reinterpret_cast<u32*>(image.GetPixels());
|
||||||
const u32* image_pixels_end = image_pixels + (width * height);
|
const u32* image_pixels_end = image_pixels + (width * height);
|
||||||
@ -2852,6 +2853,7 @@ void GPUTextureCache::DumpTexture(TextureReplacementType type, u32 offset_x, u32
|
|||||||
|
|
||||||
if (!image.SaveToFile(path.c_str()))
|
if (!image.SaveToFile(path.c_str()))
|
||||||
ERROR_LOG("Failed to write texture dump to {}.", Path::GetFileName(path));
|
ERROR_LOG("Failed to write texture dump to {}.", Path::GetFileName(path));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GPUTextureCache::IsMatchingReplacementPalette(HashType full_palette_hash, GPUTextureMode mode,
|
bool GPUTextureCache::IsMatchingReplacementPalette(HashType full_palette_hash, GPUTextureMode mode,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user