Skip to content
Permalink
Browse files

Merge pull request #12237 from hrydgard/vulkan-device-name-blacklist

Vulkan: Simple blacklist of device names that are not allowed to check for Vulkan
  • Loading branch information...
unknownbrackets committed Aug 14, 2019
2 parents f52cc59 + 44cb991 commit 9f694afcc38ae9a061427cad4abf4a1d21889d55
Showing with 19 additions and 0 deletions.
  1. +17 −0 Common/Vulkan/VulkanLoader.cpp
  2. +2 −0 android/jni/app-android.cpp
@@ -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>
@@ -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",
@@ -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++) {
@@ -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)

0 comments on commit 9f694af

Please sign in to comment.
You can’t perform that action at this time.