From f2da5dafd11ea689bdc0b7342bbe5d8776814288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 12 Dec 2023 18:19:29 +0100 Subject: [PATCH] Use the universally supported Vulkan "565" 16-bit texture format Previously mistakenly used the BGR format instead of the RGB. Probably won't make much of a difference for anything, but may affect #17881 if my theory about it is correct. Also minor cleanups. --- Core/HLE/sceDisplay.cpp | 2 +- GPU/Vulkan/DrawEngineVulkan.cpp | 5 ----- GPU/Vulkan/GPU_Vulkan.cpp | 8 +++----- GPU/Vulkan/VulkanUtil.cpp | 2 +- GPU/Vulkan/VulkanUtil.h | 3 +-- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 18be5cefc84e..2b3d4b1f7d65 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -599,7 +599,7 @@ void __DisplayFlip(int cyclesLate) { } if (!FrameTimingThrottled()) { - NOTICE_LOG(SYSTEM, "Throttle: %d %d", (int)fastForwardSkipFlip, (int)postEffectRequiresFlip); + // NOTICE_LOG(SYSTEM, "Throttle: %d %d", (int)fastForwardSkipFlip, (int)postEffectRequiresFlip); } const bool fbDirty = gpu->FramebufferDirty(); diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index 670338bbb4d2..3b1ff9ad4bde 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -388,11 +388,6 @@ void DrawEngineVulkan::DoFlush() { gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && ((hasColor && (gstate.materialupdate & 1)) || gstate.getMaterialAmbientA() == 255) && (!gstate.isLightingEnabled() || gstate.getAmbientA() == 255); } - int vcount = indexGen.VertexCount(); - if (numDecodedVerts_ > 10 * vcount) { - decIndex_ = decIndex_; - } - gpuStats.numUncachedVertsDrawn += indexGen.VertexCount(); prim = indexGen.Prim(); // Undo the strip optimization, not supported by the SW code yet. diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 2d977f66d7cf..ae969d2c3d08 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -255,13 +255,11 @@ u32 GPU_Vulkan::CheckGPUFeatures() const { } // These are VULKAN_4444_FORMAT and friends. + // Note that we are now using the correct set of formats - the only cases where some may be missing + // are non-conformant implementations like MoltenVK. uint32_t fmt4444 = draw_->GetDataFormatSupport(Draw::DataFormat::B4G4R4A4_UNORM_PACK16); uint32_t fmt1555 = draw_->GetDataFormatSupport(Draw::DataFormat::A1R5G5B5_UNORM_PACK16); - - // Note that we are (accidentally) using B5G6R5 instead of the mandatory R5G6B5. - // Support is almost as widespread, but not quite. So let's just not use any 16-bit formats - // if it's not available, for simplicity. - uint32_t fmt565 = draw_->GetDataFormatSupport(Draw::DataFormat::B5G6R5_UNORM_PACK16); + uint32_t fmt565 = draw_->GetDataFormatSupport(Draw::DataFormat::R5G6B5_UNORM_PACK16); if ((fmt4444 & Draw::FMT_TEXTURE) && (fmt565 & Draw::FMT_TEXTURE) && (fmt1555 & Draw::FMT_TEXTURE)) { features |= GPU_USE_16BIT_FORMATS; } else { diff --git a/GPU/Vulkan/VulkanUtil.cpp b/GPU/Vulkan/VulkanUtil.cpp index f100ad24db5d..0309c35c20d6 100644 --- a/GPU/Vulkan/VulkanUtil.cpp +++ b/GPU/Vulkan/VulkanUtil.cpp @@ -24,7 +24,7 @@ using namespace PPSSPP_VK; const VkComponentMapping VULKAN_4444_SWIZZLE = { VK_COMPONENT_SWIZZLE_A, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B }; const VkComponentMapping VULKAN_1555_SWIZZLE = { VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_A }; -const VkComponentMapping VULKAN_565_SWIZZLE = { VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY }; +const VkComponentMapping VULKAN_565_SWIZZLE = { VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_IDENTITY }; const VkComponentMapping VULKAN_8888_SWIZZLE = { VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY }; VkShaderModule CompileShaderModule(VulkanContext *vulkan, VkShaderStageFlagBits stage, const char *code, std::string *error) { diff --git a/GPU/Vulkan/VulkanUtil.h b/GPU/Vulkan/VulkanUtil.h index 7cadc957f5ee..1b45dbcec580 100644 --- a/GPU/Vulkan/VulkanUtil.h +++ b/GPU/Vulkan/VulkanUtil.h @@ -32,10 +32,9 @@ extern const VkComponentMapping VULKAN_1555_SWIZZLE; extern const VkComponentMapping VULKAN_565_SWIZZLE; extern const VkComponentMapping VULKAN_8888_SWIZZLE; -// Note: some drivers prefer B4G4R4A4_UNORM_PACK16 over R4G4B4A4_UNORM_PACK16. #define VULKAN_4444_FORMAT VK_FORMAT_B4G4R4A4_UNORM_PACK16 #define VULKAN_1555_FORMAT VK_FORMAT_A1R5G5B5_UNORM_PACK16 -#define VULKAN_565_FORMAT VK_FORMAT_B5G6R5_UNORM_PACK16 // TODO: Does not actually have mandatory support, though R5G6B5 does! See #14602 +#define VULKAN_565_FORMAT VK_FORMAT_R5G6B5_UNORM_PACK16 #define VULKAN_8888_FORMAT VK_FORMAT_R8G8B8A8_UNORM #define VULKAN_CLUT8_FORMAT VK_FORMAT_R8_UNORM