Skip to content

Commit

Permalink
Merge pull request #18781 from hrydgard/even-more-fixes
Browse files Browse the repository at this point in the history
Disable 16-bit textures on PowerVR with Vulkan
  • Loading branch information
hrydgard authored Jan 29, 2024
2 parents f4b7cfe + c5191ca commit f02142c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
3 changes: 3 additions & 0 deletions Common/GPU/Vulkan/thin3d_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,9 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread)
// Very rough heuristic.
multisampleAllowed = false;
}
} else if (caps_.vendor == GPUVendor::VENDOR_IMGTEC) {
// Not sure about driver versions, so let's just ban, impact is tiny.
bugs_.Infest(Bugs::PVR_BAD_16BIT_TEXFORMATS);
}

if (!vulkan->Extensions().KHR_depth_stencil_resolve) {
Expand Down
1 change: 1 addition & 0 deletions Common/GPU/thin3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ const char *Bugs::GetBugName(uint32_t bug) {
case SUBPASS_FEEDBACK_BROKEN: return "SUBPASS_FEEDBACK_BROKEN";
case GEOMETRY_SHADERS_SLOW_OR_BROKEN: return "GEOMETRY_SHADERS_SLOW_OR_BROKEN";
case ADRENO_RESOURCE_DEADLOCK: return "ADRENO_RESOURCE_DEADLOCK";
case PVR_BAD_16BIT_TEXFORMATS: return "PVR_BAD_16BIT_TEXFORMATS";
default: return "(N/A)";
}
}
Expand Down
1 change: 1 addition & 0 deletions Common/GPU/thin3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ class Bugs {
GEOMETRY_SHADERS_SLOW_OR_BROKEN = 11,
ADRENO_RESOURCE_DEADLOCK = 12,
UNIFORM_INDEXING_BROKEN = 13, // not a properly diagnosed issue, a workaround attempt: #17386
PVR_BAD_16BIT_TEXFORMATS = 14,
MAX_BUG,
};

Expand Down
3 changes: 3 additions & 0 deletions Core/Debugger/MemBlockInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Common/Log.h"
#include "Common/Serialize/Serializer.h"
#include "Common/Serialize/SerializeFuncs.h"
#include "Common/Thread/ThreadUtil.h"
#include "Core/Config.h"
#include "Core/CoreTiming.h"
#include "Core/Debugger/Breakpoints.h"
Expand Down Expand Up @@ -675,6 +676,8 @@ size_t FormatMemWriteTagAtNoFlush(char *buf, size_t sz, const char *prefix, uint
}

static void FlushMemInfoThread() {
SetCurrentThreadName("FlushMemInfo");

while (flushThreadRunning.load()) {
flushThreadPending = false;
FlushPendingMemInfo();
Expand Down
22 changes: 12 additions & 10 deletions GPU/Vulkan/GPU_Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,18 @@ 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);
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 {
INFO_LOG(G3D, "Deficient texture format support: 4444: %d 1555: %d 565: %d", fmt4444, fmt1555, fmt565);
if (!draw_->GetBugs().Has(Draw::Bugs::PVR_BAD_16BIT_TEXFORMATS)) {
// 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);
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 {
INFO_LOG(G3D, "Deficient texture format support: 4444: %d 1555: %d 565: %d", fmt4444, fmt1555, fmt565);
}
}

if (g_Config.bStereoRendering && draw_->GetDeviceCaps().multiViewSupported) {
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ android {
vr {
applicationId 'org.ppsspp.ppssppvr'
dimension "variant"
targetSdkVersion 29
targetSdkVersion 29 // Do not upgrade this, we depend on not requiring scoped storage on Oculus.
externalNativeBuild {
cmake {
// Available arguments listed at https://developer.android.com/ndk/guides/cmake.html
Expand Down

0 comments on commit f02142c

Please sign in to comment.