Skip to content

Commit

Permalink
Merge pull request #12237 from hrydgard/vulkan-device-name-blacklist
Browse files Browse the repository at this point in the history
Vulkan: Simple blacklist of device names that are not allowed to check for Vulkan
  • Loading branch information
unknownbrackets authored Aug 14, 2019
2 parents f52cc59 + 44cb991 commit 9f694af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Common/Vulkan/VulkanLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@

#include "Common/Vulkan/VulkanLoader.h"
#include <vector>
#include <string>

#include "base/logging.h"
#include "base/basictypes.h"
#include "base/NativeApp.h"

#ifndef _WIN32
#include <dlfcn.h>
Expand Down Expand Up @@ -227,6 +230,10 @@ bool g_vulkanMayBeAvailable = false;

#define LOAD_GLOBAL_FUNC_LOCAL(lib, x) (PFN_ ## x)dlsym(lib, #x);

static const char *device_name_blacklist[] = {
"SHIELD Tablet",
};

static const char *so_names[] = {
"libvulkan.so",
"libvulkan.so.1",
Expand All @@ -240,6 +247,16 @@ void VulkanSetAvailable(bool available) {
bool VulkanMayBeAvailable() {
if (g_vulkanAvailabilityChecked)
return g_vulkanMayBeAvailable;

std::string name = System_GetProperty(SYSPROP_NAME);
for (const char *blacklisted_name : device_name_blacklist) {
if (!strcmp(name.c_str(), blacklisted_name)) {
g_vulkanAvailabilityChecked = true;
g_vulkanMayBeAvailable = false;
return false;
}
}

#ifndef _WIN32
void *lib = nullptr;
for (int i = 0; i < ARRAY_SIZE(so_names); i++) {
Expand Down
2 changes: 2 additions & 0 deletions android/jni/app-android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_init
systemName = GetJavaString(env, jmodel);
langRegion = GetJavaString(env, jlangRegion);

ILOG("NativeApp.init(): device name: '%s'", systemName.c_str());

std::string externalDir = GetJavaString(env, jexternalDir);
std::string user_data_path = GetJavaString(env, jdataDir);
if (user_data_path.size() > 0)
Expand Down

0 comments on commit 9f694af

Please sign in to comment.