Fix error handling on texture creation failure

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

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;
}
}

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_;