Skip to content

Commit

Permalink
Vulkan: Simple blacklist of device names that are not allowed to chec…
Browse files Browse the repository at this point in the history
…k for Vulkan. Will help #12093.
  • Loading branch information
hrydgard committed Aug 13, 2019
1 parent 825dac3 commit 8788c1e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Common/Vulkan/VulkanLoader.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@


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

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


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


#define LOAD_GLOBAL_FUNC_LOCAL(lib, x) (PFN_ ## x)dlsym(lib, #x); #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[] = { static const char *so_names[] = {
"libvulkan.so", "libvulkan.so",
"libvulkan.so.1", "libvulkan.so.1",
Expand All @@ -239,6 +246,16 @@ void VulkanSetAvailable(bool available) {
bool VulkanMayBeAvailable() { bool VulkanMayBeAvailable() {
if (g_vulkanAvailabilityChecked) if (g_vulkanAvailabilityChecked)
return g_vulkanMayBeAvailable; return g_vulkanMayBeAvailable;

std::string name = System_GetProperty(SYSPROP_NAME);
for (size_t i = 0; i < ARRAY_SIZE(device_name_blacklist); i++) {
if (name == device_name_blacklist[i]) {
g_vulkanAvailabilityChecked = true;
g_vulkanMayBeAvailable = false;
return false;
}
}

#ifndef _WIN32 #ifndef _WIN32
void *lib = nullptr; void *lib = nullptr;
for (int i = 0; i < ARRAY_SIZE(so_names); i++) { for (int i = 0; i < ARRAY_SIZE(so_names); i++) {
Expand Down

0 comments on commit 8788c1e

Please sign in to comment.