diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml
index c4a3a9b9f..6d2ab72ca 100644
--- a/.github/codeql/codeql-config.yml
+++ b/.github/codeql/codeql-config.yml
@@ -6,7 +6,9 @@ queries:
paths:
- Apps
- Modules
+
paths-ignore:
+ - Build/Output
- Externals
- Tests
- CMake
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 48de87cb4..11cc24f44 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -9,14 +9,18 @@ on:
- '.github/**/codeql-*.yml'
- 'Apps/**'
- 'Modules/**'
+ - 'Externals/**'
- 'Tests/**'
+ - 'CMakeLists.txt'
pull_request:
branches: [ master ]
paths:
- '.github/**/codeql-*.yml'
- 'Apps/**'
- 'Modules/**'
+ - 'Externals/**'
- 'Tests/**'
+ - 'CMakeLists.txt'
schedule:
- cron: '20 23 * * 3'
@@ -51,10 +55,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- with:
- submodules: 'recursive'
- # Windows CodeQL analysis is DISABLED (see reason description next to Analysis step below)
+ # NOTE: CodeQL is temporary DISABLED on Windows (see reason description next to Analysis step below)
- name: Initialize CodeQL
if: ${{ matrix.os != 'windows-2019' }}
uses: github/codeql-action/init@v2
@@ -62,6 +64,15 @@ jobs:
languages: cpp
config-file: ./.github/codeql/codeql-config.yml
+ - name: Initialize Externals Cache
+ id: cache-externals
+ uses: actions/cache@v3
+ env:
+ cache-name: cache-externals
+ with:
+ path: Build/Output/ExternalsCache
+ key: ExternalsCache-${{ matrix.config_preset }}-${{ hashFiles('Externals/*.cmake') }}
+
- name: CMake Configure Preset ${{ matrix.config_preset }}
run: cmake --preset ${{ matrix.config_preset }} -DMETHANE_CODE_COVERAGE_ENABLED:BOOL=OFF -DMETHANE_TESTS_BUILD_ENABLED:BOOL=OFF -DMETHANE_SHADERS_VALIDATION_ENABLED:BOOL=OFF
@@ -72,3 +83,23 @@ jobs:
- name: Perform CodeQL Analysis
if: ${{ matrix.os != 'windows-2019' }}
uses: github/codeql-action/analyze@v2
+ with:
+ upload: false
+ output: results
+
+ - name: Filter CodeQL Results
+ if: ${{ matrix.os != 'windows-2019' }}
+ uses: MethanePowered/FilterSarif@master
+ with:
+ patterns: |
+ -Build/Output/**
+ -Externals/**
+ -Tests/**
+ input: results/cpp.sarif
+ output: results/cpp-filtered.sarif
+
+ - name: Upload Filtered CodeQL Results
+ if: ${{ matrix.os != 'windows-2019' }}
+ uses: github/codeql-action/upload-sarif@v2
+ with:
+ sarif_file: results/cpp-filtered.sarif
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 43a83da63..000000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "Externals"]
- path = Externals
- url = https://github.com/egorodet/MethaneExternals.git
diff --git a/.idea/cmake.xml b/.idea/cmake.xml
index 140325c90..2ce3ce8f1 100644
--- a/.idea/cmake.xml
+++ b/.idea/cmake.xml
@@ -25,14 +25,15 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 57ba3f43c..94a25f7f4 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,23 +2,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Build/README.md b/Build/README.md
index 23bd29b08..ee011a58b 100644
--- a/Build/README.md
+++ b/Build/README.md
@@ -5,9 +5,9 @@
- [First time initialization](#first-time-initialization)
- [Update sources to latest revision](#update-sources-to-latest-revision)
- [Building from Sources](#building-from-sources)
- - [Windows Build with Visual Studio](#-windows-build-with-visual-studio)
- - [MacOS Build with XCode](#-macos-build-with-xcode)
- - [Linux Build with Unix Makefiles](#-linux-build-with-unix-makefiles)
+ - [Windows Build with Visual Studio](#windows-build-with-visual-studio)
+ - [Linux Build with Unix Makefiles](#linux-build-with-unix-makefiles)
+ - [MacOS Build with XCode](#macos-build-with-xcode)
- [CMake Generator](#cmake-generator)
- [CMake Options](#cmake-options)
- [CMake Presets](#cMake-presets)
@@ -15,12 +15,11 @@
## Prerequisites
- **Common**
- - Git (required to pull sub-modules)
- CMake 3.18 or later
- **Windows**
- Windows 10 RS5 (build 1809) or later
- Visual Studio 2019/22 with MSVC v142 or later
- - Windows 10 SDK latest
+ - Windows 10 SDK (latest)
- **MacOS**
- MacOS 10.15 "Catalina" or later
- XCode 11 or later with command-line tools
@@ -34,33 +33,36 @@
## Fetch Sources
-**IMPORTANT!**
-- Do not download source code via Zip archive, since it does not include content of
-[Externals](https://github.com/egorodet/MethaneExternals/tree/master) submodules.
-Use `git clone` command as described below.
-- Consider using short path for repository location on Windows (for example `c:\Git`),
-which may be required to resolve problem with support of paths longer than 260 symbols in some Microsoft build tools.
+### Notes
+- Since v0.6 Methane Kit does not use Git submodules anymore and switches to [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake)
+to fetch dependent repositories during CMake configuration stage, so it should be both possible to acquire sources
+with `git clone` command or to download as ZIP-archive using `Code > Download ZIP` button.
+- All [External](/Externals) dependencies are fetched to the `Build/Output/ExternalsCache/...` directory,
+which can be changed by adding `-DCPM_SOURCE_CACHE=` to the CMake configuration command.
+- Consider using short path for repository location on Windows (for example `c:\Git\`),
+which may be required to resolve problem with support of paths longer than 260 symbols for some of Microsoft build tools.
-#### First time initialization
+### First time initialization
```console
-git clone --recurse-submodules https://github.com/egorodet/MethaneKit.git
+git clone https://github.com/egorodet/MethaneKit.git
cd MethaneKit
```
-#### Update sources to latest revision
+### Update sources to latest revision
```console
cd MethaneKit
-git pull && git submodule update --init --recursive
+git pull
```
## Building from Sources
-### Windows Build with Visual Studio
+### Windows Build with Visual Studio
-Start Command Prompt, go to `MethaneKit` root directory (don't forget to pull dependent submodules as [described above](#fetch-sources))
-and either start auxiliary build script [Build/Windows/Build.bat](/Build/Windows/Build.bat) or build with CMake command line
+
+Start Command Prompt, go to `MethaneKit` root directory and either start auxiliary build script
+[Build/Windows/Build.bat](/Build/Windows/Build.bat) or build with CMake command line
to generate Visual Studio 2019/22 solution:
```console
@@ -70,7 +72,7 @@ cmake --build %OUTPUT_DIR%\Build --config Release --target install
```
Alternatively root [CMakeLists.txt](/CMakeLists.txt) can be opened directly in Visual Studio or
-[any other IDE with native CMake support](#development-environments) and [built using CMake presets](#cmake-presets).
+[any other IDE with native CMake support](/README.md#development-environments) and [built using CMake presets](#cmake-presets).
[Methane Graphics Core](/Modules/Graphics/Core) is built using **DirectX 12** graphics API by default on Windows.
Vulkan graphics API can be used instead by adding cmake generator option `-DMETHANE_GFX_VULKAN_ENABLED:BOOL=ON` or
@@ -78,10 +80,32 @@ by running `Build/Windows/Build.bat --vulkan`.
Run built applications from the installation directory `Build\Output\VisualStudio\Win64-DX\Install\Apps`
-### MacOS Build with XCode
+### Linux Build with Unix Makefiles
-Start Terminal, go to `MethaneKit` root directory (don't forget to pull dependent submodules as [described above](#fetch-sources))
-and either start auxiliary build script [Build/Unix/Build.sh](/Build/Unix/Build.sh) or build with CMake command line:
+
+Start Terminal, go to `MethaneKit` root directory and either start auxiliary build script
+[Build/Unix/Build.sh](/Build/Unix/Build.sh) or build with CMake command line to generate Unix Makefiles:
+
+```console
+OUTPUT_DIR=Build/Output/Linux
+cmake -S . -B $OUTPUT_DIR/Build -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/$OUTPUT_DIR/Install"
+cmake --build $OUTPUT_DIR/Build --config Release --target install --parallel 8
+```
+
+[Methane Graphics Core](/Modules/Graphics/Core) is built using **Vulkan** graphics API on Linux.
+
+Alternatively root [CMakeLists.txt](/CMakeLists.txt) can be opened directly in
+[any IDE with native CMake support](/README.md#development-environments) and [built using CMake presets](#cmake-presets).
+
+Run built applications from the installation directory `Build/Output/Linux/Install/Apps`.
+Note that in Ubuntu Linux even GUI applications should be started from "Terminal" app,
+because of `noexec` permission set on user's home directory by security reasons.
+
+### MacOS Build with XCode
+
+
+Start Terminal, go to `MethaneKit` root directory and either start auxiliary build script
+[Build/Unix/Build.sh](/Build/Unix/Build.sh) or build with CMake command line to generate XCode workspace:
```console
OUTPUT_DIR=Build/Output/XCode
@@ -94,7 +118,7 @@ using CMake generator command line option `-DCMAKE_OSX_ARCHITECTURES="arm64;x86_
This option should be omitted with earlier versions of Clang on macOS.
Alternatively root [CMakeLists.txt](/CMakeLists.txt) can be opened directly in Visual Studio or
-[any other IDE with native CMake support](#development-environments) and [built using CMake presets](#cmake-presets).
+[any other IDE with native CMake support](/README.md#development-environments) and [built using CMake presets](#cmake-presets).
[Methane Graphics Core](/Modules/Graphics/Core) is built using **Metal** graphics API on MacOS by default.
Vulkan graphics API can be used instead by adding cmake generator option `-DMETHANE_GFX_VULKAN_ENABLED:BOOL=ON` or
@@ -103,26 +127,6 @@ on top of Metal, which is not currently supporting all extensions required by Me
Run built applications from the installation directory `Build/Output/XCode/Install/Apps`.
-### Linux Build with Unix Makefiles
-
-Start Terminal, go to `MethaneKit` root directory (don't forget to pull dependent submodules as [described above](#fetch-sources))
-and either start auxiliary build script [Build/Unix/Build.sh](/Build/Unix/Build.sh) or build with CMake command line:
-
-```console
-OUTPUT_DIR=Build/Output/Linux
-cmake -S . -B $OUTPUT_DIR/Build -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/$OUTPUT_DIR/Install"
-cmake --build $OUTPUT_DIR/Build --config Release --target install --parallel 8
-```
-
-[Methane Graphics Core](/Modules/Graphics/Core) is built using **Vulkan** graphics API on Linux.
-
-Alternatively root [CMakeLists.txt](/CMakeLists.txt) can be opened directly in
-[any IDE with native CMake support](#development-environments) and [built using CMake presets](#cmake-presets).
-
-Run built applications from the installation directory `Build/Output/Linux/Install/Apps`.
-Note that in Ubuntu Linux even GUI applications should be started from "Terminal" app,
-because of `noexec` permission set on user's home directory by security reasons.
-
## CMake Generator
### CMake Options
diff --git a/Build/Unix/AzureBuild.yml b/Build/Unix/AzureBuild.yml
index 7a467ea41..5a405f984 100644
--- a/Build/Unix/AzureBuild.yml
+++ b/Build/Unix/AzureBuild.yml
@@ -19,6 +19,12 @@ steps:
inputs:
cmakeArgs: '--version'
+ - task: Cache@2
+ displayName: 'Initialize Externals Cache'
+ inputs:
+ key: 'ExternalsCache | $(cmake.ConfigurePreset) | Externals/*.cmake'
+ path: '$(cmake.ExternalsCacheDir)'
+
- task: CMake@1
displayName: 'Generate with configuration preset $(cmake.ConfigurePreset)'
inputs:
diff --git a/Build/Unix/AzureSonarScan.yml b/Build/Unix/AzureSonarScan.yml
index 533c833a5..8ca5b5e04 100644
--- a/Build/Unix/AzureSonarScan.yml
+++ b/Build/Unix/AzureSonarScan.yml
@@ -26,11 +26,17 @@ steps:
displayName: 'Download and unpack Sonar Build-Wrapper'
- task: Cache@2
- displayName: 'Sonar Scanner Cache'
+ displayName: 'Initialize Sonar Scanner Cache'
inputs:
key: 'SonarCache | $(sonar.ProjectKey) | $(Build.SourceBranchName) | $(cmake.ConfigurePreset) | "$(sonar.ScannerVersion)"'
path: $(sonar.CacheDir)
+ - task: Cache@2
+ displayName: 'Initialize Externals Cache'
+ inputs:
+ key: 'ExternalsCache | $(cmake.ConfigurePreset) | Externals/*.cmake'
+ path: '$(cmake.ExternalsCacheDir)'
+
- task: SonarCloudPrepare@1
displayName: 'Prepare Sonar Cloud Scanner'
inputs:
diff --git a/Build/Windows/AzureBuild.yml b/Build/Windows/AzureBuild.yml
index 3072c09c0..c1b680bab 100644
--- a/Build/Windows/AzureBuild.yml
+++ b/Build/Windows/AzureBuild.yml
@@ -13,6 +13,12 @@ steps:
inputs:
cmakeArgs: '--version'
+ - task: Cache@2
+ displayName: 'Initialize Externals Cache'
+ inputs:
+ key: 'ExternalsCache | $(cmake.ConfigurePreset) | Externals/*.cmake'
+ path: '$(cmake.ExternalsCacheDir)'
+
- task: CMake@1
displayName: 'Generate with configuration preset $(cmake.ConfigurePreset)'
inputs:
diff --git a/Build/Windows/AzureSonarScan.yml b/Build/Windows/AzureSonarScan.yml
index a08179a97..4c80bc240 100644
--- a/Build/Windows/AzureSonarScan.yml
+++ b/Build/Windows/AzureSonarScan.yml
@@ -15,17 +15,18 @@ steps:
workingDirectory: $(buildDir)
displayName: 'Download and unpack Sonar Build-Wrapper'
- - powershell: |
- Expand-Archive -Path 'OpenCppCoverage.zip' -DestinationPath '.'
- workingDirectory: Externals\Tools
- displayName: 'Unpack OpenCppCoverage tool'
-
- task: Cache@2
- displayName: 'Sonar Scanner Cache'
+ displayName: 'Initialize Sonar Scanner Cache'
inputs:
key: 'SonarCache | $(sonar.ProjectKey) | $(Build.SourceBranchName) | $(cmake.ConfigurePreset) | "$(sonar.ScannerVersion)"'
path: $(sonar.CacheDir)
+ - task: Cache@2
+ displayName: 'Initialize Externals Cache'
+ inputs:
+ key: 'ExternalsCache | $(cmake.ConfigurePreset) | Externals/*.cmake'
+ path: '$(cmake.ExternalsCacheDir)'
+
- task: SonarCloudPrepare@1
displayName: 'Prepare Sonar Cloud Scanner'
inputs:
@@ -52,16 +53,36 @@ steps:
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Build under Sonar Build-Wrapper with $(cmake.BuildPreset)'
+ - powershell: |
+ Invoke-WebRequest -Uri '$(coverage.OpenCppCoverageUrl)' -OutFile 'OpenCppCoverage.zip'
+ Expand-Archive -Path 'OpenCppCoverage.zip' -DestinationPath 'OpenCppCoverage'
+ if (-not(Test-Path -Path 'OpenCppCoverage\OpenCppCoverage.exe' -PathType Leaf)) {
+ Get-ChildItem 'OpenCppCoverage'
+ throw 'OpenCppCoverage\OpenCppCoverage.exe executable was not found in unpacked content!'
+ }
+ workingDirectory: '$(installDir)\Tests'
+ displayName: 'Download and unpack OpenCppCoverage tool'
+
- script: |
setlocal enabledelayedexpansion
+ set open_cpp_coverage_exe="OpenCppCoverage\OpenCppCoverage.exe"
+ if not exist "%open_cpp_coverage_exe%" (
+ echo File path "%open_cpp_coverage_exe%" does not exist!
+ exit 101
+ )
echo Running unit-tests in directory "%cd%"
mkdir Results
mkdir Coverage
+ set /A result_error_level=0
for /r "." %%a in (*Test.exe) do (
- "$(Build.SourcesDirectory)\Externals\Tools\OpenCppCoverage\OpenCppCoverage.exe" --sources "$(Build.SourcesDirectory)\Modules" --export_type=cobertura:Coverage\%%~na.xml -- "%%~fa" -r sonarqube -o "Results\%%~na.xml"
+ echo "%open_cpp_coverage_exe%" --sources "$(Build.SourcesDirectory)\Modules" --export_type=cobertura:Coverage\%%~na.xml -- "%%~fa" -r sonarqube -o "Results\%%~na.xml"
+ "%open_cpp_coverage_exe%" --sources "$(Build.SourcesDirectory)\Modules" --export_type=cobertura:Coverage\%%~na.xml -- "%%~fa" -r sonarqube -o "Results\%%~na.xml"
echo - %%~na - completed with !errorlevel! exit status
+ if not !errorlevel!==0 (
+ set /A result_error_level=!errorlevel!
+ )
)
- exit 0
+ exit !result_error_level!
workingDirectory: '$(installDir)\Tests'
failOnStderr: false
displayName: 'Collect code coverage from all unit-tests in install directory'
diff --git a/CMake/MethaneBuildOptions.cmake b/CMake/MethaneBuildOptions.cmake
new file mode 100644
index 000000000..f4d6187b8
--- /dev/null
+++ b/CMake/MethaneBuildOptions.cmake
@@ -0,0 +1,146 @@
+#[[****************************************************************************
+
+Copyright 2022 Evgeny Gorodetskiy
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*******************************************************************************
+
+FILE: MethaneBuildOptions.cmake
+Methane compilation and build options interface target.
+
+*****************************************************************************]]
+
+include(MethaneUtils)
+
+split_by_first_delimiter("${METHANE_VERSION_BUILD}" "." METHANE_VERSION_BUILD_MAJOR METHANE_VERSION_BUILD_MINOR)
+
+add_library(MethaneBuildOptions INTERFACE)
+
+target_compile_definitions(MethaneBuildOptions INTERFACE
+ $<$:_DEBUG>
+ $<$:NDEBUG>
+ $<$:NDEBUG>
+ $<$:NDEBUG>
+ $<$:METHANE_CHECKS_ENABLED>
+ $<$:ITT_INSTRUMENTATION_ENABLED>
+ $<$,$>:ITT_ARGUMENTS_METADATA_ENABLED>
+ METHANE_VERSION_MAJOR=${METHANE_VERSION_MAJOR}
+ METHANE_VERSION_MINOR=${METHANE_VERSION_MINOR}
+ METHANE_VERSION_BUILD=${METHANE_VERSION_BUILD_MAJOR}
+)
+
+if(WIN32)
+
+ include(FindWindowsSDK)
+
+ if(WINDOWSSDK_FOUND)
+ message(STATUS "${WINDOWSSDK_LATEST_NAME} was selected for build")
+ else()
+ message(FATAL_ERROR "Windows SDK was not found!")
+ endif()
+
+ get_windowssdk_include_dirs(${WINDOWSSDK_LATEST_DIR} WINDOWSSDK_INCLUDE_DIRS)
+ if(NOT WINDOWSSDK_INCLUDE_DIRS)
+ message(FATAL_ERROR "Failed to get Windows SDK include directories from ${WINDOWSSDK_LATEST_DIR}")
+ endif()
+
+ get_windowssdk_library_dirs(${WINDOWSSDK_LATEST_DIR} WINDOWSSDK_LIBRARY_DIRS)
+ if(NOT WINDOWSSDK_LIBRARY_DIRS)
+ message(FATAL_ERROR "Failed to get Windows SDK library directories from ${WINDOWSSDK_LATEST_DIR}")
+ endif()
+
+ target_include_directories(MethaneBuildOptions INTERFACE ${WINDOWSSDK_INCLUDE_DIRS})
+ target_link_directories(MethaneBuildOptions INTERFACE ${WINDOWSSDK_LIBRARY_DIRS})
+ target_compile_definitions(MethaneBuildOptions INTERFACE
+ UNICODE _UNICODE NOMINMAX WIN32_LEAN_AND_MEAN USE_PIX
+ _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING # silence warning C4996 about std::wstring_convert deprecation
+ )
+
+endif()
+
+if (MSVC)
+
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+
+ target_compile_options(MethaneBuildOptions INTERFACE
+ # Exception handling mode
+ /EHsc
+ # Set maximum warnings level and treat warnings as errors
+ /W4 /WX
+ # Disable useless warnings
+ /wd4250 # - C4250: inheritance via dominance (used only with abstract interfaces)
+ /wd4324 # - C4324: structure was padded due to alignment specifier
+ )
+
+ else() # Clang compiler on Windows
+
+ target_compile_options(MethaneBuildOptions INTERFACE
+ # Set maximum warnings level & treat warnings as errors
+ -Werror
+ # Disable useless warnings produced by Windows headers
+ -Wno-unknown-pragmas
+ -Wno-unused-local-typedef
+ -Wno-ignored-pragma-intrinsic
+ -Wno-expansion-to-defined
+ -Wno-nonportable-include-path
+ -Wno-pragma-pack
+ -Wno-unused-value
+ -Wno-microsoft-template
+ -Wno-microsoft-template-shadow
+ -Wno-microsoft-sealed
+ -Wno-microsoft-exception-spec
+ -Wno-ignored-attributes
+ -Wno-macro-redefined
+ -Wno-extern-c-compat
+ -Wno-invalid-noreturn
+ )
+
+ endif()
+
+else() # Clang or GCC on Linux/MacOS
+
+ target_compile_options(MethaneBuildOptions INTERFACE
+ # Set maximum warnings level & treat warnings as errors
+ -Wall -Wextra -Werror
+ # Disable useless Clang and GCC warnings
+ -Wno-missing-field-initializers
+ )
+
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # GCC
+
+ target_compile_options(MethaneBuildOptions INTERFACE
+ # Disable useless GCC warnings
+ -Wno-ignored-qualifiers
+ )
+
+ endif()
+
+endif()
+
+if (METHANE_CODE_COVERAGE_ENABLED)
+
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
+ CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+ message(STATUS "Methane code coverage is enabled with Clang compiler")
+ target_compile_options(MethaneBuildOptions INTERFACE -fprofile-instr-generate -fcoverage-mapping)
+ target_link_options(MethaneBuildOptions INTERFACE -fprofile-instr-generate)
+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ message(STATUS "Methane code coverage is enabled with GCC compiler")
+ target_compile_options(MethaneBuildOptions INTERFACE -coverage)
+ target_link_options(MethaneBuildOptions INTERFACE -coverage)
+ else()
+ message(AUTHOR_WARNING "Methane code coverage is unavailable with ${CMAKE_CXX_COMPILER_ID} compiler")
+ endif()
+
+endif()
\ No newline at end of file
diff --git a/CMake/MethaneModules.cmake b/CMake/MethaneModules.cmake
index 886106e2b..bfecccc24 100644
--- a/CMake/MethaneModules.cmake
+++ b/CMake/MethaneModules.cmake
@@ -39,14 +39,14 @@ endfunction()
function(get_platform_dir PLATFORM_DIR CPP_EXT)
if (WIN32)
- set(PLATFORM_DIR Windows PARENT_SCOPE)
- set(CPP_EXT cpp PARENT_SCOPE)
+ set(${PLATFORM_DIR} Windows PARENT_SCOPE)
+ set(${CPP_EXT} cpp PARENT_SCOPE)
elseif(APPLE)
- set(PLATFORM_DIR MacOS PARENT_SCOPE)
- set(CPP_EXT mm PARENT_SCOPE)
+ set(${PLATFORM_DIR} MacOS PARENT_SCOPE)
+ set(${CPP_EXT} mm PARENT_SCOPE)
else()
- set(PLATFORM_DIR Linux PARENT_SCOPE)
- set(CPP_EXT cpp PARENT_SCOPE)
+ set(${PLATFORM_DIR} Linux PARENT_SCOPE)
+ set(${CPP_EXT} cpp PARENT_SCOPE)
endif()
endfunction()
@@ -54,19 +54,19 @@ function(get_platform_arch_dir PLATFORM_ARCH_DIR CPP_EXT)
get_platform_dir(PLATFORM_DIR CPP_EXT)
if (WIN32)
get_target_arch(WIN_ARCH)
- set(PLATFORM_ARCH_DIR "${PLATFORM_DIR}-${WIN_ARCH}" PARENT_SCOPE)
+ set(${PLATFORM_ARCH_DIR} "${PLATFORM_DIR}-${WIN_ARCH}" PARENT_SCOPE)
else()
- set(PLATFORM_ARCH_DIR "${PLATFORM_DIR}" PARENT_SCOPE)
+ set(${PLATFORM_ARCH_DIR} "${PLATFORM_DIR}" PARENT_SCOPE)
endif()
endfunction()
function(get_graphics_dir GRAPHICS_DIR)
if (METHANE_GFX_API EQUAL METHANE_GFX_DIRECTX)
- set(GRAPHICS_DIR DirectX12 PARENT_SCOPE)
+ set(${GRAPHICS_DIR} DirectX12 PARENT_SCOPE)
elseif(METHANE_GFX_API EQUAL METHANE_GFX_METAL)
- set(GRAPHICS_DIR Metal PARENT_SCOPE)
+ set(${GRAPHICS_DIR} Metal PARENT_SCOPE)
elseif(METHANE_GFX_API EQUAL METHANE_GFX_VULKAN)
- set(GRAPHICS_DIR Vulkan PARENT_SCOPE)
+ set(${GRAPHICS_DIR} Vulkan PARENT_SCOPE)
endif()
endfunction()
diff --git a/CMake/MethaneShaders.cmake b/CMake/MethaneShaders.cmake
index ea99c4f7c..5304047c2 100644
--- a/CMake/MethaneShaders.cmake
+++ b/CMake/MethaneShaders.cmake
@@ -58,16 +58,12 @@ function(get_generated_shader_extension OUT_SHADER_EXT)
endfunction()
function(generate_metal_shaders_from_hlsl FOR_TARGET SHADERS_HLSL PROFILE_VER SHADER_TYPES OUT_SHADERS_METAL OUT_GENERATE_METAL_TARGETS)
- get_platform_dir(PLATFORM_DIR CPP_EXT)
get_target_shaders_dir(${FOR_TARGET} TARGET_SHADERS_DIR)
get_file_name(${SHADERS_HLSL} SHADERS_NAME)
- set(DXC_BIN_DIR "${CMAKE_SOURCE_DIR}/Externals/DirectXCompiler/binaries/${PLATFORM_DIR}/bin")
- set(DXC_EXE "${DXC_BIN_DIR}/dxc")
-
- set(SPIRV_BIN_DIR "${CMAKE_SOURCE_DIR}/Externals/SPIRV/binaries/${PLATFORM_DIR}")
- set(SPIRV_GEN_EXE "${SPIRV_BIN_DIR}/glslangValidator")
- set(SPIRV_CROSS_EXE "${SPIRV_BIN_DIR}/spirv-cross")
+ set(DXC_EXE "${DXC_BINARY_DIR}/dxc")
+ set(SPIRV_GEN_EXE "${SPIRV_BINARY_DIR}/glslangValidator")
+ set(SPIRV_CROSS_EXE "${SPIRV_BINARY_DIR}/spirv-cross")
foreach(KEY_VALUE_STRING ${SHADER_TYPES})
trim_spaces(${KEY_VALUE_STRING} KEY_VALUE_STRING)
@@ -172,14 +168,11 @@ function(compile_metal_shaders_to_library FOR_TARGET SDK METAL_SHADERS METAL_LIB
endfunction()
function(compile_hlsl_shaders FOR_TARGET SHADERS_HLSL PROFILE_VER SHADER_TYPES OUT_COMPILED_SHADER_BINARIES OUT_COMPILE_SHADER_TARGETS)
-
- get_platform_arch_dir(PLATFORM_ARCH_DIR CPP_EXT)
get_target_shaders_dir(${FOR_TARGET} TARGET_SHADERS_DIR)
get_file_name(${SHADERS_HLSL} SHADERS_NAME)
get_generated_shader_extension(OUTPUT_FILE_EXT)
- set(DXC_DIR "${CMAKE_SOURCE_DIR}/Externals/DirectXCompiler/binaries/${PLATFORM_ARCH_DIR}/bin")
- set(DXC_EXE "${DXC_DIR}/dxc")
+ set(DXC_EXE "${DXC_BINARY_DIR}/dxc")
if (NOT WIN32)
set(DXC_EXE "LD_LIBRARY_PATH=.;${DXC_EXE}")
@@ -236,7 +229,7 @@ function(compile_hlsl_shaders FOR_TARGET SHADERS_HLSL PROFILE_VER SHADER_TYPES O
COMMENT "Compiling HLSL shader from file ${SHADERS_HLSL} with profile ${SHADER_PROFILE} and macro-definitions \"${SHADER_DEFINITIONS}\" to ${OUTPUT_FILE_EXT} file ${SHADER_OBJ_FILE}"
BYPRODUCTS "${SHADER_OBJ_PATH}"
DEPENDS "${SHADERS_HLSL}" "${SHADERS_CONFIG}"
- WORKING_DIRECTORY "${DXC_DIR}"
+ WORKING_DIRECTORY "${DXC_BINARY_DIR}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${TARGET_SHADERS_DIR}"
COMMAND ${DXC_EXE} ${OUTPUT_TYPE_ARG} ${EXTRA_OPTIONS} /T ${SHADER_PROFILE} /E ${ORIG_ENTRY_POINT} /Fo ${SHADER_OBJ_PATH} ${EXTRA_COMPILE_FLAGS} ${SHADER_DEFINITION_ARGUMENTS} ${SHADERS_HLSL}
)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 772cf3f5d..546f945ad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,7 @@ set(METHANE_VERSION_SHORT "${METHANE_VERSION_MAJOR}.${METHANE_VERSION_MINOR}")
set(METHANE_VERSION_FULL "${METHANE_VERSION_SHORT}.${METHANE_VERSION_BUILD}")
set(METHANE_PRODUCT_NAME "Methane Kit (https://github.com/egorodet/MethaneKit)")
set(METHANE_COPYRIGHT "Copyright 2019-2021 Evgeny Gorodetskiy")
+set(RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Resources")
# Methane graphics native APIs
set(METHANE_GFX_METAL 1) # MacOS default API
@@ -73,16 +74,9 @@ else()
endif()
endif()
-list(APPEND CMAKE_MODULE_PATH
- "${CMAKE_CURRENT_SOURCE_DIR}/CMake"
- "${CMAKE_CURRENT_SOURCE_DIR}/Externals/CMakeModules"
- "${CMAKE_CURRENT_SOURCE_DIR}/Externals/CMakeExtraModules"
- "${CMAKE_CURRENT_SOURCE_DIR}/Externals/Catch2/contrib"
- "${CMAKE_CURRENT_SOURCE_DIR}/Externals/CMRC"
-)
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
include(MethaneModules)
-include(MethaneUtils)
set(CMAKE_CXX_STANDARD 17)
set(CTEST_OUTPUT_ON_FAILURE ON)
@@ -92,44 +86,32 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
-add_library(MethaneBuildOptions INTERFACE)
-
-if(NOT WIN32 AND NOT APPLE AND UNIX)
- set(LINUX 1)
+# Use build-independent location for CPM package source cache to speedup CMake configuration
+# NOTE: Do not use single cache location under CLion IDE to workaround CPM cache initialization collision
+# when multiple CMake configurations are initialized simultaneously
+if (NOT CPM_SOURCE_CACHE AND NOT DEFINED ENV{CLION_IDE})
+ set(CPM_SOURCE_CACHE "${CMAKE_SOURCE_DIR}/Build/Output/ExternalsCache" CACHE STRING "Set default CPM source cache path for External repositories")
endif()
if(WIN32)
- include(FindWindowsSDK)
- if(WINDOWSSDK_FOUND)
- message(STATUS "${WINDOWSSDK_LATEST_NAME} was selected for build")
- else()
- message(FATAL_ERROR "Windows SDK was not found!")
- endif()
-
- get_windowssdk_include_dirs(${WINDOWSSDK_LATEST_DIR} WINDOWSSDK_INCLUDE_DIRS)
- if(NOT WINDOWSSDK_INCLUDE_DIRS)
- message(FATAL_ERROR "Failed to get Windows SDK include directories from ${WINDOWSSDK_LATEST_DIR}")
- endif()
+ set(VS_STARTUP_PROJECT MethaneAsteroids)
+ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") # use /MT static runtime linking
+ string(REPLACE "/W3 " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- get_windowssdk_library_dirs(${WINDOWSSDK_LATEST_DIR} WINDOWSSDK_LIBRARY_DIRS)
- if(NOT WINDOWSSDK_LIBRARY_DIRS)
- message(FATAL_ERROR "Failed to get Windows SDK library directories from ${WINDOWSSDK_LATEST_DIR}")
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ # Enable multi-threaded build with MSVC
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
- target_include_directories(MethaneBuildOptions INTERFACE ${WINDOWSSDK_INCLUDE_DIRS})
- target_link_directories(MethaneBuildOptions INTERFACE ${WINDOWSSDK_LIBRARY_DIRS})
- target_compile_definitions(MethaneBuildOptions INTERFACE
- UNICODE _UNICODE NOMINMAX WIN32_LEAN_AND_MEAN USE_PIX
- _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING # silence warning C4996 about std::wstring_convert deprecation
- )
-
-elseif(APPLE)
+elseif(APPLE) # MacOS
set(CMAKE_BUILD_WITH_INSTALL_RPATH true)
set(CMAKE_INSTALL_RPATH "@executable_path")
-else(UNIX)
+else(UNIX) # Linux
+
+ set(LINUX 1)
find_package(X11 REQUIRED)
if (NOT X11_xcb_FOUND OR
@@ -140,105 +122,23 @@ else(UNIX)
endif()
-if (MSVC)
-
- set(VS_STARTUP_PROJECT MethaneAsteroids)
- set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") # use /MT static runtime linking
- string(REPLACE "/W3 " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-
- if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
-
- # Enable multi-threaded build with MSVC
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
- target_compile_options(MethaneBuildOptions INTERFACE
- # Exception handling mode
- /EHsc
- # Set maximum warnings level and treat warnings as errors
- /W4 /WX
- # Disable useless warnings
- /wd4250 # - C4250: inheritance via dominance (used only with abstract interfaces)
- /wd4324 # - C4324: structure was padded due to alignment specifier
- )
-
- else() # Clang compiler on Windows
-
- target_compile_options(MethaneBuildOptions INTERFACE
- # Set maximum warnings level & treat warnings as errors
- -Werror
- # Disable useless warnings produced by Windows headers
- -Wno-unknown-pragmas
- -Wno-unused-local-typedef
- -Wno-ignored-pragma-intrinsic
- -Wno-expansion-to-defined
- -Wno-nonportable-include-path
- -Wno-pragma-pack
- -Wno-unused-value
- -Wno-microsoft-template
- -Wno-microsoft-template-shadow
- -Wno-microsoft-sealed
- -Wno-microsoft-exception-spec
- -Wno-ignored-attributes
- -Wno-macro-redefined
- -Wno-extern-c-compat
- -Wno-invalid-noreturn
- )
-
- endif()
-
-else() # Clang or GCC on Linux/MacOS
-
- target_compile_options(MethaneBuildOptions INTERFACE
- # Set maximum warnings level & treat warnings as errors
- -Wall -Wextra -Werror
- # Disable useless Clang and GCC warnings
- -Wno-missing-field-initializers
- )
-
- if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # GCC
-
- target_compile_options(MethaneBuildOptions INTERFACE
- # Disable useless GCC warnings
- -Wno-ignored-qualifiers
- )
-
- endif()
-
-endif()
-
-target_compile_definitions(MethaneBuildOptions INTERFACE
- "$<$:_DEBUG>"
- "$<$:NDEBUG>"
- "$<$:NDEBUG>"
- "$<$:NDEBUG>"
-)
-
message(STATUS "Methane Kit version ${METHANE_VERSION_FULL}")
-split_by_first_delimiter("${METHANE_VERSION_BUILD}" "." METHANE_VERSION_BUILD_MAJOR METHANE_VERSION_BUILD_MINOR)
-target_compile_definitions(MethaneBuildOptions INTERFACE
- METHANE_VERSION_MAJOR=${METHANE_VERSION_MAJOR}
- METHANE_VERSION_MINOR=${METHANE_VERSION_MINOR}
- METHANE_VERSION_BUILD=${METHANE_VERSION_BUILD_MAJOR}
-)
# METHANE_GFX_API is platform dependent and is selected in CMake/MethaneModules.cmake
-if(METHANE_GFX_API EQUAL METHANE_GFX_DIRECTX)
- message(STATUS "Methane is using DirectX 12 graphics API")
-elseif(METHANE_GFX_API EQUAL METHANE_GFX_METAL)
- message(STATUS "Methane is using Metal graphics API")
-elseif (METHANE_GFX_API EQUAL METHANE_GFX_VULKAN)
- message(STATUS "Methane is using Vulkan graphics API")
+get_graphics_dir(GRAPHICS_API_NAME)
+message(STATUS "Methane is built with ${GRAPHICS_API_NAME} graphics API")
+
+if (APPLE AND METHANE_GFX_API EQUAL METHANE_GFX_VULKAN)
# On Windows and Linux, only Vulkan-Headers are required to build Methane Kit,
# because it is dynamically loading Vulkan library in runtime. Vulkan SDK is not required for build.
- if (APPLE)
- message(WARNING "Vulkan API is not supported on MacOS, because MoltenVK does not support extension 'VK_EXT_extended_dynamic_state'")
- # To enable Vulkan API on MacOS we link statically with MoltenVK framework (translation layer to Metal).
- # in order to enable finding Vulkan SDK with MoltenVK framework, set environment variable
- # - VULKAN_SDK to full installation path before running CMake generator ($USER_HOME$/VulkanSDK/1.2.182.0/macOS)
- find_package(Vulkan REQUIRED)
- # To run Vulkan application on MacOS, additional environment variables need to be set for application:
- # - VK_ICD_FILENAMES=$USER_HOME$/VulkanSDK/1.2.182.0/macOS/share/vulkan/icd.d/MoltenVK_icd.json
- # - VK_LAYER_PATH=$USER_HOME$/VulkanSDK/1.2.182.0/macOS/share/vulkan/explicit_layer.d
- endif()
+ message(AUTHOR_WARNING "Vulkan API is not supported on MacOS, because MoltenVK does not support extension 'VK_EXT_extended_dynamic_state'")
+ # To enable Vulkan API on MacOS we link statically with MoltenVK framework (translation layer to Metal).
+ # in order to enable finding Vulkan SDK with MoltenVK framework, set environment variable
+ # - VULKAN_SDK to full installation path before running CMake generator ($USER_HOME$/VulkanSDK/1.2.182.0/macOS)
+ find_package(Vulkan REQUIRED)
+ # To run Vulkan application on MacOS, additional environment variables need to be set for application:
+ # - VK_ICD_FILENAMES=$USER_HOME$/VulkanSDK/1.2.182.0/macOS/share/vulkan/icd.d/MoltenVK_icd.json
+ # - VK_LAYER_PATH=$USER_HOME$/VulkanSDK/1.2.182.0/macOS/share/vulkan/explicit_layer.d
endif()
if (METHANE_APPS_BUILD_ENABLED)
@@ -252,30 +152,12 @@ endif()
if (METHANE_CHECKS_ENABLED)
message(STATUS "Methane runtime checks of input arguments are enabled")
- target_compile_definitions(MethaneBuildOptions INTERFACE METHANE_CHECKS_ENABLED)
endif()
if(METHANE_RUN_TESTS_DURING_BUILD)
message(STATUS "Methane tests running during build is enabled")
endif()
-if (METHANE_CODE_COVERAGE_ENABLED)
-
- if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
- CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
- message(STATUS "Methane code coverage is enabled with Clang compiler")
- target_compile_options(MethaneBuildOptions INTERFACE -fprofile-instr-generate -fcoverage-mapping)
- target_link_options(MethaneBuildOptions INTERFACE -fprofile-instr-generate)
- elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- message(STATUS "Methane code coverage is enabled with GCC compiler")
- target_compile_options(MethaneBuildOptions INTERFACE -coverage)
- target_link_options(MethaneBuildOptions INTERFACE -coverage)
- else()
- message(STATUS "Methane code coverage is unavailable with ${CMAKE_CXX_COMPILER_ID} compiler")
- endif()
-
-endif()
-
if(METHANE_SHADERS_CODEVIEW_ENABLED)
message(STATUS "Methane shaders code symbols are enabled")
endif()
@@ -298,11 +180,8 @@ endif()
if(METHANE_ITT_INSTRUMENTATION_ENABLED)
message(STATUS "Methane ITT instrumentation is enabled")
- target_compile_definitions(MethaneBuildOptions INTERFACE ITT_INSTRUMENTATION_ENABLED)
-
if(METHANE_ITT_METADATA_ENABLED)
message(STATUS "Methane ITT metadata is enabled")
- target_compile_definitions(MethaneBuildOptions INTERFACE ITT_ARGUMENTS_METADATA_ENABLED)
endif()
endif()
@@ -328,22 +207,10 @@ else()
set(CTEST_EXE "ctest")
endif()
-set(RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Resources")
-
-# Disable finding packages by External libraries
-set(CMAKE_DISABLE_FIND_PACKAGE_Doxygen TRUE)
-set(CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz TRUE)
-set(CMAKE_DISABLE_FIND_PACKAGE_PkgConfig TRUE)
-set(CMAKE_DISABLE_FIND_PACKAGE_ZLIB TRUE)
-set(CMAKE_DISABLE_FIND_PACKAGE_PNG TRUE)
-set(CMAKE_DISABLE_FIND_PACKAGE_BZip2 TRUE)
-set(CMAKE_DISABLE_FIND_PACKAGE_HHC TRUE)
-set(CMAKE_DISABLE_FIND_PACKAGE_LATEX TRUE)
-set(CMAKE_DISABLE_FIND_PACKAGE_Perl TRUE)
+add_subdirectory(Externals)
-set(MAGIC_ENUM_OPT_INSTALL ON CACHE BOOL "Generate and install magic_enum target")
+include(MethaneBuildOptions)
-add_subdirectory(Externals)
add_subdirectory(Modules)
if (METHANE_APPS_BUILD_ENABLED)
diff --git a/Externals b/Externals
deleted file mode 160000
index bc8296dcc..000000000
--- a/Externals
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit bc8296dcc315f664616baee416c5982c2e06de92
diff --git a/Externals/BoostNowide.cmake b/Externals/BoostNowide.cmake
new file mode 100644
index 000000000..58219889c
--- /dev/null
+++ b/Externals/BoostNowide.cmake
@@ -0,0 +1,15 @@
+CPMAddPackage(
+ NAME BoostNowide
+ GITHUB_REPOSITORY MethanePowered/BoostNowide
+ GIT_TAG 40666d41d287b9cbb2092f564e8832d3b8c0e1d9 # last commit from 'standalone' branch
+ VERSION 11.1.4
+ OPTIONS
+ "BUILD_SHARED_LIBS OFF"
+ "BUILD_TESTING OFF"
+ "NOWIDE_INSTALL OFF"
+)
+
+set_target_properties(nowide
+ PROPERTIES
+ FOLDER Externals
+)
diff --git a/Externals/CLI11.cmake b/Externals/CLI11.cmake
new file mode 100644
index 000000000..3f8ee4dbb
--- /dev/null
+++ b/Externals/CLI11.cmake
@@ -0,0 +1,5 @@
+CPMAddPackage(
+ NAME CLI11
+ GITHUB_REPOSITORY MethanePowered/CLI11
+ VERSION 2.2.0
+)
diff --git a/Externals/CMRC.cmake b/Externals/CMRC.cmake
new file mode 100644
index 000000000..90d3809d4
--- /dev/null
+++ b/Externals/CMRC.cmake
@@ -0,0 +1,7 @@
+CPMAddPackage(
+ NAME CMRC
+ GITHUB_REPOSITORY MethanePowered/CMRC
+ GIT_TAG a64bea50c05594c8e7cf1f08e441bb9507742e2e # last commit from 'master' branch
+)
+
+list(APPEND CMAKE_MODULE_PATH "${CMRC_SOURCE_DIR}")
\ No newline at end of file
diff --git a/Externals/CMakeLists.txt b/Externals/CMakeLists.txt
new file mode 100644
index 000000000..0f4b9c8f1
--- /dev/null
+++ b/Externals/CMakeLists.txt
@@ -0,0 +1,75 @@
+cmake_minimum_required(VERSION 3.14.0)
+
+set(CMAKE_DISABLE_FIND_PACKAGE_Doxygen TRUE)
+set(CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz TRUE)
+set(CMAKE_DISABLE_FIND_PACKAGE_PkgConfig TRUE)
+set(CMAKE_DISABLE_FIND_PACKAGE_ZLIB TRUE)
+set(CMAKE_DISABLE_FIND_PACKAGE_PNG TRUE)
+set(CMAKE_DISABLE_FIND_PACKAGE_BZip2 TRUE)
+set(CMAKE_DISABLE_FIND_PACKAGE_HHC TRUE)
+set(CMAKE_DISABLE_FIND_PACKAGE_LATEX TRUE)
+set(CMAKE_DISABLE_FIND_PACKAGE_Perl TRUE)
+
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+# CMake libraries
+include(CPM) # keep 1-st
+include(CMakeModules)
+include(CMRC)
+include(FindPkgConfig)
+
+# Set Windows SDK for external libraries build
+if(WIN32)
+ include(FindWindowsSDK)
+ if(WINDOWSSDK_FOUND)
+ message(STATUS "${WINDOWSSDK_LATEST_NAME} from directory '${WINDOWSSDK_LATEST_DIR}' is used for External libraries build")
+ get_windowssdk_include_dirs(${WINDOWSSDK_LATEST_DIR} WINSDK_INCLUDE_DIRS)
+ get_windowssdk_library_dirs(${WINDOWSSDK_LATEST_DIR} WINSDK_LINK_DIRS)
+ include_directories(${WINSDK_INCLUDE_DIRS})
+ link_directories(${WINSDK_LINK_DIRS})
+ else()
+ message(FATAL_ERROR "Windows SDK was not found!")
+ endif()
+endif()
+
+# Cross-platform C++ libraries
+include(BoostNowide)
+include(FMT)
+include(Catch2)
+include(CLI11)
+include(FreeType2)
+include(HLSLpp)
+include(MagicEnum)
+include(TaskFlow)
+include(Tracy)
+include(PerlinNoise)
+
+if(METHANE_ITT_INSTRUMENTATION_ENABLED)
+ include(IttApi)
+endif()
+
+if (NOT METHANE_OPEN_IMAGE_IO_ENABLED)
+ include(STB)
+endif()
+
+# DirectX API C++ libraries
+if(METHANE_GFX_API EQUAL METHANE_GFX_DIRECTX)
+ include(DirectXHeaders)
+ include(DirectXTex)
+endif()
+
+# Vulkan API C++ libraries
+if (METHANE_GFX_API EQUAL METHANE_GFX_VULKAN)
+ include(VulkanHeaders)
+ include(SPIRVCross)
+endif()
+
+# Pre-built binary tools
+include(DirectXShaderCompilerBinary)
+include(SPIRVCrossBinary)
+
+if (METHANE_OPEN_IMAGE_IO_ENABLED)
+ include(OpenImageIOBinary)
+endif()
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE)
\ No newline at end of file
diff --git a/Externals/CMakeModules.cmake b/Externals/CMakeModules.cmake
new file mode 100644
index 000000000..a2fb0449a
--- /dev/null
+++ b/Externals/CMakeModules.cmake
@@ -0,0 +1,7 @@
+CPMAddPackage(
+ NAME CMakeModules
+ GITHUB_REPOSITORY MethanePowered/CMakeModules
+ GIT_TAG 9de6ddab101ee6778bda388ae6a807d18cec91ac # last commit from 'methane' branch
+)
+
+list(APPEND CMAKE_MODULE_PATH "${CMakeModules_SOURCE_DIR}")
\ No newline at end of file
diff --git a/Externals/CPM.cmake b/Externals/CPM.cmake
new file mode 100644
index 000000000..6073550c1
--- /dev/null
+++ b/Externals/CPM.cmake
@@ -0,0 +1,21 @@
+set(CPM_DOWNLOAD_VERSION 0.35.1)
+
+if(CPM_SOURCE_CACHE)
+ # Expand relative path. This is important if the provided path contains a tilde (~)
+ get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE)
+ set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
+elseif(DEFINED ENV{CPM_SOURCE_CACHE})
+ set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
+else()
+ set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
+endif()
+
+if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
+ message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
+ file(DOWNLOAD
+ https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
+ ${CPM_DOWNLOAD_LOCATION}
+ )
+endif()
+
+include(${CPM_DOWNLOAD_LOCATION})
diff --git a/Externals/Catch2.cmake b/Externals/Catch2.cmake
new file mode 100644
index 000000000..2e110b375
--- /dev/null
+++ b/Externals/Catch2.cmake
@@ -0,0 +1,15 @@
+CPMAddPackage(
+ NAME Catch2
+ GITHUB_REPOSITORY MethanePowered/Catch2
+ VERSION 3.0.1
+)
+
+list(APPEND CMAKE_MODULE_PATH "${Catch2_SOURCE_DIR}/extras")
+
+# Catch2 headers produce build errors with GCC <= 9, which are muted here
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # GCC
+ target_compile_options(Catch2
+ PUBLIC
+ -Wno-parentheses
+ )
+endif()
diff --git a/Externals/DirectXHeaders.cmake b/Externals/DirectXHeaders.cmake
new file mode 100644
index 000000000..fdb86c866
--- /dev/null
+++ b/Externals/DirectXHeaders.cmake
@@ -0,0 +1,6 @@
+CPMAddPackage(
+ NAME DirectXHeaders
+ GITHUB_REPOSITORY MethanePowered/DirectXHeaders
+ VERSION 1.602.0
+)
+
diff --git a/Externals/DirectXShaderCompilerBinary.cmake b/Externals/DirectXShaderCompilerBinary.cmake
new file mode 100644
index 000000000..8ad6965b6
--- /dev/null
+++ b/Externals/DirectXShaderCompilerBinary.cmake
@@ -0,0 +1,10 @@
+include(MethaneModules)
+
+CPMAddPackage(
+ NAME DirectXShaderCompilerBinary
+ GITHUB_REPOSITORY MethanePowered/DirectXShaderCompilerBinary
+ VERSION 1.6.2104
+)
+
+get_platform_arch_dir(PLATFORM_ARCH_DIR CPP_EXT)
+set(DXC_BINARY_DIR "${DirectXShaderCompilerBinary_SOURCE_DIR}/binaries/${PLATFORM_ARCH_DIR}/bin" PARENT_SCOPE)
\ No newline at end of file
diff --git a/Externals/DirectXTex.cmake b/Externals/DirectXTex.cmake
new file mode 100644
index 000000000..99fe8af96
--- /dev/null
+++ b/Externals/DirectXTex.cmake
@@ -0,0 +1,16 @@
+CPMAddPackage(
+ NAME DirectXTex
+ GITHUB_REPOSITORY MethanePowered/DirectXTex
+ GIT_TAG may2022
+ VERSION 1.9.6
+ OPTIONS
+ "BUILD_DX12 ON"
+ "BUILD_DX11 OFF"
+ "BUILD_TOOLS OFF"
+ "BUILD_SAMPLE OFF"
+)
+
+set_target_properties(DirectXTex
+ PROPERTIES
+ FOLDER Externals
+)
diff --git a/Externals/FMT.cmake b/Externals/FMT.cmake
new file mode 100644
index 000000000..45092b953
--- /dev/null
+++ b/Externals/FMT.cmake
@@ -0,0 +1,11 @@
+CPMAddPackage(
+ NAME FMT
+ GITHUB_REPOSITORY MethanePowered/FMT
+ GIT_TAG 8.1.1
+ VERSION 8.1.1
+)
+
+set_target_properties(fmt
+ PROPERTIES
+ FOLDER Externals
+)
diff --git a/Externals/FreeType2.cmake b/Externals/FreeType2.cmake
new file mode 100644
index 000000000..ee0675c6f
--- /dev/null
+++ b/Externals/FreeType2.cmake
@@ -0,0 +1,23 @@
+CPMAddPackage(
+ NAME FreeType2
+ GITHUB_REPOSITORY MethanePowered/FreeType2
+ GIT_TAG VER-2-12-1
+ VERSION 2.12.1
+ OPTIONS
+ "FT_DISABLE_ZLIB ON"
+ "FT_DISABLE_BZIP2 ON"
+ "FT_DISABLE_PNG ON"
+ "FT_DISABLE_HARFBUZZ ON"
+ "FT_DISABLE_BROTLI ON"
+)
+
+if(MSVC)
+ target_compile_options(freetype PRIVATE /wd4267 /wd4244 /wd4018 /wd4312)
+else()
+ target_compile_options(freetype PRIVATE -Wno-everything)
+endif()
+
+set_target_properties(freetype
+ PROPERTIES
+ FOLDER Externals
+)
diff --git a/Externals/HLSLpp.cmake b/Externals/HLSLpp.cmake
new file mode 100644
index 000000000..19d6a1755
--- /dev/null
+++ b/Externals/HLSLpp.cmake
@@ -0,0 +1,20 @@
+CPMAddPackage(
+ NAME HLSLpp
+ GITHUB_REPOSITORY MethanePowered/HLSLpp
+ GIT_TAG 3.2
+ VERSION 3.2
+)
+
+add_library(HLSLpp INTERFACE)
+target_include_directories(HLSLpp INTERFACE ${HLSLpp_SOURCE_DIR}/include)
+target_compile_definitions(HLSLpp INTERFACE
+ HLSLPP_FEATURE_TRANSFORM # Enable transformation matrices
+ HLSLPP_LOGICAL_LAYOUT=0 # Set row-major logical layout
+ HLSLPP_COORDINATES=0 # Set left-handed coordinate system
+)
+
+if(MSVC)
+ target_sources(HLSLpp INTERFACE ${HLSLpp_SOURCE_DIR}/include/hlsl++.natvis)
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # GCC
+ target_compile_options(HLSLpp INTERFACE -Wno-deprecated-copy)
+endif()
diff --git a/Externals/IttApi.cmake b/Externals/IttApi.cmake
new file mode 100644
index 000000000..733f3b971
--- /dev/null
+++ b/Externals/IttApi.cmake
@@ -0,0 +1,10 @@
+CPMAddPackage(
+ NAME IttApi
+ GITHUB_REPOSITORY MethanePowered/IttApi
+ VERSION 3.23.0
+)
+
+set_target_properties(ittnotify
+ PROPERTIES
+ FOLDER Externals
+)
diff --git a/Externals/MagicEnum.cmake b/Externals/MagicEnum.cmake
new file mode 100644
index 000000000..75e28b7d1
--- /dev/null
+++ b/Externals/MagicEnum.cmake
@@ -0,0 +1,7 @@
+CPMAddPackage(
+ NAME MagicEnum
+ GITHUB_REPOSITORY MethanePowered/MagicEnum
+ VERSION 0.8.0
+ OPTIONS
+ "MAGIC_ENUM_OPT_INSTALL ON"
+)
diff --git a/Externals/OpenImageIOBinary.cmake b/Externals/OpenImageIOBinary.cmake
new file mode 100644
index 000000000..9c290c504
--- /dev/null
+++ b/Externals/OpenImageIOBinary.cmake
@@ -0,0 +1,5 @@
+CPMAddPackage(
+ NAME OpenImageIOBinary
+ GITHUB_REPOSITORY MethanePowered/OpenImageIOBinary
+ VERSION 2.0.5
+)
diff --git a/Externals/PerlinNoise.cmake b/Externals/PerlinNoise.cmake
new file mode 100644
index 000000000..5252a0d78
--- /dev/null
+++ b/Externals/PerlinNoise.cmake
@@ -0,0 +1,5 @@
+CPMAddPackage(
+ NAME PerlinNoise
+ GITHUB_REPOSITORY MethanePowered/PerlinNoise
+ VERSION 1.0
+)
diff --git a/Externals/README.md b/Externals/README.md
new file mode 100644
index 000000000..a3643083c
--- /dev/null
+++ b/Externals/README.md
@@ -0,0 +1,55 @@
+# Methane Kit External Dependencies
+
+All external [libraries](#libraries) and [build tools](#build-tools)
+are integrated using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) package manager script.
+Specific versions of the dependent repositories are cloned and configured
+during `MethaneKit` CMake configuration step either to the `Build/Output/ExternalsCache` directory (by default)
+or to the custom location provided via CMake option `CPM_SOURCE_CACHE`.
+Under CLion IDE dependent repositories are cloned inside cmake build directory of each configuration
+to support parallel cmake configurations processing.
+
+## Libraries
+
+| Libraries | Version | Linkage | License | Description |
+|-------------------------------------------------------------------|------------|-------------------|---------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
+| [Boost Nowide](https://github.com/boostorg/nowide) | 11.1.4 | Static | [BSL 1.0](https://github.com/boostorg/nowide/blob/develop/LICENSE) | Standard library functions with UTF-8 API on Windows. |
+| [Catch2](https://github.com/catchorg/Catch2) | 3.0.1 | Static (tests) | [BSL 1.0](https://github.com/catchorg/Catch2/blob/devel/LICENSE.txt) | A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later. |
+| [CLI11](https://github.com/CLIUtils/CLI11) | 2.2.0 | Header-only | [CLI11 2.2](https://github.com/CLIUtils/CLI11/blob/main/LICENSE) | CLI11 is a command line parser for C++11 and beyond that provides a rich feature set with a simple and intuitive interface. |
+| [DirectX Headers](https://github.com/microsoft/DirectX-Headers) | n/a | Header-only | [MIT](https://github.com/microsoft/DirectX-Headers/blob/main/LICENSE) | Official DirectX headers available under an open source license |
+| [DirectX Tex](https://github.com/microsoft/DirectXTex) | 1.9.6 | Static | [MIT](https://github.com/microsoft/DirectXTex/blob/main/LICENSE) | Texture processing library. |
+| [FMT](https://github.com/fmtlib/fmt) | 8.1.1 | Header-only | [Victor Zverovich](https://github.com/fmtlib/fmt/blob/master/LICENSE.rst) | A modern formatting library. |
+| [FreeType](https://gitlab.freedesktop.org/freetype/freetype/) | 2.12.1 | Static | [FreeType (GPL 3.0)](https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/docs/FTL.TXT) | FreeType is a freely available software library to render fonts. |
+| [HLSL++](https://github.com/redorav/hlslpp) | 3.2 | Header-only | [MIT](https://github.com/MethanePowered/HLSLpp/blob/master/LICENSE) | Math library using hlsl syntax with SSE/NEON support. |
+| [ITT API](https://github.com/intel/ittapi) | 3.23.0 | Static | [BSD 3.0](https://github.com/MethanePowered/IttApi/blob/master/LICENSES/BSD-3-Clause.txt) | Intel® Instrumentation and Tracing Technology (ITT) and Just-In-Time (JIT) API. |
+| [Magic Enum](https://github.com/Neargye/magic_enum) | 0.8.0 | Header-only | [MIT](https://github.com/Neargye/magic_enum/blob/master/LICENSE) | Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code. |
+| [OpenImageIO](https://github.com/OpenImageIO/oiio) | 2.0.5 | Static (optional) | [GPL 3.0](https://github.com/OpenCppCoverage/OpenCppCoverage/blob/master/LICENSE.txt) | Reading, writing, and processing images in a wide variety of file formats, using a format-agnostic API, aimed at VFX applications. |
+| [Perlin Noise](https://github.com/stegu/perlin-noise/) | 1.0 | Static | [Public Domain](https://github.com/stegu/perlin-noise/blob/master/LICENSE.md) | Simplex and Perlin noise implementation by Stefan Gustavson. |
+| [SPIRV-Cross](https://github.com/KhronosGroup/SPIRV-Cross) | 1.3.216.0 | Static | [Apache 2.0](https://github.com/KhronosGroup/SPIRV-Cross/blob/master/LICENSE) | A library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages. |
+| [STB](https://github.com/nothings/stb) | 2020-01-16 | Header-only | [MIT, Public Domain](https://github.com/nothings/stb/blob/master/LICENSE) | Single-file public domain libraries for C/C++. |
+| [TaskFlow](https://github.com/taskflow/taskflow) | 3.4.0 | Header-only | [MIT](https://github.com/taskflow/taskflow/blob/master/LICENSE) | A General-purpose Parallel and Heterogeneous Task Programming System. |
+| [Tracy](https://github.com/wolfpld/tracy) | 0.8.2.1 | Static | [BSD 3.0](https://github.com/wolfpld/tracy/blob/master/LICENSE) | A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications. |
+| [Vulkan Headers](https://github.com/MethanePowered/VulkanHeaders) | 1.3.219 | Header-only | [Apache 2.0](https://github.com/KhronosGroup/Vulkan-Headers/blob/main/LICENSE.txt) | Vulkan Header files and API registry. |
+
+## Build Tools
+
+| Libraries | Version | Usage | License | Description |
+|-------------------------------------------------------------------------------|-----------|--------------------------|------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
+| [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) | 0.35.1 | CMake | [MIT](https://github.com/cpm-cmake/CPM.cmake/blob/master/LICENSE) | CMake's missing package manager. |
+| [CMRC](https://github.com/vector-of-bool/cmrc) | n/a | CMake | [MIT](https://github.com/vector-of-bool/cmrc/blob/master/LICENSE.txt) | A Resource Compiler in a Single CMake script. |
+| [CMake Modules](https://github.com/rpavlik/cmake-modules) | n/a | CMake | [BSL 1.0](https://github.com/microsoft/CMakeModules/blob/main/LICENSE_1_0.txt) | R.Pavlik collection of CMake modules. |
+| [DirectX Shader Compiler](https://github.com/microsoft/DirectXShaderCompiler) | 1.6.2104 | HLSL Compiler to SPIRV | [LLVM Release](https://github.com/microsoft/DirectXShaderCompiler/blob/main/LICENSE.TXT) | Open-source HLSL Shader Compiler which is based on LLVM/Clang. |
+| [Filter Sarif](https://github.com/zbazztian/filter-sarif) | n/a | CodeQL Workflow | [Apache 2.0](https://github.com/zbazztian/filter-sarif/blob/master/LICENSE) | GitHub action to filter .sarif files produced by CodeQL. |
+| [SPIRV-Cross](https://github.com/KhronosGroup/SPIRV-Cross) | 1.3.216.0 | SPIRV Converter to Metal | [Apache 2.0](https://github.com/KhronosGroup/SPIRV-Cross/blob/master/LICENSE) | Practical tool for disassembling SPIR-V back to high level languages. |
+| [OpenCppCoverage](https://github.com/OpenCppCoverage/OpenCppCoverage) | 0.9.9.0 | Code Coverage in Azure | [GPL 3.0](https://github.com/OpenCppCoverage/OpenCppCoverage/blob/master/LICENSE.txt) | Open source code coverage tool for C++ under Windows. |
+
+## Assets
+
+| Type | Asset Name | Copyright | License | Description |
+|----------|----------------------------------------------------------------------|--------------------------------------------------------|-----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| Font | [Amiri](https://fonts.google.com/specimen/Amiri) | [Khaled Hosny](khaledhosny@eglug.org) | [OFL 1.1](http://scripts.sil.org/OFL) | Amiri is a classical Arabic typeface in Naskh style for typesetting books and other running text. Its design is a revival of the beautiful typeface pioneered in early 20th century by Bulaq Press in Cairo, also known as Amiria Press, after which the font is named. |
+| Font | [Playball](https://fonts.google.com/specimen/Playball) | [Robert Leuschke, TypeSETit LLC](typesetit.com) | [OFL 1.1](http://scripts.sil.org/OFL) | An athletic look was the inspiration for Playball. Take advantage of the sweeping swashes to give a true sports look. Perfect for baseball banners and the like. Playball comes with Latin Character sets including Western, Central, and Vietnamese language support. |
+| Font | [Roboto](https://fonts.google.com/specimen/Roboto) | [Christian Robertson](http://christianrobertson.com/) | [Apache 2.0](http://www.apache.org/licenses/) | Roboto has a mechanical skeleton and the forms are largely geometric. At the same time, the font features friendly and open curves. This makes for a more natural reading rhythm more commonly found in humanist and serif types. |
+| Font | [Roboto Mono](https://fonts.google.com/specimen/Roboto+Mono) | [Christian Robertson](http://christianrobertson.com/) | [Apache 2.0](http://www.apache.org/licenses/) | Monospaced addition to the Roboto type family. Like the other members of the Roboto family, the fonts are optimized for readability on screens across a wide variety of devices and reading environments. |
+| Font | [Sawarabi Mincho](https://fonts.google.com/specimen/Sawarabi+Mincho) | [Mshio](http://mshio.b.osdn.me/) | [OFL 1.1](http://scripts.sil.org/OFL) | Japanese font with a delicate and beautiful design, it is suitable for text and headline usage. It already has many hiragana, katakana, ruled lines, and so on, but it does not yet have enough kanji glyphs. |
+| Font | [Squada One](https://fonts.google.com/specimen/Squada+One) | [Admix Designs](http://www.admixdesigns.com/) | [OFL 1.1](http://scripts.sil.org/OFL) | Perfect font to make a lasting impression on any webpage. Its bold presence and geometric, condensed form allow for setting in any context. Squada One can be used at any size while still maintaining clarity and smoothness. |
+| Textures | [Solar System Planets](https://www.solarsystemscope.com/textures/) | [Solar System Scope](https://www.solarsystemscope.com) | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) | Textures in this pack are based on NASA elevation and imagery data. Colors and shades of the textures are tuned accordng to true-color photos made by Messenger, Viking and Cassini spacecrafts, and, of course, the Hubble Space Telescope. |
diff --git a/Externals/SPIRVCross.cmake b/Externals/SPIRVCross.cmake
new file mode 100644
index 000000000..e67bf24e3
--- /dev/null
+++ b/Externals/SPIRVCross.cmake
@@ -0,0 +1,23 @@
+CPMAddPackage(
+ NAME SPIRVCross
+ GITHUB_REPOSITORY MethanePowered/SPIRVCross
+ GIT_TAG sdk-1.3.216.0
+ VERSION 1.3.216.0
+ OPTIONS
+ "SPIRV_CROSS_STATIC ON"
+ "SPIRV_CROSS_SHARED OFF"
+ "SPIRV_CROSS_CLI OFF"
+ "SPIRV_CROSS_ENABLE_TESTS OFF"
+ "SPIRV_CROSS_ENABLE_HLSL ON"
+ "SPIRV_CROSS_ENABLE_GLSL ON"
+ "SPIRV_CROSS_ENABLE_MSL OFF"
+ "SPIRV_CROSS_ENABLE_CPP OFF"
+ "SPIRV_CROSS_ENABLE_REFLECT OFF"
+ "SPIRV_CROSS_ENABLE_C_API OFF"
+ "SPIRV_CROSS_ENABLE_UTIL OFF"
+)
+
+set_target_properties(spirv-cross-core spirv-cross-hlsl spirv-cross-glsl uninstall
+ PROPERTIES
+ FOLDER Externals
+)
\ No newline at end of file
diff --git a/Externals/SPIRVCrossBinary.cmake b/Externals/SPIRVCrossBinary.cmake
new file mode 100644
index 000000000..93ce8e8d5
--- /dev/null
+++ b/Externals/SPIRVCrossBinary.cmake
@@ -0,0 +1,8 @@
+CPMAddPackage(
+ NAME SPIRVCrossBinary
+ GITHUB_REPOSITORY MethanePowered/SPIRVCrossBinary
+ GIT_TAG b440a00005bf0225b4a815fd3dd2d98bba84d4df # 2020-01-16
+)
+
+get_platform_dir(PLATFORM_DIR CPP_EXT)
+set(SPIRV_BINARY_DIR "${SPIRVCrossBinary_SOURCE_DIR}/binaries/${PLATFORM_DIR}" PARENT_SCOPE)
diff --git a/Externals/STB.cmake b/Externals/STB.cmake
new file mode 100644
index 000000000..804dbbaac
--- /dev/null
+++ b/Externals/STB.cmake
@@ -0,0 +1,8 @@
+CPMAddPackage(
+ NAME STB
+ GITHUB_REPOSITORY MethanePowered/STB
+ GIT_TAG af1a5bc352164740c1cc1354942b1c6b72eacb8a
+)
+
+add_library(STB INTERFACE)
+target_include_directories(STB INTERFACE "${STB_SOURCE_DIR}")
diff --git a/Externals/TaskFlow.cmake b/Externals/TaskFlow.cmake
new file mode 100644
index 000000000..75276b418
--- /dev/null
+++ b/Externals/TaskFlow.cmake
@@ -0,0 +1,18 @@
+CPMAddPackage(
+ NAME TaskFlow
+ GITHUB_REPOSITORY MethanePowered/TaskFlow
+ VERSION 3.4.0
+ OPTIONS
+ "TF_BUILD_BENCHMARKS OFF"
+ "TF_BUILD_CUDA OFF"
+ "TF_BUILD_TESTS OFF"
+ "TF_BUILD_EXAMPLES OFF"
+)
+
+add_library(TaskFlow ALIAS Taskflow)
+
+if(MSVC)
+ target_compile_options(Taskflow INTERFACE
+ /wd4456 # declaration of 'lock' hides previous local declaration (taskflow/core/executor.hpp:1842)
+ )
+endif()
\ No newline at end of file
diff --git a/Externals/Tracy.cmake b/Externals/Tracy.cmake
new file mode 100644
index 000000000..61b0482db
--- /dev/null
+++ b/Externals/Tracy.cmake
@@ -0,0 +1,12 @@
+CPMAddPackage(
+ NAME Tracy
+ GITHUB_REPOSITORY MethanePowered/Tracy
+ VERSION 0.8.2.1
+ OPTIONS
+ "TRACY_ENABLE ${METHANE_TRACY_PROFILING_ENABLED}"
+ "TRACY_ON_DEMAND ${METHANE_TRACY_PROFILING_ON_DEMAND}"
+)
+
+# Tracy instrumentation interface library
+add_library(TracyInstrumentation INTERFACE)
+target_include_directories(TracyInstrumentation INTERFACE "${Tracy_SOURCE_DIR}")
diff --git a/Externals/VulkanHeaders.cmake b/Externals/VulkanHeaders.cmake
new file mode 100644
index 000000000..1a02380fa
--- /dev/null
+++ b/Externals/VulkanHeaders.cmake
@@ -0,0 +1,5 @@
+CPMAddPackage(
+ NAME VulkanHeaders
+ GITHUB_REPOSITORY MethanePowered/VulkanHeaders
+ VERSION 1.3.219
+)
diff --git a/Modules/Common/Instrumentation/CMakeLists.txt b/Modules/Common/Instrumentation/CMakeLists.txt
index 10c53803a..b511059ab 100644
--- a/Modules/Common/Instrumentation/CMakeLists.txt
+++ b/Modules/Common/Instrumentation/CMakeLists.txt
@@ -37,10 +37,10 @@ target_include_directories(${TARGET}
target_link_libraries(${TARGET}
PUBLIC
- $<$:MethanePlatformUtils> # Logging functions
MethanePrimitives
+ $<$:MethanePlatformUtils> # Logging functions
+ $<$:ittnotify>
TracyInstrumentation
- ittnotify
nowide
PRIVATE
MethaneBuildOptions
@@ -74,15 +74,6 @@ if (WIN32 AND METHANE_TRACY_PROFILING_ENABLED)
)
endif()
-# TracyClient interface target is defined separately in Externals,
-# but it also has to be configured with TRACY_* macro definitions
-# and is required for linking in target application for Tracy profiling
-target_compile_definitions(TracyClient
- INTERFACE
- $<$:TRACY_ENABLE>
- $<$:TRACY_ON_DEMAND>
-)
-
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${HEADERS} ${SOURCES})
if (APPLE)
diff --git a/Modules/Common/Instrumentation/Include/Methane/TracyGpu.hpp b/Modules/Common/Instrumentation/Include/Methane/TracyGpu.hpp
index b136da9fa..e07f0cd85 100644
--- a/Modules/Common/Instrumentation/Include/Methane/TracyGpu.hpp
+++ b/Modules/Common/Instrumentation/Include/Methane/TracyGpu.hpp
@@ -343,7 +343,7 @@ class GpuScope
tracy_force_inline void Complete(Timestamp gpu_begin_timestamp, Timestamp gpu_end_timestamp)
{
- if (!m_context_ptr)
+ if (!m_context_ptr || gpu_begin_timestamp == gpu_end_timestamp)
return;
#ifdef TRACY_ON_DEMAND
diff --git a/Modules/Common/PrecompiledHeaders/CMakeLists.txt b/Modules/Common/PrecompiledHeaders/CMakeLists.txt
index 23592fb98..9892c415d 100644
--- a/Modules/Common/PrecompiledHeaders/CMakeLists.txt
+++ b/Modules/Common/PrecompiledHeaders/CMakeLists.txt
@@ -91,12 +91,12 @@ set(PRECOMPILED_EXTRA_HEADERS ${PRECOMPILED_HEADERS}
if (METHANE_GFX_API EQUAL METHANE_GFX_DIRECTX)
set(PRECOMPILED_EXTRA_HEADERS ${PRECOMPILED_EXTRA_HEADERS}
-
-
+
+
)
set(PLATFORM_LIBRARIES
- D3DX12
+ DirectX-Headers
)
endif()
diff --git a/Modules/Common/Primitives/Include/Methane/Exceptions.hpp b/Modules/Common/Primitives/Include/Methane/Exceptions.hpp
index b9ff6dc47..2e17f89eb 100644
--- a/Modules/Common/Primitives/Include/Methane/Exceptions.hpp
+++ b/Modules/Common/Primitives/Include/Methane/Exceptions.hpp
@@ -99,7 +99,7 @@ class InvalidArgumentException : public ArgumentExceptionBase)
- return fmt::format("{}::{}({}) is not valid", magic_enum::enum_type_name(), magic_enum::enum_name(value), value);
+ return fmt::format("{}::{}({}) is not valid", magic_enum::enum_type_name(), magic_enum::enum_name(value), magic_enum::enum_integer(value));
else if constexpr (std::is_pointer_v)
return fmt::format("{}*({}) is not valid", typeid(V).name(), fmt::ptr(value));
else if constexpr (IsStaticCastable::value)
@@ -158,29 +158,30 @@ class ZeroArgumentException : public ArgumentExceptionBase>
+template
class UnexpectedArgumentException : public ArgumentExceptionBase
{
public:
- template
- UnexpectedArgumentException(const std::string& function_name, const std::string& variable_name, ValueType&& value, const std::string& description = "")
+ using DecayType = typename std::decay_t;
+
+ UnexpectedArgumentException(const std::string& function_name, const std::string& variable_name, DecayType value, const std::string& description = "")
: ArgumentExceptionBaseType(function_name, variable_name, GetMessage(value), description)
- , m_value(std::forward(value))
+ , m_value(std::move(value))
{ }
- [[nodiscard]] RawType GetValue() const noexcept { m_value; }
+ [[nodiscard]] const DecayType& GetValue() const noexcept { m_value; }
private:
- template
- static std::string GetMessage(ValueType&& value)
+ template
+ static std::string GetMessage(const V& value)
{
- if constexpr (std::is_enum_v)
- return fmt::format("{}::{}({}) is unexpected", magic_enum::enum_type_name(), magic_enum::enum_name(std::forward(value)), std::forward(value));
+ if constexpr (std::is_enum_v)
+ return fmt::format("{}::{}({}) is unexpected", magic_enum::enum_type_name(), magic_enum::enum_name(value), magic_enum::enum_integer(value));
else
- return fmt::format("{}({}) is unexpected", typeid(ValueType).name(), std::forward(value));
+ return fmt::format("{}({}) is unexpected", typeid(V).name(), value);
}
- RawType m_value;
+ DecayType m_value;
};
class NotImplementedException : public std::logic_error
diff --git a/Modules/Data/Types/Include/Methane/Data/Point.hpp b/Modules/Data/Types/Include/Methane/Data/Point.hpp
index a453a1cd0..46560d482 100644
--- a/Modules/Data/Types/Include/Methane/Data/Point.hpp
+++ b/Modules/Data/Types/Include/Methane/Data/Point.hpp
@@ -72,6 +72,16 @@ class Point
VectorType& AsVector() noexcept { return m_vector; }
const VectorType& AsVector() const noexcept { return m_vector; }
+ std::array AsArray() const noexcept
+ {
+ if constexpr (size == 2)
+ return std::array{{ GetX(), GetY() }};
+ else if constexpr (size == 3)
+ return std::array{{ GetX(), GetY(), GetZ() }};
+ else if constexpr (size == 4)
+ return std::array{{ GetX(), GetY(), GetZ(), GetW() }};
+ }
+
T GetX() const noexcept { return m_vector.x; }
T GetY() const noexcept { return m_vector.y; }
@@ -111,11 +121,59 @@ class Point
return *this;
}
- bool operator==(const PointType& other) const noexcept { return hlslpp::all(m_vector == other.AsVector()); }
+ [[nodiscard]] T operator[](size_t index) const
+ {
+ switch(index)
+ {
+ case 0: return m_vector.x;
+ case 1: return m_vector.y;
+ case 2: if constexpr(size > 2) return m_vector.z;
+ case 3: if constexpr(size > 3) return m_vector.w;
+ default: META_UNEXPECTED_ARG_RETURN(index, T{});
+ }
+ }
+
+ [[nodiscard]] bool operator==(const PointType& other) const noexcept
+ {
+#if defined(__APPLE__) && defined(__x86_64__)
+ // FIXME: workaround for HLSL++ issue (https://github.com/redorav/hlslpp/issues/61):
+ // Integer vector comparison is working incorrectly on Intel based Macs with MacOS >= 11
+ return AsArray() == other.AsArray();
+#else
+ return hlslpp::all(m_vector == other.AsVector());
+#endif
+ }
+
+ [[nodiscard]] bool operator<(const PointType& other) const noexcept
+ {
+#if defined(__APPLE__) && defined(__x86_64__)
+ // FIXME: workaround for HLSL++ issue (https://github.com/redorav/hlslpp/issues/61):
+ // Integer vector comparison is working incorrectly on Intel based Macs with MacOS >= 11
+ for(size_t i = 0; i < size; ++i)
+ if ((*this)[i] >= other[i])
+ return false;
+ return true;
+#else
+ return hlslpp::all(m_vector < other.AsVector());
+#endif
+ }
+
+ [[nodiscard]] bool operator>(const PointType& other) const noexcept
+ {
+#if defined(__APPLE__) && defined(__x86_64__)
+ // FIXME: workaround for HLSL++ issue (https://github.com/redorav/hlslpp/issues/61):
+ // Integer vector comparison is working incorrectly on Intel based Macs with MacOS >= 11
+ for(size_t i = 0; i < size; ++i)
+ if ((*this)[i] <= other[i])
+ return false;
+ return true;
+#else
+ return hlslpp::all(m_vector > other.AsVector());
+#endif
+ }
+
bool operator!=(const PointType& other) const noexcept { return !operator==(other); }
- bool operator<(const PointType& other) const noexcept { return hlslpp::all(m_vector < other.AsVector()); }
bool operator<=(const PointType& other) const noexcept { return hlslpp::all(m_vector <= other.AsVector()); }
- bool operator>(const PointType& other) const noexcept { return hlslpp::all(m_vector > other.AsVector()); }
bool operator>=(const PointType& other) const noexcept { return hlslpp::all(m_vector >= other.AsVector()); }
PointType operator+(const PointType& other) const noexcept { return PointType(m_vector + other.AsVector()); }
@@ -140,6 +198,13 @@ class Point
template
std::enable_if_t, PointType> operator/(M divisor) const noexcept
{
+#if defined(__APPLE__) && defined(__aarch64__)
+ // FIXME: workaround for HLSL++ issue (https://github.com/redorav/hlslpp/issues/60)
+ // Integer vector division is working incorrectly on Macs with Apple M1 (ARM)
+ std::array components = AsArray();
+ Divide(components, divisor);
+ return PointType(std::move(components));
+#else
if constexpr (std::is_same_v)
return PointType(m_vector / divisor);
else
@@ -149,6 +214,7 @@ class Point
else
return PointType(m_vector / static_cast(divisor));
}
+#endif
}
template
@@ -170,6 +236,13 @@ class Point
template
std::enable_if_t, PointType> operator/(const Point& divisor) const noexcept
{
+#if defined(__APPLE__) && defined(__aarch64__)
+ // FIXME: workaround for HLSL++ issue (https://github.com/redorav/hlslpp/issues/60)
+ // Integer vector division is working incorrectly on Macs with Apple M1 (ARM)
+ std::array components = AsArray();
+ Divide(components, divisor.AsArray());
+ return PointType(std::move(components));
+#else
if constexpr (std::is_same_v)
return PointType(m_vector / divisor.AsVector());
else
@@ -179,6 +252,7 @@ class Point
else
return PointType(m_vector / static_cast(divisor).AsVector());
}
+#endif
}
template
@@ -199,6 +273,13 @@ class Point
template
std::enable_if_t, PointType&> operator/=(M divisor) noexcept
{
+#if defined(__APPLE__) && defined(__aarch64__)
+ // FIXME: workaround for HLSL++ issue (https://github.com/redorav/hlslpp/issues/60)
+ // Integer vector division is working incorrectly on Macs with Apple M1 (ARM)
+ std::array components = AsArray();
+ Divide(components, divisor);
+ m_vector = RawVector(std::move(components)).AsHlsl();
+#else
if constexpr (std::is_same_v)
m_vector /= divisor;
else
@@ -208,6 +289,7 @@ class Point
else
m_vector /= static_cast(divisor);
}
+#endif
return *this;
}
@@ -229,6 +311,13 @@ class Point
template
std::enable_if_t, PointType&> operator/=(const Point& divisor) noexcept
{
+#if defined(__APPLE__) && defined(__aarch64__)
+ // FIXME: workaround for HLSL++ issue (https://github.com/redorav/hlslpp/issues/60)
+ // Integer vector division is working incorrectly on Macs with Apple M1 (ARM)
+ std::array components = AsArray();
+ Divide(components, divisor.AsArray());
+ m_vector = RawVector(std::move(components)).AsHlsl();
+#else
if constexpr (std::is_same_v)
m_vector /= divisor.AsVector();
else
@@ -238,6 +327,7 @@ class Point
else
m_vector /= static_cast(divisor).AsVector();
}
+#endif
return *this;
}
@@ -264,11 +354,37 @@ class Point
explicit operator VectorType() const noexcept { return m_vector; }
- const VectorType& AsHlsl() const noexcept { return m_vector; }
-
private:
static inline T Square(T s) noexcept { return s * s; }
+ template
+ static void Divide(T& component, M divisor)
+ {
+ if constexpr (std::is_same_v)
+ component /= divisor;
+ else
+ {
+ if constexpr (std::is_floating_point_v)
+ component = RoundCast(static_cast(component) / divisor);
+ else
+ component = RoundCast(component / static_cast(divisor));
+ }
+ }
+
+ template
+ static void Divide(std::array& components, M divisor)
+ {
+ for (T& component: components)
+ Divide(component, divisor);
+ }
+
+ template
+ static void Divide(std::array& components, const std::array& divisors)
+ {
+ for (size_t i = 0; i < size; ++i)
+ Divide(components[i], divisors[i]);
+ }
+
VectorType m_vector;
};
diff --git a/Modules/Data/Types/Include/Methane/Data/TimeRange.hpp b/Modules/Data/Types/Include/Methane/Data/TimeRange.hpp
index 2fd5add81..67a2081b2 100644
--- a/Modules/Data/Types/Include/Methane/Data/TimeRange.hpp
+++ b/Modules/Data/Types/Include/Methane/Data/TimeRange.hpp
@@ -26,6 +26,10 @@ Methane time range type definition
#include
#include
+#ifdef _WIN32
+#include
+#endif
+
namespace Methane::Data
{
@@ -34,21 +38,45 @@ using TimeRange = Range;
constexpr Timestamp g_one_sec_in_nanoseconds = 1000000000;
[[nodiscard]]
-inline Timestamp ConvertTimeSecondsToNanoseconds(double seconds)
+inline Timestamp ConvertTimeSecondsToNanoseconds(double seconds) noexcept
{
return static_cast(seconds * g_one_sec_in_nanoseconds);
}
[[nodiscard]]
-inline Timestamp ConvertTicksToNanoseconds(Timestamp ticks, Frequency frequency)
+inline Timestamp ConvertTicksToNanoseconds(Timestamp ticks, Frequency frequency) noexcept
{
return ticks * g_one_sec_in_nanoseconds / frequency;
}
[[nodiscard]]
-inline float ConvertFrequencyToTickPeriod(Frequency frequency)
+inline float ConvertFrequencyToTickPeriod(Frequency frequency) noexcept
{
return static_cast(g_one_sec_in_nanoseconds) / static_cast(frequency);
}
+#ifdef _WIN32
+
+inline uint64_t GetQpcFrequency() noexcept
+{
+ LARGE_INTEGER t;
+ QueryPerformanceFrequency( &t );
+ return static_cast(t.QuadPart);
+}
+
+inline uint64_t GetQpcToNSecMultiplier() noexcept
+{
+ static const auto s_qpc_to_nsec = static_cast(static_cast(g_one_sec_in_nanoseconds) / static_cast(GetQpcFrequency()));
+ return s_qpc_to_nsec;
+}
+
+#else // !defined(_WIN32)
+
+inline uint64_t GetQpcToNSecMultiplier() noexcept
+{
+ return 1U;
+}
+
+#endif // defined(_WIN32)
+
} // namespace Methane::Data
diff --git a/Modules/Data/Types/Include/Methane/Data/Vector.hpp b/Modules/Data/Types/Include/Methane/Data/Vector.hpp
index fa8ac0bcc..41a5d1aa9 100644
--- a/Modules/Data/Types/Include/Methane/Data/Vector.hpp
+++ b/Modules/Data/Types/Include/Methane/Data/Vector.hpp
@@ -254,10 +254,10 @@ class RawVector
return RoundCast(std::sqrt(square_sum));
}
- [[nodiscard]] T operator[](size_t index) const noexcept { return m_components[index]; }
- [[nodiscard]] T& operator[](size_t index) noexcept { return m_components[index]; }
+ [[nodiscard]] T operator[](size_t index) const { META_CHECK_ARG_LESS(index, size); return m_components[index]; }
+ [[nodiscard]] T& operator[](size_t index) { META_CHECK_ARG_LESS(index, size); return m_components[index]; }
- [[nodiscard]] T Get(size_t index) const { META_CHECK_ARG_LESS(index, size); return m_components[index]; }
+ [[nodiscard]] T Get(size_t index) const { META_CHECK_ARG_LESS(index, size); return m_components[index]; }
[[nodiscard]] T GetX() const noexcept { return m_components[0]; }
[[nodiscard]] T GetY() const noexcept { return m_components[1]; }
diff --git a/Modules/Graphics/Core/CMakeLists.txt b/Modules/Graphics/Core/CMakeLists.txt
index 1d56f528f..a3845c85e 100644
--- a/Modules/Graphics/Core/CMakeLists.txt
+++ b/Modules/Graphics/Core/CMakeLists.txt
@@ -82,9 +82,9 @@ if (METHANE_GFX_API EQUAL METHANE_GFX_DIRECTX)
)
set(PLATFORM_LIBRARIES
- D3DX12
+ DirectX-Headers
DirectXTex
- D3DCompilerToDXC
+ DirectXCompiler
d3d12
dxgi
dxguid
@@ -217,7 +217,8 @@ elseif(METHANE_GFX_API EQUAL METHANE_GFX_VULKAN)
endif()
set(PLATFORM_LIBRARIES
- $<$>:Vulkan-Headers> # Lin/Win: Dynamic linking with Vulkan, so only Vulkan headers are needed
+ $<$>:Vulkan-Headers> # Lin/Win: Dynamic linking with Vulkan, only Vulkan headers are needed
+ $<$:dl> # Linux: Link with dynamic linker for vk::DynamicLoader on Linux
$<$:Vulkan::Vulkan> # MacOS: Link statically with MoltenVK framework on MacOS
spirv-cross-core
spirv-cross-hlsl
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/CommandListBase.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/CommandListBase.cpp
index 852994363..52faa59e5 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/CommandListBase.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/CommandListBase.cpp
@@ -262,6 +262,7 @@ void CommandListBase::CompleteInternal()
"{} command list '{}' in {} state can not be completed; only command lists in 'Executing' state can be completed",
magic_enum::enum_name(m_type), GetName(), magic_enum::enum_name(m_state));
+ ReleaseRetainedResources();
SetCommandListStateNoLock(State::Pending);
TRACY_GPU_SCOPE_COMPLETE(m_tracy_gpu_scope, GetGpuTimeRange(false));
@@ -380,7 +381,6 @@ void CommandListBase::ResetCommandState()
{
META_FUNCTION_TASK();
m_command_state.program_bindings_ptr = nullptr;
- m_command_state.retained_resources.clear();
}
void CommandListBase::ApplyProgramBindings(ProgramBindingsBase& program_bindings, ProgramBindings::ApplyBehavior apply_behavior)
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/CommandListBase.h b/Modules/Graphics/Core/Sources/Methane/Graphics/CommandListBase.h
index bf57fb17a..d2304e7d6 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/CommandListBase.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/CommandListBase.h
@@ -110,8 +110,9 @@ class CommandListBase
const ProgramBindingsBase* GetProgramBindingsPtr() const noexcept { return GetCommandState().program_bindings_ptr; }
Ptr GetCommandListPtr() { return GetPtr(); }
- inline void RetainResource(const Ptr& resource_ptr) { if (resource_ptr) m_command_state.retained_resources.emplace_back(resource_ptr); }
- inline void RetainResource(ObjectBase& resource) { m_command_state.retained_resources.emplace_back(resource.GetBasePtr()); }
+ inline void RetainResource(const Ptr& resource_ptr) { if (resource_ptr) m_command_state.retained_resources.emplace_back(resource_ptr); }
+ inline void RetainResource(ObjectBase& resource) { m_command_state.retained_resources.emplace_back(resource.GetBasePtr()); }
+ inline void ReleaseRetainedResources() { m_command_state.retained_resources.clear(); }
template>>
inline void RetainResources(const Ptrs& resource_ptrs)
@@ -127,11 +128,12 @@ class CommandListBase
CommandState& GetCommandState() { return m_command_state; }
const CommandState& GetCommandState() const { return m_command_state; }
- void SetCommandListState(State state);
- void SetCommandListStateNoLock(State state);
- bool IsExecutingOnAnyFrame() const { return m_state == State::Executing; }
- bool IsCommitted() const { return m_state == State::Committed; }
- bool IsExecuting() const { return m_state == State::Executing; }
+ void SetCommandListState(State state);
+ void SetCommandListStateNoLock(State state);
+ bool IsExecutingOnAnyFrame() const { return m_state == State::Executing; }
+ bool IsCommitted() const { return m_state == State::Committed; }
+ bool IsExecuting() const { return m_state == State::Executing; }
+ auto LockStateMutex() const { return std::scoped_lock(m_state_mutex); }
void InitializeTimestampQueries();
void BeginGpuZone();
@@ -155,7 +157,7 @@ class CommandListBase
DebugGroupStack m_open_debug_groups;
CompletedCallback m_completed_callback;
State m_state = State::Pending;
- mutable TracyLockable(std::mutex, m_state_mutex)
+ mutable TracyLockable(std::recursive_mutex, m_state_mutex)
TracyLockable(std::mutex, m_state_change_mutex)
std::condition_variable_any m_state_change_condition_var;
TRACY_GPU_SCOPE_TYPE m_tracy_gpu_scope;
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/CommandQueueTrackingBase.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/CommandQueueTrackingBase.cpp
index 084aba23a..1569b6e95 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/CommandQueueTrackingBase.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/CommandQueueTrackingBase.cpp
@@ -61,20 +61,7 @@ CommandQueueTrackingBase::CommandQueueTrackingBase(const ContextBase& context, C
CommandQueueTrackingBase::~CommandQueueTrackingBase()
{
META_FUNCTION_TASK();
- try
- {
- // Do not use virtual call in destructor
- CommandQueueTrackingBase::CompleteExecution();
- }
- catch(const std::exception& ex)
- {
- META_UNUSED(ex);
- META_LOG("WARNING: Command queue '{}' has failed to complete command list execution, exception occurred: {}", GetName(), ex.what());
- assert(false);
- }
- m_execution_waiting = false;
- m_execution_waiting_condition_var.notify_one();
- m_execution_waiting_thread.join();
+ ShutdownQueueExecution();
}
void CommandQueueTrackingBase::InitializeTimestampQueryBuffer()
@@ -132,7 +119,6 @@ void CommandQueueTrackingBase::CompleteExecution(const Opt& frame_i
while (!m_executing_command_lists.empty() &&
m_executing_command_lists.front()->GetFrameIndex() == frame_index)
{
- META_CHECK_ARG_NOT_NULL(m_executing_command_lists.front());
m_executing_command_lists.front()->Complete();
m_executing_command_lists.pop();
}
@@ -146,7 +132,7 @@ void CommandQueueTrackingBase::WaitForExecution() noexcept
do
{
std::unique_lock lock(m_execution_waiting_mutex);
- m_execution_waiting_condition_var.wait(lock,
+ m_execution_waiting_condition_var.wait_for(lock, std::chrono::milliseconds(32),
[this] { return !m_execution_waiting || !m_executing_command_lists.empty(); }
);
@@ -167,14 +153,11 @@ void CommandQueueTrackingBase::WaitForExecution() noexcept
CompleteCommandListSetExecution(*command_list_set_ptr);
}
- // FIXME: GPU timestamps re-calibration does not work correctly for DirectX, so it's used for Vulkan only
-#ifdef METHANE_GFX_VULKAN
if (m_timestamp_query_buffer_ptr)
{
const TimestampQueryBuffer::CalibratedTimestamps calibrated_timestamps = m_timestamp_query_buffer_ptr->Calibrate();
GetTracyContext().Calibrate(calibrated_timestamps.cpu_ts, calibrated_timestamps.gpu_ts);
}
-#endif
}
while (m_execution_waiting);
}
@@ -216,4 +199,32 @@ void CommandQueueTrackingBase::CompleteCommandListSetExecution(CommandListSetBas
}
}
+void CommandQueueTrackingBase::ShutdownQueueExecution()
+{
+ META_FUNCTION_TASK();
+ if (!m_execution_waiting)
+ return;
+
+ {
+ std::unique_lock lock(m_execution_waiting_mutex);
+ m_timestamp_query_buffer_ptr.reset();
+
+ try
+ {
+ // Do not use virtual call in destructor
+ CommandQueueTrackingBase::CompleteExecution();
+ }
+ catch (const std::exception& ex) // NOSONAR
+ {
+ META_UNUSED(ex);
+ META_LOG("WARNING: Command queue '{}' has failed to complete command list execution, exception occurred: {}", GetName(), ex.what());
+ assert(false);
+ }
+
+ m_execution_waiting = false;
+ }
+ m_execution_waiting_condition_var.notify_one();
+ m_execution_waiting_thread.join();
+}
+
} // namespace Methane::Graphics
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/CommandQueueTrackingBase.h b/Modules/Graphics/Core/Sources/Methane/Graphics/CommandQueueTrackingBase.h
index bcfd8b10e..2d358c7eb 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/CommandQueueTrackingBase.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/CommandQueueTrackingBase.h
@@ -86,6 +86,8 @@ class CommandQueueTrackingBase // NOSONAR - destructor is required
virtual void CompleteCommandListSetExecution(CommandListSetBase& executing_command_list_set);
+ void ShutdownQueueExecution();
+
private:
void WaitForExecution() noexcept;
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/ContextBase.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/ContextBase.cpp
index 410b5f34c..75d4a4a75 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/ContextBase.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/ContextBase.cpp
@@ -104,7 +104,7 @@ void ContextBase::Reset(Device& device)
WaitForGpu(WaitFor::RenderComplete);
Release();
- Initialize(static_cast(device), false);
+ Initialize(static_cast(device), true);
}
void ContextBase::Reset()
@@ -147,7 +147,7 @@ void ContextBase::Release()
Data::Emitter::Emit(&IContextCallback::OnContextReleased, std::ref(*this));
}
-void ContextBase::Initialize(DeviceBase& device, bool /* deferred_heap_allocation */, bool is_callback_emitted)
+void ContextBase::Initialize(DeviceBase& device, bool is_callback_emitted)
{
META_FUNCTION_TASK();
META_LOG("Context '{}' INITIALIZE", GetName());
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/ContextBase.h b/Modules/Graphics/Core/Sources/Methane/Graphics/ContextBase.h
index 4b8a7d0c4..14ca8d941 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/ContextBase.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/ContextBase.h
@@ -79,7 +79,7 @@ class ContextBase
const Device& GetDevice() const final;
// ContextBase interface
- virtual void Initialize(DeviceBase& device, bool deferred_heap_allocation, bool is_callback_emitted = true);
+ virtual void Initialize(DeviceBase& device, bool is_callback_emitted = true);
virtual void Release();
// Object interface
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DescriptorManagerBase.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DescriptorManagerBase.cpp
index 6aee21dea..4b8351c59 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DescriptorManagerBase.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DescriptorManagerBase.cpp
@@ -54,8 +54,11 @@ void DescriptorManagerBase::CompleteInitialization()
static const auto binding_initialization_completer = [](const WeakPtr& program_bindings_wptr)
{
META_FUNCTION_TASK();
+ // Some binding pointers may become expired here due to command list retained resources cleanup on execution completion
Ptr program_bindings_ptr = program_bindings_wptr.lock();
- META_CHECK_ARG_NOT_NULL(program_bindings_ptr);
+ if (!program_bindings_ptr)
+ return;
+
static_cast(*program_bindings_ptr).CompleteInitialization();
};
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/BufferDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/BufferDX.h
index 8fca0a7a7..a197e3cca 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/BufferDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/BufferDX.h
@@ -28,13 +28,13 @@ DirectX 12 implementation of the buffer interface.
#include "DescriptorHeapDX.h"
#include
-#include
+#include
#include
#include
#include
#include
-#include
+#include
namespace Methane::Graphics
{
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandListDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandListDX.h
index 93aa9873a..ef95db7fa 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandListDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandListDX.h
@@ -28,7 +28,7 @@ DirectX 12 command list accessor interface for template class CommandListDX
#include
-#include
+#include
#include
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandListDX.hpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandListDX.hpp
index f29ea2eff..e030b9c08 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandListDX.hpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandListDX.hpp
@@ -31,13 +31,13 @@ DirectX 12 base template implementation of the command list interface.
#include "ProgramBindingsDX.h"
#include
-#include
+#include
#include
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -92,6 +92,7 @@ class CommandListDX
void Commit() override
{
META_FUNCTION_TASK();
+ const auto state_lock = CommandListBase::LockStateMutex();
CommandListBaseT::Commit();
EndGpuZoneDX();
@@ -122,6 +123,7 @@ class CommandListDX
void Reset(CommandList::DebugGroup* p_debug_group) override
{
META_FUNCTION_TASK();
+ const auto state_lock = CommandListBase::LockStateMutex();
if (!m_is_native_committed)
return;
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandQueueDX.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandQueueDX.cpp
index 4d11cc1fa..8f3bc0e8c 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandQueueDX.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandQueueDX.cpp
@@ -29,7 +29,7 @@ DirectX 12 implementation of the command queue interface.
#include "ParallelRenderCommandListDX.h"
#include
-#include
+#include
#include
#include
@@ -100,6 +100,8 @@ CommandQueueDX::CommandQueueDX(const ContextBase& context, CommandList::Type com
CommandQueueDX::~CommandQueueDX() // NOSONAR - destructor is not default under define
{
+ META_FUNCTION_TASK();
+ ShutdownQueueExecution();
#if defined(METHANE_GPU_INSTRUMENTATION_ENABLED) && METHANE_GPU_INSTRUMENTATION_ENABLED == 2
TracyD3D12Destroy(m_tracy_context);
#endif
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandQueueDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandQueueDX.h
index 282626eba..dcee1cf67 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandQueueDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/CommandQueueDX.h
@@ -31,7 +31,7 @@ DirectX 12 implementation of the command queue interface.
#pragma warning(pop)
#include
-#include
+#include
namespace Methane::Graphics
{
@@ -41,7 +41,8 @@ namespace wrl = Microsoft::WRL;
struct IContextDX;
class CommandListSetDX;
-class CommandQueueDX final : public CommandQueueTrackingBase
+class CommandQueueDX final // NOSONAR - destructor is needed
+ : public CommandQueueTrackingBase
{
public:
CommandQueueDX(const ContextBase& context, CommandList::Type command_lists_type);
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ContextDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ContextDX.h
index 14187cb41..06c4e7619 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ContextDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ContextDX.h
@@ -25,7 +25,7 @@ DirectX 12 context accessor interface for template class ContextDX
#include
-#include
+#include
namespace Methane::Graphics
{
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ContextDX.hpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ContextDX.hpp
index de837df83..9377dcb4e 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ContextDX.hpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ContextDX.hpp
@@ -31,12 +31,12 @@ DirectX 12 base template implementation of the context interface.
#include
#include
-#include
+#include
#include
#include
#include
-#include
+#include
#include
@@ -57,20 +57,11 @@ class ContextDX : public ContextBaseT
// ContextBase interface
- void Initialize(DeviceBase& device, bool deferred_heap_allocation, bool is_callback_emitted) override
+ void Initialize(DeviceBase& device, bool is_callback_emitted) override
{
META_FUNCTION_TASK();
- ContextBaseT::Initialize(device, deferred_heap_allocation, false);
-
- m_descriptor_manager_init_settings.deferred_heap_allocation = deferred_heap_allocation;
- if (deferred_heap_allocation)
- {
- m_descriptor_manager_init_settings.default_heap_sizes = {};
- m_descriptor_manager_init_settings.shader_visible_heap_sizes = {};
- }
-
+ ContextBaseT::Initialize(device, false);
GetDescriptorManagerDX().Initialize(m_descriptor_manager_init_settings);
-
if (is_callback_emitted)
{
Data::Emitter::Emit(&IContextCallback::OnContextInitialized, *this);
@@ -130,7 +121,7 @@ class ContextDX : public ContextBaseT
using NativeQueryHeaps = std::array, D3D12_QUERY_HEAP_TYPE_COPY_QUEUE_TIMESTAMP + 1>;
DescriptorManagerDX::Settings m_descriptor_manager_init_settings{ true, {}, {} };
- mutable NativeQueryHeaps m_query_heaps;
+ mutable NativeQueryHeaps m_query_heaps;
};
} // namespace Methane::Graphics
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DescriptorHeapDX.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DescriptorHeapDX.cpp
index 6b4a2b1ae..2f5b0b165 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DescriptorHeapDX.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DescriptorHeapDX.cpp
@@ -26,7 +26,7 @@ Descriptor Heap is a platform abstraction of DirectX 12 descriptor heaps.
#include
#include
-#include
+#include
#include
#include
#include
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DescriptorHeapDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DescriptorHeapDX.h
index f2f4d4c3b..2a5975401 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DescriptorHeapDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DescriptorHeapDX.h
@@ -36,7 +36,7 @@ Descriptor Heap is a platform abstraction of DirectX 12 descriptor heaps.
#include
#include
-#include
+#include
namespace Methane::Graphics
{
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DeviceDX.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DeviceDX.cpp
index ec03739cc..fd13a108f 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DeviceDX.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DeviceDX.cpp
@@ -23,7 +23,7 @@ DirectX 12 implementation of the device interface.
#include "DeviceDX.h"
-#include
+#include
#include
#include
#include
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DeviceDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DeviceDX.h
index c057c0483..c3a739572 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DeviceDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/DeviceDX.h
@@ -27,8 +27,8 @@ DirectX 12 implementation of the device interface.
#include
#include
-#include
-#include
+#include
+#include
#include
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/FenceDX.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/FenceDX.cpp
index c3a534cf3..acb794d3f 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/FenceDX.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/FenceDX.cpp
@@ -27,7 +27,7 @@ DirectX 12 fence implementation.
#include
#include
-#include
+#include
#include
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/FenceDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/FenceDX.h
index 0d9d50933..ba519ddb5 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/FenceDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/FenceDX.h
@@ -26,7 +26,7 @@ DirectX 12 fence implementation.
#include
#include
-#include
+#include
namespace Methane::Graphics
{
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ParallelRenderCommandListDX.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ParallelRenderCommandListDX.cpp
index 1e12f240c..005d2084e 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ParallelRenderCommandListDX.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ParallelRenderCommandListDX.cpp
@@ -30,7 +30,7 @@ DirectX 12 implementation of the parallel render command list interface.
#include
#include
-#include
+#include
#include
#include
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramBindingsDX.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramBindingsDX.cpp
index 63b30c472..ecb26649d 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramBindingsDX.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramBindingsDX.cpp
@@ -35,7 +35,7 @@ DirectX 12 implementation of the program bindings interface.
#include
#include
-#include
+#include
#include
namespace Methane::Graphics
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramBindingsDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramBindingsDX.h
index 10e94fd5d..61da0baa0 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramBindingsDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramBindingsDX.h
@@ -28,7 +28,7 @@ DirectX 12 implementation of the program bindings interface.
#include
#include
-#include
+#include
#include
#include
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramDX.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramDX.cpp
index d29e6c213..b4bed8ee1 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramDX.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramDX.cpp
@@ -29,9 +29,9 @@ DirectX 12 implementation of the program interface.
#include
#include
-#include
+#include
-#include
+#include
#include
#include
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramDX.h
index f63c52181..1b9135410 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/ProgramDX.h
@@ -29,7 +29,7 @@ DirectX 12 implementation of the program interface.
#include "ProgramBindingsDX.h"
#include
-#include
+#include
#include
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/QueryBufferDX.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/QueryBufferDX.cpp
index 34eff0047..166058bbd 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/QueryBufferDX.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/QueryBufferDX.cpp
@@ -31,12 +31,12 @@ DirectX 12 GPU query results buffer.
#include
#include
#include
-#include
+#include
#include
#include
#include
-#include
+#include
namespace wrl = Microsoft::WRL;
@@ -201,6 +201,7 @@ TimestampQueryBuffer::CalibratedTimestamps TimestampQueryBufferDX::Calibrate()
CalibratedTimestamps calibrated_timestamps{ 0U, 0U };
ThrowIfFailed(GetCommandQueueDX().GetNativeCommandQueue().GetClockCalibration(&calibrated_timestamps.gpu_ts, &calibrated_timestamps.cpu_ts),
GetContextDX().GetDeviceDX().GetNativeDevice().Get());
+ calibrated_timestamps.cpu_ts *= Data::GetQpcToNSecMultiplier();
SetCalibratedTimestamps(calibrated_timestamps);
return calibrated_timestamps;
}
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/QueryBufferDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/QueryBufferDX.h
index bdd2c6a7e..ac34bd84d 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/QueryBufferDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/QueryBufferDX.h
@@ -26,7 +26,7 @@ DirectX 12 GPU query results buffer.
#include
#include
-#include
+#include
namespace Methane::Graphics
{
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderCommandListDX.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderCommandListDX.cpp
index 128330998..8fbd555f8 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderCommandListDX.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderCommandListDX.cpp
@@ -32,10 +32,10 @@ DirectX 12 implementation of the render command list interface.
#include
#include
-#include
+#include
#include
-#include
+#include
namespace Methane::Graphics
{
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderContextDX.cpp b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderContextDX.cpp
index b03ad5692..4d8867c23 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderContextDX.cpp
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderContextDX.cpp
@@ -26,7 +26,7 @@ DirectX 12 implementation of the render context interface.
#include "CommandQueueDX.h"
#include "TypesDX.h"
-#include
+#include
#include
#include
@@ -135,7 +135,7 @@ void RenderContextDX::Release()
ContextDX::Release();
}
-void RenderContextDX::Initialize(DeviceBase& device, bool deferred_heap_allocation, bool is_callback_emitted)
+void RenderContextDX::Initialize(DeviceBase& device, bool is_callback_emitted)
{
META_FUNCTION_TASK();
@@ -204,7 +204,7 @@ void RenderContextDX::Initialize(DeviceBase& device, bool deferred_heap_allocati
UpdateFrameBufferIndex();
- ContextDX::Initialize(device, deferred_heap_allocation, is_callback_emitted);
+ ContextDX::Initialize(device, is_callback_emitted);
}
void RenderContextDX::Resize(const FrameSize& frame_size)
diff --git a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderContextDX.h b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderContextDX.h
index 8fa3f71ed..cbe645444 100644
--- a/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderContextDX.h
+++ b/Modules/Graphics/Core/Sources/Methane/Graphics/DirectX12/RenderContextDX.h
@@ -51,7 +51,7 @@ class RenderContextDX final : public ContextDX