[vk, cmake] Bump minimum VulkanTools to 1.4.317 and add UnifiedImageLayouts (#3318)
It seems too easy, the specification does not state anything more to be done for it towork. Requires performance testing on android. Co-authored-by: DraVee <dravee@eden-emu.dev> Co-authored-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3318 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: wildcard <wildcard@eden-emu.dev> Co-committed-by: wildcard <wildcard@eden-emu.dev>
This commit is contained in:
parent
d59fcf01bf
commit
48ba1f3f24
|
|
@ -41,6 +41,11 @@ function(cpm_utils_message level name message)
|
||||||
message(${level} "[CPMUtil] ${name}: ${message}")
|
message(${level} "[CPMUtil] ${name}: ${message}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# propagate a variable to parent scope
|
||||||
|
macro(Propagate var)
|
||||||
|
set(${var} ${${var}} PARENT_SCOPE)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
function(array_to_list array length out)
|
function(array_to_list array length out)
|
||||||
math(EXPR range "${length} - 1")
|
math(EXPR range "${length} - 1")
|
||||||
|
|
||||||
|
|
@ -72,45 +77,68 @@ function(get_json_element object out member default)
|
||||||
set("${out}" "${outvar}" PARENT_SCOPE)
|
set("${out}" "${outvar}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# The preferred usage
|
# Determine whether or not a package has a viable system candidate.
|
||||||
function(AddJsonPackage)
|
function(SystemPackageViable JSON_NAME)
|
||||||
set(oneValueArgs
|
string(JSON object GET "${CPMFILE_CONTENT}" "${JSON_NAME}")
|
||||||
NAME
|
|
||||||
|
|
||||||
# these are overrides that can be generated at runtime,
|
parse_object(${object})
|
||||||
# so can be defined separately from the json
|
|
||||||
DOWNLOAD_ONLY
|
|
||||||
BUNDLED_PACKAGE)
|
|
||||||
|
|
||||||
set(multiValueArgs OPTIONS)
|
string(REPLACE " " ";" find_args "${find_args}")
|
||||||
|
find_package(${package} ${version} ${find_args} QUIET NO_POLICY_SCOPE)
|
||||||
|
|
||||||
cmake_parse_arguments(JSON "" "${oneValueArgs}" "${multiValueArgs}"
|
set(${pkg}_VIABLE ${${package}_FOUND} PARENT_SCOPE)
|
||||||
"${ARGN}")
|
set(${pkg}_PACKAGE ${package} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
list(LENGTH ARGN argnLength)
|
# Add several packages such that if one is bundled,
|
||||||
|
# all the rest must also be bundled.
|
||||||
|
function(AddDependentPackages)
|
||||||
|
set(_some_system OFF)
|
||||||
|
set(_some_bundled OFF)
|
||||||
|
|
||||||
# single name argument
|
foreach(pkg ${ARGN})
|
||||||
if(argnLength EQUAL 1)
|
SystemPackageViable(${pkg})
|
||||||
set(JSON_NAME "${ARGV0}")
|
|
||||||
|
if (${pkg}_VIABLE)
|
||||||
|
set(_some_system ON)
|
||||||
|
list(APPEND _system_pkgs ${${pkg}_PACKAGE})
|
||||||
|
else()
|
||||||
|
set(_some_bundled ON)
|
||||||
|
list(APPEND _bundled_pkgs ${${pkg}_PACKAGE})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if (_some_system AND _some_bundled)
|
||||||
|
foreach(pkg ${ARGN})
|
||||||
|
list(APPEND package_names ${${pkg}_PACKAGE})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
string(REPLACE ";" ", " package_names "${package_names}")
|
||||||
|
string(REPLACE ";" ", " bundled_names "${_bundled_pkgs}")
|
||||||
|
foreach(sys ${_system_pkgs})
|
||||||
|
list(APPEND system_names ${sys}_FORCE_BUNDLED)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
string(REPLACE ";" ", " system_names "${system_names}")
|
||||||
|
|
||||||
|
message(FATAL_ERROR "Partial dependency installation detected "
|
||||||
|
"for the following packages:\n${package_names}\n"
|
||||||
|
"You can solve this in one of two ways:\n"
|
||||||
|
"1. Install the following packages to your system if available:"
|
||||||
|
"\n\t${bundled_names}\n"
|
||||||
|
"2. Set the following variables to ON:"
|
||||||
|
"\n\t${system_names}\n"
|
||||||
|
"This may also be caused by a version mismatch, "
|
||||||
|
"such as one package being newer than the other.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED CPMFILE_CONTENT)
|
foreach(pkg ${ARGN})
|
||||||
cpm_utils_message(WARNING ${name}
|
AddJsonPackage(${pkg})
|
||||||
"No cpmfile, AddJsonPackage is a no-op")
|
endforeach()
|
||||||
return()
|
endfunction()
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT DEFINED JSON_NAME)
|
|
||||||
cpm_utils_message(FATAL_ERROR "json package" "No name specified")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(JSON object ERROR_VARIABLE
|
|
||||||
err GET "${CPMFILE_CONTENT}" "${JSON_NAME}")
|
|
||||||
|
|
||||||
if(err)
|
|
||||||
cpm_utils_message(FATAL_ERROR ${JSON_NAME} "Not found in cpmfile")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
# json util
|
||||||
|
macro(parse_object object)
|
||||||
get_json_element("${object}" package package ${JSON_NAME})
|
get_json_element("${object}" package package ${JSON_NAME})
|
||||||
get_json_element("${object}" repo repo "")
|
get_json_element("${object}" repo repo "")
|
||||||
get_json_element("${object}" ci ci OFF)
|
get_json_element("${object}" ci ci OFF)
|
||||||
|
|
@ -128,27 +156,7 @@ function(AddJsonPackage)
|
||||||
else()
|
else()
|
||||||
set(disabled_platforms "")
|
set(disabled_platforms "")
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
AddCIPackage(
|
|
||||||
VERSION ${version}
|
|
||||||
NAME ${name}
|
|
||||||
REPO ${repo}
|
|
||||||
PACKAGE ${package}
|
|
||||||
EXTENSION ${extension}
|
|
||||||
MIN_VERSION ${min_version}
|
|
||||||
DISABLED_PLATFORMS ${disabled_platforms})
|
|
||||||
|
|
||||||
# pass stuff to parent scope
|
|
||||||
set(${package}_ADDED "${${package}_ADDED}"
|
|
||||||
PARENT_SCOPE)
|
|
||||||
set(${package}_SOURCE_DIR "${${package}_SOURCE_DIR}"
|
|
||||||
PARENT_SCOPE)
|
|
||||||
set(${package}_BINARY_DIR "${${package}_BINARY_DIR}"
|
|
||||||
PARENT_SCOPE)
|
|
||||||
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_json_element("${object}" hash hash "")
|
get_json_element("${object}" hash hash "")
|
||||||
get_json_element("${object}" hash_suffix hash_suffix "")
|
get_json_element("${object}" hash_suffix hash_suffix "")
|
||||||
get_json_element("${object}" sha sha "")
|
get_json_element("${object}" sha sha "")
|
||||||
|
|
@ -181,7 +189,8 @@ function(AddJsonPackage)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(artifact)
|
if(artifact)
|
||||||
string(REPLACE "%VERSION%" "${version_replace}" artifact ${artifact})
|
string(REPLACE "%VERSION%" "${version_replace}"
|
||||||
|
artifact ${artifact})
|
||||||
string(REPLACE "%TAG%" "${tag}" artifact ${artifact})
|
string(REPLACE "%TAG%" "${tag}" artifact ${artifact})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
@ -218,6 +227,65 @@ function(AddJsonPackage)
|
||||||
if(bundled STREQUAL "unset" AND DEFINED JSON_BUNDLED_PACKAGE)
|
if(bundled STREQUAL "unset" AND DEFINED JSON_BUNDLED_PACKAGE)
|
||||||
set(bundled ${JSON_BUNDLED_PACKAGE})
|
set(bundled ${JSON_BUNDLED_PACKAGE})
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# The preferred usage
|
||||||
|
function(AddJsonPackage)
|
||||||
|
set(oneValueArgs
|
||||||
|
NAME
|
||||||
|
|
||||||
|
# these are overrides that can be generated at runtime,
|
||||||
|
# so can be defined separately from the json
|
||||||
|
DOWNLOAD_ONLY
|
||||||
|
BUNDLED_PACKAGE
|
||||||
|
FORCE_BUNDLED_PACKAGE)
|
||||||
|
|
||||||
|
set(multiValueArgs OPTIONS)
|
||||||
|
|
||||||
|
cmake_parse_arguments(JSON "" "${oneValueArgs}" "${multiValueArgs}"
|
||||||
|
"${ARGN}")
|
||||||
|
|
||||||
|
list(LENGTH ARGN argnLength)
|
||||||
|
|
||||||
|
# single name argument
|
||||||
|
if(argnLength EQUAL 1)
|
||||||
|
set(JSON_NAME "${ARGV0}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED CPMFILE_CONTENT)
|
||||||
|
cpm_utils_message(WARNING ${name}
|
||||||
|
"No cpmfile, AddJsonPackage is a no-op")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED JSON_NAME)
|
||||||
|
cpm_utils_message(FATAL_ERROR "json package" "No name specified")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(JSON object ERROR_VARIABLE
|
||||||
|
err GET "${CPMFILE_CONTENT}" "${JSON_NAME}")
|
||||||
|
|
||||||
|
if(err)
|
||||||
|
cpm_utils_message(FATAL_ERROR ${JSON_NAME} "Not found in cpmfile")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
parse_object(${object})
|
||||||
|
|
||||||
|
if(ci)
|
||||||
|
AddCIPackage(
|
||||||
|
VERSION ${version}
|
||||||
|
NAME ${name}
|
||||||
|
REPO ${repo}
|
||||||
|
PACKAGE ${package}
|
||||||
|
EXTENSION ${extension}
|
||||||
|
MIN_VERSION ${min_version}
|
||||||
|
DISABLED_PLATFORMS ${disabled_platforms})
|
||||||
|
|
||||||
|
else()
|
||||||
|
if (NOT DEFINED JSON_FORCE_BUNDLED_PACKAGE)
|
||||||
|
set(JSON_FORCE_BUNDLED_PACKAGE OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
AddPackage(
|
AddPackage(
|
||||||
NAME "${package}"
|
NAME "${package}"
|
||||||
|
|
@ -232,6 +300,7 @@ function(AddJsonPackage)
|
||||||
OPTIONS "${options}"
|
OPTIONS "${options}"
|
||||||
FIND_PACKAGE_ARGUMENTS "${find_args}"
|
FIND_PACKAGE_ARGUMENTS "${find_args}"
|
||||||
BUNDLED_PACKAGE "${bundled}"
|
BUNDLED_PACKAGE "${bundled}"
|
||||||
|
FORCE_BUNDLED_PACKAGE "${JSON_FORCE_BUNDLED_PACKAGE}"
|
||||||
SOURCE_SUBDIR "${source_subdir}"
|
SOURCE_SUBDIR "${source_subdir}"
|
||||||
|
|
||||||
GIT_VERSION ${git_version}
|
GIT_VERSION ${git_version}
|
||||||
|
|
@ -239,15 +308,12 @@ function(AddJsonPackage)
|
||||||
|
|
||||||
ARTIFACT ${artifact}
|
ARTIFACT ${artifact}
|
||||||
TAG ${tag})
|
TAG ${tag})
|
||||||
|
endif()
|
||||||
|
|
||||||
# pass stuff to parent scope
|
# pass stuff to parent scope
|
||||||
set(${package}_ADDED "${${package}_ADDED}"
|
Propagate(${package}_ADDED)
|
||||||
PARENT_SCOPE)
|
Propagate(${package}_SOURCE_DIR)
|
||||||
set(${package}_SOURCE_DIR "${${package}_SOURCE_DIR}"
|
Propagate(${package}_BINARY_DIR)
|
||||||
PARENT_SCOPE)
|
|
||||||
set(${package}_BINARY_DIR "${${package}_BINARY_DIR}"
|
|
||||||
PARENT_SCOPE)
|
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(AddPackage)
|
function(AddPackage)
|
||||||
|
|
@ -343,7 +409,7 @@ function(AddPackage)
|
||||||
|
|
||||||
if(DEFINED PKG_ARGS_ARTIFACT)
|
if(DEFINED PKG_ARGS_ARTIFACT)
|
||||||
set(pkg_url
|
set(pkg_url
|
||||||
${pkg_git_url}/releases/download/${PKG_ARGS_TAG}/${PKG_ARGS_ARTIFACT})
|
"${pkg_git_url}/releases/download/${PKG_ARGS_TAG}/${PKG_ARGS_ARTIFACT}")
|
||||||
else()
|
else()
|
||||||
set(pkg_url
|
set(pkg_url
|
||||||
${pkg_git_url}/archive/refs/tags/${PKG_ARGS_TAG}.tar.gz)
|
${pkg_git_url}/archive/refs/tags/${PKG_ARGS_TAG}.tar.gz)
|
||||||
|
|
@ -625,7 +691,8 @@ function(AddCIPackage)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (DEFINED pkgname AND NOT "${pkgname}" IN_LIST DISABLED_PLATFORMS)
|
if (DEFINED pkgname AND NOT "${pkgname}" IN_LIST DISABLED_PLATFORMS)
|
||||||
set(ARTIFACT "${ARTIFACT_NAME}-${pkgname}-${ARTIFACT_VERSION}.${ARTIFACT_EXT}")
|
set(ARTIFACT
|
||||||
|
"${ARTIFACT_NAME}-${pkgname}-${ARTIFACT_VERSION}.${ARTIFACT_EXT}")
|
||||||
|
|
||||||
AddPackage(
|
AddPackage(
|
||||||
NAME ${ARTIFACT_PACKAGE}
|
NAME ${ARTIFACT_PACKAGE}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
# AddDependentPackage
|
||||||
|
|
||||||
|
Use `AddDependentPackage` when you have multiple packages that are required to all be from the system, OR bundled. This is useful in cases where e.g. versions must absolutely match.
|
||||||
|
|
||||||
|
## Versioning
|
||||||
|
|
||||||
|
Versioning must be handled by the package itself.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Vulkan
|
||||||
|
|
||||||
|
`cpmfile.json`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"vulkan-headers": {
|
||||||
|
"repo": "KhronosGroup/Vulkan-Headers",
|
||||||
|
"package": "VulkanHeaders",
|
||||||
|
"version": "1.4.317",
|
||||||
|
"hash": "26e0ad8fa34ab65a91ca62ddc54cc4410d209a94f64f2817dcdb8061dc621539a4262eab6387e9b9aa421db3dbf2cf8e2a4b041b696d0d03746bae1f25191272",
|
||||||
|
"git_version": "1.4.342",
|
||||||
|
"tag": "v%VERSION%"
|
||||||
|
},
|
||||||
|
"vulkan-utility-libraries": {
|
||||||
|
"repo": "KhronosGroup/Vulkan-Utility-Libraries",
|
||||||
|
"package": "VulkanUtilityLibraries",
|
||||||
|
"hash": "8147370f964fd82c315d6bb89adeda30186098427bf3efaa641d36282d42a263f31e96e4586bfd7ae0410ff015379c19aa4512ba160630444d3d8553afd1ec14",
|
||||||
|
"git_version": "1.4.342",
|
||||||
|
"tag": "v%VERSION%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`CMakeLists.txt`:
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
AddDependentPackages(vulkan-headers vulkan-utility-libraries)
|
||||||
|
```
|
||||||
|
|
||||||
|
If Vulkan Headers are installed, but NOT Vulkan Utility Libraries, then CPMUtil will throw an error.
|
||||||
|
|
@ -31,6 +31,10 @@ The core of CPMUtil is the [`AddPackage`](./AddPackage.md) function. [`AddPackag
|
||||||
|
|
||||||
[`AddJsonPackage`](./AddJsonPackage.md) is the recommended method of usage for CPMUtil.
|
[`AddJsonPackage`](./AddJsonPackage.md) is the recommended method of usage for CPMUtil.
|
||||||
|
|
||||||
|
## AddDependentPackage
|
||||||
|
|
||||||
|
[`AddDependentPackage`](./AddDependentPackage.md) allows you to add multiple packages such that all of them must be from the system OR bundled.
|
||||||
|
|
||||||
## AddQt
|
## AddQt
|
||||||
|
|
||||||
[`AddQt`](./AddQt.md) adds a specific version of Qt to your project.
|
[`AddQt`](./AddQt.md) adds a specific version of Qt to your project.
|
||||||
|
|
|
||||||
|
|
@ -84,13 +84,7 @@ endif()
|
||||||
AddJsonPackage(mcl)
|
AddJsonPackage(mcl)
|
||||||
|
|
||||||
# Vulkan stuff
|
# Vulkan stuff
|
||||||
AddJsonPackage(vulkan-headers)
|
AddDependentPackages(vulkan-headers vulkan-utility-libraries)
|
||||||
AddJsonPackage(vulkan-utility-libraries)
|
|
||||||
|
|
||||||
# small hack
|
|
||||||
if (NOT VulkanUtilityLibraries_ADDED)
|
|
||||||
find_package(VulkanHeaders 1.3.274 REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# frozen
|
# frozen
|
||||||
AddJsonPackage(frozen)
|
AddJsonPackage(frozen)
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@
|
||||||
"vulkan-headers": {
|
"vulkan-headers": {
|
||||||
"repo": "KhronosGroup/Vulkan-Headers",
|
"repo": "KhronosGroup/Vulkan-Headers",
|
||||||
"package": "VulkanHeaders",
|
"package": "VulkanHeaders",
|
||||||
"version": "1.3.274",
|
"version": "1.4.317",
|
||||||
"hash": "26e0ad8fa34ab65a91ca62ddc54cc4410d209a94f64f2817dcdb8061dc621539a4262eab6387e9b9aa421db3dbf2cf8e2a4b041b696d0d03746bae1f25191272",
|
"hash": "26e0ad8fa34ab65a91ca62ddc54cc4410d209a94f64f2817dcdb8061dc621539a4262eab6387e9b9aa421db3dbf2cf8e2a4b041b696d0d03746bae1f25191272",
|
||||||
"git_version": "1.4.342",
|
"git_version": "1.4.342",
|
||||||
"tag": "v%VERSION%"
|
"tag": "v%VERSION%"
|
||||||
|
|
|
||||||
|
|
@ -1230,6 +1230,10 @@ void Device::RemoveUnsuitableExtensions() {
|
||||||
}
|
}
|
||||||
RemoveExtensionFeatureIfUnsuitable(extensions.custom_border_color, features.custom_border_color,
|
RemoveExtensionFeatureIfUnsuitable(extensions.custom_border_color, features.custom_border_color,
|
||||||
VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME);
|
VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME);
|
||||||
|
// VK_KHR_unified_image_layouts
|
||||||
|
extensions.unified_image_layouts = features.unified_image_layouts.unifiedImageLayouts;
|
||||||
|
RemoveExtensionFeatureIfUnsuitable(extensions.unified_image_layouts, features.unified_image_layouts,
|
||||||
|
VK_KHR_UNIFIED_IMAGE_LAYOUTS_EXTENSION_NAME);
|
||||||
|
|
||||||
// VK_EXT_depth_bias_control
|
// VK_EXT_depth_bias_control
|
||||||
extensions.depth_bias_control =
|
extensions.depth_bias_control =
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,9 @@ VK_DEFINE_HANDLE(VmaAllocator)
|
||||||
FEATURE(KHR, PipelineExecutableProperties, PIPELINE_EXECUTABLE_PROPERTIES, \
|
FEATURE(KHR, PipelineExecutableProperties, PIPELINE_EXECUTABLE_PROPERTIES, \
|
||||||
pipeline_executable_properties) \
|
pipeline_executable_properties) \
|
||||||
FEATURE(KHR, WorkgroupMemoryExplicitLayout, WORKGROUP_MEMORY_EXPLICIT_LAYOUT, \
|
FEATURE(KHR, WorkgroupMemoryExplicitLayout, WORKGROUP_MEMORY_EXPLICIT_LAYOUT, \
|
||||||
workgroup_memory_explicit_layout)
|
workgroup_memory_explicit_layout) \
|
||||||
|
FEATURE(KHR, UnifiedImageLayouts, UNIFIED_IMAGE_LAYOUTS, unified_image_layouts)
|
||||||
|
|
||||||
|
|
||||||
// Define miscellaneous extensions which may be used by the implementation here.
|
// Define miscellaneous extensions which may be used by the implementation here.
|
||||||
#define FOR_EACH_VK_EXTENSION(EXTENSION) \
|
#define FOR_EACH_VK_EXTENSION(EXTENSION) \
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ MAXDEPTH=3
|
||||||
# For your project you'll want to change this to define what dirs you have cpmfiles in
|
# For your project you'll want to change this to define what dirs you have cpmfiles in
|
||||||
# Remember to account for the MAXDEPTH variable!
|
# Remember to account for the MAXDEPTH variable!
|
||||||
# Adding ./ before each will help to remove duplicates
|
# Adding ./ before each will help to remove duplicates
|
||||||
CPMFILES=$(find . src -maxdepth "$MAXDEPTH" -name cpmfile.json | sort | uniq)
|
CPMFILES=$(find . -maxdepth "$MAXDEPTH" -name cpmfile.json | sort | uniq)
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
# shellcheck disable=SC2016
|
||||||
PACKAGES=$(echo "$CPMFILES" | xargs jq -s 'reduce .[] as $item ({}; . * $item)')
|
PACKAGES=$(echo "$CPMFILES" | xargs jq -s 'reduce .[] as $item ({}; . * $item)')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue