|
2 | 2 | // See the LICENCE file in the repository root for full licence text. |
3 | 3 |
|
4 | 4 | #include "vulkan_bridge.h" |
| 5 | +#include <android/log.h> |
5 | 6 | #include <vector> |
6 | 7 | #include <cstring> |
7 | | -#include <android/log.h> |
| 8 | +#include <new> |
8 | 9 |
|
9 | | -#define LOG_TAG "osu!native-vulkan" |
| 10 | +#define LOG_TAG "osu_native" |
10 | 11 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) |
| 12 | +#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) |
11 | 13 |
|
12 | 14 | VulkanProbe::VulkanProbe() { |
13 | | - if (createInstance()) { |
14 | | - available_ = queryDevice(); |
| 15 | + if (!createInstance()) { |
| 16 | + LOGE("Failed to create Vulkan instance for probing"); |
| 17 | + return; |
15 | 18 | } |
16 | 19 |
|
17 | | - if (!available_) { |
| 20 | + if (!queryDevice()) { |
| 21 | + LOGE("Failed to query Vulkan physical device info"); |
18 | 22 | cleanup(); |
| 23 | + return; |
19 | 24 | } |
20 | 25 |
|
| 26 | + available_ = true; |
| 27 | + |
21 | 28 | if (available_) { |
22 | 29 | LOGI("Vulkan available: %s (Vendor: 0x%x, API %u.%u.%u, driver %u, VRAM %u MB, " |
23 | | - "queues %u, mailbox=%d, vk1.3=%d, sync2=%d, presentWait=%d, gpl=%d, shaderObj=%d, priority=%d)", |
| 30 | + "qCount %u, mailbox %d, vk1.3 %d, sync2 %d, pWait %d, gpl %d, sObj %d, gPrio %d)", |
24 | 31 | deviceInfo_.deviceName.c_str(), |
25 | 32 | deviceInfo_.vendorId, |
26 | 33 | VK_VERSION_MAJOR(deviceInfo_.apiVersion), |
@@ -155,14 +162,16 @@ void VulkanProbe::queryModernExtensions(VkPhysicalDevice device) { |
155 | 162 | if (strcmp(ext.extensionName, VK_EXT_SHADER_OBJECT_EXTENSION_NAME) == 0) deviceInfo_.supportsShaderObject = true; |
156 | 163 | if (strcmp(ext.extensionName, VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME) == 0 || strcmp(ext.extensionName, VK_KHR_GLOBAL_PRIORITY_EXTENSION_NAME) == 0) deviceInfo_.supportsGlobalPriority = true; |
157 | 164 | if (strcmp(ext.extensionName, VK_EXT_MEMORY_BUDGET_EXTENSION_NAME) == 0) deviceInfo_.supportsMemoryBudget = true; |
| 165 | + if (strcmp(ext.extensionName, "VK_EXT_surface_maintenance1") == 0) deviceInfo_.supportsSurfaceMaintenance1 = true; |
158 | 166 | } |
159 | 167 |
|
160 | | - // Adreno 740 (S23 Ultra) known flickering issues with present_id/wait extensions. |
161 | | - // Adreno vendor ID is 0x5143 (Qualcomm). |
162 | | - if (deviceInfo_.vendorId == 0x5143 && (deviceInfo_.deviceName.find("740") != std::string::npos || deviceInfo_.deviceName.find("Adreno") != std::string::npos)) { |
163 | | - LOGI("Adreno GPU detected: disabling present_id and present_wait to prevent flickering/glitching"); |
164 | | - deviceInfo_.supportsPresentId = false; |
165 | | - deviceInfo_.supportsPresentWait = false; |
| 168 | + if (deviceInfo_.vendorId == 0x5143 && (deviceInfo_.deviceName.find("740") != std::string::npos || |
| 169 | + deviceInfo_.deviceName.find("750") != std::string::npos || |
| 170 | + deviceInfo_.deviceName.find("Adreno") != std::string::npos)) { |
| 171 | + LOGI("Adreno 7xx GPU detected: applying aggressive performance and flickering overrides"); |
| 172 | + deviceInfo_.disablePresentId = true; |
| 173 | + deviceInfo_.disablePresentWait = true; |
| 174 | + deviceInfo_.disableGraphicsPipelineLibrary = true; |
166 | 175 | } |
167 | 176 | } |
168 | 177 |
|
@@ -208,4 +217,8 @@ OSU_EXPORT byte nVulkanSupportsGraphicsPipelineLibrary(intptr_t ptr) { return (p |
208 | 217 | OSU_EXPORT byte nVulkanSupportsShaderObject(intptr_t ptr) { return (ptr && reinterpret_cast<VulkanProbe*>(ptr)->getDeviceInfo().supportsShaderObject) ? 1 : 0; } |
209 | 218 | OSU_EXPORT byte nVulkanSupportsGlobalPriority(intptr_t ptr) { return (ptr && reinterpret_cast<VulkanProbe*>(ptr)->getDeviceInfo().supportsGlobalPriority) ? 1 : 0; } |
210 | 219 | OSU_EXPORT byte nVulkanSupportsMemoryBudget(intptr_t ptr) { return (ptr && reinterpret_cast<VulkanProbe*>(ptr)->getDeviceInfo().supportsMemoryBudget) ? 1 : 0; } |
| 220 | +OSU_EXPORT byte nVulkanSupportsSurfaceMaintenance1(intptr_t ptr) { return (ptr && reinterpret_cast<VulkanProbe*>(ptr)->getDeviceInfo().supportsSurfaceMaintenance1) ? 1 : 0; } |
| 221 | +OSU_EXPORT byte nVulkanDisablePresentId(intptr_t ptr) { return (ptr && reinterpret_cast<VulkanProbe*>(ptr)->getDeviceInfo().disablePresentId) ? 1 : 0; } |
| 222 | +OSU_EXPORT byte nVulkanDisablePresentWait(intptr_t ptr) { return (ptr && reinterpret_cast<VulkanProbe*>(ptr)->getDeviceInfo().disablePresentWait) ? 1 : 0; } |
| 223 | +OSU_EXPORT byte nVulkanDisableGraphicsPipelineLibrary(intptr_t ptr) { return (ptr && reinterpret_cast<VulkanProbe*>(ptr)->getDeviceInfo().disableGraphicsPipelineLibrary) ? 1 : 0; } |
211 | 224 | } |
0 commit comments