mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-03 11:13:44 +01:00
Vulkan: Fix ordering issue in tex loading - decided on color swizzle too early
This commit is contained in:
1 parent
9993df5e77
commit
f70d233511
1 file changed
+8
-8
@@ -478,14 +478,6 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
||||
entry->vkTex = new VulkanTexture(vulkan, texName);
|
||||
VulkanTexture *image = entry->vkTex;
|
||||
|
||||
const VkComponentMapping *mapping;
|
||||
switch (actualFmt) {
|
||||
case VULKAN_4444_FORMAT: mapping = &VULKAN_4444_SWIZZLE; break;
|
||||
case VULKAN_1555_FORMAT: mapping = &VULKAN_1555_SWIZZLE; break;
|
||||
case VULKAN_565_FORMAT: mapping = &VULKAN_565_SWIZZLE; break;
|
||||
default: mapping = &VULKAN_8888_SWIZZLE; break; // no swizzle
|
||||
}
|
||||
|
||||
VkImageLayout imageLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||
VkImageUsageFlags usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
|
||||
@@ -506,6 +498,14 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
||||
actualFmt = VULKAN_8888_FORMAT;
|
||||
}
|
||||
|
||||
const VkComponentMapping *mapping;
|
||||
switch (actualFmt) {
|
||||
case VULKAN_4444_FORMAT: mapping = &VULKAN_4444_SWIZZLE; break;
|
||||
case VULKAN_1555_FORMAT: mapping = &VULKAN_1555_SWIZZLE; break;
|
||||
case VULKAN_565_FORMAT: mapping = &VULKAN_565_SWIZZLE; break;
|
||||
default: mapping = &VULKAN_8888_SWIZZLE; break; // no swizzle
|
||||
}
|
||||
|
||||
bool allocSuccess = image->CreateDirect(cmdInit, plan.createW, plan.createH, plan.depth, plan.levelsToCreate, actualFmt, imageLayout, usage, mapping);
|
||||
if (!allocSuccess && !lowMemoryMode_) {
|
||||
WARN_LOG_REPORT(G3D, "Texture cache ran out of GPU memory; switching to low memory mode");
|
||||
|
||||
Reference in new issue
Block a user