vk: create staging buffer for texture if null

Fixes SF3 double impact crash
better texture cache cleanup
This commit is contained in:
Flyinghead 2020-12-16 14:37:28 +01:00
parent bb5b5d4512
commit 190ab6690a
2 changed files with 13 additions and 0 deletions

View File

@ -254,7 +254,12 @@ void Texture::SetImage(u32 srcSize, void *srcData, bool isNew, bool genMipmaps)
void* data;
if (needsStaging)
{
if (!stagingBufferData)
// This can happen if a texture is first created for RTT, then later updated
stagingBufferData = std::unique_ptr<BufferData>(new BufferData(srcSize, vk::BufferUsageFlagBits::eTransferSrc));
data = stagingBufferData->MapMemory();
}
else
data = allocation.MapMemory();
verify(data != nullptr);

View File

@ -180,6 +180,14 @@ public:
BaseTextureCache::Clear();
for (auto& set : inFlightTextures)
set.clear();
for (auto& v : trashedImageViews)
v.clear();
for (auto& v : trashedImages)
v.clear();
for (auto& v : trashedMem)
v.clear();
for (auto& v : trashedBuffers)
v.clear();
}
private: