Fix error handling on texture creation failure

This commit is contained in:
Henrik Rydgård committed 2023-12-15 10:47:20 +01:00
1 parent 773bbbd648
commit 43a2af46ee
2 files changed
+5 -1

No files matched your search

+1 -1
View File
@@ -1298,7 +1298,7 @@ Texture *VKContext::CreateTexture(const TextureDesc &desc) {
return tex;
} else {
ERROR_LOG(G3D, "Failed to create texture");
delete tex;
tex->Release();
return nullptr;
}
}
+4
View File
@@ -194,6 +194,10 @@ Draw::Texture *ManagedTexture::GetTexture() {
}
// Image load is done, texture creation is not.
texture_ = CreateTextureFromTempImage(draw_, pendingImage_, generateMips_, filename_.c_str());
if (!texture_) {
// Failed to create the texture for whatever reason, like dimensions. Don't retry next time.
state_ = LoadState::FAILED;
}
pendingImage_.Free();
}
return texture_;