Skip to content

Commit

Permalink
Merge pull request #325 from Crydsch/fix_check_vulkan_version
Browse files Browse the repository at this point in the history
Fix vulkan version parsing
  • Loading branch information
axsaucedo authored May 28, 2023
2 parents e7890bb + cd831a7 commit 63567a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmake/check_vulkan_version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function(check_vulkan_version)
file(STRINGS ${VULKAN_CORE_H} VULKAN_HEADER_VERSION_LINE REGEX "^#define VK_HEADER_VERSION ")
string(REGEX MATCHALL "[0-9]+" VULKAN_HEADER_VERSION "${VULKAN_HEADER_VERSION_LINE}")
file(STRINGS ${VULKAN_CORE_H} VULKAN_HEADER_VERSION_LINE2 REGEX "^#define VK_HEADER_VERSION_COMPLETE ")
if(${VULKAN_HEADER_VERSION_LINE2})
if(NOT ${VULKAN_HEADER_VERSION_LINE2} STREQUAL "")
string(REGEX MATCHALL "[0-9]+" VULKAN_HEADER_VERSION2 "${VULKAN_HEADER_VERSION_LINE2}")
list(LENGTH VULKAN_HEADER_VERSION2 _len)
# Versions >= 1.2.175 have an additional numbers in front of e.g. '0, 1, 2' instead of '1, 2'
Expand Down Expand Up @@ -71,7 +71,7 @@ function(check_vulkan_version)
message(FATAL_ERROR "No GPU supporting Vulkan found in vulkaninfo. Does your GPU (driver) support Vulkan?")
endif()

string(REGEX MATCHALL "apiVersion[ ]*=[ ]*[0-9a-fA-F]+[ ]+[(]([0-9]+[.][0-9]+[.][0-9]+)[)]" GPU_API_VERSIONS ${VULKAN_INFO_OUTPUT})
string(REGEX MATCHALL "apiVersion[ ]*=[ ]*[0-9a-fA-F]*[ ]*[(]*([0-9]+[.][0-9]+[.][0-9]+)[)]*" GPU_API_VERSIONS ${VULKAN_INFO_OUTPUT})
if(NOT GPU_API_VERSIONS)
message(FATAL_ERROR "No valid Vulkan API version found in vulkaninfo. Does your GPU (driver) support Vulkan?")
endif()
Expand All @@ -93,7 +93,7 @@ function(check_vulkan_version)
list(GET GPU_API_VERSIONS ${INDEX} API_VERSION)

# Extract API version
if(${API_VERSION} MATCHES "apiVersion[ ]*=[ ]*[0-9a-fA-F]+[ ]+[(]([0-9]+[.][0-9]+[.][0-9]+)[)]")
if(${API_VERSION} MATCHES "apiVersion[ ]*=[ ]*[0-9a-fA-F]*[ ]*[(]*([0-9]+[.][0-9]+[.][0-9]+)[)]*")
set(VULKAN_DRIVER_VERSION ${CMAKE_MATCH_1})
else()
message(FATAL_ERROR "API version match failed. This should not have happened...")
Expand Down

0 comments on commit 63567a7

Please sign in to comment.