Skip to content

Commit

Permalink
Merge pull request #18555 from hrydgard/ui-texture-fixes
Browse files Browse the repository at this point in the history
Vulkan: UI texture loading error handling fixes
  • Loading branch information
hrydgard committed Dec 15, 2023
2 parents 773bbbd + 06ba002 commit d61207b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Common/GPU/Vulkan/VulkanImage.cpp
Expand Up @@ -42,7 +42,8 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, int w, int h, int depth, i
ERROR_LOG(G3D, "Can't create a zero-size VulkanTexture");
return false;
}
if (w > 4096 || h > 4096) {
int maxDim = vulkan_->GetPhysicalDeviceProperties(0).properties.limits.maxImageDimension2D;
if (w > maxDim || h > maxDim) {
ERROR_LOG(G3D, "Can't create a texture this large");
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion Common/GPU/Vulkan/thin3d_vulkan.cpp
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
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 d61207b

Please sign in to comment.