| @@ -0,0 +1,313 @@ | ||
| ## | ||
| ####################################################################################################################### | ||
| # | ||
| # Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All Rights Reserved. | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included in all | ||
| # copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| # | ||
| ####################################################################################################################### | ||
| include_guard() | ||
|
|
||
| macro(xgl_use_clang_compiler) | ||
| if(UNIX) | ||
| set(CMAKE_CXX_COMPILER_ID "Clang") | ||
| set(CMAKE_C_COMPILER_ID "Clang") | ||
|
|
||
| foreach(major RANGE 6 20) | ||
| find_program(CLANG_VER clang-${major}) | ||
| if(CLANG_VER) | ||
| set(CLANG_VER ${major}) | ||
| # llvm-ar named llvm-ar-6.0 on ubuntu18.04 for version 6 | ||
| if(CLANG_VER EQUAL 6) | ||
| set(CLANG_VER "6.0") | ||
| endif() | ||
| break() | ||
| endif() | ||
| endforeach() | ||
|
|
||
| find_program(CLANG_C_COMPILER clang) | ||
| if (CLANG_C_COMPILER) | ||
| set(CMAKE_C_COMPILER ${CLANG_C_COMPILER} CACHE FILEPATH "" FORCE) | ||
| EXECUTE_PROCESS(COMMAND ${CLANG_C_COMPILER} --version OUTPUT_VARIABLE clang_full_version_string) | ||
| string(REGEX REPLACE ".*clang version ([0-9]+).*" "\\1" CLANG_VER ${clang_full_version_string}) | ||
| # llvm-ar named llvm-ar-6.0 on ubuntu18.04 for version 6 | ||
| if(CLANG_VER EQUAL 6) | ||
| set(CLANG_VER "6.0") | ||
| endif() | ||
| else() | ||
| find_program(CLANG_C_COMPILER clang-${CLANG_VER}) | ||
| if (CLANG_C_COMPILER) | ||
| set(CMAKE_C_COMPILER ${CLANG_C_COMPILER} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| message(FATAL_ERROR "clang cannot be found!") | ||
| endif() | ||
| endif() | ||
|
|
||
| find_program(CLANG_CXX_COMPILER clang++) | ||
| if (CLANG_CXX_COMPILER) | ||
| set(CMAKE_CXX_COMPILER ${CLANG_CXX_COMPILER} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| find_program(CLANG_CXX_COMPILER clang++-${CLANG_VER}) | ||
| if (CLANG_CXX_COMPILER) | ||
| set(CMAKE_CXX_COMPILER ${CLANG_CXX_COMPILER} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| message(FATAL_ERROR "clang++ cannot be found!") | ||
| endif() | ||
| endif() | ||
|
|
||
| find_program(CLANG_AR llvm-ar) | ||
| if (CLANG_AR) | ||
| set(CMAKE_AR ${CLANG_AR} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| find_program(CLANG_AR llvm-ar-${CLANG_VER}) | ||
| if (CLANG_AR) | ||
| set(CMAKE_AR ${CLANG_AR} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| message(FATAL_ERROR "llvm-ar cannot be found!") | ||
| endif() | ||
| endif() | ||
|
|
||
| find_program(CLANG_LINKER llvm-link) | ||
| if (CLANG_LINKER) | ||
| set(CMAKE_LINKER ${CLANG_LINKER} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| find_program(CLANG_LINKER llvm-link-${CLANG_VER}) | ||
| if (CLANG_LINKER) | ||
| set(CMAKE_LINKER ${CLANG_LINKER} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| message(FATAL_ERROR "llvm-link cannot be found!") | ||
| endif() | ||
| endif() | ||
|
|
||
| find_program(CLANG_NM llvm-nm) | ||
| if (CLANG_NM) | ||
| set(CMAKE_NM ${CLANG_NM} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| find_program(CLANG_NM llvm-nm-${CLANG_VER}) | ||
| if (CLANG_NM) | ||
| set(CMAKE_NM ${CLANG_NM} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| message(FATAL_ERROR "llvm-nm cannot be found!") | ||
| endif() | ||
| endif() | ||
|
|
||
| find_program(CLANG_OBJDUMP llvm-objdump) | ||
| if (CLANG_OBJDUMP) | ||
| set(CMAKE_OBJDUMP ${CLANG_OBJDUMP} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| find_program(CLANG_OBJDUMP llvm-objdump-${CLANG_VER}) | ||
| if (CLANG_OBJDUMP) | ||
| set(CMAKE_OBJDUMP ${CLANG_OBJDUMP} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| message(FATAL_ERROR "llvm-objdump cannot be found!") | ||
| endif() | ||
| endif() | ||
|
|
||
| find_program(CLANG_RANLIB llvm-ranlib) | ||
| if (CLANG_RANLIB) | ||
| set(CMAKE_RANLIB ${CLANG_RANLIB} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| find_program(CLANG_RANLIB llvm-ranlib-${CLANG_VER}) | ||
| if (CLANG_RANLIB) | ||
| set(CMAKE_RANLIB ${CLANG_RANLIB} CACHE FILEPATH "" FORCE) | ||
| else() | ||
| message(FATAL_ERROR "llvm-ranlib cannot be found!") | ||
| endif() | ||
| endif() | ||
| endif() | ||
| endmacro() | ||
|
|
||
| macro(xgl_set_compiler) | ||
| # Before GCC7, when LTO is enabled, undefined reference error was observed when linking static libraries. | ||
| # Use the gcc-ar wrapper instead of ar, this invokes ar with the right plugin arguments | ||
| # --plugin /usr/lib/gcc/.../liblto_plugin.so | ||
| if(UNIX) | ||
| if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||
| find_program(GCC_AR gcc-ar) | ||
| if (GCC_AR) | ||
| set(CMAKE_AR ${GCC_AR}) | ||
| else() | ||
| message(FATAL_ERROR "gcc-ar cannot be found!") | ||
| endif() | ||
| find_program(GCC_RANLIB gcc-ranlib) | ||
| if (GCC_RANLIB) | ||
| set(CMAKE_RANLIB ${GCC_RANLIB}) | ||
| else() | ||
| message(FATAL_ERROR "gcc-ranlib cannot be found!") | ||
| endif() | ||
| endif() | ||
| endif() | ||
|
|
||
| # Assertions | ||
| if(XGL_ENABLE_ASSERTIONS) | ||
| # MSVC doesn't like _DEBUG on release builds. | ||
| if(NOT MSVC) | ||
| add_definitions(-D_DEBUG) | ||
| endif() | ||
| # On non-Debug builds CMake automatically defines NDEBUG, so we explicitly undefine it: | ||
| if(NOT CMAKE_BUILD_TYPE_DEBUG) | ||
| add_definitions(-UNDEBUG) | ||
|
|
||
| # Also remove /D NDEBUG to avoid MSVC warnings about conflicting defines. | ||
| foreach(flags_var_to_scrub | ||
| CMAKE_CXX_FLAGS_RELEASE | ||
| CMAKE_CXX_FLAGS_RELWITHDEBINFO | ||
| CMAKE_CXX_FLAGS_MINSIZEREL | ||
| CMAKE_C_FLAGS_RELEASE | ||
| CMAKE_C_FLAGS_RELWITHDEBINFO | ||
| CMAKE_C_FLAGS_MINSIZEREL) | ||
| string(REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " " | ||
| "${flags_var_to_scrub}" "${${flags_var_to_scrub}}") | ||
| endforeach() | ||
| endif() | ||
| endif() | ||
|
|
||
| endmacro() | ||
|
|
||
| function(xgl_compiler_options TARGET) | ||
| # Set the C++ standard | ||
| set_target_properties(${TARGET} PROPERTIES | ||
| CXX_STANDARD 14 | ||
| CXX_STANDARD_REQUIRED ON | ||
| CXX_EXTENSIONS OFF | ||
| POSITION_INDEPENDENT_CODE ON | ||
| ) | ||
|
|
||
| if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") | ||
| target_compile_options(${TARGET} PRIVATE | ||
| -Wall | ||
| -Wextra | ||
|
|
||
| # Don't warn if a structure’s initializer has some fields missing. | ||
| -Wno-missing-field-initializers | ||
|
|
||
| # Disable warnings about bad/undefined pointer arithmetic | ||
| -Wno-pointer-arith | ||
|
|
||
| # Don't warn whenever a switch statement has an index of enumerated type and | ||
| # lacks a case for one or more of the named codes of that enumeration. | ||
| -Wno-switch | ||
|
|
||
| # This turns off a lot of warnings related to unused code | ||
| # -Wunused-but-set-parameter | ||
| # -Wunused-but-set-variable | ||
| # -Wunused-function | ||
| # -Wunused-label | ||
| # -Wunused-local-typedefs | ||
| # -Wunused-parameter | ||
| # -Wno-unused-result | ||
| # -Wunused-variable | ||
| # -Wunused-const-variable | ||
| # -Wunused-value | ||
| -Wno-unused | ||
| ) | ||
|
|
||
| if(ICD_ANALYSIS_WARNINGS_AS_ERRORS) | ||
| target_compile_options(${TARGET} PRIVATE | ||
| -Werror | ||
| -Wno-error=comment | ||
| -Wno-error=delete-non-abstract-non-virtual-dtor | ||
| -Wno-error=ignored-qualifiers | ||
| -Wno-error=missing-braces | ||
| -Wno-error=pointer-arith | ||
| -Wno-error=unused-parameter | ||
| ) | ||
| endif() | ||
|
|
||
| target_compile_options(${TARGET} PRIVATE | ||
| -pthread | ||
|
|
||
| # Disables exception handling | ||
| -fno-exceptions | ||
|
|
||
| # Disable optimizations that assume strict aliasing rules | ||
| -fno-strict-aliasing | ||
|
|
||
| # Doesn’t guarantee the frame pointer is used in all functions. | ||
| -fno-omit-frame-pointer | ||
|
|
||
| # Having simple optimization on results in dramatically smaller debug builds (and they actually build faster). | ||
| # This is mostly due to constant-folding and dead-code-elimination of registers. | ||
| $<$<CONFIG:Debug>: | ||
| -Og | ||
| > | ||
| ) | ||
|
|
||
| target_compile_options(${TARGET} PRIVATE $<$<COMPILE_LANGUAGE:CXX>: | ||
| # Disable run time type information | ||
| # This means breaking dynamic_cast and typeid | ||
| -fno-rtti | ||
|
|
||
| # Do not set errno after calling math functions that are executed with a single instruction | ||
| -fno-math-errno | ||
| >) | ||
|
|
||
| if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
| target_compile_options(${TARGET} PRIVATE | ||
| # Output with color if in terminal: https://github.com/ninja-build/ninja/wiki/FAQ | ||
| -fdiagnostics-color=always | ||
| -mpreferred-stack-boundary=6 | ||
| -fno-threadsafe-statics | ||
| -fmerge-all-constants | ||
| -fms-extensions | ||
| ) | ||
| elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| target_compile_options(${TARGET} PRIVATE | ||
| # Output with color if in terminal: https://github.com/ninja-build/ninja/wiki/FAQ | ||
| -fcolor-diagnostics | ||
|
|
||
| -Wthread-safety | ||
| ) | ||
| endif() | ||
|
|
||
| if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" | ||
| OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7)) | ||
| target_compile_options(${TARGET} PRIVATE | ||
| -fno-delete-null-pointer-checks | ||
| ) | ||
| endif() | ||
|
|
||
| if(TARGET_ARCHITECTURE_BITS EQUAL 32) | ||
| target_compile_options(${TARGET} PRIVATE -msse -msse2) | ||
| endif() | ||
|
|
||
| if(CMAKE_BUILD_TYPE_RELEASE) | ||
| target_compile_options(${TARGET} PRIVATE -O3) | ||
| if(XGL_ENABLE_LTO) | ||
| if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") | ||
| execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) | ||
| if(GCC_VERSION VERSION_GREATER 5.3 OR GCC_VERSION VERSION_EQUAL 5.3) | ||
| # add global definition to enable LTO here since some components have no option | ||
| # to enable it. | ||
| add_definitions("-flto -fuse-linker-plugin -Wno-odr") | ||
| message(WARNING "LTO enabled for ${TARGET}") | ||
| endif() | ||
| elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") | ||
| # add global definition to enable LTO here since some components have no option | ||
| # to enable it. | ||
| add_definitions("-flto=thin") | ||
| message(WARNING "LTO enabled for ${TARGET}") | ||
| endif() | ||
| endif() | ||
| endif() | ||
| else() | ||
| message(FATAL_ERROR "Using unknown compiler") | ||
| endif() | ||
|
|
||
| endfunction() |
| @@ -0,0 +1,104 @@ | ||
| ## | ||
| ####################################################################################################################### | ||
| # | ||
| # Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All Rights Reserved. | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included in all | ||
| # copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| # | ||
| ####################################################################################################################### | ||
| include_guard() | ||
|
|
||
| ### Helper Macros ##################################################################################################### | ||
| macro(target_find_headers _target) | ||
| get_target_property(${_target}_INCLUDES_DIRS ${_target} INCLUDE_DIRECTORIES) | ||
|
|
||
| if(${_target}_INCLUDES_DIRS) | ||
| foreach(_include_dir IN ITEMS ${${_target}_INCLUDES_DIRS}) | ||
| file(GLOB_RECURSE _include_files | ||
| LIST_DIRECTORIES false | ||
| "${_include_dir}/*.h" | ||
| "${_include_dir}/*.hpp" | ||
| ) | ||
|
|
||
| list(APPEND ${_target}_INCLUDES ${_include_files}) | ||
| endforeach() | ||
|
|
||
| target_sources(${_target} PRIVATE ${${_target}_INCLUDES}) | ||
| endif() | ||
| endmacro() | ||
|
|
||
| # Source Groups Helper ############################################################################# | ||
| # This helper creates source groups for generators that support them. This is primarily MSVC and | ||
| # XCode, but there are other generators that support IDE project files. | ||
| # | ||
| # Note: this only adds files that have been added to the target's SOURCES property. To add headers | ||
| # to this list, be sure that you call target_find_headers before you call target_source_groups. | ||
| macro(target_source_groups _target) | ||
| get_target_property(${_target}_SOURCES ${_target} SOURCES) | ||
| foreach(_source IN ITEMS ${${_target}_SOURCES}) | ||
| set(_source ${_source}) | ||
| get_filename_component(_source_path "${_source}" ABSOLUTE) | ||
| file(RELATIVE_PATH _source_path_rel "${PROJECT_SOURCE_DIR}" "${_source_path}") | ||
| get_filename_component(_source_path_rel "${_source_path_rel}" DIRECTORY) | ||
| string(REPLACE "/" "\\" _group_path "${_source_path_rel}") | ||
| source_group("${_group_path}" FILES "${_source}") | ||
| endforeach() | ||
| endmacro() | ||
|
|
||
| macro(xgl_append_common_sanitizer_flags) | ||
| if(NOT MSVC) | ||
| # Append -fno-omit-frame-pointer and turn on debug info to get better stack traces. | ||
| string(APPEND ICD_SANITIZER_COMPILE_FLAGS " -fno-omit-frame-pointer") | ||
| if (NOT CMAKE_BUILD_TYPE_DEBUG) | ||
| string(APPEND ICD_SANITIZER_COMPILE_FLAGS " -gline-tables-only") | ||
| else() | ||
| # Use -O1 even in debug mode, otherwise sanitizers slowdown is too large. | ||
| string(APPEND ICD_SANITIZER_COMPILE_FLAGS " -O1") | ||
| endif() | ||
| elseif(CLANG_CL) | ||
| # Keep frame pointers around. | ||
| string(APPEND ICD_SANITIZER_COMPILE_FLAGS " /Oy-") | ||
| # Always ask the linker to produce symbols with asan. | ||
| string(APPEND ICD_SANITIZER_COMPILE_FLAGS " /Z7") | ||
| string(APPEND ICD_SANITIZER_LINK_FLAGS " -debug") | ||
| endif() | ||
| endmacro() | ||
|
|
||
| macro(xgl_append_gcov_coverage_flags) | ||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") | ||
| # This option is used to compile and link code instrumented for coverage analysis. | ||
| # The option --coverage is a synonym for -fprofile-arcs -ftest-coverage (when compiling) and -lgcov (when linking) | ||
| # Ref link: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#Instrumentation-Options | ||
| string(APPEND ICD_GCOV_COMPILE_FLAGS " --coverage") | ||
| string(APPEND ICD_GCOV_LINK_FLAGS " --coverage") | ||
|
|
||
| if (NOT CMAKE_BUILD_TYPE_DEBUG) | ||
| # Use -O0 even in not debug mode, otherwise code coverage is not accurate. | ||
| string(APPEND ICD_GCOV_COMPILE_FLAGS " -O0") | ||
| endif() | ||
|
|
||
| if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| string(APPEND ICD_GCOV_COMPILE_FLAGS " -Xclang -coverage-cfg-checksum") | ||
| string(APPEND ICD_GCOV_COMPILE_FLAGS " -Xclang -coverage-no-function-names-in-data") | ||
| string(APPEND ICD_GCOV_COMPILE_FLAGS " -Xclang -coverage-version='408*'") | ||
| endif() | ||
| else() | ||
| message(FATAL_ERROR "Unknown compiler ID: ${CMAKE_CXX_COMPILER_ID}") | ||
| endif() | ||
| endmacro() |
| @@ -0,0 +1,83 @@ | ||
| ## | ||
| ####################################################################################################################### | ||
| # | ||
| # Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All Rights Reserved. | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included in all | ||
| # copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| # | ||
| ####################################################################################################################### | ||
| include_guard() | ||
|
|
||
| macro(xgl_options) | ||
|
|
||
| ### Cached Project Options ############################################################################################# | ||
|
|
||
| option(XGL_ENABLE_LTO "Build with LTO enabled?" ON) | ||
|
|
||
| option(XGL_ENABLE_GCOV "Build with gcov source code coverage?" OFF) | ||
|
|
||
| option(XGL_BUILD_VEGA20 "Build open source vulkan for Vega20?" ON) | ||
|
|
||
| option(XGL_BUILD_GFX103 "Build open source vulkan for GFX103" ON) | ||
|
|
||
| option(XGL_BUILD_NAVI22 "Build open source vulkan for Navi22" ON) | ||
|
|
||
| option(XGL_BUILD_LIT "Build with Lit test?" OFF) | ||
|
|
||
| option(XGL_BUILD_CACHE_CREATOR "Build cache-creator tools?" OFF) | ||
|
|
||
| #if VKI_KHR_SHADER_SUBGROUP_EXTENDED_TYPES | ||
| option(VKI_KHR_SHADER_SUBGROUP_EXTENDED_TYPES "Build vulkan with KHR_SHADER_SUBGROUP_EXTENDED_TYPES" OFF) | ||
| #endif | ||
|
|
||
| #if VKI_EXPOSE_SW_DECOMPRESS | ||
| option(VKI_EXPOSE_SW_DECOMPRESS "Expose SW_DECOMPRESS" OFF) | ||
| #endif | ||
|
|
||
| #if VKI_3RD_PARTY_IP_PROPERTY_ID | ||
| option(VKI_3RD_PARTY_IP_PROPERTY_ID "Build vulkan with 3RD_PARTY_IP_PROPERTY_ID" OFF) | ||
| #endif | ||
|
|
||
| #if VKI_EXT_EXTENDED_DYNAMIC_STATE | ||
| option(VKI_EXT_EXTENDED_DYNAMIC_STATE "Build vulkan with EXTENDED_DYNAMIC_STATE extention" OFF) | ||
| #endif | ||
|
|
||
| option(ICD_BUILD_LLPC "Build LLPC?" ON) | ||
|
|
||
| option(ICD_BUILD_LLPCONLY "Build LLPC Only?" OFF) | ||
|
|
||
| option(XGL_LLVM_UPSTREAM "Build with upstreamed LLVM?" OFF) | ||
|
|
||
| option(XGL_ENABLE_ASSERTIONS "Enable assertions in release builds" OFF) | ||
|
|
||
| option(ICD_GPUOPEN_DEVMODE_BUILD "Build ${PROJECT_NAME} with GPU Open Developer Mode driver support?" ON) | ||
|
|
||
| option(ICD_MEMTRACK "Turn on memory tracking?" ${CMAKE_BUILD_TYPE_DEBUG}) | ||
|
|
||
| if (NOT WIN32) | ||
| option(BUILD_WAYLAND_SUPPORT "Build XGL with Wayland support" ON) | ||
|
|
||
| option(BUILD_XLIB_XRANDR_SUPPORT "Build Xlib with xrandr 1.6 support" OFF) | ||
|
|
||
| option(BUILD_DRI3_SUPPORT "Build XGL with Dri3 support" ON) | ||
| endif() | ||
|
|
||
| option(ICD_ANALYSIS_WARNINGS_AS_ERRORS "Warnings as errors?" OFF) | ||
|
|
||
| endmacro() |
| @@ -0,0 +1,233 @@ | ||
| ## | ||
| ####################################################################################################################### | ||
| # | ||
| # Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All Rights Reserved. | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included in all | ||
| # copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| # | ||
| ####################################################################################################################### | ||
| include_guard() | ||
|
|
||
| macro(xgl_get_version) | ||
|
|
||
| # This will become the value of PAL_CLIENT_INTERFACE_MAJOR_VERSION. It describes the version of the PAL interface | ||
| # that the ICD supports. PAL uses this value to enable backwards-compatibility for older interface versions. It must | ||
| # be updated on each PAL promotion after handling all of the interface changes described in palLib.h. | ||
| file(STRINGS icd/make/importdefs PAL_MAJOR_VERSION REGEX "^ICD_PAL_CLIENT_MAJOR_VERSION = [0-9]+") | ||
|
|
||
| if(PAL_MAJOR_VERSION STREQUAL "") | ||
| message(STATUS "Failed to find ICD_PAL_CLIENT_MAJOR_VERSION") | ||
| else() | ||
| string(REGEX REPLACE "ICD_PAL_CLIENT_MAJOR_VERSION = " "" PAL_MAJOR_VERSION ${PAL_MAJOR_VERSION}) | ||
| message(STATUS "Detected ICD_PAL_CLIENT_MAJOR_VERSION is " ${PAL_MAJOR_VERSION}) | ||
| endif() | ||
|
|
||
| set(ICD_PAL_CLIENT_MAJOR_VERSION ${PAL_MAJOR_VERSION}) | ||
|
|
||
| # Handle MINOR_VERSION in the same way | ||
| file(STRINGS icd/make/importdefs PAL_MINOR_VERSION REGEX "^ICD_PAL_CLIENT_MINOR_VERSION = [0-9]+") | ||
|
|
||
| if(PAL_MINOR_VERSION STREQUAL "") | ||
| message(STATUS "Failed to find ICD_PAL_CLIENT_MINOR_VERSION") | ||
| else() | ||
| string(REGEX REPLACE "ICD_PAL_CLIENT_MINOR_VERSION = " "" PAL_MINOR_VERSION ${PAL_MINOR_VERSION}) | ||
| message(STATUS "Detected ICD_PAL_CLIENT_MINOR_VERSION is " ${PAL_MINOR_VERSION}) | ||
| endif() | ||
|
|
||
| set(ICD_PAL_CLIENT_MINOR_VERSION ${PAL_MINOR_VERSION}) | ||
|
|
||
| # This will become the value of LLPC_CLIENT_INTERFACE_MAJOR_VERSION. It describes the version of the LLPC interface | ||
| # that the ICD supports. LLPC uses this value to enable backwards-compatibility for older interface versions. It must | ||
| # be updated on each LLPC promotion after handling all of the interface changes described in llpc.h | ||
| file(STRINGS icd/make/importdefs LLPC_MAJOR_VERSION REGEX "^ICD_LLPC_CLIENT_MAJOR_VERSION = [0-9]+") | ||
|
|
||
| if(LLPC_MAJOR_VERSION STREQUAL "") | ||
| message(STATUS "Failed to find ICD_LLPC_CLIENT_MAJOR_VERSION") | ||
| else() | ||
| string(REGEX REPLACE "ICD_LLPC_CLIENT_MAJOR_VERSION = " "" LLPC_MAJOR_VERSION ${LLPC_MAJOR_VERSION}) | ||
| message(STATUS "Detected ICD_LLPC_CLIENT_MAJOR_VERSION is " ${LLPC_MAJOR_VERSION}) | ||
| endif() | ||
|
|
||
| set(ICD_LLPC_CLIENT_MAJOR_VERSION ${LLPC_MAJOR_VERSION}) | ||
|
|
||
| # This will become the value of GPUOPEN_CLIENT_INTERFACE_MAJOR_VERSION. It describes the version of the GPUOPEN interface | ||
| # that the ICD supports. | ||
| if(ICD_GPUOPEN_DEVMODE_BUILD) | ||
| file(STRINGS icd/make/importdefs GPUOPEN_MAJOR_VERSION REGEX "^ICD_GPUOPEN_CLIENT_MAJOR_VERSION = [0-9]+") | ||
|
|
||
| if(GPUOPEN_MAJOR_VERSION STREQUAL "") | ||
| message(STATUS "Failed to find ICD_GPUOPEN_CLIENT_MAJOR_VERSION") | ||
| else() | ||
| string(REGEX REPLACE "ICD_GPUOPEN_CLIENT_MAJOR_VERSION = " "" GPUOPEN_MAJOR_VERSION ${GPUOPEN_MAJOR_VERSION}) | ||
| message(STATUS "Detected ICD_GPUOPEN_CLIENT_MAJOR_VERSION is " ${GPUOPEN_MAJOR_VERSION}) | ||
| endif() | ||
| set(GPUOPEN_CLIENT_INTERFACE_MAJOR_VERSION ${GPUOPEN_MAJOR_VERSION}) | ||
| endif() | ||
|
|
||
| endmacro() | ||
|
|
||
| macro(xgl_get_path) | ||
| # icd path | ||
| set(XGL_ICD_PATH ${PROJECT_SOURCE_DIR}/icd CACHE PATH "The path of xgl, it is read-only.") | ||
|
|
||
| # XGL cache creator tool | ||
| set(XGL_CACHE_CREATOR_PATH ${PROJECT_SOURCE_DIR}/tools/cache_creator CACHE PATH "Path to the cache creator tool") | ||
|
|
||
| # PAL path | ||
| if(EXISTS ${PROJECT_SOURCE_DIR}/../pal) | ||
| set(XGL_PAL_PATH ${PROJECT_SOURCE_DIR}/../pal CACHE PATH "Specify the path to the PAL project.") | ||
| endif() | ||
|
|
||
| # VKGC path | ||
| if (EXISTS ${XGL_ICD_PATH}/api/compiler/CMakeLists.txt) | ||
| set(XGL_VKGC_PATH ${XGL_ICD_PATH}/api/compiler CACHE PATH "Specify the path to the compiler." FORCE) | ||
| else() | ||
| # On github, the default repo name is llpc instead of compiler | ||
| set(XGL_VKGC_PATH ${PROJECT_SOURCE_DIR}/../llpc CACHE PATH "Specify the path to the llpc repository." FORCE) | ||
| endif() | ||
|
|
||
| # external Vulkan headers path | ||
| if(EXISTS ${PROJECT_SOURCE_DIR}/../Vulkan-Headers) | ||
| set(VULKAN_HEADERS_PATH ${PROJECT_SOURCE_DIR}/../Vulkan-Headers CACHE PATH "The path of Vulkan headers.") | ||
| endif() | ||
|
|
||
| # Metrohash path | ||
| if(EXISTS ${PROJECT_SOURCE_DIR}/../MetroHash) | ||
| set(XGL_METROHASH_PATH ${PROJECT_SOURCE_DIR}/../MetroHash CACHE PATH "The path of metrohash.") | ||
| else() | ||
| set(XGL_METROHASH_PATH ${PROJECT_SOURCE_DIR}/../third_party/metrohash CACHE PATH "The path of metrohash.") | ||
| endif() | ||
|
|
||
| # cwpack path | ||
| if(EXISTS ${PROJECT_SOURCE_DIR}/../CWPack) | ||
| set(XGL_CWPACK_PATH ${PROJECT_SOURCE_DIR}/../CWPack CACHE PATH "The path of cwpack.") | ||
| else() | ||
| set(XGL_CWPACK_PATH ${PROJECT_SOURCE_DIR}/../third_party/cwpack CACHE PATH "The path of cwpack.") | ||
| endif() | ||
| endmacro() | ||
|
|
||
| macro(xgl_overrides_pal) | ||
| ### For PAL ########################################################################################################### | ||
| set(PAL_BUILD_JEMALLOC OFF CACHE BOOL "Force jemalloc off" FORCE) | ||
|
|
||
| set(PAL_CLIENT_INTERFACE_MAJOR_VERSION ${ICD_PAL_CLIENT_MAJOR_VERSION} CACHE STRING "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_CLIENT_INTERFACE_MINOR_VERSION ${ICD_PAL_CLIENT_MINOR_VERSION} CACHE STRING "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_CLIENT "VULKAN" CACHE STRING "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_ENABLE_LTO ${XGL_ENABLE_LTO} CACHE BOOL "XGL override to build PAL with LTO support" FORCE) | ||
|
|
||
| set(PAL_MEMTRACK ${ICD_MEMTRACK} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_BUILD_GPUOPEN ${ICD_GPUOPEN_DEVMODE_BUILD} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_BUILD_RAVEN2 ON CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_BUILD_RENOIR ON CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_BUILD_VEGA20 ${XGL_BUILD_VEGA20} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_BUILD_GFX10 ON CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_BUILD_NAVI14 ON CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_BUILD_GFX103 ${XGL_BUILD_GFX103} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_BUILD_NAVI21 ON CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(PAL_BUILD_NAVI22 ${XGL_BUILD_NAVI22} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| # Wayland | ||
| set(PAL_BUILD_WAYLAND ${BUILD_WAYLAND_SUPPORT} CACHE BOOL "Build PAL with Wayland support" FORCE) | ||
|
|
||
| # Dri3 | ||
| set(PAL_BUILD_DRI3 ${BUILD_DRI3_SUPPORT} CACHE BOOL "PAL build with Dri3 enabled" FORCE) | ||
|
|
||
| #if VKI_3RD_PARTY_IP_PROPERTY_ID | ||
| set(PAL_3RD_PARTY_IP_PROPERTY_ID ${VKI_3RD_PARTY_IP_PROPERTY_ID}) | ||
| #endif | ||
|
|
||
| if(EXISTS ${XGL_METROHASH_PATH}) | ||
| set(PAL_METROHASH_PATH ${XGL_METROHASH_PATH} CACHE PATH "${PROJECT_NAME} override." FORCE) | ||
| endif() | ||
|
|
||
| if(EXISTS ${XGL_CWPACK_PATH}) | ||
| set(PAL_CWPACK_PATH ${XGL_CWPACK_PATH} CACHE PATH "${PROJECT_NAME} override." FORCE) | ||
| endif() | ||
|
|
||
| endmacro() | ||
|
|
||
| macro(xgl_overrides_vkgc) | ||
| ### For LLPC ########################################################################################################## | ||
| set(LLPC_CLIENT_INTERFACE_MAJOR_VERSION ${ICD_LLPC_CLIENT_MAJOR_VERSION} CACHE STRING "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| if(ICD_BUILD_LLPC) | ||
|
|
||
| set(LLPC_BUILD_LIT ${XGL_BUILD_LIT} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(LLPC_BUILD_NAVI22 ${XGL_BUILD_NAVI22} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(LLPC_BUILD_RAVEN2 ON CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(LLPC_BUILD_VEGA20 ${XGL_BUILD_VEGA20} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(LLPC_ENABLE_WERROR ${ICD_ANALYSIS_WARNINGS_AS_ERRORS} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
| endif() | ||
|
|
||
| endmacro() | ||
|
|
||
| macro(xgl_overrides) | ||
|
|
||
| xgl_get_version() | ||
|
|
||
| xgl_get_path() | ||
|
|
||
| if(ICD_BUILD_LLPCONLY) | ||
| set(ICD_BUILD_LLPC ON CACHE BOOL "ICD_BUILD_LLPCONLY override." FORCE) | ||
| endif() | ||
|
|
||
| if(NOT ICD_BUILD_LLPC) | ||
| set(XGL_LLVM_UPSTREAM OFF CACHE BOOL "XGL_LLVM_UPSTREAM is overrided to false." FORCE) | ||
| endif() | ||
|
|
||
| set(XGL_USE_SANITIZER "" CACHE STRING "Build with sanitizers, e.g. Address;Undefined") | ||
|
|
||
| if(XGL_USE_SANITIZER) | ||
| set(LLVM_USE_SANITIZER "${XGL_USE_SANITIZER}" CACHE BOOL "LLVM_USE_SANITIZER is overridden." FORCE) | ||
| endif() | ||
|
|
||
| if(XGL_ENABLE_ASSERTIONS) | ||
| set(LLVM_ENABLE_ASSERTIONS "${XGL_ENABLE_ASSERTIONS}" CACHE BOOL "LLVM_ENABLE_ASSERTIONS is overridden." FORCE) | ||
| endif() | ||
|
|
||
| set(VAM_ENABLE_WERROR ${ICD_ANALYSIS_WARNINGS_AS_ERRORS} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(ADDR_ENABLE_WERROR ${ICD_ANALYSIS_WARNINGS_AS_ERRORS} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| set(METROHASH_ENABLE_WERROR ${ICD_ANALYSIS_WARNINGS_AS_ERRORS} CACHE BOOL "${PROJECT_NAME} override." FORCE) | ||
|
|
||
| xgl_overrides_pal() | ||
|
|
||
| xgl_overrides_vkgc() | ||
|
|
||
| ### XCB required ###################################################################################################### | ||
| set(XCB_REQUIRED ON) | ||
|
|
||
| endmacro() |
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "entries": [ | ||
| { | ||
| "pattern": { | ||
| "cs": { | ||
| "stageActive": true, | ||
| "codeHash": "0x151B4F8C25C76937 D3CA0B94C0F09B4E" | ||
| } | ||
| }, | ||
| "action": { | ||
| "cs": { | ||
| "forceLoopUnrollCount": 2 | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } |
| @@ -80,6 +80,12 @@ | ||
| #endif | ||
|
|
||
|
|
||
| #ifdef VK_USE_PLATFORM_SCREEN_QNX | ||
| #include <screen/screen.h> | ||
| #include "vulkan_screen.h" | ||
| #endif | ||
|
|
||
|
|
||
| #ifdef VK_ENABLE_BETA_EXTENSIONS | ||
| #include "vulkan_beta.h" | ||
| #endif | ||
| @@ -0,0 +1,54 @@ | ||
| #ifndef VULKAN_SCREEN_H_ | ||
| #define VULKAN_SCREEN_H_ 1 | ||
|
|
||
| /* | ||
| ** Copyright 2015-2021 The Khronos Group Inc. | ||
| ** | ||
| ** SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /* | ||
| ** This header is generated from the Khronos Vulkan XML API Registry. | ||
| ** | ||
| */ | ||
|
|
||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
|
|
||
|
|
||
| #define VK_QNX_screen_surface 1 | ||
| #define VK_QNX_SCREEN_SURFACE_SPEC_VERSION 1 | ||
| #define VK_QNX_SCREEN_SURFACE_EXTENSION_NAME "VK_QNX_screen_surface" | ||
| typedef VkFlags VkScreenSurfaceCreateFlagsQNX; | ||
| typedef struct VkScreenSurfaceCreateInfoQNX { | ||
| VkStructureType sType; | ||
| const void* pNext; | ||
| VkScreenSurfaceCreateFlagsQNX flags; | ||
| struct _screen_context* context; | ||
| struct _screen_window* window; | ||
| } VkScreenSurfaceCreateInfoQNX; | ||
|
|
||
| typedef VkResult (VKAPI_PTR *PFN_vkCreateScreenSurfaceQNX)(VkInstance instance, const VkScreenSurfaceCreateInfoQNX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); | ||
| typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct _screen_window* window); | ||
|
|
||
| #ifndef VK_NO_PROTOTYPES | ||
| VKAPI_ATTR VkResult VKAPI_CALL vkCreateScreenSurfaceQNX( | ||
| VkInstance instance, | ||
| const VkScreenSurfaceCreateInfoQNX* pCreateInfo, | ||
| const VkAllocationCallbacks* pAllocator, | ||
| VkSurfaceKHR* pSurface); | ||
|
|
||
| VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceScreenPresentationSupportQNX( | ||
| VkPhysicalDevice physicalDevice, | ||
| uint32_t queueFamilyIndex, | ||
| struct _screen_window* window); | ||
| #endif | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif |