Ignore patch version when checking compatibility of vulkan layers

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1970233002

Review-Url: https://codereview.chromium.org/1970233002
This commit is contained in:
egdaniel 2016-05-12 11:42:00 -07:00 committed by Commit bot
parent 15332a841d
commit dde2c0356c

View File

@ -32,7 +32,12 @@ static int find_string(const SkTArray<SkString>& strings, const char ext[]) {
#define GET_PROC_LOCAL(inst, F) PFN_vk ## F F = (PFN_vk ## F) vkGetInstanceProcAddr(inst, "vk" #F)
static uint32_t remove_patch_version(uint32_t specVersion) {
return (specVersion >> 12) << 12;
}
bool GrVkExtensions::initInstance(uint32_t specVersion) {
uint32_t nonPatchVersion = remove_patch_version(specVersion);
GET_PROC_LOCAL(nullptr, EnumerateInstanceExtensionProperties);
GET_PROC_LOCAL(nullptr, EnumerateInstanceLayerProperties);
@ -57,7 +62,7 @@ bool GrVkExtensions::initInstance(uint32_t specVersion) {
return false;
}
for (uint32_t i = 0; i < layerCount; ++i) {
if (specVersion >= layers[i].specVersion) {
if (nonPatchVersion >= remove_patch_version(layers[i].specVersion)) {
fInstanceLayerStrings->push_back() = layers[i].layerName;
}
}
@ -80,7 +85,7 @@ bool GrVkExtensions::initInstance(uint32_t specVersion) {
return false;
}
for (uint32_t i = 0; i < extensionCount; ++i) {
if (specVersion >= extensions[i].specVersion) {
if (nonPatchVersion >= remove_patch_version(extensions[i].specVersion)) {
fInstanceExtensionStrings->push_back() = extensions[i].extensionName;
}
}
@ -107,7 +112,7 @@ bool GrVkExtensions::initInstance(uint32_t specVersion) {
}
for (uint32_t i = 0; i < extensionCount; ++i) {
// if not already in the list, add it
if (specVersion >= extensions[i].specVersion &&
if (nonPatchVersion >= remove_patch_version(extensions[i].specVersion) &&
find_string(*fInstanceExtensionStrings, extensions[i].extensionName) < 0) {
fInstanceExtensionStrings->push_back() = extensions[i].extensionName;
SkTQSort(&fInstanceExtensionStrings->front(), &fInstanceExtensionStrings->back(),
@ -121,6 +126,7 @@ bool GrVkExtensions::initInstance(uint32_t specVersion) {
}
bool GrVkExtensions::initDevice(uint32_t specVersion, VkInstance inst, VkPhysicalDevice physDev) {
uint32_t nonPatchVersion = remove_patch_version(specVersion);
GET_PROC_LOCAL(inst, EnumerateDeviceExtensionProperties);
GET_PROC_LOCAL(inst, EnumerateDeviceLayerProperties);
@ -145,7 +151,7 @@ bool GrVkExtensions::initDevice(uint32_t specVersion, VkInstance inst, VkPhysica
return false;
}
for (uint32_t i = 0; i < layerCount; ++i) {
if (specVersion >= layers[i].specVersion) {
if (nonPatchVersion >= remove_patch_version(layers[i].specVersion)) {
fDeviceLayerStrings->push_back() = layers[i].layerName;
}
}
@ -169,7 +175,7 @@ bool GrVkExtensions::initDevice(uint32_t specVersion, VkInstance inst, VkPhysica
return false;
}
for (uint32_t i = 0; i < extensionCount; ++i) {
if (specVersion >= extensions[i].specVersion) {
if (nonPatchVersion >= remove_patch_version(extensions[i].specVersion)) {
fDeviceExtensionStrings->push_back() = extensions[i].extensionName;
}
}
@ -198,7 +204,7 @@ bool GrVkExtensions::initDevice(uint32_t specVersion, VkInstance inst, VkPhysica
}
for (uint32_t i = 0; i < extensionCount; ++i) {
// if not already in the list, add it
if (specVersion >= extensions[i].specVersion &&
if (nonPatchVersion >= remove_patch_version(extensions[i].specVersion) &&
find_string(*fDeviceExtensionStrings, extensions[i].extensionName) < 0) {
fDeviceExtensionStrings->push_back() = extensions[i].extensionName;
SkTQSort(&fDeviceExtensionStrings->front(), &fDeviceExtensionStrings->back(), cmp);