Skip to content

Commit

Permalink
Fix error handling on texture creation failure
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Dec 15, 2023
1 parent 773bbbd commit 43a2af4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Common/GPU/Vulkan/thin3d_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 4 additions & 0 deletions Common/Render/ManagedTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down

0 comments on commit 43a2af4

Please sign in to comment.