├── .clang-format
├── .gitignore
├── .idea
├── codeStyles
│ └── codeStyleConfig.xml
├── hevx.iml
├── inspectionProfiles
│ └── Project_Default.xml
├── misc.xml
├── modules.xml
└── vcs.xml
├── .travis.yml
├── .ycm_extra_conf.py
├── CMakeLists.txt
├── CMakeSettings.json
├── CTestConfig.cmake
├── LICENSE.md
├── README.md
├── cmake
├── FindSphinx.cmake
├── HEVToolchain.cmake
└── HEVUserMakeRulesOverride.cmake
├── docs
├── .gitignore
├── CMakeLists.txt
├── Doxyfile.in
├── api.rst
├── conf.py.in
├── figures
│ └── highlevel_architecture.svg
├── index.rst
├── namespaces
│ ├── iris.rst
│ └── iris_renderer.rst
├── pages.rst
├── pages
│ ├── NIST_techniques_raytracing.md
│ ├── control_commands.md
│ ├── ecs_design.md
│ └── scenegraph.md
└── sphinx
│ └── _static
│ └── css
│ └── hevx_custom.css
├── iris
├── CMakeLists.txt
├── KHR
│ └── khrplatform.h
├── acceleration_structure.cc
├── acceleration_structure.h
├── assets
│ ├── data
│ │ ├── README.md
│ │ └── cars.json
│ ├── fonts
│ │ ├── SourceSansPro-Black.ttf
│ │ ├── SourceSansPro-BlackIt.ttf
│ │ ├── SourceSansPro-Bold.ttf
│ │ ├── SourceSansPro-BoldIt.ttf
│ │ ├── SourceSansPro-ExtraLight.ttf
│ │ ├── SourceSansPro-ExtraLightIt.ttf
│ │ ├── SourceSansPro-It.ttf
│ │ ├── SourceSansPro-LICENSE.txt
│ │ ├── SourceSansPro-Light.ttf
│ │ ├── SourceSansPro-LightIt.ttf
│ │ ├── SourceSansPro-Regular.ttf
│ │ ├── SourceSansPro-Semibold.ttf
│ │ └── SourceSansPro-SemiboldIt.ttf
│ ├── models
│ │ ├── Box
│ │ │ ├── Box_README.md
│ │ │ ├── glTF-Binary
│ │ │ │ └── Box.glb
│ │ │ ├── glTF-Draco
│ │ │ │ ├── 0.bin
│ │ │ │ └── Box.gltf
│ │ │ ├── glTF-Embedded
│ │ │ │ └── Box.gltf
│ │ │ ├── glTF-pbrSpecularGlossiness
│ │ │ │ ├── Box.gltf
│ │ │ │ └── Box0.bin
│ │ │ ├── glTF
│ │ │ │ ├── Box.gltf
│ │ │ │ └── Box0.bin
│ │ │ └── screenshot
│ │ │ │ └── screenshot.png
│ │ ├── BoxTextured
│ │ │ ├── BoxTextured_README.md
│ │ │ ├── glTF-Binary
│ │ │ │ └── BoxTextured.glb
│ │ │ ├── glTF-Embedded
│ │ │ │ └── BoxTextured.gltf
│ │ │ ├── glTF-pbrSpecularGlossiness
│ │ │ │ ├── BoxTextured.gltf
│ │ │ │ ├── BoxTextured0.bin
│ │ │ │ └── CesiumLogoFlat.png
│ │ │ ├── glTF
│ │ │ │ ├── BoxTextured.gltf
│ │ │ │ ├── BoxTextured0.bin
│ │ │ │ └── CesiumLogoFlat.png
│ │ │ └── screenshot
│ │ │ │ └── screenshot.png
│ │ ├── Gnomon
│ │ │ ├── gnomon.bin
│ │ │ ├── gnomon.gltf
│ │ │ └── gnomon.py
│ │ └── RaytracedSpheres
│ │ │ ├── spheres.bin
│ │ │ └── spheres.gltf
│ ├── shaders
│ │ ├── gltf.vert
│ │ ├── gltf_pbr.frag
│ │ ├── lambertian.rchit
│ │ ├── metal.rchit
│ │ ├── miss.rmiss
│ │ ├── prd.glsl
│ │ ├── rand.glsl
│ │ ├── raygen.rgen
│ │ ├── sphere.glsl
│ │ └── sphere.rint
│ └── shadertoy
│ │ ├── shadertoy_uv.frag
│ │ └── spheres.gltf
├── buffer.cc
├── buffer.h
├── components
│ ├── material.h
│ ├── renderable.h
│ └── traceable.h
├── config.h.in
├── configs
│ ├── 4kdesktop.json
│ ├── desktop.json
│ ├── nist_cave.json
│ └── simulator.json
├── enumerate.h
├── error.h
├── flext
│ ├── vk_win32_khr.txt
│ ├── vk_xcb_khr.txt
│ ├── vk_xlib_khr.txt
│ └── vulkan
│ │ ├── flextVk.cpp.template
│ │ └── flextVk.h.template
├── image.cc
├── image.h
├── io
│ ├── gltf.cc
│ ├── gltf.h
│ ├── json.cc
│ ├── json.h
│ ├── read_file.cc
│ ├── read_file.h
│ ├── shadertoy.cc
│ └── shadertoy.h
├── iris-dxr.cc
├── iris-swsynth.cc
├── iris-viewer.cc
├── logging.h
├── pipeline.cc
├── pipeline.h
├── protos.h
├── protos
│ ├── color.proto
│ ├── control.proto
│ ├── displays.proto
│ ├── examine.proto
│ ├── nav.proto
│ └── window.proto
├── renderer.cc
├── renderer.h
├── renderer_private.h
├── safe_numeric.h
├── shader.cc
├── shader.h
├── string_util.cc
├── string_util.h
├── test
│ ├── CMakeLists.txt
│ └── safe_numeric.cc
├── trackball.h
├── types.h
├── ui_util.h
├── vulkan.h
├── vulkan_util.cc
├── vulkan_util.h
├── window.cc
├── window.h
└── wsi
│ ├── input.h
│ ├── platform_window.cc
│ ├── platform_window.h
│ ├── platform_window_win32.cc
│ ├── platform_window_win32.h
│ ├── platform_window_x11.cc
│ └── platform_window_x11.h
├── test
├── CTestScript.cmake
├── Dockerfile.bionic
├── Dockerfile.cosmic
├── Dockerfile.el7
├── Dockerfile.f28
├── Dockerfile.f29
├── README.md
├── build-vulkan-sdk.py
├── create-report.py
└── hevx-ci.sh
└── third_party
├── Abseil.cmake
├── CMakeLists.txt
├── Cpprestsdk.cmake
├── FlextGL.cmake
├── Fmtlib.cmake
├── GLM.cmake
├── GSL.cmake
├── GSL.natvis
├── Glslang.cmake
├── GoogleTest.cmake
├── ImGui.cmake
├── JSON.cmake
├── Portaudio.cmake
├── Protobuf.cmake
├── STB.cmake
├── Spdlog.cmake
├── TBB.cmake
├── VRPN.cmake
├── Vulkan.cmake
├── VulkanMemoryAllocator.cmake
├── Websocketpp.cmake
├── expected
├── CMakeLists.txt
└── expected.hpp
├── imconfig.h
├── mikktspace
├── CMakeLists.txt
├── mikktspace-license.txt
├── mikktspace.c
└── mikktspace.h
├── miniball
├── CMakeLists.txt
└── Miniball.hpp
└── tweakme.h
/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | Language: Cpp
3 | # BasedOnStyle: LLVM
4 | AccessModifierOffset: -2
5 | AlignAfterOpenBracket: Align
6 | AlignConsecutiveAssignments: false
7 | AlignConsecutiveDeclarations: false
8 | AlignEscapedNewlinesLeft: false
9 | AlignOperands: true
10 | AlignTrailingComments: true
11 | AllowAllParametersOfDeclarationOnNextLine: true
12 | AllowShortBlocksOnASingleLine: true
13 | AllowShortCaseLabelsOnASingleLine: true
14 | AllowShortFunctionsOnASingleLine: Inline
15 | AllowShortIfStatementsOnASingleLine: true
16 | AllowShortLoopsOnASingleLine: true
17 | AlwaysBreakAfterReturnType: None
18 | AlwaysBreakBeforeMultilineStrings: true
19 | AlwaysBreakTemplateDeclarations: true
20 | BinPackArguments: true
21 | BinPackParameters: true
22 | BraceWrapping:
23 | AfterClass: false
24 | AfterControlStatement: false
25 | AfterEnum: false
26 | AfterFunction: false
27 | AfterNamespace: false
28 | AfterObjCDeclaration: false
29 | AfterStruct: false
30 | AfterUnion: false
31 | BeforeCatch: false
32 | BeforeElse: false
33 | IndentBraces: false
34 | BreakBeforeBinaryOperators: None
35 | BreakBeforeBraces: Attach
36 | BreakBeforeTernaryOperators: true
37 | BreakConstructorInitializersBeforeComma: true
38 | ColumnLimit: 80
39 | CommentPragmas: '^ IWYU pragma:'
40 | ConstructorInitializerAllOnOneLineOrOnePerLine: false
41 | ConstructorInitializerIndentWidth: 2
42 | ContinuationIndentWidth: 2
43 | Cpp11BracedListStyle: true
44 | DerivePointerAlignment: false
45 | ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
46 | IncludeCategories:
47 | - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
48 | Priority: 2
49 | - Regex: '^(<|"(gtest|isl|json)/)'
50 | Priority: 3
51 | - Regex: '.*'
52 | Priority: 1
53 | IndentCaseLabels: false
54 | IndentWidth: 2
55 | IndentWrappedFunctionNames: false
56 | KeepEmptyLinesAtTheStartOfBlocks: true
57 | MacroBlockBegin: ''
58 | MacroBlockEnd: ''
59 | MaxEmptyLinesToKeep: 1
60 | NamespaceIndentation: None
61 | PenaltyBreakBeforeFirstCallParameter: 19
62 | PenaltyBreakComment: 300
63 | PenaltyBreakFirstLessLess: 120
64 | PenaltyBreakString: 1000
65 | PenaltyExcessCharacter: 1000000
66 | PenaltyReturnTypeOnItsOwnLine: 60
67 | PointerAlignment: Left
68 | ReflowComments: true
69 | SortIncludes: true
70 | SpaceAfterCStyleCast: false
71 | SpaceBeforeAssignmentOperators: true
72 | SpaceBeforeParens: ControlStatements
73 | SpaceInEmptyParentheses: false
74 | SpacesBeforeTrailingComments: 1
75 | SpacesInAngles: false
76 | SpacesInContainerLiterals: true
77 | SpacesInCStyleCastParentheses: false
78 | SpacesInParentheses: false
79 | SpacesInSquareBrackets: false
80 | Standard: Cpp11
81 | TabWidth: 2
82 | UseTab: Never
83 | ...
84 |
85 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Output
2 | iris-raytracer.log
3 | iris-viewer.log
4 | imgui.ini
5 | *.nsight-gfxproj
6 |
7 | # Visual Studio
8 | .vs/
9 | out/
10 |
11 | # CLion
12 | cmake-build-*/
13 | .idea/**/workspace.xml
14 | .idea/**/tasks.xml
15 | .idea/**/usage.statistics.xml
16 | .idea/**/dictionaries
17 | .idea/**/shelf
18 |
19 | # Visual Studio Code
20 | .vscode/
21 |
22 | # Other
23 | build/
24 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/hevx.iml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: cpp
2 |
3 | dist: xenial
4 |
5 | services:
6 | - docker
7 |
8 | env:
9 | global:
10 | - CONFIGURATION_TYPE="RelWithDebInfo"
11 | - SOURCE_DIR="/s"
12 | - BUILD_DIR="/b"
13 | - DOCKER_IMAGE="wesleygriffin/hevx"
14 | - DOCKER_ARGS="-v $TRAVIS_BUILD_DIR:$SOURCE_DIR -w $BUILD_DIR"
15 | - ROOT="-DCTEST_DASHBOARD_ROOT=$BUILD_DIR"
16 | - TYPE="-DCTEST_CONFIGURATION_TYPE=$CONFIGURATION_TYPE"
17 | - CTEST_ARGS="-VV $ROOT $TYPE -S $SOURCE_DIR/test/CTestScript.cmake"
18 |
19 | matrix:
20 | include:
21 | - name: "CentOS 7 (GCC 8.2.1)"
22 | env: PLATFORM=el7 CTEST_CMD="scl enable devtoolset-8 -- ctest3 -DEXTRA_CONFIG:STRING='-DPYTHON_EXECUTABLE=/usr/bin/python3'"
23 | - name: "Fedora 28 (GCC 8.2.1)"
24 | env: PLATFORM=f28 CTEST_CMD="/cmake/bin/ctest -DEXTRA_CONFIG:STRING='-DPYTHON_EXECUTABLE=/usr/bin/python3'"
25 | - name: "Fedora 29 (GCC 8.2.1)"
26 | env: PLATFORM=f29 CTEST_CMD="ctest -DEXTRA_CONFIG:STRING='-DPYTHON_EXECUTABLE=/usr/bin/python3'"
27 | - name: "Unbuntu 18.10 (GCC 8.2.0)"
28 | env: PLATFORM=cosmic CTEST_CMD="ctest -DEXTRA_CONFIG:STRING='-DPYTHON_EXECUTABLE=/usr/bin/python3'"
29 |
30 | before_install:
31 | - echo "$DOCKER_PASSWORD" | docker login -u $DOCKER_USERNAME --password-stdin
32 | - docker pull $DOCKER_IMAGE:$PLATFORM
33 |
34 | script:
35 | - docker run $DOCKER_ARGS $DOCKER_IMAGE:$PLATFORM $CTEST_CMD $CTEST_ARGS
36 |
--------------------------------------------------------------------------------
/.ycm_extra_conf.py:
--------------------------------------------------------------------------------
1 | import ycm_core
2 | import os.path
3 |
4 | SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
5 | database = ycm_core.CompilationDatabase(os.path.join(SCRIPT_DIR, 'build'))
6 |
7 | SOURCE_EXTENSIONS = ['.cpp', '.cc', '.c']
8 |
9 | def IsHeaderFile(filename):
10 | extension = os.path.splitext(filename)[1]
11 | return extension in ['.h', '.hxx', '.hpp', '.hh']
12 |
13 |
14 | def FindCorrespondingSourceFile(filename):
15 | if IsHeaderFile(filename):
16 | basename = os.path.splitext(filename)[0]
17 | for extension in SOURCE_EXTENSIONS:
18 | replacement_file = basename + extension
19 | if os.path.exists(replacement_file):
20 | return replacement_file
21 | return filename
22 |
23 | def Settings(**kwargs):
24 | if kwargs['language'] == 'cfamily':
25 | filename = FindCorrespondingSourceFile(kwargs['filename'])
26 |
27 | compilation_info = database.GetCompilationInfoForFile(filename)
28 | if not compilation_info.compiler_flags_:
29 | return {}
30 |
31 | final_flags = list(compilation_info.compiler_flags_)
32 |
33 | return {
34 | 'flags': final_flags,
35 | 'include_paths_relative_to_dir': compilation_info.compiler_working_dir_,
36 | 'override_filename': filename
37 | }
38 | return {}
39 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.12)
2 | cmake_policy(VERSION 3.12)
3 |
4 | set(CMAKE_USER_MAKE_RULES_OVERRIDE
5 | "${CMAKE_CURRENT_LIST_DIR}/cmake/HEVUserMakeRulesOverride.cmake")
6 | project(hevx VERSION 3.0.0 LANGUAGES C CXX)
7 |
8 | ##
9 | # CMake helpers
10 | ##
11 | include(CMakeDependentOption)
12 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
13 |
14 | ##
15 | # Build options
16 | ##
17 | option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
18 | option(BUILD_DOCS "Build the documentation" ON)
19 | CMAKE_DEPENDENT_OPTION(BUILD_DOCS_INTERNAL "Build developer documentation"
20 | ON "BUILD_DOCS" OFF)
21 | option(THIRD_PARTY_UPDATE_DISCONNECTED "Update third party dependencies" ON)
22 |
23 | # CTest adds a BUILD_TESTING option (default: ON) and calls enable_testing
24 | if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
25 | include(CTest)
26 | endif()
27 |
28 | CMAKE_DEPENDENT_OPTION(BUILD_DEPENDENCY_TESTING "Build tests in dependencies"
29 | ON "BUILD_TESTING" OFF)
30 |
31 | ##
32 | # HEVx configuration
33 | ##
34 | include(HEVToolchain)
35 | include(GNUInstallDirs)
36 |
37 | ##
38 | # Packages we need in CMake
39 | ##
40 | find_package(Python3 COMPONENTS Interpreter REQUIRED)
41 | find_package(Git REQUIRED)
42 |
43 | ##
44 | # Required libraries
45 | ##
46 | add_subdirectory(third_party)
47 |
48 | ##
49 | # HEV Documentation
50 | ##
51 | if(BUILD_DOCS AND (PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
52 | add_subdirectory(docs)
53 | endif()
54 |
55 | ##
56 | # HEV components
57 | ##
58 | add_subdirectory(iris)
59 |
--------------------------------------------------------------------------------
/CMakeSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "x64-Debug",
5 | "generator": "Ninja",
6 | "configurationType": "Debug",
7 | "inheritEnvironments": [ "msvc_x64_x64" ],
8 | "buildRoot": "${projectDir}\\build\\${name}",
9 | "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\hevx\\install\\${name}",
10 | "cmakeCommandArgs": "",
11 | "buildCommandArgs": "-v",
12 | "ctestCommandArgs": "",
13 | "variables": []
14 | },
15 | {
16 | "name": "x64-Release",
17 | "generator": "Ninja",
18 | "configurationType": "Release",
19 | "inheritEnvironments": [ "msvc_x64_x64" ],
20 | "buildRoot": "${projectDir}\\build\\${name}",
21 | "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\hevx\\install\\${name}",
22 | "cmakeCommandArgs": "",
23 | "buildCommandArgs": "-v",
24 | "ctestCommandArgs": "",
25 | "variables": []
26 | },
27 | {
28 | "name": "Linux-Debug",
29 | "generator": "Ninja",
30 | "remoteMachineName": "${defaultRemoteMachineName}",
31 | "configurationType": "Debug",
32 | "remoteCMakeListsRoot": "/var/tmp/src/hevx/${name}",
33 | "cmakeExecutable": "/usr/bin/cmake3",
34 | "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuilds\\hevx\\build\\${name}",
35 | "installRoot": "${env.LOCALAPPDATA}\\CMakeBuilds\\hevx\\install\\${name}",
36 | "remoteBuildRoot": "/var/tmp/build/hevx/build/${name}",
37 | "remoteInstallRoot": "/var/tmp/build/hevx/install/${name}",
38 | "remoteCopySources": true,
39 | "remoteCopySourcesMethod": "rsync",
40 | "remoteCopySourcesExclusionList": [ ".vs", ".git" ],
41 | "rsyncCommandArgs": "-t --delete --delete-excluded",
42 | "remoteCopyBuildOutput": false,
43 | "cmakeCommandArgs": "-DPYTHON_EXECUTABLE=/usr/bin/python3",
44 | "buildCommandArgs": "-v",
45 | "ctestCommandArgs": "",
46 | "inheritEnvironments": [ "linux_x64" ],
47 | "variables": []
48 | },
49 | {
50 | "name": "Linux-Release",
51 | "generator": "Ninja",
52 | "remoteMachineName": "${defaultRemoteMachineName}",
53 | "configurationType": "RelWithDebInfo",
54 | "remoteCMakeListsRoot": "/var/tmp/src/hevx/${name}",
55 | "cmakeExecutable": "/usr/bin/cmake3",
56 | "buildRoot": "${env.LOCALAPPDATA}\\CMakeBuilds\\hevx\\build\\${name}",
57 | "installRoot": "${env.LOCALAPPDATA}\\CMakeBuilds\\hevx\\install\\${name}",
58 | "remoteBuildRoot": "/var/tmp/build/hevx/build/${name}",
59 | "remoteInstallRoot": "/var/tmp/build/hevx/install/${name}",
60 | "remoteCopySources": true,
61 | "remoteCopySourcesMethod": "rsync",
62 | "remoteCopySourcesExclusionList": [ ".vs", ".git" ],
63 | "rsyncCommandArgs": "-t --delete --delete-excluded",
64 | "remoteCopyBuildOutput": false,
65 | "cmakeCommandArgs": "-DPYTHON_EXECUTABLE=/usr/bin/python3",
66 | "buildCommandArgs": "-v",
67 | "ctestCommandArgs": "",
68 | "inheritEnvironments": [ "linux_x64" ],
69 | "variables": []
70 | }
71 | ]
72 | }
--------------------------------------------------------------------------------
/CTestConfig.cmake:
--------------------------------------------------------------------------------
1 | set(CTEST_PROJECT_NAME "hevx")
2 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | This software was developed by employees of the National Institute of
2 | Standards and Technology (NIST), an agency of the Federal Government and is
3 | being made available as a public service. Pursuant to title 17 United States
4 | Code Section 105, works of NIST employees are not subject to copyright
5 | protection in the United States. This software may be subject to foreign
6 | copyright. Permission in the United States and in foreign countries, to the
7 | extent that NIST may hold copyright, to use, copy, modify, create derivative
8 | works, and distribute this software and its documentation without fee is
9 | hereby granted on a non-exclusive basis, provided that this notice and
10 | disclaimer of warranty appears in all copies.
11 |
12 | THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND, EITHER
13 | EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY
14 | THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
15 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND FREEDOM FROM
16 | INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL CONFORM TO THE
17 | SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR FREE. IN NO EVENT
18 | SHALL NIST BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT,
19 | INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR
20 | IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,
21 | CONTRACT, TORT, OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY PERSONS
22 | OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED FROM, OR AROSE
23 | OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER.
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | HEVx
2 | ====
3 | [](https://travis-ci.org/usnistgov/hevx)
4 |
5 | High End Visualization (HEV) is a software environment for developing
6 | visualization applications in both desktop and immersive environments.
7 |
8 | This development environment is mainly designed for supporting the NIST CAVE
9 | and other immersive environments at NIST for visualization purposes. The code
10 | is being made publically available for the benefit of the visualization
11 | community.
12 |
13 | Currently this code is under active development and in a pre-release state.
14 |
15 | Build Requirements
16 | ------------------
17 | - CMake 3.12
18 | - Python 3.4
19 | - Wheezy Template: `pip install --user wheezy.template`
20 | - GCC >= 8
21 | - X11 XCB development libraries
22 | - Boost development libraries
23 | - Vulkan SDK
24 |
25 | ### Vulkan SDK ###
26 | Ensure the VULKAN_SDK environment variable is set before building HEVx.
27 |
28 | ### CentOS 7 ###
29 | ~~~
30 | yum install -y centos-release-scl epel-release
31 | yum install -y devtoolset-8\* python34 git cmake3 boost-\* openssl-devel \
32 | glm-devel libpng-devel wayland-devel libpciaccess-devel libX11-devel \
33 | libXpresent libxcb xcb-util libxcb-devel libXrandr-devel xcb-util-wm-devel \
34 | xcb-util-keysyms-devel
35 | curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
36 | python3 get-pip.py --user
37 | pip3 install --user wheezy.template
38 | ~~~
39 |
40 | ### Fedora 28 / 29 ###
41 | ~~~
42 | dnf install -y git cmake gcc-c++ make boost-\* openssl-devel glm-devel \
43 | libpng-devel wayland-devel libpciaccess-devel libX11-devel libXpresent \
44 | libxcb xcb-util libxcb-devel libXrandr-devel xcb-util-wm-devel \
45 | xcb-util-keysyms-devel
46 | pip3 install --user wheezy.template
47 | ~~~
48 |
49 | ### Ubuntu 18.10 ###
50 | ~~~
51 | apt install -y curl python3-pip cmake git pkg-config libssl-dev zlib1g-dev \
52 | libboost-1.65-all-dev libx11-dev libx11-xcb-dev libxcb1-dev \
53 | libxkb-common-dev libxcb-icccm4-dev libwayland-dev libxrandr-dev \
54 | libxcb-randr0-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-ewmh-dev
55 | pip3 install --user wheezy.template
56 | ~~~
57 |
58 | Build Instructions
59 | ------------------
60 |
61 | ### CentOS 7 ###
62 | ~~~
63 | $ mkdir build && cd build
64 | $ scl enable devtoolset-8 -- cmake3 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
65 | $ cmake --build .
66 | ~~~
67 |
68 | ### Fedora 28 / 29 and Ubuntu 18.10 ###
69 | ~~~
70 | $ mkdir build && cd build
71 | $ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
72 | $ cmake --build .
73 | ~~~
74 |
75 | ### Dependencies ###
76 | The following packages are fetched and managed with CMake:
77 | - [01org/tbb](https://github.com/01org/tbb)
78 | - [abseil/apseil-cpp](https://github.com/abseil/abseil-cpp)
79 | - [fmtlib/fmt](https://github.com/fmtlib/fmt)
80 | - [g-truc/glm](https://github.com/g-truc/glm)
81 | - [gabime/spdlog](https://github.com/gabime/spdlog)
82 | - [google/googletest](https://github.com/google/googletest)
83 | - [GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)
84 | - [KhronosGroup/glslang](https://github.com/KhronosGroup/glslang)
85 | - [Microsoft/GSL](https://github.com/Microsoft/GSL)
86 | - [Microsoft/cpprestsdk](https://github.com/Microsoft/cpprestsdk)
87 | - [nlohmann/json](https://github.com/nlohmann/json)
88 | - [nothings/stb](https://github.com/nothings/stb)
89 | - [mosra/flextgl](https://github.com/mosra/flextgl)
90 | - [ocornut/imgui](https://github.com/ocornut/imgui)
91 | - [protocolbuffers/protobuf](https://github.com/protocolbuffers/protobuf)
92 | - [TartanLlama/expected](https://github.com/TartanLlama/expected)
93 | - [vrpn/vrpn](https://github.com/vrpn/vrpn)
94 | - [zaphoyd/websocketpp](https://github.com/zaphoyd/websocketpp)
95 |
96 | Developers
97 | ----------
98 | - Wesley Griffin wesley.griffin@nist.gov
99 |
100 | License
101 | -------
102 | This software was developed by employees of the National Institute of
103 | Standards and Technology (NIST), an agency of the Federal Government and is
104 | being made available as a public service. Pursuant to title 17 United States
105 | Code Section 105, works of NIST employees are not subject to copyright
106 | protection in the United States. This software may be subject to foreign
107 | copyright. Permission in the United States and in foreign countries, to the
108 | extent that NIST may hold copyright, to use, copy, modify, create derivative
109 | works, and distribute this software and its documentation without fee is
110 | hereby granted on a non-exclusive basis, provided that this notice and
111 | disclaimer of warranty appears in all copies.
112 |
113 | THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND, EITHER
114 | EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY
115 | THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
116 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND FREEDOM FROM
117 | INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL CONFORM TO THE
118 | SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR FREE. IN NO EVENT
119 | SHALL NIST BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT,
120 | INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR
121 | IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,
122 | CONTRACT, TORT, OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY PERSONS
123 | OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED FROM, OR AROSE
124 | OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER.
125 |
126 |
--------------------------------------------------------------------------------
/cmake/FindSphinx.cmake:
--------------------------------------------------------------------------------
1 | find_program(SPHINX_EXECUTABLE
2 | NAMES sphinx-build
3 | HINTS
4 | $ENV{HOME}/.local/bin
5 | $ENV{USERPROFILE}/AppData/Roaming/Python/Python37/Scripts
6 | DOC "Path to sphinx-build executable"
7 | )
8 |
9 | include(FindPackageHandleStandardArgs)
10 |
11 | find_package_handle_standard_args(Sphinx
12 | "Failed to find sphinx-build executable"
13 | SPHINX_EXECUTABLE
14 | )
15 |
--------------------------------------------------------------------------------
/cmake/HEVToolchain.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
2 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
3 | set(CMAKE_CXX_STANDARD 17)
4 |
--------------------------------------------------------------------------------
/cmake/HEVUserMakeRulesOverride.cmake:
--------------------------------------------------------------------------------
1 | if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
2 | get_filename_component(_clang_bin ${CMAKE_CXX_COMPILER} DIRECTORY)
3 | get_filename_component(_clang_lib ${_clang_bin}/../lib REALPATH)
4 |
5 | set(CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT} -stdlib=libc++")
6 | set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} -Wl,-rpath,${_clang_lib} -lc++")
7 |
8 | unset(_clang_bin)
9 | unset(_clang_lib)
10 | endif()
11 |
12 | if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
13 | string(REGEX REPLACE "/W[0-4]+" "" CMAKE_CXX_FLAGS_INIT "${CMAKE_CXX_FLAGS_INIT}")
14 | set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT} /LTCG")
15 | endif()
16 |
17 | if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
18 | string(REGEX REPLACE "/W[0-4]+" "" CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT}")
19 | set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT} /LTCG")
20 | endif()
21 |
22 |
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | man/
2 |
--------------------------------------------------------------------------------
/docs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | find_package(Doxygen)
2 |
3 | if(BUILD_DOCS_INTERNAL)
4 | set(INTERNAL_DOCS "YES")
5 | else()
6 | set(INTERNAL_DOCS "NO")
7 | endif()
8 |
9 | if(Doxygen_FOUND)
10 | find_package(Sphinx)
11 | configure_file(Doxyfile.in Doxyfile @ONLY)
12 | configure_file(conf.py.in conf.py @ONLY)
13 |
14 | if(Sphinx_FOUND)
15 | add_custom_target(docs
16 | Doxygen::doxygen Doxyfile
17 | COMMAND ${SPHINX_EXECUTABLE} -c "." "${CMAKE_CURRENT_SOURCE_DIR}" "rtd"
18 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
19 | )
20 | else()
21 | add_custom_target(docs
22 | Doxygen::doxygen Doxyfile
23 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
24 | )
25 | endif()
26 | endif()
27 |
--------------------------------------------------------------------------------
/docs/api.rst:
--------------------------------------------------------------------------------
1 | API
2 | ===
3 |
4 | .. toctree::
5 | :maxdepth: 4
6 |
7 | namespaces/iris
8 | namespaces/iris_renderer
9 |
--------------------------------------------------------------------------------
/docs/conf.py.in:
--------------------------------------------------------------------------------
1 | # Configuration file for the Sphinx documentation builder.
2 | #
3 | # This file only contains a selection of the most common options. For a full
4 | # list see the documentation:
5 | # http://www.sphinx-doc.org/en/master/config
6 |
7 | # -- Path setup --------------------------------------------------------------
8 |
9 | # If extensions (or modules to document with autodoc) are in another directory,
10 | # add these directories to sys.path here. If the directory is relative to the
11 | # documentation root, use os.path.abspath to make it absolute, like shown here.
12 | #
13 | # import os
14 | # import sys
15 | # sys.path.insert(0, os.path.abspath('.'))
16 |
17 |
18 | # -- Project information -----------------------------------------------------
19 |
20 | project = u'HEVx'
21 |
22 | # The full version, including alpha/beta/rc tags
23 | release = u'@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@@PROJECT_VERSION_TWEAK@'
24 |
25 |
26 | # -- General configuration ---------------------------------------------------
27 |
28 | # Add any Sphinx extension module names here, as strings. They can be
29 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
30 | # ones.
31 | extensions = [
32 | 'm2r', 'sphinx.ext.todo', 'breathe', 'sphinx.ext.graphviz'
33 | ]
34 |
35 | # Add any paths that contain templates here, relative to this directory.
36 | templates_path = ['@CMAKE_CURRENT_SOURCE_DIR@/sphinx/_templates']
37 |
38 | # List of patterns, relative to source directory, that match files and
39 | # directories to ignore when looking for source files.
40 | # This pattern also affects html_static_path and html_extra_path.
41 | exclude_patterns = []
42 |
43 | source_suffix = ['.rst', '.md']
44 |
45 | master_doc = 'index'
46 |
47 |
48 | # -- Options for HTML output -------------------------------------------------
49 |
50 | # The theme to use for HTML and HTML Help pages. See the documentation for
51 | # a list of builtin themes.
52 | #
53 | html_theme = 'sphinx_rtd_theme'
54 |
55 | # Add any paths that contain custom static files (such as style sheets) here,
56 | # relative to this directory. They are copied after the builtin static files,
57 | # so a file named "default.css" will overwrite the builtin "default.css".
58 | html_static_path = ['@CMAKE_CURRENT_SOURCE_DIR@/sphinx/_static']
59 |
60 |
61 | # -- Options for Breathe -----------------------------------------------------
62 |
63 | breathe_projects = { "hevx": "@CMAKE_CURRENT_BINARY_DIR@/xml/" }
64 |
65 | breathe_default_project = "hevx"
66 |
67 |
68 | # -- Setup customization ------------------------------------------------------
69 |
70 | def setup(app):
71 | app.add_stylesheet('css/hevx_custom.css')
72 |
73 | html_theme_options = {
74 | 'collapse_navigation': False
75 | }
76 |
77 |
--------------------------------------------------------------------------------
/docs/figures/highlevel_architecture.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. mdinclude:: ../README.md
2 |
3 | .. toctree::
4 | :hidden:
5 | :maxdepth: 4
6 | :caption: Table of Contents
7 |
8 | self
9 | pages
10 | api
--------------------------------------------------------------------------------
/docs/namespaces/iris.rst:
--------------------------------------------------------------------------------
1 | IRIS
2 | ====
3 |
4 | .. toctree::
5 | :maxdepth: 4
6 |
7 | namespaces/iris_renderer
8 |
9 | .. doxygennamespace:: iris
10 |
--------------------------------------------------------------------------------
/docs/namespaces/iris_renderer.rst:
--------------------------------------------------------------------------------
1 | IRIS::Renderer
2 | ==============
3 |
4 | .. toctree::
5 | :maxdepth: 4
6 |
7 | .. doxygennamespace:: iris::Renderer
8 |
--------------------------------------------------------------------------------
/docs/pages.rst:
--------------------------------------------------------------------------------
1 | Related Pages
2 | =============
3 |
4 | .. toctree::
5 | :maxdepth: 4
6 |
7 | pages/ecs_design
8 | pages/scenegraph
--------------------------------------------------------------------------------
/docs/pages/NIST_techniques_raytracing.md:
--------------------------------------------------------------------------------
1 | # NIST_techniques_raytracing
2 |
3 | ## Contributors
4 |
5 | - Wesley Griffin, NIST, wesley.griffin@nist.gov
6 |
7 | ## Status
8 |
9 | Draft
10 |
11 | ## Dependencies
12 |
13 | Written against the glTF 2.0 spec.
14 |
15 | ## Overview
16 |
17 | TODO
18 |
19 | ## glTF Schema Updates
20 |
21 | ### Extending Primitives
22 |
23 | This extension deifnes two new attribute semantic properties for primitives:
24 |
25 | | Name | Accessor Type | Component Type | Description |
26 | |---------|---------------|----------------|---------------------------|
27 | | `_AABB` | `"VEC3"` | `5126` (FLOAT) | Axis Aligned Bounding Box |
28 |
29 | The Axis Aligned Bounding Box is a sequential set of two `VEC3` values defining
30 | the minimum and maximum corners of the AABB respectively.
31 |
32 | ### Extending Materials
33 |
34 | ~~~
35 | "materials": {
36 | {
37 | "extensions": {
38 | "NIST_techniques_raytracing": {
39 | "technique": 0
40 | }
41 | }
42 | }
43 | }
44 | ~~~
45 |
46 | ### Extension
47 |
48 | NIST_techniques_raytracing is defined in the asset's top level `extensions`
49 | property with the following additional values.
50 |
51 | ~~~
52 | {
53 | "extensions": {
54 | "NIST_techniques_raytracing": {
55 | "programs": [
56 | {
57 | "raygenShader": 0,
58 | "closestHitShader": 2,
59 | "missShader": 3,
60 | }
61 | ],
62 | "shaders": [
63 | {
64 | "type": 256,
65 | "uri": "raygen.glsl"
66 | },
67 | {
68 | "type": 1024,
69 | "uri": "closesetHit.glsl"
70 | },
71 | {
72 | "type": 2048,
73 | "uri": "miss.glsl"
74 | }
75 | ],
76 | "techniques": [
77 | {
78 | "program": 0,
79 | }
80 | ]
81 | }
82 | }
83 | }
84 | ~~~
85 |
86 | ### JSON Schema
87 |
88 | | Name | Accessor Type | Component Type | Description |
89 | |---------|---------------|----------------|---------------------------|
90 | | `_AABB` | `"VEC3"` | `5126` (FLOAT) | Axis Aligned Bounding Box |
91 |
92 | #### shader.type
93 |
94 | - **Type:** `integer`
95 | - **Required:** Yes
96 | - **Allowed values:**
97 | - `256` VK_SHADER_STAGE_RAYGEN_BIT_NV
98 | - `512` VK_SHADER_STAGE_ANY_HIT_BIT_NV
99 | - `1024` VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV
100 | - `2048` VK_SHADER_STAGE_MISS_BIT_NV
101 | - `4096` VK_SHADER_STAGE_INTERSECTION_BIT_NV
102 | - `8192` VK_SHADER_STAGE_CALLABLE_BIT_NV
103 |
104 | ## Known Implementations
105 |
106 | - TODO
107 |
108 | ## Resources
109 |
110 | - TODO
--------------------------------------------------------------------------------
/docs/pages/control_commands.md:
--------------------------------------------------------------------------------
1 | IRIS Control Commands
2 | =====================
3 |
4 | ## Overview
5 |
6 | Control commands can be in an iris file, read by the iris file loader, or can
7 | be sent to a running iris application via `$IRIS_CONTROL_FIFO`.
8 |
9 | Keywords are shown in **UPPERCASE** and parameters are shown in _italics_.
10 | Specific parameter values are shown in `Courier`.
11 |
12 | When _nodeName_ is a parameter, the special node name **-** can be used to
13 | refer to the last node loaded by the **LOAD** command. Also see the **LOAD**
14 | _nodeName_ _fileName_ command for an additional use of the **-** node name.
15 |
16 | ## Commands
17 |
18 | **BACKGROUND** _r g b_
19 | sets the background color for every pane
20 | - _r g b_ are each between 0 and 1 inclusive
21 |
22 | **ECHO** _ON_ | _OFF_
23 | enables or disable the echoing of incoming commands
24 |
25 | **TERMINATE**
26 | terminates iris
27 |
28 | **NAV** `POSITION` _x y z_
29 | set the navigation position to _x y z_
30 |
31 | **NAV** `ORIENTATION` _h p r_
32 | set the navigation orientation to the Euler angle _h p r_
33 |
34 | **NAV** `ATTITUDE` _x y z w_
35 | set the navigation orientation to the quaternion _x y z w_
36 |
37 | **NAV** `SCALE` _x_ [_y z_]
38 | set the navigation scale to _x y z_
39 | - if _y_ and _z_ are omitted a uniform scale of _x_ is applied
40 |
41 | **NAV** `MATRIX` _a00 a01 a02 a03 a10 a11 a12 a13 a20 a21 a22 a23 a30 a31 a32 a33_
42 | set the entire navigation matrix
43 |
44 | **NAV** `RESPONSE` _s_
45 | set the navigation response to _s_
46 |
--------------------------------------------------------------------------------
/docs/pages/ecs_design.md:
--------------------------------------------------------------------------------
1 | ECS Design
2 | ==========
3 |
4 | ## Entity Component System (ECS) Overview
5 | TODO: list some references here
6 |
7 | ### Entity
8 | - NO data
9 | - NO methods
10 | - JUST a name
11 | - Really just a globally unique number (GUID)
12 |
13 | ### Components
14 | - ONLY data
15 |
16 | ### Systems
17 | - ONLY methods
18 |
19 | ## Components
20 | - Renderable
21 | - Inputable
22 |
23 | ### Renderable
24 | - transformation matrix
25 | - model-specific uniform buffer (matrices; shader variables)
26 | - pipeline
27 | - descriptor set
28 | - number of vertices to draw
29 | - vertex buffer
30 | - number of indices to draw
31 | - index buffer
32 |
33 | ## Systems
34 | - Rendering
35 | - Renders all entities that have the Renderable component
36 | - Input
37 | - Updates Inputable entities
--------------------------------------------------------------------------------
/docs/pages/scenegraph.md:
--------------------------------------------------------------------------------
1 | Scenegraph
2 | ==========
3 |
4 | ```
5 | +-------+
6 | | scene |
7 | +-------+
8 | |
9 | +------------+------------+------------+------------+------------+
10 | | | | | | |
11 | +-------+ +-------+ +-------+ +-------+ +-------+ +-------+
12 | | ether | | nav | | pivot | | head | | wand | | light |
13 | +-------+ +-------+ +-------+ +-------+ +-------+ +-------+
14 | |
15 | +-------+
16 | | world |
17 | +-------+
18 | ```
19 |
20 | * **scene**
21 | - root of scenegraph
22 | - normalized units
23 | - nodes under **scene** do not move with navigation
24 |
25 | * **ether**
26 | - contains same transformation as **world**
27 | - model units
28 | - nodes under **ether** do not move with navigation
29 |
30 | * **nav**
31 | - normalized units
32 | - nodes under **nav** move with navigation
33 | - **world**
34 | - model units
35 | - typical use is to set transform of **world** to accomodate models and load
36 | all models underneath **world**
37 |
38 | * **pivot**
39 | - normalized units, reflect the position and orientation of the pivot point
40 | - nodes under **pivot** move with navigation
41 |
42 | * **head**
43 | - position of head in virtual world
44 | - normalized units
45 | - nodes under **head** do not move with navigation, do move with head motions
46 |
47 | * **wand**
48 | - position of wand in virtual world
49 | - normalized units
50 | - nodes under **wand** do not move with navigation, do move with wand motions
51 |
52 | * **light**
53 | - default light: above and behind the viewer
54 |
55 | ## Purpose of **nav** node
56 |
57 | Typical 3D applications move a _camera_ around the world based on user input.
58 | Instead of moving a camera, HEVx uses a stationary camera and instead moves
59 | all the objects the camera is looking at. The **nav** node in the scenegraph
60 | is updated based on navigation (i.e. user input) thereby moving all nodes
61 | underneath it.
62 |
63 |
--------------------------------------------------------------------------------
/docs/sphinx/_static/css/hevx_custom.css:
--------------------------------------------------------------------------------
1 | div[role=contentinfo] p {
2 | display: none;
3 | }
--------------------------------------------------------------------------------
/iris/acceleration_structure.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_ACCELERATION_STRUCTURE_H_
2 | #define HEV_IRIS_ACCELERATION_STRUCTURE_H_
3 |
4 | #include "iris/config.h"
5 |
6 | #include "iris/buffer.h"
7 | #include "iris/shader.h"
8 | #include "iris/types.h"
9 | #include "iris/vulkan.h"
10 |
11 | #if PLATFORM_COMPILER_MSVC
12 | #include
13 | #pragma warning(push)
14 | #pragma warning(disable : ALL_CODE_ANALYSIS_WARNINGS)
15 | #pragma warning(disable : ALL_CPPCORECHECK_WARNINGS)
16 | #endif
17 |
18 | #include "gsl/gsl"
19 | #include
20 | #include
21 |
22 | #if PLATFORM_COMPILER_MSVC
23 | #pragma warning(pop)
24 | #endif
25 |
26 | namespace iris {
27 |
28 | struct AccelerationStructure {
29 | VkAccelerationStructureNV structure{VK_NULL_HANDLE};
30 | VmaAllocation allocation{VK_NULL_HANDLE};
31 | std::uint64_t handle{UINT64_MAX};
32 |
33 | explicit operator bool() const noexcept {
34 | return structure != VK_NULL_HANDLE && allocation != VK_NULL_HANDLE;
35 | }
36 | }; // struct AccelerationStructure
37 |
38 | struct GeometryInstance {
39 | float transform[12];
40 | std::uint32_t customIndex : 24;
41 | std::uint32_t mask : 8;
42 | std::uint32_t offset : 24;
43 | std::uint32_t flags : 8;
44 | std::uint64_t accelerationStructureHandle;
45 |
46 | GeometryInstance(std::uint64_t handle = 0) noexcept
47 | : accelerationStructureHandle(handle) {
48 | std::memset(transform, 0, sizeof(float) * 12);
49 | transform[0] = transform[4] = transform[8] = 1.f;
50 | customIndex = 0;
51 | mask = 0xF;
52 | offset = 0;
53 | flags = 0;
54 | }
55 | }; // GeometryInstance
56 |
57 | [[nodiscard]] expected
58 | CreateTopLevelAccelerationStructure(std::uint32_t instanceCount,
59 | VkDeviceSize compactedSize) noexcept;
60 |
61 | [[nodiscard]] expected
62 | CreateBottomLevelAccelerationStructure(gsl::span geometries,
63 | VkDeviceSize compactedSize) noexcept;
64 |
65 | [[nodiscard]] expected
66 | BuildTopLevelAccelerationStructure(
67 | AccelerationStructure const& structure, VkCommandPool commandPool,
68 | VkQueue queue, VkFence fence, gsl::span instances) noexcept;
69 |
70 | [[nodiscard]] expected
71 | BuildBottomLevelAccelerationStructure(
72 | AccelerationStructure const& structure, VkCommandPool commandPool,
73 | VkQueue queue, VkFence fence, gsl::span geometries) noexcept;
74 |
75 | void DestroyAccelerationStructure(AccelerationStructure structure) noexcept;
76 |
77 | } // namespace iris
78 |
79 | #endif // HEV_IRIS_ACCELERATION_STRUCTURE_H_
80 |
--------------------------------------------------------------------------------
/iris/assets/data/README.md:
--------------------------------------------------------------------------------
1 | # Datasets
2 |
3 | These are datasets currently used by iris-dxr.
4 |
5 | ## Sources
6 |
7 | cars.json: https://github.com/vega/vega-datasets
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-Black.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-BlackIt.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-BlackIt.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-Bold.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-BoldIt.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-BoldIt.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-ExtraLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-ExtraLight.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-ExtraLightIt.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-ExtraLightIt.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-It.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-It.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2010-2018 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries.
2 |
3 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
4 |
5 | This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
6 |
7 |
8 | -----------------------------------------------------------
9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10 | -----------------------------------------------------------
11 |
12 | PREAMBLE
13 | The goals of the Open Font License (OFL) are to stimulate worldwide
14 | development of collaborative font projects, to support the font creation
15 | efforts of academic and linguistic communities, and to provide a free and
16 | open framework in which fonts may be shared and improved in partnership
17 | with others.
18 |
19 | The OFL allows the licensed fonts to be used, studied, modified and
20 | redistributed freely as long as they are not sold by themselves. The
21 | fonts, including any derivative works, can be bundled, embedded,
22 | redistributed and/or sold with any software provided that any reserved
23 | names are not used by derivative works. The fonts and derivatives,
24 | however, cannot be released under any other type of license. The
25 | requirement for fonts to remain under this license does not apply
26 | to any document created using the fonts or their derivatives.
27 |
28 | DEFINITIONS
29 | "Font Software" refers to the set of files released by the Copyright
30 | Holder(s) under this license and clearly marked as such. This may
31 | include source files, build scripts and documentation.
32 |
33 | "Reserved Font Name" refers to any names specified as such after the
34 | copyright statement(s).
35 |
36 | "Original Version" refers to the collection of Font Software components as
37 | distributed by the Copyright Holder(s).
38 |
39 | "Modified Version" refers to any derivative made by adding to, deleting,
40 | or substituting -- in part or in whole -- any of the components of the
41 | Original Version, by changing formats or by porting the Font Software to a
42 | new environment.
43 |
44 | "Author" refers to any designer, engineer, programmer, technical
45 | writer or other person who contributed to the Font Software.
46 |
47 | PERMISSION & CONDITIONS
48 | Permission is hereby granted, free of charge, to any person obtaining
49 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
50 | redistribute, and sell modified and unmodified copies of the Font
51 | Software, subject to the following conditions:
52 |
53 | 1) Neither the Font Software nor any of its individual components,
54 | in Original or Modified Versions, may be sold by itself.
55 |
56 | 2) Original or Modified Versions of the Font Software may be bundled,
57 | redistributed and/or sold with any software, provided that each copy
58 | contains the above copyright notice and this license. These can be
59 | included either as stand-alone text files, human-readable headers or
60 | in the appropriate machine-readable metadata fields within text or
61 | binary files as long as those fields can be easily viewed by the user.
62 |
63 | 3) No Modified Version of the Font Software may use the Reserved Font
64 | Name(s) unless explicit written permission is granted by the corresponding
65 | Copyright Holder. This restriction only applies to the primary font name as
66 | presented to the users.
67 |
68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69 | Software shall not be used to promote, endorse or advertise any
70 | Modified Version, except to acknowledge the contribution(s) of the
71 | Copyright Holder(s) and the Author(s) or with their explicit written
72 | permission.
73 |
74 | 5) The Font Software, modified or unmodified, in part or in whole,
75 | must be distributed entirely under this license, and must not be
76 | distributed under any other license. The requirement for fonts to
77 | remain under this license does not apply to any document created
78 | using the Font Software.
79 |
80 | TERMINATION
81 | This license becomes null and void if any of the above conditions are
82 | not met.
83 |
84 | DISCLAIMER
85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93 | OTHER DEALINGS IN THE FONT SOFTWARE.
94 |
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-Light.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-LightIt.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-LightIt.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-Regular.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-Semibold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-Semibold.ttf
--------------------------------------------------------------------------------
/iris/assets/fonts/SourceSansPro-SemiboldIt.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/fonts/SourceSansPro-SemiboldIt.ttf
--------------------------------------------------------------------------------
/iris/assets/models/Box/Box_README.md:
--------------------------------------------------------------------------------
1 | # Box
2 | ## Screenshot
3 |
4 | 
5 |
6 | ## License Information
7 |
8 | Donated by [Cesium](http://cesiumjs.org/) for glTF testing.
9 |
10 | This model is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).
11 |
--------------------------------------------------------------------------------
/iris/assets/models/Box/glTF-Binary/Box.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/Box/glTF-Binary/Box.glb
--------------------------------------------------------------------------------
/iris/assets/models/Box/glTF-Draco/0.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/Box/glTF-Draco/0.bin
--------------------------------------------------------------------------------
/iris/assets/models/Box/glTF-Draco/Box.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset": {
3 | "generator": "COLLADA2GLTF",
4 | "version": "2.0"
5 | },
6 | "scene": 0,
7 | "scenes": [
8 | {
9 | "nodes": [
10 | 0
11 | ]
12 | }
13 | ],
14 | "nodes": [
15 | {
16 | "children": [
17 | 1
18 | ],
19 | "matrix": [
20 | 1,
21 | 0,
22 | 0,
23 | 0,
24 | 0,
25 | 0,
26 | -1,
27 | 0,
28 | 0,
29 | 1,
30 | 0,
31 | 0,
32 | 0,
33 | 0,
34 | 0,
35 | 1
36 | ]
37 | },
38 | {
39 | "mesh": 0
40 | }
41 | ],
42 | "meshes": [
43 | {
44 | "primitives": [
45 | {
46 | "attributes": {
47 | "NORMAL": 1,
48 | "POSITION": 2
49 | },
50 | "indices": 0,
51 | "mode": 4,
52 | "material": 0,
53 | "extensions": {
54 | "KHR_draco_mesh_compression": {
55 | "bufferView": 0,
56 | "attributes": {
57 | "NORMAL": 0,
58 | "POSITION": 1
59 | }
60 | }
61 | }
62 | }
63 | ],
64 | "name": "Mesh"
65 | }
66 | ],
67 | "accessors": [
68 | {
69 | "componentType": 5123,
70 | "count": 36,
71 | "max": [
72 | 23
73 | ],
74 | "min": [
75 | 0
76 | ],
77 | "type": "SCALAR"
78 | },
79 | {
80 | "componentType": 5126,
81 | "count": 24,
82 | "max": [
83 | 1,
84 | 1,
85 | 1
86 | ],
87 | "min": [
88 | -1,
89 | -1,
90 | -1
91 | ],
92 | "type": "VEC3"
93 | },
94 | {
95 | "componentType": 5126,
96 | "count": 24,
97 | "max": [
98 | 0.5,
99 | 0.5,
100 | 0.5
101 | ],
102 | "min": [
103 | -0.5,
104 | -0.5,
105 | -0.5
106 | ],
107 | "type": "VEC3"
108 | }
109 | ],
110 | "materials": [
111 | {
112 | "pbrMetallicRoughness": {
113 | "baseColorFactor": [
114 | 0.800000011920929,
115 | 0,
116 | 0,
117 | 1
118 | ],
119 | "metallicFactor": 0
120 | },
121 | "name": "Red"
122 | }
123 | ],
124 | "bufferViews": [
125 | {
126 | "buffer": 0,
127 | "byteOffset": 0,
128 | "byteLength": 118
129 | }
130 | ],
131 | "buffers": [
132 | {
133 | "byteLength": 118,
134 | "uri": "0.bin"
135 | }
136 | ],
137 | "extensionsRequired": [
138 | "KHR_draco_mesh_compression"
139 | ],
140 | "extensionsUsed": [
141 | "KHR_draco_mesh_compression"
142 | ]
143 | }
144 |
--------------------------------------------------------------------------------
/iris/assets/models/Box/glTF-Embedded/Box.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset": {
3 | "generator": "COLLADA2GLTF",
4 | "version": "2.0"
5 | },
6 | "scene": 0,
7 | "scenes": [
8 | {
9 | "nodes": [
10 | 0
11 | ]
12 | }
13 | ],
14 | "nodes": [
15 | {
16 | "children": [
17 | 1
18 | ],
19 | "matrix": [
20 | 1.0,
21 | 0.0,
22 | 0.0,
23 | 0.0,
24 | 0.0,
25 | 0.0,
26 | -1.0,
27 | 0.0,
28 | 0.0,
29 | 1.0,
30 | 0.0,
31 | 0.0,
32 | 0.0,
33 | 0.0,
34 | 0.0,
35 | 1.0
36 | ]
37 | },
38 | {
39 | "mesh": 0
40 | }
41 | ],
42 | "meshes": [
43 | {
44 | "primitives": [
45 | {
46 | "attributes": {
47 | "NORMAL": 1,
48 | "POSITION": 2
49 | },
50 | "indices": 0,
51 | "mode": 4,
52 | "material": 0
53 | }
54 | ],
55 | "name": "Mesh"
56 | }
57 | ],
58 | "accessors": [
59 | {
60 | "bufferView": 0,
61 | "byteOffset": 0,
62 | "componentType": 5123,
63 | "count": 36,
64 | "max": [
65 | 23
66 | ],
67 | "min": [
68 | 0
69 | ],
70 | "type": "SCALAR"
71 | },
72 | {
73 | "bufferView": 1,
74 | "byteOffset": 0,
75 | "componentType": 5126,
76 | "count": 24,
77 | "max": [
78 | 1.0,
79 | 1.0,
80 | 1.0
81 | ],
82 | "min": [
83 | -1.0,
84 | -1.0,
85 | -1.0
86 | ],
87 | "type": "VEC3"
88 | },
89 | {
90 | "bufferView": 1,
91 | "byteOffset": 288,
92 | "componentType": 5126,
93 | "count": 24,
94 | "max": [
95 | 0.5,
96 | 0.5,
97 | 0.5
98 | ],
99 | "min": [
100 | -0.5,
101 | -0.5,
102 | -0.5
103 | ],
104 | "type": "VEC3"
105 | }
106 | ],
107 | "materials": [
108 | {
109 | "pbrMetallicRoughness": {
110 | "baseColorFactor": [
111 | 0.800000011920929,
112 | 0.0,
113 | 0.0,
114 | 1.0
115 | ],
116 | "metallicFactor": 0.0
117 | },
118 | "name": "Red"
119 | }
120 | ],
121 | "bufferViews": [
122 | {
123 | "buffer": 0,
124 | "byteOffset": 576,
125 | "byteLength": 72,
126 | "target": 34963
127 | },
128 | {
129 | "buffer": 0,
130 | "byteOffset": 0,
131 | "byteLength": 576,
132 | "byteStride": 12,
133 | "target": 34962
134 | }
135 | ],
136 | "buffers": [
137 | {
138 | "byteLength": 648,
139 | "uri": "data:application/octet-stream;base64,AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAgL8AAAAAAAAAAAAAgL8AAAAAAAAAAAAAgL8AAAAAAAAAAAAAgL8AAAAAAACAPwAAAAAAAAAAAACAPwAAAAAAAAAAAACAPwAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAACAvwAAAAAAAAAAAACAvwAAAAAAAAAAAACAvwAAAAAAAAAAAACAvwAAAAAAAAAAAAAAAAAAAAAAAIC/AAAAAAAAAAAAAIC/AAAAAAAAAAAAAIC/AAAAAAAAAAAAAIC/AAAAvwAAAL8AAAA/AAAAPwAAAL8AAAA/AAAAvwAAAD8AAAA/AAAAPwAAAD8AAAA/AAAAPwAAAL8AAAA/AAAAvwAAAL8AAAA/AAAAPwAAAL8AAAC/AAAAvwAAAL8AAAC/AAAAPwAAAD8AAAA/AAAAPwAAAL8AAAA/AAAAPwAAAD8AAAC/AAAAPwAAAL8AAAC/AAAAvwAAAD8AAAA/AAAAPwAAAD8AAAA/AAAAvwAAAD8AAAC/AAAAPwAAAD8AAAC/AAAAvwAAAL8AAAA/AAAAvwAAAD8AAAA/AAAAvwAAAL8AAAC/AAAAvwAAAD8AAAC/AAAAvwAAAL8AAAC/AAAAvwAAAD8AAAC/AAAAPwAAAL8AAAC/AAAAPwAAAD8AAAC/AAABAAIAAwACAAEABAAFAAYABwAGAAUACAAJAAoACwAKAAkADAANAA4ADwAOAA0AEAARABIAEwASABEAFAAVABYAFwAWABUA"
140 | }
141 | ]
142 | }
143 |
--------------------------------------------------------------------------------
/iris/assets/models/Box/glTF-pbrSpecularGlossiness/Box.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset": {
3 | "generator": "COLLADA2GLTF",
4 | "version": "2.0"
5 | },
6 | "scene": 0,
7 | "scenes": [
8 | {
9 | "nodes": [
10 | 0
11 | ]
12 | }
13 | ],
14 | "nodes": [
15 | {
16 | "children": [
17 | 1
18 | ],
19 | "matrix": [
20 | 1.0,
21 | 0.0,
22 | 0.0,
23 | 0.0,
24 | 0.0,
25 | 0.0,
26 | -1.0,
27 | 0.0,
28 | 0.0,
29 | 1.0,
30 | 0.0,
31 | 0.0,
32 | 0.0,
33 | 0.0,
34 | 0.0,
35 | 1.0
36 | ]
37 | },
38 | {
39 | "mesh": 0
40 | }
41 | ],
42 | "meshes": [
43 | {
44 | "primitives": [
45 | {
46 | "attributes": {
47 | "NORMAL": 1,
48 | "POSITION": 2
49 | },
50 | "indices": 0,
51 | "mode": 4,
52 | "material": 0
53 | }
54 | ],
55 | "name": "Mesh"
56 | }
57 | ],
58 | "accessors": [
59 | {
60 | "bufferView": 0,
61 | "byteOffset": 0,
62 | "componentType": 5123,
63 | "count": 36,
64 | "max": [
65 | 23
66 | ],
67 | "min": [
68 | 0
69 | ],
70 | "type": "SCALAR"
71 | },
72 | {
73 | "bufferView": 1,
74 | "byteOffset": 0,
75 | "componentType": 5126,
76 | "count": 24,
77 | "max": [
78 | 1.0,
79 | 1.0,
80 | 1.0
81 | ],
82 | "min": [
83 | -1.0,
84 | -1.0,
85 | -1.0
86 | ],
87 | "type": "VEC3"
88 | },
89 | {
90 | "bufferView": 1,
91 | "byteOffset": 288,
92 | "componentType": 5126,
93 | "count": 24,
94 | "max": [
95 | 0.5,
96 | 0.5,
97 | 0.5
98 | ],
99 | "min": [
100 | -0.5,
101 | -0.5,
102 | -0.5
103 | ],
104 | "type": "VEC3"
105 | }
106 | ],
107 | "materials": [
108 | {
109 | "pbrMetallicRoughness": {
110 | "baseColorFactor": [
111 | 0.800000011920929,
112 | 0.0,
113 | 0.0,
114 | 1.0
115 | ],
116 | "metallicFactor": 0.0
117 | },
118 | "extensions": {
119 | "KHR_materials_pbrSpecularGlossiness": {
120 | "diffuseFactor": [
121 | 0.800000011920929,
122 | 0.0,
123 | 0.0,
124 | 1.0
125 | ],
126 | "specularFactor": [
127 | 0.20000000298023225,
128 | 0.20000000298023225,
129 | 0.20000000298023225
130 | ],
131 | "glossinessFactor": 1.0
132 | }
133 | },
134 | "name": "Red"
135 | }
136 | ],
137 | "bufferViews": [
138 | {
139 | "buffer": 0,
140 | "byteOffset": 576,
141 | "byteLength": 72,
142 | "target": 34963
143 | },
144 | {
145 | "buffer": 0,
146 | "byteOffset": 0,
147 | "byteLength": 576,
148 | "byteStride": 12,
149 | "target": 34962
150 | }
151 | ],
152 | "buffers": [
153 | {
154 | "byteLength": 648,
155 | "uri": "Box0.bin"
156 | }
157 | ],
158 | "extensionsUsed": [
159 | "KHR_materials_pbrSpecularGlossiness"
160 | ]
161 | }
162 |
--------------------------------------------------------------------------------
/iris/assets/models/Box/glTF-pbrSpecularGlossiness/Box0.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/Box/glTF-pbrSpecularGlossiness/Box0.bin
--------------------------------------------------------------------------------
/iris/assets/models/Box/glTF/Box.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset": {
3 | "generator": "COLLADA2GLTF",
4 | "version": "2.0"
5 | },
6 | "scene": 0,
7 | "scenes": [
8 | {
9 | "nodes": [
10 | 0
11 | ]
12 | }
13 | ],
14 | "nodes": [
15 | {
16 | "children": [
17 | 1
18 | ],
19 | "matrix": [
20 | 1.0,
21 | 0.0,
22 | 0.0,
23 | 0.0,
24 | 0.0,
25 | 0.0,
26 | -1.0,
27 | 0.0,
28 | 0.0,
29 | 1.0,
30 | 0.0,
31 | 0.0,
32 | 0.0,
33 | 0.0,
34 | 0.0,
35 | 1.0
36 | ]
37 | },
38 | {
39 | "mesh": 0
40 | }
41 | ],
42 | "meshes": [
43 | {
44 | "primitives": [
45 | {
46 | "attributes": {
47 | "NORMAL": 1,
48 | "POSITION": 2
49 | },
50 | "indices": 0,
51 | "mode": 4,
52 | "material": 0
53 | }
54 | ],
55 | "name": "Mesh"
56 | }
57 | ],
58 | "accessors": [
59 | {
60 | "bufferView": 0,
61 | "byteOffset": 0,
62 | "componentType": 5123,
63 | "count": 36,
64 | "max": [
65 | 23
66 | ],
67 | "min": [
68 | 0
69 | ],
70 | "type": "SCALAR"
71 | },
72 | {
73 | "bufferView": 1,
74 | "byteOffset": 0,
75 | "componentType": 5126,
76 | "count": 24,
77 | "max": [
78 | 1.0,
79 | 1.0,
80 | 1.0
81 | ],
82 | "min": [
83 | -1.0,
84 | -1.0,
85 | -1.0
86 | ],
87 | "type": "VEC3"
88 | },
89 | {
90 | "bufferView": 1,
91 | "byteOffset": 288,
92 | "componentType": 5126,
93 | "count": 24,
94 | "max": [
95 | 0.5,
96 | 0.5,
97 | 0.5
98 | ],
99 | "min": [
100 | -0.5,
101 | -0.5,
102 | -0.5
103 | ],
104 | "type": "VEC3"
105 | }
106 | ],
107 | "materials": [
108 | {
109 | "pbrMetallicRoughness": {
110 | "baseColorFactor": [
111 | 0.800000011920929,
112 | 0.0,
113 | 0.0,
114 | 1.0
115 | ],
116 | "metallicFactor": 0.0
117 | },
118 | "name": "Red"
119 | }
120 | ],
121 | "bufferViews": [
122 | {
123 | "buffer": 0,
124 | "byteOffset": 576,
125 | "byteLength": 72,
126 | "target": 34963
127 | },
128 | {
129 | "buffer": 0,
130 | "byteOffset": 0,
131 | "byteLength": 576,
132 | "byteStride": 12,
133 | "target": 34962
134 | }
135 | ],
136 | "buffers": [
137 | {
138 | "byteLength": 648,
139 | "uri": "Box0.bin"
140 | }
141 | ]
142 | }
143 |
--------------------------------------------------------------------------------
/iris/assets/models/Box/glTF/Box0.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/Box/glTF/Box0.bin
--------------------------------------------------------------------------------
/iris/assets/models/Box/screenshot/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/Box/screenshot/screenshot.png
--------------------------------------------------------------------------------
/iris/assets/models/BoxTextured/BoxTextured_README.md:
--------------------------------------------------------------------------------
1 | # Box Textured
2 | ## Screenshot
3 |
4 | 
5 |
6 | ## License Information
7 |
8 | Donated by Cesium for glTF testing. Please follow the [Cesium Trademark Terms and Conditions](https://github.com/AnalyticalGraphicsInc/cesium/wiki/CesiumTrademark.pdf).
9 |
10 | This model is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).
11 |
--------------------------------------------------------------------------------
/iris/assets/models/BoxTextured/glTF-Binary/BoxTextured.glb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/BoxTextured/glTF-Binary/BoxTextured.glb
--------------------------------------------------------------------------------
/iris/assets/models/BoxTextured/glTF-pbrSpecularGlossiness/BoxTextured.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset": {
3 | "generator": "COLLADA2GLTF",
4 | "version": "2.0"
5 | },
6 | "scene": 0,
7 | "scenes": [
8 | {
9 | "nodes": [
10 | 0
11 | ]
12 | }
13 | ],
14 | "nodes": [
15 | {
16 | "children": [
17 | 1
18 | ],
19 | "matrix": [
20 | 1.0,
21 | 0.0,
22 | 0.0,
23 | 0.0,
24 | 0.0,
25 | 0.0,
26 | -1.0,
27 | 0.0,
28 | 0.0,
29 | 1.0,
30 | 0.0,
31 | 0.0,
32 | 0.0,
33 | 0.0,
34 | 0.0,
35 | 1.0
36 | ]
37 | },
38 | {
39 | "mesh": 0
40 | }
41 | ],
42 | "meshes": [
43 | {
44 | "primitives": [
45 | {
46 | "attributes": {
47 | "NORMAL": 1,
48 | "POSITION": 2,
49 | "TEXCOORD_0": 3
50 | },
51 | "indices": 0,
52 | "mode": 4,
53 | "material": 0
54 | }
55 | ],
56 | "name": "Mesh"
57 | }
58 | ],
59 | "accessors": [
60 | {
61 | "bufferView": 0,
62 | "byteOffset": 0,
63 | "componentType": 5123,
64 | "count": 36,
65 | "max": [
66 | 23
67 | ],
68 | "min": [
69 | 0
70 | ],
71 | "type": "SCALAR"
72 | },
73 | {
74 | "bufferView": 1,
75 | "byteOffset": 0,
76 | "componentType": 5126,
77 | "count": 24,
78 | "max": [
79 | 1.0,
80 | 1.0,
81 | 1.0
82 | ],
83 | "min": [
84 | -1.0,
85 | -1.0,
86 | -1.0
87 | ],
88 | "type": "VEC3"
89 | },
90 | {
91 | "bufferView": 1,
92 | "byteOffset": 288,
93 | "componentType": 5126,
94 | "count": 24,
95 | "max": [
96 | 0.5,
97 | 0.5,
98 | 0.5
99 | ],
100 | "min": [
101 | -0.5,
102 | -0.5,
103 | -0.5
104 | ],
105 | "type": "VEC3"
106 | },
107 | {
108 | "bufferView": 2,
109 | "byteOffset": 0,
110 | "componentType": 5126,
111 | "count": 24,
112 | "max": [
113 | 6.0,
114 | 1.0
115 | ],
116 | "min": [
117 | 0.0,
118 | 0.0
119 | ],
120 | "type": "VEC2"
121 | }
122 | ],
123 | "materials": [
124 | {
125 | "pbrMetallicRoughness": {
126 | "baseColorTexture": {
127 | "index": 0
128 | },
129 | "metallicFactor": 0.0
130 | },
131 | "extensions": {
132 | "KHR_materials_pbrSpecularGlossiness": {
133 | "diffuseTexture": {
134 | "index": 0
135 | },
136 | "specularFactor": [
137 | 0.20000000298023225,
138 | 0.20000000298023225,
139 | 0.20000000298023225
140 | ],
141 | "glossinessFactor": 1.0
142 | }
143 | },
144 | "name": "Texture"
145 | }
146 | ],
147 | "textures": [
148 | {
149 | "sampler": 0,
150 | "source": 0
151 | }
152 | ],
153 | "images": [
154 | {
155 | "uri": "CesiumLogoFlat.png"
156 | }
157 | ],
158 | "samplers": [
159 | {
160 | "magFilter": 9729,
161 | "minFilter": 9986,
162 | "wrapS": 10497,
163 | "wrapT": 10497
164 | }
165 | ],
166 | "bufferViews": [
167 | {
168 | "buffer": 0,
169 | "byteOffset": 768,
170 | "byteLength": 72,
171 | "target": 34963
172 | },
173 | {
174 | "buffer": 0,
175 | "byteOffset": 0,
176 | "byteLength": 576,
177 | "byteStride": 12,
178 | "target": 34962
179 | },
180 | {
181 | "buffer": 0,
182 | "byteOffset": 576,
183 | "byteLength": 192,
184 | "byteStride": 8,
185 | "target": 34962
186 | }
187 | ],
188 | "buffers": [
189 | {
190 | "byteLength": 840,
191 | "uri": "BoxTextured0.bin"
192 | }
193 | ],
194 | "extensionsUsed": [
195 | "KHR_materials_pbrSpecularGlossiness"
196 | ]
197 | }
198 |
--------------------------------------------------------------------------------
/iris/assets/models/BoxTextured/glTF-pbrSpecularGlossiness/BoxTextured0.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/BoxTextured/glTF-pbrSpecularGlossiness/BoxTextured0.bin
--------------------------------------------------------------------------------
/iris/assets/models/BoxTextured/glTF-pbrSpecularGlossiness/CesiumLogoFlat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/BoxTextured/glTF-pbrSpecularGlossiness/CesiumLogoFlat.png
--------------------------------------------------------------------------------
/iris/assets/models/BoxTextured/glTF/BoxTextured.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset": {
3 | "generator": "COLLADA2GLTF",
4 | "version": "2.0"
5 | },
6 | "scene": 0,
7 | "scenes": [
8 | {
9 | "nodes": [
10 | 0
11 | ]
12 | }
13 | ],
14 | "nodes": [
15 | {
16 | "children": [
17 | 1
18 | ],
19 | "matrix": [
20 | 1.0,
21 | 0.0,
22 | 0.0,
23 | 0.0,
24 | 0.0,
25 | 0.0,
26 | -1.0,
27 | 0.0,
28 | 0.0,
29 | 1.0,
30 | 0.0,
31 | 0.0,
32 | 0.0,
33 | 0.0,
34 | 0.0,
35 | 1.0
36 | ]
37 | },
38 | {
39 | "mesh": 0
40 | }
41 | ],
42 | "meshes": [
43 | {
44 | "primitives": [
45 | {
46 | "attributes": {
47 | "NORMAL": 1,
48 | "POSITION": 2,
49 | "TEXCOORD_0": 3
50 | },
51 | "indices": 0,
52 | "mode": 4,
53 | "material": 0
54 | }
55 | ],
56 | "name": "Mesh"
57 | }
58 | ],
59 | "accessors": [
60 | {
61 | "bufferView": 0,
62 | "byteOffset": 0,
63 | "componentType": 5123,
64 | "count": 36,
65 | "max": [
66 | 23
67 | ],
68 | "min": [
69 | 0
70 | ],
71 | "type": "SCALAR"
72 | },
73 | {
74 | "bufferView": 1,
75 | "byteOffset": 0,
76 | "componentType": 5126,
77 | "count": 24,
78 | "max": [
79 | 1.0,
80 | 1.0,
81 | 1.0
82 | ],
83 | "min": [
84 | -1.0,
85 | -1.0,
86 | -1.0
87 | ],
88 | "type": "VEC3"
89 | },
90 | {
91 | "bufferView": 1,
92 | "byteOffset": 288,
93 | "componentType": 5126,
94 | "count": 24,
95 | "max": [
96 | 0.5,
97 | 0.5,
98 | 0.5
99 | ],
100 | "min": [
101 | -0.5,
102 | -0.5,
103 | -0.5
104 | ],
105 | "type": "VEC3"
106 | },
107 | {
108 | "bufferView": 2,
109 | "byteOffset": 0,
110 | "componentType": 5126,
111 | "count": 24,
112 | "max": [
113 | 6.0,
114 | 1.0
115 | ],
116 | "min": [
117 | 0.0,
118 | 0.0
119 | ],
120 | "type": "VEC2"
121 | }
122 | ],
123 | "materials": [
124 | {
125 | "pbrMetallicRoughness": {
126 | "baseColorTexture": {
127 | "index": 0
128 | },
129 | "metallicFactor": 0.0
130 | },
131 | "name": "Texture"
132 | }
133 | ],
134 | "textures": [
135 | {
136 | "sampler": 0,
137 | "source": 0
138 | }
139 | ],
140 | "images": [
141 | {
142 | "uri": "CesiumLogoFlat.png"
143 | }
144 | ],
145 | "samplers": [
146 | {
147 | "magFilter": 9729,
148 | "minFilter": 9986,
149 | "wrapS": 10497,
150 | "wrapT": 10497
151 | }
152 | ],
153 | "bufferViews": [
154 | {
155 | "buffer": 0,
156 | "byteOffset": 768,
157 | "byteLength": 72,
158 | "target": 34963
159 | },
160 | {
161 | "buffer": 0,
162 | "byteOffset": 0,
163 | "byteLength": 576,
164 | "byteStride": 12,
165 | "target": 34962
166 | },
167 | {
168 | "buffer": 0,
169 | "byteOffset": 576,
170 | "byteLength": 192,
171 | "byteStride": 8,
172 | "target": 34962
173 | }
174 | ],
175 | "buffers": [
176 | {
177 | "byteLength": 840,
178 | "uri": "BoxTextured0.bin"
179 | }
180 | ]
181 | }
182 |
--------------------------------------------------------------------------------
/iris/assets/models/BoxTextured/glTF/BoxTextured0.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/BoxTextured/glTF/BoxTextured0.bin
--------------------------------------------------------------------------------
/iris/assets/models/BoxTextured/glTF/CesiumLogoFlat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/BoxTextured/glTF/CesiumLogoFlat.png
--------------------------------------------------------------------------------
/iris/assets/models/BoxTextured/screenshot/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/BoxTextured/screenshot/screenshot.png
--------------------------------------------------------------------------------
/iris/assets/models/Gnomon/gnomon.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/Gnomon/gnomon.bin
--------------------------------------------------------------------------------
/iris/assets/models/RaytracedSpheres/spheres.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/usnistgov/hevx/c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c/iris/assets/models/RaytracedSpheres/spheres.bin
--------------------------------------------------------------------------------
/iris/assets/models/RaytracedSpheres/spheres.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset": {
3 | "version": "2.0"
4 | },
5 | "scene": 0,
6 | "scenes": [
7 | {
8 | "nodes": [
9 | 0
10 | ]
11 | }
12 | ],
13 | "nodes": [
14 | {
15 | "mesh": 0
16 | }
17 | ],
18 | "meshes": [
19 | {
20 | "primitives": [
21 | {
22 | "attributes": {
23 | "_AABB": 0
24 | },
25 | "material": 0
26 | }
27 | ]
28 | }
29 | ],
30 | "materials": [
31 | {
32 | "name": "lambertian",
33 | "extensions": {
34 | "NIST_techniques_raytracing": {
35 | "hitShaders": 0,
36 | "shaderRecord": {
37 | "albedo": 3
38 | }
39 | }
40 | }
41 | }
42 | ],
43 | "extensions": {
44 | "NIST_techniques_raytracing": {
45 | "shaderBindingTable": {
46 | "raygenShader": 0,
47 | "missShader": 1,
48 | "hitShaders": [
49 | {
50 | "intersectionShader": 2,
51 | "closestHitShader": 3
52 | },
53 | {
54 | "intersectionShader": 2,
55 | "closestHitShader": 4
56 | }
57 | ]
58 | },
59 | "shaders": [
60 | {
61 | "type": 256,
62 | "uri": "assets/shaders/raygen.rgen"
63 | },
64 | {
65 | "type": 2048,
66 | "uri": "assets/shaders/miss.rmiss"
67 | },
68 | {
69 | "type": 4096,
70 | "uri": "assets/shaders/sphere.rint"
71 | },
72 | {
73 | "type": 1024,
74 | "uri": "assets/shaders/lambertian.rchit"
75 | },
76 | {
77 | "type": 1024,
78 | "uri": "assets/shaders/metal.rchit"
79 | }
80 | ]
81 | }
82 | },
83 | "accessors": [
84 | {
85 | "bufferView": 0,
86 | "byteOffset": 0,
87 | "componentType": 5126,
88 | "count": 4,
89 | "type": "VEC3"
90 | },
91 | {
92 | "bufferView": 0,
93 | "byteOffset": 24,
94 | "componentType": 5126,
95 | "count": 2,
96 | "type": "VEC3"
97 | },
98 | {
99 | "bufferView": 0,
100 | "byteOffset": 48,
101 | "componentType": 5126,
102 | "count": 1,
103 | "type": "VEC3"
104 | },
105 | {
106 | "bufferView": 0,
107 | "byteOffset": 64,
108 | "componentType": 5126,
109 | "count": 1,
110 | "type": "VEC3"
111 | }
112 | ],
113 | "bufferViews": [
114 | {
115 | "buffer": 0,
116 | "byteLength": 72
117 | }
118 | ],
119 | "buffers": [
120 | {
121 | "byteLength": 72,
122 | "uri": "spheres.bin"
123 | }
124 | ],
125 | "extensionsUsed": [
126 | "NIST_techniques_raytracing"
127 | ],
128 | "extensionsRequired": [
129 | "NIST_techniques_raytracing"
130 | ]
131 | }
132 |
133 |
--------------------------------------------------------------------------------
/iris/assets/shaders/gltf.vert:
--------------------------------------------------------------------------------
1 | // The MIT License
2 | //
3 | // Copyright (c) 2016-2017 Mohamad Moneimne and Contributors
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | // SOFTWARE.
22 |
23 | //
24 | // Additional changes made by Wesley Griffin
25 | // to adapt it to Vulkan GLSL and HEVx https://github.com/usnistgov/hevx
26 | //
27 |
28 | #version 460 core
29 |
30 | layout(push_constant) uniform PushConstants {
31 | vec4 iMouse;
32 | float iTime;
33 | float iTimeDelta;
34 | float iFrameRate;
35 | float iFrame;
36 | vec3 iResolution;
37 | bool bDebugNormals;
38 | vec4 EyePosition;
39 | mat4 ModelMatrix;
40 | mat4 ModelViewMatrix;
41 | mat3 NormalMatrix;
42 | };
43 |
44 | layout(set = 0, binding = 0) uniform MatricesBuffer {
45 | mat4 ViewMatrix;
46 | mat4 ViewMatrixInverse;
47 | mat4 ProjectionMatrix;
48 | mat4 ProjectionMatrixInverse;
49 | };
50 |
51 | layout(location = 0) in vec3 Vertex;
52 | layout(location = 1) in vec3 Normal;
53 | #ifdef HAS_TEXCOORDS
54 | layout(location = 2) in vec4 Tangent;
55 | layout(location = 3) in vec2 Texcoord;
56 | #endif
57 |
58 | layout(location = 0) out vec4 Po; // surface position in object-space
59 | layout(location = 1) out vec4 Eo; // eye position in object-space
60 | layout(location = 2) out vec3 Vo; // view vector in object-space
61 | layout(location = 3) out vec3 No; // normal vector in object-space
62 |
63 | layout(location = 4) out vec4 Pe; // surface position in eye-space
64 | layout(location = 5) out vec4 Ee; // eye position in eye-space
65 | layout(location = 6) out vec3 Ve; // view vector in eye-space
66 | layout(location = 7) out vec3 Ne; // normal vector in eye-space
67 |
68 | layout(location = 8) out vec2 UV;
69 | #ifdef HAS_TEXCOORDS
70 | layout(location = 9) out mat3 TBN;
71 | #endif
72 |
73 | out gl_PerVertex {
74 | vec4 gl_Position;
75 | };
76 |
77 | void main() {
78 | Po = vec4(Vertex, 1.0);
79 | Pe = ModelViewMatrix * Po;
80 |
81 | No = normalize(Normal);
82 | Ne = NormalMatrix * No;
83 |
84 | Eo = EyePosition;
85 | Ee = ModelViewMatrix * Eo;
86 |
87 | Vo = normalize(Eo.xyz*Po.w - Po.xyz*Eo.w);
88 | Ve = normalize(Ee.xyz*Pe.w - Pe.xyz*Ee.w);
89 |
90 | #ifdef HAS_TEXCOORDS
91 | vec3 normalW = normalize(Ne);
92 | vec3 tangentW = normalize(vec3(ModelMatrix * vec4(Tangent.xyz, 0.0)));
93 | vec3 bitangentW = cross(normalW, tangentW) * Tangent.w;
94 | TBN = mat3(tangentW, bitangentW, normalW);
95 | #endif
96 |
97 | #ifdef HAS_TEXCOORDS
98 | UV = Texcoord;
99 | #else
100 | UV = vec2(0.0, 0.0);
101 | #endif
102 |
103 | gl_Position = ProjectionMatrix * Pe;
104 | }
105 |
--------------------------------------------------------------------------------
/iris/assets/shaders/lambertian.rchit:
--------------------------------------------------------------------------------
1 | #version 460 core
2 | #extension GL_NV_ray_tracing : require
3 | #extension GL_GOOGLE_include_directive : require
4 | #extension GL_ARB_gpu_shader_int64 : require
5 | #extension GL_EXT_nonuniform_qualifier : enable
6 |
7 | #include "rand.glsl"
8 | #include "prd.glsl"
9 |
10 | #define MAX_LIGHTS 100
11 |
12 | struct Light {
13 | vec4 direction;
14 | vec4 color;
15 | };
16 |
17 | layout(push_constant) uniform PushConstants {
18 | vec4 padding0;
19 | float iTime;
20 | float iTimeDelta;
21 | float iFrameRate;
22 | float iFrame;
23 | vec3 padding1;
24 | bool bDebugNormals;
25 | vec4 EyePosition;
26 | mat4 ModelMatrix;
27 | mat4 ModelViewMatrix;
28 | mat3 NormalMatrix;
29 | };
30 |
31 | layout(set = 0, binding = 0) uniform MatricesBuffer {
32 | mat4 ViewMatrix;
33 | mat4 ViewMatrixInverse;
34 | mat4 ProjectionMatrix;
35 | mat4 ProjectionMatrixInverse;
36 | };
37 |
38 | layout(set = 0, binding = 1) uniform LightsBuffer {
39 | Light Lights[MAX_LIGHTS];
40 | int NumLights;
41 | };
42 |
43 | layout(location = 0) rayPayloadInNV PerRayData prd;
44 |
45 | hitAttributeNV vec3 Po; // Hit position in world-space
46 | hitAttributeNV vec3 No; // Normal in world-space
47 |
48 | void main() {
49 | const vec3 target = Po + No + rand_vec3_in_unit_sphere(prd.rngState);
50 |
51 | prd.event = EVENT_RAY_BOUNCED;
52 | prd.scattered = Ray(Po, (target - Po));
53 | prd.attenuation = vec3(.5f, .5f, .5f);
54 | }
55 |
--------------------------------------------------------------------------------
/iris/assets/shaders/metal.rchit:
--------------------------------------------------------------------------------
1 | #version 460 core
2 | #extension GL_NV_ray_tracing : require
3 | #extension GL_GOOGLE_include_directive : require
4 | #extension GL_ARB_gpu_shader_int64 : require
5 | #extension GL_EXT_nonuniform_qualifier : enable
6 |
7 | #include "rand.glsl"
8 | #include "prd.glsl"
9 |
10 | #define MAX_LIGHTS 100
11 |
12 | struct Light {
13 | vec4 direction;
14 | vec4 color;
15 | };
16 |
17 | layout(push_constant) uniform PushConstants {
18 | vec4 padding0;
19 | float iTime;
20 | float iTimeDelta;
21 | float iFrameRate;
22 | float iFrame;
23 | vec3 padding1;
24 | bool bDebugNormals;
25 | vec4 EyePosition;
26 | mat4 ModelMatrix;
27 | mat4 ModelViewMatrix;
28 | mat3 NormalMatrix;
29 | };
30 |
31 | layout(set = 0, binding = 0) uniform MatricesBuffer {
32 | mat4 ViewMatrix;
33 | mat4 ViewMatrixInverse;
34 | mat4 ProjectionMatrix;
35 | mat4 ProjectionMatrixInverse;
36 | };
37 |
38 | layout(set = 0, binding = 1) uniform LightsBuffer {
39 | Light Lights[MAX_LIGHTS];
40 | int NumLights;
41 | };
42 |
43 | layout(location = 0) rayPayloadInNV PerRayData prd;
44 |
45 | hitAttributeNV vec3 Po; // Hit position in world-space
46 | hitAttributeNV vec3 No; // Normal in world-space
47 |
48 | void main() {
49 | const vec3 reflected = reflect(normalize(gl_WorldRayDirectionNV), No);
50 |
51 | prd.event = EVENT_RAY_BOUNCED;
52 | prd.scattered = Ray(Po, reflected);
53 | prd.attenuation = vec3(.8f, .8f, .8f);
54 | }
55 |
--------------------------------------------------------------------------------
/iris/assets/shaders/miss.rmiss:
--------------------------------------------------------------------------------
1 | #version 460 core
2 | #extension GL_NV_ray_tracing : require
3 | #extension GL_GOOGLE_include_directive : require
4 | #extension GL_ARB_gpu_shader_int64 : require
5 |
6 | #include "prd.glsl"
7 |
8 | layout(push_constant) uniform PushConstants {
9 | vec4 padding0;
10 | float iTime;
11 | float iTimeDelta;
12 | float iFrameRate;
13 | float iFrame;
14 | vec3 padding1;
15 | bool bDebugNormals;
16 | vec4 EyePosition;
17 | mat4 ModelMatrix;
18 | mat4 ModelViewMatrix;
19 | mat3 NormalMatrix;
20 | };
21 |
22 | layout(location = 0) rayPayloadInNV PerRayData prd;
23 |
24 | void main() {
25 | prd.event = EVENT_RAY_MISSED;
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/iris/assets/shaders/prd.glsl:
--------------------------------------------------------------------------------
1 | struct Ray {
2 | vec3 origin;
3 | vec3 direction;
4 | };
5 |
6 | #define EVENT_RAY_BOUNCED 0
7 | #define EVENT_RAY_KILLED 1
8 | #define EVENT_RAY_MISSED 2
9 |
10 | struct PerRayData {
11 | uint64_t rngState;
12 | int event; // EVENT_*
13 | Ray scattered;
14 | vec3 attenuation;
15 | };
16 |
17 |
--------------------------------------------------------------------------------
/iris/assets/shaders/rand.glsl:
--------------------------------------------------------------------------------
1 | float drand48(inout uint64_t state) {
2 | const uint64_t a = 0x5DEECE66DUL;
3 | const uint64_t c = 0xBUL;
4 | const uint64_t mask = 0xFFFFFFFFFFFFUL;
5 | state = a * state + c;
6 | return float(state & mask) / float(mask+1UL);
7 | }
8 |
9 | vec3 rand_vec3_in_unit_sphere(inout uint64_t state) {
10 | vec3 p;
11 | do {
12 | const float x = drand48(state);
13 | const float y = drand48(state);
14 | const float z = drand48(state);
15 | p = 2.f * vec3(x, y, z) - vec3(1.f, 1.f, 1.f);
16 | } while (dot(p, p) >= 1.f);
17 | return p;
18 | }
19 |
--------------------------------------------------------------------------------
/iris/assets/shaders/raygen.rgen:
--------------------------------------------------------------------------------
1 | #version 460 core
2 | #extension GL_NV_ray_tracing : require
3 | #extension GL_GOOGLE_include_directive : require
4 | #extension GL_ARB_gpu_shader_int64 : require
5 |
6 | #include "prd.glsl"
7 | #include "rand.glsl"
8 | #include "sphere.glsl"
9 |
10 | #define MAX_DEPTH 16
11 | #define NUM_SAMPLES 4
12 |
13 | layout(push_constant) uniform PushConstants {
14 | vec4 padding0;
15 | float iTime;
16 | float iTimeDelta;
17 | float iFrameRate;
18 | float iFrame;
19 | vec3 padding1;
20 | bool bDebugNormals;
21 | vec4 EyePosition;
22 | mat4 ModelMatrix;
23 | mat4 ModelViewMatrix;
24 | mat3 NormalMatrix;
25 | };
26 |
27 | layout(set = 0, binding = 0) uniform MatricesBuffer {
28 | mat4 ViewMatrix;
29 | mat4 ViewMatrixInverse;
30 | mat4 ProjectionMatrix;
31 | mat4 ProjectionMatrixInverse;
32 | };
33 |
34 | layout(set = 1, binding = 0) uniform accelerationStructureNV scene;
35 | layout(set = 1, binding = 1, rgba8) uniform image2D outputImage;
36 | layout(std430, set = 1, binding = 2) readonly buffer SphereBuffer {
37 | Sphere spheres[];
38 | };
39 |
40 | vec3 missColor(Ray ray) {
41 | const vec3 direction = normalize(ray.direction);
42 | // HEV is -Z up, so the Z coordinate of the direction vector runs top-bottom
43 | const float t = .5f * (-direction.z + 1.f);
44 | return mix(vec3(1.f, 1.f, 1.f), vec3(.5f, .7f, 1.f), t);
45 | }
46 |
47 | layout(location = 0) rayPayloadNV PerRayData prd;
48 |
49 | vec3 color(Ray ray) {
50 | vec3 attenuation = vec3(1.f, 1.f, 1.f);
51 |
52 | for (int d = 0; d < MAX_DEPTH; ++d) {
53 | traceNV(scene, // topLevel
54 | gl_RayFlagsOpaqueNV, // rayFlags
55 | 0xF, // cullMask
56 | 0, // sbtRecordOffset
57 | 0, // sbtRecordStride
58 | 0, // missIndex
59 | ray.origin.xyz, // origin
60 | .001f, // Tmin
61 | ray.direction.xyz, // direction
62 | 1e+38f, // Tmax
63 | 0 // payload
64 | );
65 |
66 | if (prd.event == EVENT_RAY_MISSED) {
67 | return attenuation * missColor(ray);
68 | } else if (prd.event == EVENT_RAY_KILLED) {
69 | return vec3(0.f, 0.f, 0.f);
70 | } else {
71 | attenuation *= prd.attenuation;
72 | ray = prd.scattered;
73 | }
74 | }
75 |
76 | return vec3(0.f, 0.f, 0.f);
77 | }
78 |
79 | void main() {
80 | prd.rngState = gl_LaunchIDNV.x * gl_LaunchIDNV.y;
81 |
82 | // gl_LaunchIDNV is the integer coordinates of the pixel in outputImage
83 | const vec2 pixelCenter = vec2(gl_LaunchIDNV.xy) + vec2(.5f);
84 |
85 | vec3 col = vec3(0.f, 0.f, 0.f);
86 | for (int s = 0; s < NUM_SAMPLES; ++s) {
87 | // gl_LaunchSizeNV is the dimensions of outputImage
88 | // uv is the normalized coordinates of the pixel in outputImage
89 | const vec2 uv = (pixelCenter
90 | + vec2(drand48(prd.rngState), drand48(prd.rngState)))
91 | / vec2(gl_LaunchSizeNV.xy);
92 |
93 | // ndc ranges from [-1, -1]
94 | const vec2 ndc = uv * 2.f - 1.f;
95 |
96 | Ray ray;
97 | // EyePosition is the world-space coordinates of the camera.
98 | ray.origin = EyePosition.xyz;
99 |
100 | // target is the view-space coordinates reverse-projected from ndc
101 | const vec4 target = ProjectionMatrixInverse * vec4(ndc.x, ndc.y, 1.f, 1.f);
102 | // HEV is -Z up for the ViewMatrix.
103 | // direction is the world-space direction of the ray
104 | ray.direction = vec3(ViewMatrixInverse * vec4(normalize(target.xyz), 0.f));
105 |
106 | col += color(ray);
107 | }
108 |
109 | col = sqrt(col / vec3(float(NUM_SAMPLES)));
110 | imageStore(outputImage, ivec2(gl_LaunchIDNV.xy), vec4(col, 1.f));
111 | }
112 |
113 |
--------------------------------------------------------------------------------
/iris/assets/shaders/sphere.glsl:
--------------------------------------------------------------------------------
1 | struct Sphere {
2 | float aabbMinX;
3 | float aabbMinY;
4 | float aabbMinZ;
5 | float aabbMaxX;
6 | float aabbMaxY;
7 | float aabbMaxZ;
8 | };
9 |
--------------------------------------------------------------------------------
/iris/assets/shaders/sphere.rint:
--------------------------------------------------------------------------------
1 | #version 460 core
2 | #extension GL_NV_ray_tracing : require
3 | #extension GL_GOOGLE_include_directive : require
4 |
5 | #include "sphere.glsl"
6 |
7 | layout(push_constant) uniform PushConstants {
8 | vec4 padding0;
9 | float iTime;
10 | float iTimeDelta;
11 | float iFrameRate;
12 | float iFrame;
13 | vec3 padding1;
14 | bool bDebugNormals;
15 | vec4 EyePosition;
16 | mat4 ModelMatrix;
17 | mat4 ModelViewMatrix;
18 | mat3 NormalMatrix;
19 | };
20 |
21 | layout(std430, set = 1, binding = 2) readonly buffer SphereBuffer {
22 | Sphere spheres[];
23 | };
24 |
25 | hitAttributeNV vec3 Po; // Hit position in world-space
26 | hitAttributeNV vec3 No; // Normal in world-space
27 |
28 | void main() {
29 | /////
30 | //
31 | // All of these coordinates are in world space.
32 | //
33 | ////
34 |
35 | const vec3 origin = gl_WorldRayOriginNV;
36 | const vec3 direction = normalize(gl_WorldRayDirectionNV);
37 |
38 | Sphere sphere = spheres[gl_PrimitiveID];
39 | const vec3 aabbMin = vec3(sphere.aabbMinX, sphere.aabbMinY, sphere.aabbMinZ);
40 | const vec3 aabbMax = vec3(sphere.aabbMaxX, sphere.aabbMaxY, sphere.aabbMaxZ);
41 |
42 | const vec3 center =
43 | (ModelMatrix * vec4((aabbMax.xyz + aabbMin.xyz) / vec3(2.f), 1.f)).xyz;
44 | const float radius = (aabbMax.x - aabbMin.x) / 2.f;
45 |
46 | const vec3 oc = origin - center;
47 | const float a = dot(direction, direction);
48 | const float b = dot(oc, direction);
49 | const float c = dot(oc, oc) - (radius * radius);
50 | const float d = b * b - a * c;
51 |
52 | if (d > 0.f) {
53 | const float s_d = sqrt(d);
54 | const float t1 = (-b - s_d) / a;
55 | const float t2 = (-b + s_d) / a;
56 |
57 | if (gl_RayTminNV < t1 && t1 < gl_RayTmaxNV) {
58 | Po = origin + direction * t1;
59 | No = (Po - center) / radius;
60 | reportIntersectionNV(t1, 0);
61 | } else if (gl_RayTminNV < t2 && t2 < gl_RayTmaxNV) {
62 | Po = origin + direction * t2;
63 | No = (Po - center) / radius;
64 | reportIntersectionNV(t2, 0);
65 | }
66 | }
67 | }
68 |
69 |
--------------------------------------------------------------------------------
/iris/assets/shadertoy/shadertoy_uv.frag:
--------------------------------------------------------------------------------
1 | void mainImage(out vec4 fragColor, in vec2 fragCoord) {
2 | // Normalized pixel coordinates (from 0 to 1)"
3 | vec2 uv = fragCoord/iResolution.xy;
4 | // Time varying pixel color"
5 | vec3 col = 0.5 + 0.5 * cos(iTime+uv.xyx+vec3(0,2,4));
6 | // Output to screen
7 | fragColor = vec4(col,1.0);
8 | }
--------------------------------------------------------------------------------
/iris/assets/shadertoy/spheres.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset": {
3 | "version": "2.0"
4 | },
5 | "scene": 0,
6 | "scenes": [
7 | {
8 | "nodes": [
9 | 0
10 | ]
11 | }
12 | ],
13 | "nodes": [
14 | {
15 | "name": "spheres",
16 | "extras": {
17 | "HEV": {
18 | "shadertoy": {
19 | "url": "https://www.shadertoy.com/view/MsSSWV"
20 | }
21 | }
22 | }
23 | }
24 | ]
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/iris/buffer.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_BUFFER_H_
2 | #define HEV_IRIS_BUFFER_H_
3 |
4 | #include "iris/config.h"
5 |
6 | #include "iris/types.h"
7 | #include "iris/vulkan.h"
8 |
9 | #if PLATFORM_COMPILER_MSVC
10 | #include
11 | #pragma warning(push)
12 | #pragma warning(disable : ALL_CODE_ANALYSIS_WARNINGS)
13 | #pragma warning(disable : ALL_CPPCORECHECK_WARNINGS)
14 | #endif
15 |
16 | #include
17 |
18 | #if PLATFORM_COMPILER_MSVC
19 | #pragma warning(pop)
20 | #endif
21 |
22 | namespace iris {
23 |
24 | struct Buffer {
25 | VkBuffer buffer{VK_NULL_HANDLE};
26 | VmaAllocation allocation{VK_NULL_HANDLE};
27 | VkDeviceSize size{0};
28 |
29 | template
30 | expected Map() noexcept {
31 | if (auto ptr = Map()) {
32 | return reinterpret_cast(*ptr);
33 | } else {
34 | return unexpected(ptr.error());
35 | }
36 | }
37 |
38 | void Unmap() noexcept;
39 |
40 | explicit operator bool() const noexcept {
41 | return buffer != VK_NULL_HANDLE && allocation != VK_NULL_HANDLE;
42 | }
43 | }; // struct Buffer
44 |
45 | template <>
46 | expected Buffer::Map() noexcept;
47 |
48 | [[nodiscard]] expected
49 | AllocateBuffer(VkDeviceSize size, VkBufferUsageFlags bufferUsage,
50 | VmaMemoryUsage memoryUsage) noexcept;
51 |
52 | [[nodiscard]] expected
53 | ReallocateBuffer(Buffer oldBuffer, VkDeviceSize newSize,
54 | VkBufferUsageFlags bufferUsage,
55 | VmaMemoryUsage memoryUsage) noexcept;
56 |
57 | [[nodiscard]] expected
58 | CreateBuffer(VkCommandPool commandPool, VkQueue queue, VkFence fence,
59 | VkBufferUsageFlags bufferUsage, VmaMemoryUsage memoryUsage,
60 | VkDeviceSize size, gsl::not_null data) noexcept;
61 |
62 | void DestroyBuffer(Buffer buffer) noexcept;
63 |
64 | } // namespace iris
65 |
66 | #endif // HEV_IRIS_BUFFER_H_
67 |
--------------------------------------------------------------------------------
/iris/components/material.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_COMPONENTS_MATERIAL_H_
2 | #define HEV_IRIS_COMPONENTS_MATERIAL_H_
3 |
4 | #include "absl/container/inlined_vector.h"
5 | #include "glm/mat4x4.hpp"
6 | #include "glm/vec4.hpp"
7 | #include "iris/buffer.h"
8 | #include "iris/image.h"
9 | #include "iris/pipeline.h"
10 | #include "iris/vulkan.h"
11 | #include
12 |
13 | namespace iris::Renderer::Component {
14 |
15 | struct Material {
16 | static constexpr std::size_t const kMaxTextures = 4;
17 | absl::InlinedVector textures{};
18 | absl::InlinedVector textureViews{};
19 | absl::InlinedVector textureSamplers{};
20 |
21 | Buffer materialBuffer{};
22 |
23 | static constexpr std::size_t const kMaxVertexBindings = 4;
24 | absl::InlinedVector
25 | vertexInputBindingDescriptions;
26 |
27 | static constexpr std::size_t const kMaxVertexAttributes = 4;
28 | absl::InlinedVector
29 | vertexInputAttributeDescriptions{};
30 |
31 | VkPrimitiveTopology topology{VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST};
32 |
33 | VkPolygonMode polygonMode{VK_POLYGON_MODE_FILL};
34 | VkCullModeFlags cullMode{VK_CULL_MODE_BACK_BIT};
35 |
36 | absl::InlinedVector
37 | descriptorSetLayoutBindings{};
38 |
39 | VkDescriptorSetLayout descriptorSetLayout{VK_NULL_HANDLE};
40 | VkDescriptorSet descriptorSet{VK_NULL_HANDLE};
41 |
42 | Pipeline pipeline{};
43 |
44 | friend bool operator==(Material const& lhs, Material const& rhs) noexcept {
45 | return lhs.pipeline.pipeline == rhs.pipeline.pipeline;
46 | }
47 |
48 | template
49 | friend H AbslHashValue(H h, Material const& material) {
50 | return H::combine(std::move(h), material.pipeline.pipeline);
51 | }
52 | }; // struct Material
53 |
54 | } // namespace iris::Renderer::Component
55 |
56 | #endif // HEV_IRIS_COMPONENTS_MATERIAL_H_
57 |
--------------------------------------------------------------------------------
/iris/components/renderable.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_COMPONENTS_RENDERABLE_H_
2 | #define HEV_IRIS_COMPONENTS_RENDERABLE_H_
3 |
4 | #include "absl/container/inlined_vector.h"
5 | #include "glm/mat4x4.hpp"
6 | #include "glm/vec4.hpp"
7 | #include "iris/buffer.h"
8 | #include "iris/renderer.h"
9 | #include "iris/vulkan.h"
10 | #include
11 |
12 | namespace iris::Renderer::Component {
13 |
14 | struct Renderable {
15 | VkPrimitiveTopology topology{};
16 | MaterialID material{};
17 |
18 | static constexpr std::size_t const kMaxBuffers = 4;
19 | absl::InlinedVector buffers{};
20 |
21 | Buffer vertexBuffer{};
22 | VkDeviceSize vertexBufferBindingOffset{0};
23 |
24 | Buffer indexBuffer{};
25 | VkDeviceSize indexBufferBindingOffset{0};
26 |
27 | glm::mat4 modelMatrix{1.f};
28 |
29 | VkIndexType indexType{VK_INDEX_TYPE_UINT32};
30 | std::uint32_t numIndices{0};
31 | std::uint32_t instanceCount{1};
32 | std::uint32_t firstIndex{0};
33 | std::uint32_t vertexOffset{0};
34 | std::uint32_t firstInstance{0};
35 |
36 | std::uint32_t numVertices{0};
37 | std::uint32_t firstVertex{0};
38 |
39 | glm::vec4 boundingSphere{};
40 | }; // struct Renderable
41 |
42 | } // namespace iris::Renderer::Component
43 |
44 | #endif // HEV_IRIS_COMPONENTS_RENDERABLE_H_
45 |
--------------------------------------------------------------------------------
/iris/components/traceable.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_COMPONENTS_TRACEABLE_H_
2 | #define HEV_IRIS_COMPONENTS_TRACEABLE_H_
3 |
4 | #include "absl/container/inlined_vector.h"
5 | #include "glm/mat4x4.hpp"
6 | #include "glm/vec4.hpp"
7 | #include "iris/acceleration_structure.h"
8 | #include "iris/buffer.h"
9 | #include "iris/image.h"
10 | #include "iris/pipeline.h"
11 | #include "iris/shader.h"
12 | #include "iris/vulkan.h"
13 | #include
14 |
15 | namespace iris::Renderer::Component {
16 |
17 | struct Traceable {
18 | VkDescriptorSetLayout descriptorSetLayout{VK_NULL_HANDLE};
19 | VkDescriptorSet descriptorSet{VK_NULL_HANDLE};
20 | absl::InlinedVector shaderGroups;
21 | Pipeline pipeline{};
22 |
23 | VkDeviceSize raygenBindingOffset{0};
24 | Buffer raygenShaderBindingTable{};
25 |
26 | VkDeviceSize missBindingOffset{0};
27 | VkDeviceSize missBindingStride{0};
28 | Buffer missShadersBindingTable{};
29 |
30 | VkDeviceSize hitBindingOffset{0};
31 | VkDeviceSize hitBindingStride{0};
32 | Buffer hitShadersBindingTable{};
33 |
34 | struct Geometry {
35 | Buffer buffer{};
36 | VkGeometryNV geometry{};
37 | bool bottomLevelDirty{true};
38 | AccelerationStructure bottomLevelAccelerationStructure{};
39 | };
40 |
41 | absl::InlinedVector geometries;
42 | bool topLevelDirty{true};
43 | AccelerationStructure topLevelAccelerationStructure{};
44 |
45 | VkExtent2D outputImageExtent{1600, 1200};
46 | Image outputImage{};
47 | VkImageView outputImageView{};
48 |
49 | VkFence traceFinishedFence{VK_NULL_HANDLE};
50 | }; // struct Traceable
51 |
52 | } // namespace iris::Renderer::Component
53 |
54 | #endif //HEV_IRIS_COMPONENTS_TRACEABLE_H_
55 |
--------------------------------------------------------------------------------
/iris/config.h.in:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_CONFIG_H_
2 | #define HEV_IRIS_CONFIG_H_
3 | /*! \file
4 | * \brief IRIS configuration variables
5 | */
6 |
7 | namespace iris {
8 |
9 | inline constexpr unsigned int kVersionMajor = @PROJECT_VERSION_MAJOR@; //!< Major version
10 | inline constexpr unsigned int kVersionMinor = @PROJECT_VERSION_MINOR@; //!< Minor version
11 | inline constexpr unsigned int kVersionPatch = @PROJECT_VERSION_PATCH@; //!< Patch version
12 | inline constexpr char const* kVersionStr = "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@"; //!< Version string
13 |
14 | inline constexpr char const* kVulkanSDKDirectory = "@Vulkan_SDK_DIR@"; //!< Location of Vulkan SDK
15 | inline constexpr char const* kIRISContentDirectory = "@CMAKE_CURRENT_SOURCE_DIR@";
16 |
17 | } // namespace iris
18 |
19 | //! Indicates if the build platform is Windows
20 | #cmakedefine01 PLATFORM_WINDOWS
21 | //! Indicates if the build platform is Linux
22 | #cmakedefine01 PLATFORM_LINUX
23 |
24 | //! Indicates if the compiler is MSVC
25 | #cmakedefine01 PLATFORM_COMPILER_MSVC
26 |
27 | //! Indicates if the compiler is GCC or Clang
28 | #cmakedefine01 PLATFORM_COMPILER_GCC
29 |
30 | #endif // HEV_IRIS_CONFIG_H_
31 |
32 |
--------------------------------------------------------------------------------
/iris/configs/4kdesktop.json:
--------------------------------------------------------------------------------
1 | {
2 | "displays": {
3 | "windows": [
4 | {
5 | "name": "desktopWindow",
6 | "is_stereo": false,
7 | "x": 320,
8 | "y": 320,
9 | "width": 1600,
10 | "height": 1200,
11 | "show_system_decoration": true,
12 | "background_color": {
13 | "r": 0.19607843137254902,
14 | "g": 0.19607843137254902,
15 | "b": 0.19607843137254902,
16 | "a": 0.0
17 | },
18 | "show_ui": true
19 | }
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/iris/configs/desktop.json:
--------------------------------------------------------------------------------
1 | {
2 | "displays": {
3 | "windows": [
4 | {
5 | "name": "desktopWindow",
6 | "is_stereo": false,
7 | "x": 320,
8 | "y": 320,
9 | "width": 1000,
10 | "height": 750,
11 | "show_system_decoration": true,
12 | "background_color": {
13 | "r": 0.0,
14 | "g": 0.0,
15 | "b": 0.0,
16 | "a": 0.0
17 | },
18 | "show_ui": true
19 | }
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/iris/configs/nist_cave.json:
--------------------------------------------------------------------------------
1 | {
2 | "displays": {
3 | "windows": [
4 | {
5 | "name": "frontWindow",
6 | "is_stereo": true,
7 | "x": 0,
8 | "y": 0,
9 | "width": 1600,
10 | "height": 1200,
11 | "show_system_decoration": false,
12 | "background_color": {
13 | "r": 0,
14 | "g": 0,
15 | "b": 0,
16 | "a": 1
17 | },
18 | "show_ui": false,
19 | "display": 1
20 | },
21 | {
22 | "name": "leftWindow",
23 | "is_stereo": true,
24 | "x": 0,
25 | "y": 0,
26 | "width": 1600,
27 | "height": 1200,
28 | "show_system_decoration": false,
29 | "background_color": {
30 | "r": 0,
31 | "g": 0,
32 | "b": 0,
33 | "a": 1
34 | },
35 | "show_ui": false,
36 | "display": 2
37 | },
38 | {
39 | "name": "floorWindow",
40 | "is_stereo": true,
41 | "x": 0,
42 | "y": 0,
43 | "width": 1600,
44 | "height": 1200,
45 | "show_system_decoration": false,
46 | "background_color": {
47 | "r": 0,
48 | "g": 0,
49 | "b": 0,
50 | "a": 1
51 | },
52 | "show_ui": false,
53 | "display": 3
54 | },
55 | {
56 | "name": "consoleWindow",
57 | "is_stereo": false,
58 | "x": 320,
59 | "y": 320,
60 | "width": 720,
61 | "height": 720,
62 | "show_system_decoration": true,
63 | "background_color": {
64 | "r": 0,
65 | "g": 0,
66 | "b": 0,
67 | "a": 1
68 | },
69 | "show_ui": true
70 | }
71 | ]
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/iris/configs/simulator.json:
--------------------------------------------------------------------------------
1 | {
2 | "displays": {
3 | "windows": [
4 | {
5 | "name": "frontSimulatorWindow",
6 | "is_stereo": false,
7 | "x": 20,
8 | "y": 20,
9 | "width": 720,
10 | "height": 720,
11 | "show_system_decoration": true,
12 | "background_color": {
13 | "r": 0,
14 | "g": 0,
15 | "b": 0,
16 | "a": 1
17 | },
18 | "show_ui": false
19 | },
20 | {
21 | "name": "leftSimulatorWindow",
22 | "is_stereo": false,
23 | "x": 760,
24 | "y": 20,
25 | "width": 720,
26 | "height": 720,
27 | "show_system_decoration": true,
28 | "background_color": {
29 | "r": 0,
30 | "g": 0,
31 | "b": 0,
32 | "a": 1
33 | },
34 | "show_ui": false
35 | },
36 | {
37 | "name": "floorSimulatorWindow",
38 | "is_stereo": false,
39 | "x": 20,
40 | "y": 760,
41 | "width": 720,
42 | "height": 720,
43 | "show_system_decoration": true,
44 | "background_color": {
45 | "r": 0,
46 | "g": 0,
47 | "b": 0,
48 | "a": 1
49 | },
50 | "show_ui": false
51 | },
52 | {
53 | "name": "consoleWindow",
54 | "is_stereo": false,
55 | "x": 760,
56 | "y": 760,
57 | "width": 720,
58 | "height": 720,
59 | "show_system_decoration": true,
60 | "background_color": {
61 | "r": 0,
62 | "g": 0,
63 | "b": 0,
64 | "a": 1
65 | },
66 | "show_ui": true
67 | }
68 | ]
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/iris/enumerate.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_ENUMERATE_H_
2 | #define HEV_IRIS_ENUMERATE_H_
3 |
4 | #include
5 | #include
6 |
7 | namespace iris {
8 |
9 | template ())),
10 | class = decltype(std::end(std::declval()))>
11 | constexpr auto enumerate(C&& c) noexcept(noexcept(std::begin(c)) &&
12 | noexcept(std::end(c))) {
13 | // clang-format off
14 | struct iterator {
15 | std::size_t n;
16 | I i;
17 | bool operator!=(iterator const& o) const noexcept { return i != o.i; }
18 | void operator++() noexcept(noexcept(++i)) { ++n; ++i; }
19 | auto operator*() const noexcept(noexcept(*i)) { return std::tie(n, *i); }
20 | };
21 |
22 | struct wrapper {
23 | C i;
24 | iterator begin() noexcept(noexcept(std::begin(i))) {return {0,std::begin(i)};}
25 | iterator end() noexcept(noexcept(std::end(i))) {return{0, std::end(i)};}
26 | };
27 | // clang-format on
28 |
29 | return wrapper{std::forward(c)};
30 | } // enumerate
31 |
32 | } // namespace iris
33 |
34 | #endif // HEV_IRIS_ENUMERATE_H_
35 |
--------------------------------------------------------------------------------
/iris/error.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_ERROR_H_
2 | #define HEV_IRIS_ERROR_H_
3 | /*!
4 | \file
5 | \brief \ref iris::Error definition.
6 | */
7 |
8 | #include "iris/config.h"
9 |
10 | #include
11 | #include
12 |
13 | namespace iris {
14 |
15 | //! \brief IRIS errors.
16 | enum class Error {
17 | kNone = 0, //!< No error
18 | kInitializationFailed, //!< Initialization failed for some reason.
19 | kNoPhysicalDevice, //!< No physical device available.
20 | kFileLoadFailed, //!< File load failed.
21 | kFileNotSupported, //!< File is not supported.
22 | kFileParseFailed, //!< Parsing a file failed.
23 | kURIInvalid, //!< Invalid URI.
24 | kControlMessageInvalid, //!< Control message invalid.
25 | kControlMessageFailed, //!< Control message failed.
26 | kSurfaceNotSupported, //!< Surface not supported by physical device.
27 | kWindowResizeFailed, //!< Resizing a window failed.
28 | kImageTransitionFailed, //!< Image transition failed.
29 | kShaderCompileFailed, //!< Shader compilation failed.
30 | kNoCommandQueuesFree, //!< All command queues are in use.
31 | kTimeout, //!< A timeout occured.
32 | kEnqueueError, //!< Enqueing a task failed.
33 | kUniqueComponentNotMapped, //!< Unique component not mapped.
34 | kNotImplemented, //!< Not implemented
35 | };
36 |
37 | //! \brief Implements std::error_category for \ref Error
38 | class ErrorCategory : public std::error_category {
39 | public:
40 | virtual ~ErrorCategory() noexcept {}
41 |
42 | //! \brief Get the name of this category.
43 | virtual const char* name() const noexcept override { return "iris::Error"; }
44 |
45 | //! \brief Convert an int representing an Error into a std::string.
46 | virtual std::string message(int code) const override {
47 | using namespace std::string_literals;
48 | switch (static_cast(code)) {
49 | case Error::kNone: return "none"s;
50 | case Error::kInitializationFailed: return "initialization failed"s;
51 | case Error::kNoPhysicalDevice: return "no physical device"s;
52 | case Error::kFileLoadFailed: return "file load failed"s;
53 | case Error::kFileNotSupported: return "file not supported"s;
54 | case Error::kFileParseFailed: return "file parse failed"s;
55 | case Error::kURIInvalid: return "uri invalid"s;
56 | case Error::kControlMessageInvalid: return "control message invalid"s;
57 | case Error::kControlMessageFailed: return "control message failed"s;
58 | case Error::kSurfaceNotSupported: return "surface not supported"s;
59 | case Error::kWindowResizeFailed: return "surface resize failed"s;
60 | case Error::kImageTransitionFailed: return "image transition failed"s;
61 | case Error::kShaderCompileFailed: return "shader compile failed"s;
62 | case Error::kNoCommandQueuesFree: return "no command queues free"s;
63 | case Error::kTimeout: return "timed out"s;
64 | case Error::kEnqueueError: return "enqueue error"s;
65 | case Error::kUniqueComponentNotMapped:
66 | return "unique component not mapped"s;
67 | case Error::kNotImplemented: return "not implemented";
68 | }
69 | return "unknown"s;
70 | }
71 | }; // class ErrorCategory
72 |
73 | //! The global instance of the ErrorCategory.
74 | inline ErrorCategory const gErrorCategory;
75 |
76 | /*! \brief Get the global instance of the ErrorCategory.
77 | \return \ref gErrorCategory
78 | */
79 | inline std::error_category const& GetErrorCategory() {
80 | return gErrorCategory;
81 | }
82 |
83 | /*! \brief Make a std::error_code from a \ref Error.
84 | \return std::error_code
85 | */
86 | inline std::error_code make_error_code(Error e) noexcept {
87 | return std::error_code(static_cast(e), GetErrorCategory());
88 | }
89 |
90 | } // namespace iris
91 |
92 | namespace std {
93 |
94 | template <>
95 | struct is_error_code_enum : public true_type {};
96 |
97 | } // namespace std
98 |
99 | #endif // HEV_IRIS_ERROR_H_
100 |
--------------------------------------------------------------------------------
/iris/flext/vk_win32_khr.txt:
--------------------------------------------------------------------------------
1 | version 1.1 vulkan
2 |
3 | # Instance Extensions
4 | extension KHR_get_physical_device_properties2 required
5 | extension KHR_get_surface_capabilities2 required
6 | extension KHR_surface required
7 |
8 | extension KHR_win32_surface required
9 | extension EXT_debug_report optional
10 | extension EXT_debug_utils optional
11 |
12 | # Device Extensions
13 | extension KHR_dedicated_allocation required
14 | extension KHR_get_memory_requirements2 required
15 | extension KHR_maintenance1 required
16 | extension KHR_maintenance2 required
17 | extension KHR_multiview required
18 | extension KHR_swapchain required
19 | extension EXT_inline_uniform_block required
20 |
21 | extension NV_ray_tracing optional
22 | extension NV_mesh_shader optional
23 |
--------------------------------------------------------------------------------
/iris/flext/vk_xcb_khr.txt:
--------------------------------------------------------------------------------
1 | version 1.1 vulkan
2 |
3 | # Instance Extensions
4 | extension KHR_get_physical_device_properties2 required
5 | extension KHR_get_surface_capabilities2 required
6 | extension KHR_surface required
7 |
8 | extension KHR_xcb_surface required
9 | extension EXT_debug_report optional
10 | extension EXT_debug_utils optional
11 |
12 | # Device Extensions
13 | extension KHR_dedicated_allocation required
14 | extension KHR_get_memory_requirements2 required
15 | extension KHR_maintenance1 required
16 | extension KHR_maintenance2 required
17 | extension KHR_multiview required
18 | extension KHR_swapchain required
19 | extension EXT_inline_uniform_block required
20 |
21 | extension NV_ray_tracing optional
22 | extension NV_mesh_shader optional
23 |
--------------------------------------------------------------------------------
/iris/flext/vk_xlib_khr.txt:
--------------------------------------------------------------------------------
1 | version 1.1 vulkan
2 |
3 | # Instance Extensions
4 | extension KHR_get_physical_device_properties2 required
5 | extension KHR_get_surface_capabilities2 required
6 | extension KHR_surface required
7 |
8 | extension KHR_xlib_surface required
9 | extension EXT_debug_report optional
10 | extension EXT_debug_utils optional
11 |
12 | # Device Extensions
13 | extension KHR_dedicated_allocation required
14 | extension KHR_get_memory_requirements2 required
15 | extension KHR_maintenance1 required
16 | extension KHR_maintenance2 required
17 | extension KHR_multiview required
18 | extension KHR_swapchain required
19 | extension EXT_inline_uniform_block required
20 |
21 | extension NV_ray_tracing optional
22 | extension NV_mesh_shader optional
23 |
--------------------------------------------------------------------------------
/iris/flext/vulkan/flextVk.cpp.template:
--------------------------------------------------------------------------------
1 | @require(passthru, functions, enums, options, version, extensions)
2 | #include "flextVk.h"
3 |
4 | @for category,funcs in functions:
5 | @if funcs:
6 | @for f in funcs:
7 | @if f.name not in ['GetInstanceProcAddr', 'EnumerateInstanceExtensionProperties', 'EnumerateInstanceLayerProperties', 'CreateInstance']:
8 | @f.returntype\
9 | (VKAPI_PTR *flextvk@f.name)(@f.param_type_list_string()) = nullptr;
10 | @end
11 | @end
12 | @end
13 | @end
14 |
15 | void flextVkInit() {
16 | /* All functions that are present already in 1.0 are loaded statically, but
17 | the following are not, so we have to load them at runtime */
18 | @for category,funcs in functions:
19 | @if funcs:
20 | @for f in funcs:
21 | @if f.name in ['EnumerateInstanceVersion']:
22 | flextvk@f.name = reinterpret_cast<@f.returntype\
23 | (VKAPI_PTR*)(@f.param_type_list_string())>(vkGetInstanceProcAddr(nullptr, "vk@f.name"));
24 | @end
25 | @end
26 | @end
27 | @end
28 | }
29 |
30 | void flextVkInitInstance(VkInstance instance) {
31 | @for category,funcs in functions:
32 | @if funcs:
33 | @for f in funcs:
34 | @if f.name not in ['GetInstanceProcAddr', 'EnumerateInstanceVersion', 'EnumerateInstanceExtensionProperties', 'EnumerateInstanceLayerProperties', 'CreateInstance']:
35 | flextvk@f.name = reinterpret_cast<@f.returntype\
36 | (VKAPI_PTR*)(@f.param_type_list_string())>(vkGetInstanceProcAddr(instance, "vk@f.name"));
37 | @end
38 | @end
39 | @end
40 | @end
41 | }
42 |
--------------------------------------------------------------------------------
/iris/flext/vulkan/flextVk.h.template:
--------------------------------------------------------------------------------
1 | @require(passthru, functions, enums, options, version, extensions)
2 | #ifndef _flextvk_h_
3 | #define _flextvk_h_
4 |
5 | #include
6 | #include
7 |
8 | /* Defensive include guards */
9 |
10 | #if defined(VULKAN_H_)
11 | #error Attempt to include auto-generated header after including vulkan.h
12 | #endif
13 | #if defined(VK_PLATFORM_H_)
14 | #error Attempt to include auto-generated header after including vk_platform.h
15 | #endif
16 |
17 | #define VULKAN_H_
18 | #define VK_PLATFORM_H_
19 |
20 | #ifdef __cplusplus
21 | extern "C" {
22 | #endif
23 |
24 | /* Verbatim copied from upstream vk_platform.h */
25 | #if defined(_WIN32)
26 | // On Windows, Vulkan commands use the stdcall convention
27 | #define VKAPI_ATTR
28 | #define VKAPI_CALL __stdcall
29 | #define VKAPI_PTR VKAPI_CALL
30 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
31 | #error "Vulkan isn't supported for the 'armeabi' NDK ABI"
32 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
33 | // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
34 | // calling convention, i.e. float parameters are passed in registers. This
35 | // is true even if the rest of the application passes floats on the stack,
36 | // as it does by default when compiling for the armeabi-v7a NDK ABI.
37 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
38 | #define VKAPI_CALL
39 | #define VKAPI_PTR VKAPI_ATTR
40 | #else
41 | // On other platforms, use the default calling convention
42 | #define VKAPI_ATTR
43 | #define VKAPI_CALL
44 | #define VKAPI_PTR
45 | #endif
46 |
47 | #ifdef VK_USE_PLATFORM_MIR_KHR
48 | #include
49 | #endif
50 |
51 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR
52 | #include
53 | #endif
54 |
55 | #ifdef VK_USE_PLATFORM_WIN32_KHR
56 | #define _AMD64_
57 | #include
58 | #endif
59 |
60 | #ifdef VK_USE_PLATFORM_XCB_KHR
61 | #include
62 | #endif
63 |
64 | #ifdef VK_USE_PLATFORM_XLIB_KHR
65 | #include
66 | #endif
67 |
68 | #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
69 | #include
70 | #include
71 | #endif
72 |
73 | /* Enums */
74 |
75 | @enums
76 |
77 | /* Data types */
78 |
79 | @passthru
80 |
81 | /* I'll bite the bullet and expect that vkCreateInstance(),
82 | vkEnumerateInstanceExtensionProperties() and vkEnumerateInstanceLayerProperties()
83 | functions can be loaded statically to avoid the need for a global
84 | flextVkInit() that needs to be called before everything else */
85 | @for cat,funcs in functions:
86 | @for f in funcs:
87 | @if f.name in ['GetInstanceProcAddr', 'EnumerateInstanceExtensionProperties', 'EnumerateInstanceLayerProperties', 'CreateInstance']:
88 | VKAPI_ATTR @f.returntype VKAPI_CALL vk@f.name\
89 | (@f.param_type_list_string());
90 | @end
91 | @end
92 | @end
93 |
94 | /* Function pointers */
95 | @for cat,funcs in functions:
96 | @if funcs:
97 |
98 | /* VK_@cat */
99 |
100 | @for f in funcs:
101 | @if f.name not in ['GetInstanceProcAddr', 'EnumerateInstanceExtensionProperties', 'EnumerateInstanceLayerProperties', 'CreateInstance']:
102 | extern @f.returntype\
103 | (VKAPI_PTR *flextvk@f.name)(@f.param_type_list_string());
104 | #define vk@f.name flextvk@f.name
105 | @end
106 | @end
107 | @end
108 | @end
109 |
110 | /* Global function pointer initialization */
111 | void flextVkInit();
112 |
113 | /* Function pointer initialization */
114 | void flextVkInitInstance(VkInstance instance);
115 |
116 | #ifdef __cplusplus
117 | }
118 | #endif
119 |
120 | #endif
121 |
--------------------------------------------------------------------------------
/iris/image.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_IMAGE_H_
2 | #define HEV_IRIS_IMAGE_H_
3 |
4 | #include "iris/config.h"
5 |
6 | #include "iris/types.h"
7 | #include "iris/vulkan_util.h"
8 |
9 | #if PLATFORM_COMPILER_MSVC
10 | #include
11 | #pragma warning(push)
12 | #pragma warning(disable : ALL_CODE_ANALYSIS_WARNINGS)
13 | #pragma warning(disable : ALL_CPPCORECHECK_WARNINGS)
14 | #endif
15 |
16 | #include
17 |
18 | #if PLATFORM_COMPILER_MSVC
19 | #pragma warning(pop)
20 | #endif
21 |
22 | namespace iris {
23 |
24 | struct Image {
25 | VkImage image{VK_NULL_HANDLE};
26 | VmaAllocation allocation{VK_NULL_HANDLE};
27 |
28 | explicit operator bool() const noexcept {
29 | return image != VK_NULL_HANDLE && allocation != VK_NULL_HANDLE;
30 | }
31 | }; // struct Image
32 |
33 | inline void SetImageLayout(VkCommandBuffer commandBuffer, Image image,
34 | VkPipelineStageFlags srcStages,
35 | VkPipelineStageFlags dstStages,
36 | VkImageLayout oldLayout, VkImageLayout newLayout,
37 | VkImageAspectFlags aspectMask,
38 | std::uint32_t mipLevels,
39 | std::uint32_t arrayLayers) noexcept {
40 | vk::SetImageLayout(commandBuffer, image.image, srcStages, dstStages,
41 | oldLayout, newLayout, aspectMask, mipLevels, arrayLayers);
42 | }
43 |
44 | expected
45 | TransitionImage(VkCommandPool commandPool, VkQueue queue, VkFence fence,
46 | Image image, VkImageLayout oldLayout, VkImageLayout newLayout,
47 | std::uint32_t mipLevels, std::uint32_t arrayLayers) noexcept;
48 |
49 | [[nodiscard]] expected
50 | AllocateImage(VkFormat format, VkExtent2D extent, std::uint32_t mipLevels,
51 | std::uint32_t arrayLayers, VkSampleCountFlagBits sampleCount,
52 | VkImageUsageFlags imageUsage, VkImageTiling imageTiling,
53 | VmaMemoryUsage memoryUsage) noexcept;
54 |
55 | [[nodiscard]] expected
56 | CreateImageView(Image image, VkImageViewType type, VkFormat format,
57 | VkImageSubresourceRange subresourceRange) noexcept;
58 |
59 | [[nodiscard]] expected
60 | CreateImage(VkCommandPool commandPool, VkQueue queue, VkFence fence,
61 | VkFormat format, VkExtent2D extent, VkImageUsageFlags imageUsage,
62 | VmaMemoryUsage memoryUsage, gsl::not_null pixels,
63 | std::uint32_t bytesPerPixel) noexcept;
64 |
65 | [[nodiscard]] expected
66 | CreateImage(VkCommandPool commandPool, VkQueue queue, VkFence fence,
67 | VkFormat format, gsl::span extents,
68 | VkImageUsageFlags imageUsage, VmaMemoryUsage memoryUsage,
69 | gsl::not_null levelsPixels,
70 | std::uint32_t bytesPerPixel) noexcept;
71 |
72 | void DestroyImage(Image image) noexcept;
73 |
74 | } // namespace iris
75 |
76 | #endif // HEV_IRIS_IMAGE_H_
77 |
--------------------------------------------------------------------------------
/iris/io/gltf.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_IO_GLTF_H_
2 | #define HEV_IRIS_IO_GLTF_H_
3 |
4 | #include "nlohmann/json.hpp"
5 | #include
6 | #include
7 | #include
8 |
9 | namespace iris::io {
10 |
11 | using json = nlohmann::json;
12 |
13 | std::function
14 | LoadGLTF(std::filesystem::path const& path) noexcept;
15 |
16 | std::function
17 | LoadGLTF(json const& gltf) noexcept;
18 |
19 | } // namespace iris::io
20 |
21 | #endif // HEV_IRIS_IO_GLTF_H_
22 |
--------------------------------------------------------------------------------
/iris/io/json.cc:
--------------------------------------------------------------------------------
1 | #include "io/json.h"
2 | #include "config.h"
3 | #include "error.h"
4 | #include "io/read_file.h"
5 | #if PLATFORM_COMPILER_MSVC
6 | #pragma warning(push)
7 | #pragma warning(disable : 4100)
8 | #elif PLATFORM_COMPILER_GCC
9 | #pragma GCC diagnostic push
10 | #pragma GCC diagnostic ignored "-Wshadow"
11 | #pragma GCC diagnostic ignored "-Wunused-parameter"
12 | #endif
13 | #include "google/protobuf/util/json_util.h"
14 | #if PLATFORM_COMPILER_MSVC
15 | #pragma warning(pop)
16 | #elif PLATFORM_COMPILER_GCC
17 | #pragma GCC diagnostic pop
18 | #endif
19 | #include "logging.h"
20 | #include "protos.h"
21 | #include "renderer.h"
22 | #include "types.h"
23 | #include
24 | #include
25 |
26 | std::function
27 | iris::io::LoadJSON(std::filesystem::path const& path) noexcept {
28 | IRIS_LOG_ENTER();
29 |
30 | std::string json;
31 | if (auto&& bytes = ReadFile(path)) {
32 | json =
33 | std::string(reinterpret_cast(bytes->data()), bytes->size());
34 | } else {
35 | IRIS_LOG_LEAVE();
36 | return [error = bytes.error()]() { return error; };
37 | }
38 |
39 | iris::Control::Control cMsg;
40 | if (auto status = google::protobuf::util::JsonStringToMessage(json, &cMsg);
41 | status.ok()) {
42 | IRIS_LOG_LEAVE();
43 | return [cMsg]() {
44 | if (auto result = Renderer::ProcessControlMessage(cMsg)) {
45 | return std::system_error(Error::kNone);
46 | } else {
47 | return result.error();
48 | }
49 | };
50 | } else {
51 | IRIS_LOG_LEAVE();
52 | return [message = status.ToString()]() {
53 | return std::system_error(Error::kFileParseFailed, message);
54 | };
55 | }
56 | } // iris::io::LoadJSON
57 |
--------------------------------------------------------------------------------
/iris/io/json.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_IO_JSON_H_
2 | #define HEV_IRIS_IO_JSON_H_
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | namespace iris::io {
9 |
10 | std::function
11 | LoadJSON(std::filesystem::path const& path) noexcept;
12 |
13 | } // namespace iris::io
14 |
15 | #endif // HEV_IRIS_IO_JSON_H_
16 |
--------------------------------------------------------------------------------
/iris/io/read_file.cc:
--------------------------------------------------------------------------------
1 | #include "io/read_file.h"
2 | #include "config.h"
3 | #include "logging.h"
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | iris::expected, std::system_error>
11 | iris::io::ReadFile(std::filesystem::path const& path) noexcept {
12 | IRIS_LOG_ENTER();
13 |
14 | std::unique_ptr fh{nullptr, std::fclose};
15 |
16 | if (std::filesystem::exists(path)) {
17 | IRIS_LOG_DEBUG("Reading {}", path.string());
18 | fh.reset(std::fopen(path.string().c_str(), "rb"));
19 | } else {
20 | if (std::filesystem::exists(kIRISContentDirectory / path)) {
21 | IRIS_LOG_DEBUG("Reading {}", (kIRISContentDirectory / path).string());
22 | fh.reset(
23 | std::fopen((kIRISContentDirectory / path).string().c_str(), "rb"));
24 | }
25 | }
26 |
27 | if (!fh) {
28 | return unexpected(std::system_error(
29 | std::make_error_code(std::errc::no_such_file_or_directory),
30 | path.string()));
31 | }
32 |
33 | std::fseek(fh.get(), 0L, SEEK_END);
34 | std::vector bytes(std::ftell(fh.get()));
35 |
36 | IRIS_LOG_DEBUG("Reading {} bytes from {}", bytes.size(), path.string());
37 | std::fseek(fh.get(), 0L, SEEK_SET);
38 |
39 | std::size_t nRead =
40 | std::fread(bytes.data(), sizeof(std::byte), bytes.size(), fh.get());
41 |
42 | if ((std::ferror(fh.get()) && !std::feof(fh.get())) ||
43 | nRead != bytes.size()) {
44 | return unexpected(std::system_error(
45 | std::make_error_code(std::errc::io_error), path.string()));
46 | }
47 |
48 | IRIS_LOG_LEAVE();
49 | return bytes;
50 | } // iris::io::ReadFile
51 |
--------------------------------------------------------------------------------
/iris/io/read_file.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_IO_READ_FILE_H_
2 | #define HEV_IRIS_IO_READ_FILE_H_
3 |
4 | #include "iris/types.h"
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | namespace iris::io {
11 |
12 | /*! \brief Blocking function to directly read a file.
13 | */
14 | expected, std::system_error>
15 | ReadFile(std::filesystem::path const& path) noexcept;
16 |
17 | } // namespace iris::io
18 |
19 | #endif // HEV_IRIS_IO_READ_FILE_H_
20 |
--------------------------------------------------------------------------------
/iris/io/shadertoy.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_IO_SHADERTOY_H_
2 | #define HEV_IRIS_IO_SHADERTOY_H_
3 |
4 | #include "iris/components/renderable.h"
5 | #include "iris/error.h"
6 | #include "iris/types.h"
7 | #include
8 | #include
9 |
10 | namespace iris::io {
11 |
12 | expected
13 | LoadShaderToy(std::string const& url);
14 |
15 | } // namespace iris::io
16 |
17 | #endif // HEV_IRIS_IO_SHADERTOY_H_
18 |
19 |
--------------------------------------------------------------------------------
/iris/iris-viewer.cc:
--------------------------------------------------------------------------------
1 | /*! \file
2 | * \brief main rendering application
3 | */
4 | #include "iris/config.h"
5 | #include "iris/io/gltf.h"
6 | #include "iris/renderer.h"
7 |
8 | #if PLATFORM_COMPILER_MSVC
9 | #include
10 | #pragma warning(push)
11 | #pragma warning(disable: ALL_CODE_ANALYSIS_WARNINGS)
12 | #pragma warning(disable: ALL_CPPCORECHECK_WARNINGS)
13 | #endif
14 |
15 | #include "absl/debugging/failure_signal_handler.h"
16 | #include "absl/debugging/symbolize.h"
17 | #include "absl/flags/parse.h"
18 | #include "fmt/format.h"
19 | #include "spdlog/logger.h"
20 | #include "spdlog/sinks/ansicolor_sink.h"
21 | #include "spdlog/sinks/basic_file_sink.h"
22 | #include "spdlog/sinks/stdout_color_sinks.h"
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 |
31 | #if PLATFORM_COMPILER_GCC
32 | #pragma GCC diagnostic ignored "-Wshadow"
33 | #endif
34 | #include "absl/flags/flag.h"
35 |
36 | ABSL_FLAG(std::string, shadertoy_url, "", "ShaderToy URL to load");
37 |
38 | #if PLATFORM_COMPILER_MSVC
39 | #pragma warning(pop)
40 | #endif
41 |
42 | #if PLATFORM_WINDOWS
43 | extern "C" {
44 | _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
45 | }
46 |
47 | #include
48 | #include
49 |
50 | int WINAPI WinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int) {
51 | // Oh my goodness
52 | char* cmdLine = ::GetCommandLineA();
53 | int argc = 1;
54 | char* argv[128]; // 128 command line argument max
55 | argv[0] = cmdLine;
56 |
57 | for (char* p = cmdLine; *p; ++p) {
58 | if (*p == ' ') {
59 | *p++ = '\0';
60 | if (*(p + 1)) argv[argc++] = p;
61 | }
62 | }
63 |
64 | #else
65 |
66 | int main(int argc, char** argv) {
67 |
68 | #endif
69 |
70 | absl::InitializeSymbolizer(argv[0]);
71 | absl::InstallFailureSignalHandler({});
72 |
73 | auto const positional = absl::ParseCommandLine(argc, argv);
74 | auto const shadertoy_url = absl::GetFlag(FLAGS_shadertoy_url);
75 |
76 | auto file_sink = std::make_shared(
77 | "iris-viewer.log", true);
78 | file_sink->set_level(spdlog::level::trace);
79 |
80 | auto console_sink = std::make_shared();
81 | console_sink->set_level(spdlog::level::trace);
82 |
83 | spdlog::logger logger("iris-viewer", {console_sink, file_sink});
84 | logger.set_level(spdlog::level::trace);
85 |
86 | logger.info("Logging initialized");
87 |
88 | if (auto result = iris::Renderer::Initialize(
89 | "iris-viewer",
90 | iris::Renderer::Options::kReportDebugMessages |
91 | iris::Renderer::Options::kEnableValidation,
92 | {console_sink, file_sink}, 0);
93 | !result) {
94 | logger.critical("cannot initialize renderer: {}", result.error().what());
95 | std::exit(EXIT_FAILURE);
96 | }
97 |
98 | logger.info("Renderer initialized. {} files specified on command line.",
99 | positional.size() - 1);
100 |
101 | for (size_t i = 1; i < positional.size(); ++i) {
102 | logger.info("Loading {}", positional[i]);
103 | if (auto result = iris::Renderer::LoadFile(positional[i]); !result) {
104 | logger.error("Error loading {}: {}", positional[i],
105 | result.error().what());
106 | }
107 | }
108 |
109 | if (!shadertoy_url.empty()) {
110 | iris::io::json node = {
111 | {"extras", {{"HEV", {{"shadertoy", {{"url", shadertoy_url}}}}}}}};
112 |
113 | iris::io::json scene = {{"nodes", {0}}};
114 |
115 | iris::io::json gltf = {{"asset", {{"version", "2.0"}}},
116 | {"scene", 0},
117 | {"scenes", {scene}},
118 | {"nodes", {node}}};
119 |
120 | auto result = iris::io::LoadGLTF(gltf)();
121 | if (result.code()) {
122 | logger.error("Error loading {}: {}", shadertoy_url,
123 | result.what());
124 | }
125 | }
126 |
127 | while (iris::Renderer::IsRunning()) {
128 | iris::Renderer::BeginFrame();
129 |
130 | iris::Renderer::EndFrame();
131 | }
132 |
133 | logger.info("exiting");
134 | }
135 |
--------------------------------------------------------------------------------
/iris/logging.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_LOGGING_H_
2 | #define HEV_IRIS_LOGGING_H_
3 |
4 | #include "iris/config.h"
5 |
6 | #if PLATFORM_COMPILER_MSVC
7 | #include
8 | #pragma warning(push)
9 | #pragma warning(disable: ALL_CODE_ANALYSIS_WARNINGS)
10 | #pragma warning(disable: ALL_CPPCORECHECK_WARNINGS)
11 | #endif
12 |
13 | #include "spdlog/spdlog.h"
14 |
15 | #if PLATFORM_COMPILER_MSVC
16 | #pragma warning(pop)
17 | #endif
18 |
19 | namespace iris {
20 |
21 | inline static spdlog::logger* GetLogger() noexcept {
22 | static std::shared_ptr sLogger = spdlog::get("iris");
23 | return sLogger.get();
24 | }
25 |
26 | } // namespace iris
27 |
28 | #if PLATFORM_COMPILER_GCC
29 | #pragma GCC diagnostic pop
30 | #endif
31 |
32 | #define IRIS_LOG_CRITICAL(fmt, ...) \
33 | ::iris::GetLogger()->critical(fmt " ({}:{})", ##__VA_ARGS__, __FILE__, \
34 | __LINE__)
35 |
36 | #define IRIS_LOG_ERROR(fmt, ...) \
37 | ::iris::GetLogger()->error(fmt " ({}:{})", ##__VA_ARGS__, __FILE__, __LINE__)
38 |
39 | #define IRIS_LOG_WARN(fmt, ...) \
40 | ::iris::GetLogger()->warn(fmt " ({}:{})", ##__VA_ARGS__, __FILE__, __LINE__)
41 |
42 | #define IRIS_LOG_INFO(fmt, ...) \
43 | ::iris::GetLogger()->info(fmt " ({}:{})", ##__VA_ARGS__, __FILE__, __LINE__)
44 |
45 | #define IRIS_LOG_DEBUG(fmt, ...) \
46 | ::iris::GetLogger()->debug(fmt " ({}:{})", ##__VA_ARGS__, __FILE__, __LINE__)
47 |
48 | #define IRIS_LOG_TRACE(fmt, ...) \
49 | ::iris::GetLogger()->trace(fmt " ({}:{})", ##__VA_ARGS__, __FILE__, __LINE__)
50 |
51 | //! \brief Logs entry into a function.
52 | #define IRIS_LOG_ENTER() \
53 | do { \
54 | ::iris::GetLogger()->trace("ENTER: {} ({}:{})", __func__, __FILE__, \
55 | __LINE__); \
56 | ::iris::GetLogger()->flush(); \
57 | } while (false)
58 |
59 | //! \brief Logs leave from a function.
60 | #define IRIS_LOG_LEAVE() \
61 | do { \
62 | ::iris::GetLogger()->trace("LEAVE: {} ({}:{})", __func__, __FILE__, \
63 | __LINE__); \
64 | ::iris::GetLogger()->flush(); \
65 | } while (false)
66 |
67 | #endif // HEV_IRIS_LOGGING_H_
68 |
69 |
--------------------------------------------------------------------------------
/iris/pipeline.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_PIPELINE_H_
2 | #define HEV_IRIS_PIPELINE_H_
3 |
4 | #include "iris/config.h"
5 |
6 | #include "iris/shader.h"
7 | #include "iris/types.h"
8 | #include "iris/vulkan.h"
9 |
10 | #if PLATFORM_COMPILER_MSVC
11 | #include
12 | #pragma warning(push)
13 | #pragma warning(disable: ALL_CODE_ANALYSIS_WARNINGS)
14 | #pragma warning(disable: ALL_CPPCORECHECK_WARNINGS)
15 | #endif
16 |
17 | #include "gsl/gsl"
18 | #include
19 |
20 | #if PLATFORM_COMPILER_MSVC
21 | #pragma warning(pop)
22 | #endif
23 |
24 | namespace iris {
25 |
26 | struct Pipeline {
27 | VkPipelineLayout layout{VK_NULL_HANDLE};
28 | VkPipeline pipeline{VK_NULL_HANDLE};
29 |
30 | explicit operator bool() const noexcept {
31 | return layout != VK_NULL_HANDLE && pipeline != VK_NULL_HANDLE;
32 | }
33 | }; // struct Pipeline
34 |
35 | expected CreateRasterizationPipeline(
36 | gsl::span shaders,
37 | gsl::span
38 | vertexInputBindingDescriptions,
39 | gsl::span
40 | vertexInputAttributeDescriptions,
41 | VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateCI,
42 | VkPipelineViewportStateCreateInfo viewportStateCI,
43 | VkPipelineRasterizationStateCreateInfo rasterizationStateCI,
44 | VkPipelineMultisampleStateCreateInfo multisampleStateCI,
45 | VkPipelineDepthStencilStateCreateInfo depthStencilStateCI,
46 | gsl::span
47 | colorBlendAttachmentStates,
48 | gsl::span dynamicStates,
49 | std::uint32_t renderPassSubpass,
50 | gsl::span descriptorSetLayouts) noexcept;
51 |
52 | expected CreateRayTracingPipeline(
53 | gsl::span shaders, gsl::span groups,
54 | gsl::span descriptorSetLayouts,
55 | std::uint32_t maxRecursionDepth) noexcept;
56 |
57 | void DestroyPipeline(Pipeline pipeline) noexcept;
58 |
59 | } // namespace iris
60 |
61 | #endif // HEV_IRIS_PIPELINE_H_
62 |
63 |
--------------------------------------------------------------------------------
/iris/protos.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_PROTOS_H_
2 | #define HEV_IRIS_PROTOS_H_
3 |
4 | #include "iris/config.h"
5 |
6 | #if PLATFORM_COMPILER_MSVC
7 | #include
8 |
9 | #pragma warning(push)
10 | #pragma warning(disable : 4100)
11 | #pragma warning(disable: ALL_CODE_ANALYSIS_WARNINGS)
12 | #pragma warning(disable: ALL_CPPCORECHECK_WARNINGS)
13 |
14 | #elif PLATFORM_COMPILER_GCC
15 |
16 | #pragma GCC diagnostic push
17 | #pragma GCC diagnostic ignored "-Wshadow"
18 | #pragma GCC diagnostic ignored "-Wunused-parameter"
19 |
20 | #endif
21 |
22 | #include "iris/protos/control.pb.h"
23 | #include "iris/protos/displays.pb.h"
24 | #include "iris/protos/examine.pb.h"
25 | #include "iris/protos/nav.pb.h"
26 | #include "iris/protos/window.pb.h"
27 |
28 | #if PLATFORM_COMPILER_MSVC
29 | #pragma warning(pop)
30 | #elif PLATFORM_COMPILER_GCC
31 | #pragma GCC diagnostic pop
32 | #endif
33 |
34 | #endif // HEV_IRIS_PROTOS_H_
35 |
36 |
--------------------------------------------------------------------------------
/iris/protos/color.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package iris.Control;
3 |
4 | message Color {
5 | float r = 1;
6 | float g = 2;
7 | float b = 3;
8 | float a = 4;
9 | }
10 |
--------------------------------------------------------------------------------
/iris/protos/control.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package iris.Control;
3 |
4 | import "displays.proto";
5 | import "examine.proto";
6 | import "nav.proto";
7 | import "window.proto";
8 |
9 | message Control {
10 | oneof type {
11 | Displays displays = 2;
12 | Examine examine = 3;
13 | Window window = 4;
14 | Nav nav = 5;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/iris/protos/displays.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package iris.Control;
3 |
4 | import "window.proto";
5 |
6 | message Displays {
7 | repeated Window windows = 1;
8 | }
9 |
--------------------------------------------------------------------------------
/iris/protos/examine.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package iris.Control;
3 |
4 | message Examine {
5 | string node = 1;
6 | }
7 |
--------------------------------------------------------------------------------
/iris/protos/nav.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package iris.Control;
3 |
4 | message Nav {
5 | message Position {
6 | float x = 1;
7 | float y = 2;
8 | float z = 3;
9 | };
10 |
11 | message Orientation {
12 | float head = 1;
13 | float pitch = 2;
14 | float roll = 3;
15 | };
16 |
17 | message Attitude {
18 | float w = 1;
19 | float x = 2;
20 | float y = 3;
21 | float z = 4;
22 | };
23 |
24 | message Matrix {
25 | float a00 = 1;
26 | float a01 = 2;
27 | float a02 = 3;
28 | float a03 = 4;
29 | float a10 = 5;
30 | float a11 = 6;
31 | float a12 = 7;
32 | float a13 = 8;
33 | float a20 = 9;
34 | float a21 = 10;
35 | float a22 = 11;
36 | float a23 = 12;
37 | float a30 = 13;
38 | float a31 = 14;
39 | float a32 = 15;
40 | float a33 = 16;
41 | };
42 |
43 | oneof nav {
44 | Position position = 1;
45 | Orientation orientation = 2;
46 | Attitude attitude = 3;
47 | float scale = 4;
48 | Matrix matrix = 5;
49 | float response = 6;
50 | bool reset = 7;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/iris/protos/window.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package iris.Control;
3 |
4 | import "color.proto";
5 |
6 | message Window {
7 | string name = 1;
8 | bool is_stereo = 2;
9 | uint32 x = 3;
10 | uint32 y = 4;
11 | uint32 width = 5;
12 | uint32 height = 6;
13 | uint32 display = 7;
14 | bool show_system_decoration = 10;
15 | Color background_color = 11;
16 | bool show_ui = 12;
17 | }
18 |
--------------------------------------------------------------------------------
/iris/renderer_private.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_RENDERER_UTIL_H_
2 | #define HEV_IRIS_RENDERER_UTIL_H_
3 |
4 | #include "iris/config.h"
5 |
6 | #include "iris/vulkan.h"
7 |
8 | #if PLATFORM_COMPILER_MSVC
9 | #include
10 | #pragma warning(push)
11 | #pragma warning(disable: ALL_CODE_ANALYSIS_WARNINGS)
12 | #pragma warning(disable: ALL_CPPCORECHECK_WARNINGS)
13 | #endif
14 |
15 | #include "absl/container/inlined_vector.h"
16 | #include "glm/mat3x3.hpp"
17 | #include "glm/mat4x4.hpp"
18 | #include "glm/vec3.hpp"
19 | #include "glm/vec4.hpp"
20 | #include
21 |
22 | #if PLATFORM_COMPILER_MSVC
23 | #pragma warning(pop)
24 | #endif
25 |
26 | namespace iris::Renderer {
27 |
28 | extern VkInstance sInstance;
29 | extern VkDebugUtilsMessengerEXT sDebugUtilsMessenger;
30 | extern VkPhysicalDevice sPhysicalDevice;
31 | extern VkDevice sDevice;
32 | extern VmaAllocator sAllocator;
33 | extern VkRenderPass sRenderPass;
34 |
35 | inline constexpr VkSurfaceFormatKHR const sSurfaceColorFormat{
36 | VK_FORMAT_B8G8R8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR};
37 | inline constexpr VkFormat const sSurfaceDepthStencilFormat{
38 | VK_FORMAT_D32_SFLOAT};
39 | inline constexpr VkSampleCountFlagBits const sSurfaceSampleCount{
40 | VK_SAMPLE_COUNT_4_BIT};
41 | inline constexpr VkPresentModeKHR const sSurfacePresentMode{
42 | VK_PRESENT_MODE_FIFO_KHR};
43 |
44 | extern VkDescriptorPool sDescriptorPool;
45 | extern VkDescriptorSetLayout sGlobalDescriptorSetLayout;
46 |
47 | inline constexpr std::uint32_t const sCommandQueueGraphics{0};
48 |
49 | inline constexpr std::uint32_t const sNumRenderPassAttachments{4};
50 | inline constexpr std::uint32_t const sColorTargetAttachmentIndex{0};
51 | inline constexpr std::uint32_t const sColorResolveAttachmentIndex{1};
52 | inline constexpr std::uint32_t const sDepthStencilTargetAttachmentIndex{2};
53 | inline constexpr std::uint32_t const sDepthStencilResolveAttachmentIndex{3};
54 |
55 | template
56 | void NameObject(VkObjectType objectType [[maybe_unused]],
57 | T objectHandle [[maybe_unused]],
58 | gsl::czstring<> objectName [[maybe_unused]]) noexcept {
59 | Expects(sDevice != VK_NULL_HANDLE);
60 | #if 0 // this doesn't work outside the debugger?
61 | VkDebugUtilsObjectNameInfoEXT objectNameInfo = {
62 | VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, nullptr, objectType,
63 | reinterpret_cast(objectHandle), objectName};
64 | vkSetDebugUtilsObjectNameEXT(sDevice, &objectNameInfo);
65 | #endif
66 | } // NameObject
67 |
68 | struct PushConstants {
69 | glm::vec4 iMouse;
70 | float iTime;
71 | float iTimeDelta;
72 | float iFrameRate;
73 | float iFrame;
74 | glm::vec3 iResolution;
75 | bool bDebugNormals;
76 | glm::vec4 EyePosition;
77 | glm::mat4 ModelMatrix;
78 | glm::mat4 ModelViewMatrix;
79 | glm::mat3 NormalMatrix;
80 | }; // struct PushConstants
81 |
82 | struct MatricesBuffer {
83 | glm::mat4 ViewMatrix;
84 | glm::mat4 ViewMatrixInverse;
85 | glm::mat4 ProjectionMatrix;
86 | glm::mat4 ProjectionMatrixInverse;
87 | }; // struct MatricesBuffer
88 |
89 | #define MAX_LIGHTS 100
90 |
91 | struct Light {
92 | glm::vec4 direction;
93 | glm::vec4 color;
94 | }; // struct Light
95 |
96 | struct LightsBuffer {
97 | Light Lights[MAX_LIGHTS];
98 | int NumLights;
99 | }; // struct LightsBuffer
100 |
101 | } // namespace iris::Renderer
102 |
103 | #endif // HEV_IRIS_RENDERER_UTIL_H_
104 |
--------------------------------------------------------------------------------
/iris/safe_numeric.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_SAFE_NUMERIC_H_
2 | #define HEV_IRIS_SAFE_NUMERIC_H_
3 | /*!
4 | \file
5 | \brief \ref iris::SafeNumeric definition.
6 | */
7 |
8 | #include
9 |
10 | namespace iris {
11 |
12 | /*!
13 | \brief SafeNumeric is a type-safe numeric class. Its purpose is to mimic
14 | built-in numeric type operations while ensuring different SafeNumeric types
15 | aren't mixed.
16 | */
17 | template
18 | class SafeNumeric {
19 | public:
20 | using type = T;
21 |
22 | constexpr SafeNumeric() noexcept = default;
23 | constexpr explicit SafeNumeric(T value) noexcept
24 | : value_(std::move(value)) {}
25 |
26 | constexpr explicit operator T() const noexcept { return value_; }
27 |
28 | constexpr T& get() noexcept { return value_; }
29 | constexpr T const& get() const noexcept { return value_; }
30 |
31 | private:
32 | T value_{};
33 | }; // class SafeNumeric
34 |
35 | template
36 | constexpr SafeNumeric operator+(SafeNumeric const& a,
37 | SafeNumeric const& b) noexcept {
38 | return SafeNumeric(T(a) + T(b));
39 | }
40 |
41 | template
42 | constexpr SafeNumeric operator-(SafeNumeric const& a,
43 | SafeNumeric const& b) noexcept {
44 | return SafeNumeric(T(a) - T(b));
45 | }
46 |
47 | template
48 | constexpr SafeNumeric operator*(SafeNumeric const& a,
49 | SafeNumeric const& b) noexcept {
50 | return SafeNumeric(T(a) * T(b));
51 | }
52 |
53 | template
54 | constexpr SafeNumeric operator/(SafeNumeric const& a,
55 | SafeNumeric const& b) noexcept {
56 | return SafeNumeric(T(a) / T(b));
57 | }
58 |
59 | template
60 | constexpr SafeNumeric&
61 | operator+=(SafeNumeric& a, SafeNumeric const& b) noexcept {
62 | a = a + b;
63 | return a;
64 | }
65 |
66 | template
67 | constexpr SafeNumeric&
68 | operator-=(SafeNumeric& a, SafeNumeric const& b) noexcept {
69 | a = a - b;
70 | return a;
71 | }
72 |
73 | template
74 | constexpr SafeNumeric&
75 | operator*=(SafeNumeric& a, SafeNumeric const& b) noexcept {
76 | a = a * b;
77 | return a;
78 | }
79 |
80 | template
81 | constexpr SafeNumeric&
82 | operator/=(SafeNumeric& a, SafeNumeric const& b) noexcept {
83 | a = a / b;
84 | return a;
85 | }
86 |
87 | template
88 | SafeNumeric& operator++(SafeNumeric& a) noexcept {
89 | a.get()++;
90 | return a;
91 | }
92 |
93 | template
94 | SafeNumeric& operator--(SafeNumeric& a) noexcept {
95 | a.get()--;
96 | return a;
97 | }
98 |
99 | template
100 | SafeNumeric operator++(SafeNumeric& a, int) noexcept {
101 | auto tmp(a);
102 | ++a;
103 | return tmp;
104 | }
105 |
106 | template
107 | SafeNumeric operator--(SafeNumeric& a, int) noexcept {
108 | auto tmp(a);
109 | --a;
110 | return tmp;
111 | }
112 |
113 | template
114 | bool operator==(SafeNumeric const& a,
115 | SafeNumeric const& b) noexcept {
116 | return a.get() == b.get();
117 | }
118 |
119 | template
120 | bool operator!=(SafeNumeric const& a,
121 | SafeNumeric const& b) noexcept {
122 | return a.get() != b.get();
123 | }
124 |
125 | template
126 | bool operator<(SafeNumeric const& a,
127 | SafeNumeric const& b) noexcept {
128 | return a.get() < b.get();
129 | }
130 |
131 | template
132 | bool operator<=(SafeNumeric const& a,
133 | SafeNumeric const& b) noexcept {
134 | return a.get() <= b.get();
135 | }
136 |
137 | template
138 | bool operator>(SafeNumeric const& a,
139 | SafeNumeric const& b) noexcept {
140 | return a.get() > b.get();
141 | }
142 |
143 | template
144 | bool operator>=(SafeNumeric const& a,
145 | SafeNumeric const& b) noexcept {
146 | return a.get() >= b.get();
147 | }
148 |
149 | } // namespace iris
150 |
151 | #endif // HEV_IRIS_SAFE_NUMERIC_H_
152 |
--------------------------------------------------------------------------------
/iris/shader.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_SHADER_H_
2 | #define HEV_IRIS_SHADER_H_
3 |
4 | #include "iris/config.h"
5 |
6 | #include "iris/types.h"
7 | #include "iris/vulkan.h"
8 |
9 | #if PLATFORM_COMPILER_MSVC
10 | #include
11 | #pragma warning(push)
12 | #pragma warning(disable : ALL_CODE_ANALYSIS_WARNINGS)
13 | #pragma warning(disable : ALL_CPPCORECHECK_WARNINGS)
14 | #endif
15 |
16 | #include
17 | #include
18 |
19 | #if PLATFORM_COMPILER_MSVC
20 | #pragma warning(pop)
21 | #endif
22 |
23 | namespace iris {
24 |
25 | struct Shader {
26 | VkShaderModule module{VK_NULL_HANDLE};
27 | VkShaderStageFlagBits stage{VK_SHADER_STAGE_ALL};
28 |
29 | explicit operator bool() const noexcept { return module != VK_NULL_HANDLE; }
30 | }; // struct Shader
31 |
32 | struct ShaderGroup {
33 | VkRayTracingShaderGroupTypeNV type;
34 | std::uint32_t generalShaderIndex{VK_SHADER_UNUSED_NV};
35 | std::uint32_t closestHitShaderIndex{VK_SHADER_UNUSED_NV};
36 | std::uint32_t anyHitShaderIndex{VK_SHADER_UNUSED_NV};
37 | std::uint32_t intersectionShaderIndex{VK_SHADER_UNUSED_NV};
38 |
39 | static ShaderGroup General(std::uint32_t index) {
40 | return {VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_NV, index};
41 | }
42 |
43 | static ShaderGroup
44 | ProceduralHit(std::uint32_t intersectionIndex, std::uint32_t closestHitIndex,
45 | std::uint32_t anyHitIndex = VK_SHADER_UNUSED_NV) {
46 | return {VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_NV,
47 | closestHitIndex, anyHitIndex, intersectionIndex};
48 | }
49 |
50 | private:
51 | ShaderGroup(VkRayTracingShaderGroupTypeNV t, std::uint32_t g)
52 | : type(t)
53 | , generalShaderIndex(g) {}
54 |
55 | ShaderGroup(VkRayTracingShaderGroupTypeNV t, std::uint32_t c, std::uint32_t a,
56 | std::uint32_t i) noexcept
57 | : type(t)
58 | , closestHitShaderIndex(c)
59 | , anyHitShaderIndex(a)
60 | , intersectionShaderIndex(i) {}
61 | }; // struct ShaderGroup
62 |
63 | [[nodiscard]] expected
64 | CompileShaderFromSource(std::string_view source, VkShaderStageFlagBits stage,
65 | gsl::span macroDefinitions = {}) noexcept;
66 |
67 | [[nodiscard]] expected
68 | LoadShaderFromFile(std::filesystem::path const& path,
69 | VkShaderStageFlagBits stage,
70 | gsl::span macroDefinitions = {}) noexcept;
71 |
72 | } // namespace iris
73 |
74 | #endif // HEV_IRIS_SHADER_H_
75 |
--------------------------------------------------------------------------------
/iris/string_util.cc:
--------------------------------------------------------------------------------
1 | #include "string_util.h"
2 | #include "config.h"
3 |
4 | #include "gsl/gsl"
5 |
6 | #include
7 | #include
8 |
9 | #if PLATFORM_WINDOWS
10 |
11 | #include
12 |
13 | std::wstring iris::string_to_wstring(std::string const& str) {
14 | if (str.empty()) return {};
15 |
16 | int const size = ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, NULL, 0);
17 | if (size == 0) return {};
18 |
19 | std::vector bytes(size);
20 | int const count =
21 | ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, bytes.data(),
22 | gsl::narrow_cast(bytes.size()));
23 | if (count == 0) throw std::runtime_error("string_to_wstring");
24 |
25 | return bytes.data();
26 | } // string_to_wstring
27 |
28 | std::string iris::wstring_to_string(std::wstring const& wstr) {
29 | if (wstr.empty()) return {};
30 |
31 | int const size =
32 | ::WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), -1, NULL, 0, NULL, NULL);
33 | if (size == 0) return {};
34 |
35 | std::vector bytes(size);
36 | int const count =
37 | ::WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), -1, bytes.data(),
38 | gsl::narrow_cast(bytes.size()), NULL, NULL);
39 | if (count == 0) throw std::runtime_error("wstring_to_string");
40 |
41 | return bytes.data();
42 | } // wstring_to_string
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/iris/string_util.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_STRING_UTIL_H_
2 | #define HEV_IRIS_STRING_UTIL_H_
3 |
4 | #include
5 |
6 | namespace iris {
7 |
8 | std::wstring string_to_wstring(std::string const& str);
9 | std::string wstring_to_string(std::wstring const& wstr);
10 |
11 | } // namespace iris
12 |
13 | #endif // HEV_IRIS_STRING_UTIL_H_
14 |
--------------------------------------------------------------------------------
/iris/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | foreach(flag_var
2 | CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
3 | CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
4 | if(${flag_var} MATCHES "/MD")
5 | string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
6 | endif(${flag_var} MATCHES "/MD")
7 | endforeach(flag_var)
8 |
9 | add_executable(safe_numeric safe_numeric.cc)
10 | target_link_libraries(safe_numeric PRIVATE iris gtest_main)
11 | add_test(NAME safe_numeric COMMAND safe_numeric)
12 |
--------------------------------------------------------------------------------
/iris/test/safe_numeric.cc:
--------------------------------------------------------------------------------
1 | #include "iris/safe_numeric.h"
2 | #include "gtest/gtest.h"
3 |
4 | using SafeFloat = iris::SafeNumeric;
5 | using SafeInt = iris::SafeNumeric;
6 |
7 | TEST(SafeNumeric, add) {
8 | SafeFloat a(1.f), b(2.f);
9 | auto const c = a + b;
10 | EXPECT_FLOAT_EQ(float(c), 3.f);
11 | }
12 |
13 | TEST(SafeNumeric, sub) {
14 | SafeFloat a(1.f), b(2.f);
15 | auto const c = b - a;
16 | EXPECT_FLOAT_EQ(float(c), 1.f);
17 | }
18 |
19 | TEST(SafeNumeric, mul) {
20 | SafeFloat a(1.f), b(2.f);
21 | auto const c = a * b;
22 | EXPECT_FLOAT_EQ(float(c), 2.f);
23 | }
24 |
25 | TEST(SafeNumeric, div) {
26 | SafeFloat a(1.f), b(2.f);
27 | auto const c = a / b;
28 | EXPECT_FLOAT_EQ(float(c), .5f);
29 | }
30 |
31 | TEST(SafeNumeric, add_assign) {
32 | SafeFloat a(1.f), b(2.f);
33 | a += b;
34 | EXPECT_FLOAT_EQ(float(a), 3.f);
35 | }
36 |
37 | TEST(SafeNumeric, sub_assign) {
38 | SafeFloat a(1.f), b(2.f);
39 | b -= a;
40 | EXPECT_FLOAT_EQ(float(a), 1.f);
41 | }
42 |
43 | TEST(SafeNumeric, mul_assign) {
44 | SafeFloat a(1.f), b(2.f);
45 | a *= b;
46 | EXPECT_FLOAT_EQ(float(a), 2.f);
47 | }
48 |
49 | TEST(SafeNumeric, div_assign) {
50 | SafeFloat a(1.f), b(2.f);
51 | a /= b;
52 | EXPECT_FLOAT_EQ(float(a), .5f);
53 | }
54 |
55 | TEST(SafeNumeric, pre_inc) {
56 | SafeInt a(1);
57 | ++a;
58 | EXPECT_EQ(int(a), 2);
59 | }
60 |
61 | TEST(SafeNumeric, pre_dec) {
62 | SafeInt a(1);
63 | --a;
64 | EXPECT_EQ(int(a), 0);
65 | }
66 |
67 | TEST(SafeNumeric, post_inc) {
68 | SafeInt a(1);
69 | auto b = a++;
70 | EXPECT_EQ(int(a), 2);
71 | EXPECT_EQ(int(b), 1);
72 | }
73 |
74 | TEST(SafeNumeric, post_dec) {
75 | SafeInt a(1);
76 | auto b = a--;
77 | EXPECT_EQ(int(a), 0);
78 | EXPECT_EQ(int(b), 1);
79 | }
80 |
81 | TEST(SafeNumeric, comparisons) {
82 | SafeInt a(1), b(2), c(1);
83 |
84 | EXPECT_TRUE(a == c);
85 | EXPECT_FALSE(a != c);
86 | EXPECT_TRUE(a < b);
87 | EXPECT_FALSE(a < c);
88 | EXPECT_TRUE(a <= b);
89 | EXPECT_TRUE(a <= c);
90 |
91 | EXPECT_FALSE(a == b);
92 |
93 | EXPECT_FALSE(b == c);
94 | EXPECT_TRUE(b != c);
95 | EXPECT_TRUE(b > c);
96 | EXPECT_TRUE(b >= c);
97 | }
98 |
99 |
--------------------------------------------------------------------------------
/iris/trackball.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_TRACKBALL_H_
2 | #define HEV_IRIS_TRACKBALL_H_
3 |
4 | #include "glm/gtc/quaternion.hpp"
5 | #include "glm/mat4x4.hpp"
6 | #include "glm/gtx/norm.hpp"
7 | #include "glm/vec2.hpp"
8 | #include "glm/vec3.hpp"
9 | #include "imgui.h"
10 | #include "iris/renderer.h"
11 | #include "iris/types.h"
12 | #include "wsi/input.h"
13 |
14 | namespace iris {
15 |
16 | class Trackball {
17 | public:
18 | // These values are tuned to match the old HEV response
19 | static constexpr float const kSpeed = .5f; // ether units / s
20 | static constexpr float const kTwist = 45.f; // degrees / s
21 |
22 | void Update(ImGuiIO const& io) noexcept;
23 |
24 | private:
25 | EulerAngles attitude_{};
26 | glm::vec3 position_{0.f, 0.f, 0.f};
27 | glm::vec2 prevMouse_;
28 | }; // class Trackball
29 |
30 | inline void Trackball::Update(ImGuiIO const& io) noexcept {
31 | glm::vec2 const currMouse = static_cast(ImGui::GetMousePos()) /
32 | static_cast(io.DisplaySize);
33 |
34 | if (!io.WantCaptureMouse) {
35 | glm::vec2 const deltaMouse = currMouse - prevMouse_;
36 |
37 | // If movement is too fast, assume we missed some events or screen changed.
38 | if (glm::length2(deltaMouse) > .25) {
39 | prevMouse_ = currMouse;
40 | return;
41 | }
42 |
43 | if (ImGui::IsMouseClicked(wsi::Buttons::kButtonLeft) ||
44 | ImGui::IsMouseClicked(wsi::Buttons::kButtonMiddle) ||
45 | ImGui::IsMouseClicked(wsi::Buttons::kButtonRight)) {
46 | position_ = {0.f, 0.f, 0.f};
47 | attitude_ = {};
48 | return;
49 | } else if (ImGui::IsMouseReleased(wsi::Buttons::kButtonLeft) ||
50 | ImGui::IsMouseReleased(wsi::Buttons::kButtonMiddle) ||
51 | ImGui::IsMouseReleased(wsi::Buttons::kButtonRight)) {
52 | // If movement is extremely slow when button released, stop all motion.
53 | if (glm::length2(deltaMouse) < .00001f) {
54 | position_ = {0.f, 0.f, 0.f};
55 | attitude_ = {};
56 | }
57 | return;
58 | }
59 |
60 | // Use a lambda here since rotateHeadingPitch is called twice down below.
61 | auto rotateHeadingPitch = [&]() {
62 | float const dh = ImGui::IsKeyDown(wsi::Keys::kX)
63 | ? 0.f
64 | : deltaMouse.x * kTwist / io.DeltaTime;
65 | float const dp = ImGui::IsKeyDown(wsi::Keys::kZ)
66 | ? 0.f
67 | : deltaMouse.y * kTwist / io.DeltaTime;
68 | attitude_.heading = EulerAngles::Heading(glm::radians(dh));
69 | attitude_.pitch = EulerAngles::Pitch(glm::radians(dp));
70 | }; // rotateHeadingPitch
71 |
72 | if (ImGui::IsMouseDragging(wsi::Buttons::kButtonLeft)) {
73 | if (ImGui::IsKeyDown(wsi::Keys::kLeftControl)) {
74 | rotateHeadingPitch();
75 | } else {
76 | float const dx = ImGui::IsKeyDown(wsi::Keys::kZ)
77 | ? 0.f
78 | : deltaMouse.x * kSpeed / io.DeltaTime;
79 | float const dz = ImGui::IsKeyDown(wsi::Keys::kX)
80 | ? 0.f
81 | : -deltaMouse.y * kSpeed / io.DeltaTime;
82 | position_ = glm::vec3(dx, 0.f, dz);
83 | }
84 | } else if (ImGui::IsMouseDragging(wsi::Buttons::kButtonMiddle)) {
85 | rotateHeadingPitch();
86 | } else if (ImGui::IsMouseDragging(wsi::Buttons::kButtonRight)) {
87 | if (ImGui::IsKeyDown(wsi::Keys::kLeftControl)) {
88 | glm::vec2 const p0 = glm::normalize(prevMouse_);
89 | glm::vec2 const p1 = glm::normalize(currMouse);
90 | float const p0t = std::atan2(p0.y, p0.x);
91 | float const p1t = std::atan2(p1.y, p1.x);
92 | float const dr = -(p1t - p0t) * kTwist / io.DeltaTime;
93 | attitude_.roll = EulerAngles::Roll(glm::radians(dr));
94 | } else {
95 | float const dy = -deltaMouse.y * kSpeed / io.DeltaTime;
96 | position_ = glm::vec3(0.f, dy, 0.f);
97 | }
98 | }
99 |
100 | if (io.MouseWheel > 0) {
101 | Renderer::Nav::Rescale(Renderer::Nav::Scale() / 1.05f);
102 | } else if (io.MouseWheel < 0) {
103 | Renderer::Nav::Rescale(Renderer::Nav::Scale() * 1.05f);
104 | }
105 | }
106 |
107 | glm::vec3 const m(position_ * io.DeltaTime * Renderer::Nav::Response());
108 | if (m != glm::vec3(0.f, 0.f, 0.f)) Renderer::Nav::Move(m);
109 |
110 | glm::quat const o(attitude_ * io.DeltaTime * Renderer::Nav::Response());
111 | if (glm::angle(o) != 0.0f) Renderer::Nav::Rotate(o);
112 |
113 | prevMouse_ = currMouse;
114 | } // Trackball::Update
115 |
116 | } // namespace iris
117 |
118 | #endif // HEV_IRIS_TRACKBALL_H_
119 |
--------------------------------------------------------------------------------
/iris/ui_util.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_UI_UTIL_H_
2 | #define HEV_IRIS_UI_UTIL_H_
3 |
4 | #include "config.h"
5 |
6 | #include "glm/glm.hpp"
7 | #include "glm/gtc/quaternion.hpp"
8 | #include "imgui.h"
9 |
10 | namespace iris {
11 |
12 | template
13 | void Text(int width, char const* name, char const* fmt,
14 | glm::vec const& vec) {
15 | for (int i = 0; i < N; ++i) {
16 | ImGui::Text(fmt, vec[i]);
17 | ImGui::NextColumn();
18 | }
19 | for (int i = N; i < width - 1; ++i) {
20 | ImGui::Text(" ");
21 | ImGui::NextColumn();
22 | }
23 | ImGui::Text(name);
24 | } // Text
25 |
26 | template
27 | void Text(int width, char const* name, char const* fmt,
28 | glm::qua const& qua) {
29 | ImGui::Text(fmt, qua.w);
30 | ImGui::NextColumn();
31 | ImGui::Text(fmt, qua.x);
32 | ImGui::NextColumn();
33 | ImGui::Text(fmt, qua.y);
34 | ImGui::NextColumn();
35 | ImGui::Text(fmt, qua.z);
36 | ImGui::NextColumn();
37 | for (int i = 4; i < width - 1; ++i) {
38 | ImGui::Text(" ");
39 | ImGui::NextColumn();
40 | }
41 | ImGui::Text(name);
42 | } // Text
43 |
44 | template
45 | void Text(int width, char const* name, char const* fmt,
46 | glm::mat const& mat) {
47 | for (int i = 0; i < R; ++i) {
48 | for (int j = 0; j < C; ++j) {
49 | ImGui::Text(fmt, mat[j][i]);
50 | ImGui::NextColumn();
51 | }
52 | for (int k = 4; k < width - 1; ++k) {
53 | ImGui::Text(" ");
54 | ImGui::NextColumn();
55 | }
56 | if (i == 0) {
57 | ImGui::Text(name);
58 | ImGui::NextColumn();
59 | } else {
60 | ImGui::Text(" ");
61 | ImGui::NextColumn();
62 | }
63 | }
64 | } // Text
65 |
66 | } // namespace iris
67 |
68 | #endif // HEV_IRIS_UI_UTIL_H_
--------------------------------------------------------------------------------
/iris/wsi/input.h:
--------------------------------------------------------------------------------
1 | #ifndef HEV_IRIS_WSI_INPUT_H_
2 | #define HEV_IRIS_WSI_INPUT_H_
3 | /*!
4 | \file
5 | \brief \ref iris::wsi user-input definitions.
6 | */
7 |
8 | #include
9 |
10 | namespace iris::wsi {
11 |
12 | /*!
13 | \brief Keyboard keys.
14 | */
15 | enum Keys {
16 | kUnknown = 0,
17 |
18 | kSpace = 32,
19 | kApostrophe = 39,
20 | kComma = 44,
21 | kMinus = 45,
22 | kPeriod = 46,
23 | kSlash = 47,
24 | k0 = 48,
25 | k1 = 49,
26 | k2 = 50,
27 | k3 = 51,
28 | k4 = 52,
29 | k5 = 53,
30 | k6 = 54,
31 | k7 = 55,
32 | k8 = 56,
33 | k9 = 57,
34 | kSemicolon = 59,
35 | kEqual = 61,
36 | kA = 65,
37 | kB = 66,
38 | kC = 67,
39 | kD = 68,
40 | kE = 69,
41 | kF = 70,
42 | kG = 71,
43 | kH = 72,
44 | kI = 73,
45 | kJ = 74,
46 | kK = 75,
47 | kL = 76,
48 | kM = 77,
49 | kN = 78,
50 | kO = 79,
51 | kP = 80,
52 | kQ = 81,
53 | kR = 82,
54 | kS = 83,
55 | kT = 84,
56 | kU = 85,
57 | kV = 86,
58 | kW = 87,
59 | kX = 88,
60 | kY = 89,
61 | kZ = 90,
62 | kLeftBracket = 91,
63 | kBackslash = 92,
64 | kRightBracket = 93,
65 | kGraveAccent = 96,
66 |
67 | kEscape = 156,
68 | kEnter = 157,
69 | kTab = 158,
70 | kBackspace = 159,
71 | kInsert = 160,
72 | kDelete = 161,
73 | kRight = 162,
74 | kLeft = 163,
75 | kDown = 164,
76 | kUp = 165,
77 | kPageUp = 166,
78 | kPageDown = 167,
79 | kHome = 168,
80 | kEnd = 169,
81 |
82 | kCapsLock = 180,
83 | kScrollLock = 181,
84 | kNumLock = 182,
85 | kPrintScreen = 183,
86 | kPause = 184,
87 |
88 | kF1 = 190,
89 | kF2 = 191,
90 | kF3 = 192,
91 | kF4 = 193,
92 | kF5 = 194,
93 | kF6 = 195,
94 | kF7 = 196,
95 | kF8 = 197,
96 | kF9 = 198,
97 | kF10 = 199,
98 | kF11 = 200,
99 | kF12 = 201,
100 | kF13 = 202,
101 | kF14 = 203,
102 | kF15 = 204,
103 | kF16 = 205,
104 | kF17 = 206,
105 | kF18 = 207,
106 | kF19 = 208,
107 | kF20 = 209,
108 | kF21 = 210,
109 | kF22 = 211,
110 | kF23 = 212,
111 | kF24 = 213,
112 |
113 | kKeypad0 = 220,
114 | kKeypad1 = 221,
115 | kKeypad2 = 222,
116 | kKeypad3 = 223,
117 | kKeypad4 = 224,
118 | kKeypad5 = 225,
119 | kKeypad6 = 226,
120 | kKeypad7 = 227,
121 | kKeypad8 = 228,
122 | kKeypad9 = 229,
123 | kKeypadDecimal = 230,
124 | kKeypadDivide = 231,
125 | kKeypadMultiply = 232,
126 | kKeypadSubtract = 233,
127 | kKeypadAdd = 234,
128 | kKeypadEnter = 235,
129 | kKeypadEqual = 236,
130 |
131 | kLeftShift = 240,
132 | kLeftControl = 241,
133 | kLeftAlt = 242,
134 | kLeftSuper = 243,
135 | kRightShift = 244,
136 | kRightControl = 245,
137 | kRightAlt = 246,
138 | kRightSuper = 247,
139 | kMenu = 248,
140 |
141 | kMaxKeys = 255
142 | }; // enum class Keys
143 |
144 | /*!
145 | \brief Mouse buttons.
146 | */
147 | enum Buttons : std::uint8_t {
148 | kButtonLeft,
149 | kButtonRight,
150 | kButtonMiddle,
151 | kButton4,
152 | kButton5,
153 |
154 | kMaxButtons = 5
155 | }; // enum class Buttons
156 |
157 | } // namespace iris::wsi
158 |
159 | #endif // HEV_IRIS_WSI_INPUT_H_
160 |
161 |
--------------------------------------------------------------------------------
/iris/wsi/platform_window.cc:
--------------------------------------------------------------------------------
1 | /*! \file
2 | \brief \ref iris::wsi::PlatformWindow definition.
3 | */
4 | #include "wsi/platform_window.h"
5 | #include "config.h"
6 | #include "logging.h"
7 | #if PLATFORM_LINUX
8 | #include "wsi/platform_window_x11.h"
9 | #elif PLATFORM_WINDOWS
10 | #include "wsi/platform_window_win32.h"
11 | #endif
12 |
13 | iris::expected
14 | iris::wsi::PlatformWindow::Create(gsl::czstring<> title, Offset2D offset,
15 | Extent2D extent, Options const& options,
16 | int display) noexcept {
17 | PlatformWindow window;
18 | if (auto pImpl = Impl::Create(title, std::move(offset), std::move(extent),
19 | options, display)) {
20 | window.pImpl_ = std::move(*pImpl);
21 | } else {
22 | return unexpected(pImpl.error());
23 | }
24 |
25 | return std::move(window);
26 | }
27 |
28 | iris::wsi::Rect2D iris::wsi::PlatformWindow::Rect() const noexcept {
29 | return pImpl_->Rect();
30 | }
31 |
32 | iris::wsi::Offset2D iris::wsi::PlatformWindow::Offset() const noexcept {
33 | return pImpl_->Offset();
34 | }
35 |
36 | iris::wsi::Extent2D iris::wsi::PlatformWindow::Extent() const noexcept {
37 | return pImpl_->Extent();
38 | }
39 |
40 | glm::vec2 iris::wsi::PlatformWindow::CursorPos() const noexcept {
41 | return pImpl_->CursorPos();
42 | }
43 |
44 | void iris::wsi::PlatformWindow::Retitle(gsl::czstring<> title) noexcept {
45 | pImpl_->Retitle(title);
46 | }
47 |
48 | void iris::wsi::PlatformWindow::Move(Offset2D const& offset) {
49 | pImpl_->Move(offset);
50 | }
51 |
52 | void iris::wsi::PlatformWindow::Resize(Extent2D const& extent) {
53 | pImpl_->Resize(extent);
54 | }
55 |
56 | bool iris::wsi::PlatformWindow::IsClosed() const noexcept {
57 | return pImpl_->IsClosed();
58 | }
59 |
60 | void iris::wsi::PlatformWindow::Close() const noexcept {
61 | pImpl_->Close();
62 | }
63 |
64 | void iris::wsi::PlatformWindow::Show() const noexcept {
65 | pImpl_->Show();
66 | }
67 |
68 | void iris::wsi::PlatformWindow::Hide() const noexcept {
69 | pImpl_->Hide();
70 | }
71 |
72 | bool iris::wsi::PlatformWindow::IsFocused() const noexcept {
73 | return pImpl_->IsFocused();
74 | }
75 |
76 | void iris::wsi::PlatformWindow::PollEvents() noexcept {
77 | pImpl_->PollEvents();
78 | }
79 |
80 | void iris::wsi::PlatformWindow::OnClose(CloseDelegate delegate) noexcept {
81 | pImpl_->OnClose(delegate);
82 | }
83 |
84 | void iris::wsi::PlatformWindow::OnMove(MoveDelegate delegate) noexcept {
85 | pImpl_->OnMove(delegate);
86 | }
87 |
88 | void iris::wsi::PlatformWindow::OnResize(ResizeDelegate delegate) noexcept {
89 | pImpl_->OnResize(delegate);
90 | }
91 |
92 | iris::wsi::PlatformWindow::NativeHandle_t
93 | iris::wsi::PlatformWindow::NativeHandle() const noexcept {
94 | return pImpl_->NativeHandle();
95 | }
96 |
97 | iris::wsi::PlatformWindow::PlatformWindow() noexcept = default;
98 | iris::wsi::PlatformWindow::PlatformWindow(PlatformWindow&&) noexcept = default;
99 | iris::wsi::PlatformWindow& iris::wsi::PlatformWindow::
100 | operator=(PlatformWindow&&) noexcept = default;
101 |
102 | iris::wsi::PlatformWindow::~PlatformWindow() noexcept {
103 | if (!pImpl_) return;
104 | IRIS_LOG_ENTER();
105 | IRIS_LOG_LEAVE();
106 | }
107 |
--------------------------------------------------------------------------------
/test/CTestScript.cmake:
--------------------------------------------------------------------------------
1 | set(CTEST_MODEL "Experimental")
2 |
3 | set(OPTION_CONFIGURE "-DBUILD_DOCS=OFF -DBUILD_DEPENDENCY_TESTING=ON -DTHIRD_PARTY_UPDATE_DISCONNECTED=ON ${EXTRA_CONFIG} -GNinja")
4 | set(EXCLUDE_RE "resolv|multistress|glslang-gtests|test-testsuites_all|test-testsuites_default|test-ubjson_all|test-regression_all|test-regression_default|test-msgpack_all|test-msgpack_default|test-json_patch_all|test-json_patch_default|test-json_patch_all|test-inspection_all|test-inspection_default|test-cbor_all|test-cbor_default|test-bson_all|test-unicode_all")
5 |
6 | # don't flag Python DeprecationWarning messages as errors
7 | set (CTEST_CUSTOM_ERROR_EXCEPTION "DeprecationWarning")
8 |
9 | if(NOT EXISTS ${CTEST_DASHBOARD_ROOT})
10 | file(MAKE_DIRECTORY ${CTEST_DASHBOARD_ROOT})
11 | endif()
12 |
13 | set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/hevx")
14 | set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_CONFIGURATION_TYPE}")
15 |
16 | if(NOT EXISTS ${CTEST_SOURCE_DIRECTORY})
17 | set(CTEST_CHECKOUT_COMMAND "git clone --depth=1 https://github.com/usnistgov/hevx.git")
18 | endif()
19 |
20 | set(CTEST_UPDATE_COMMAND "git")
21 |
22 | set(_opts "${OPTION_CONFIGURE} -DCMAKE_BUILD_TYPE=${CTEST_CONFIGURATION_TYPE}")
23 | set(CTEST_CONFIGURE_COMMAND "${CMAKE_COMMAND} ${_opts} ${CTEST_SOURCE_DIRECTORY}")
24 |
25 | set(CTEST_BUILD_COMMAND "${CMAKE_COMMAND} --build .")
26 |
27 | message("-- Start dashboard ${CTEST_MODEL} - ${CTEST_CONFIGURATION_TYPE} --")
28 | ctest_start(${CTEST_MODEL} TRACK ${CTEST_MODEL})
29 |
30 | message("-- Update ${CTEST_MODEL} - ${CTEST_CONFIGURATION_TYPE} --")
31 | ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}")
32 |
33 | message("-- Configure ${CTEST_MODEL} - ${CTEST_CONFIGURATION_TYPE} --")
34 | ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}")
35 |
36 | message("-- Build ${CTEST_MODEL} - ${CTEST_CONFIGURATION_TYPE} --")
37 | ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}")
38 |
39 | message("-- Test ${CTEST_MODEL} - ${CTEST_CONFIGURATION_TYPE} --")
40 | ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" EXCLUDE "${EXCLUDE_RE}" PARALLEL_LEVEL ${N})
41 |
42 | message("-- Finished ${CTEST_MODEL} - ${CTEST_CONFIGURATION_TYPE} --")
43 |
--------------------------------------------------------------------------------
/test/Dockerfile.bionic:
--------------------------------------------------------------------------------
1 | FROM ubuntu:18.04
2 |
3 | ARG VULKAN_VER=1.1.101.0
4 | ARG BUILD_VULKAN_URL=https://raw.githubusercontent.com/usnistgov/hevx/master/test/build-vulkan-sdk.py
5 |
6 | ARG CMAKE_VER=3.12.4
7 | ARG CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VER/cmake-$CMAKE_VER-Linux-x86_64.tar.gz
8 |
9 | RUN apt update -y
10 | RUN apt install -y curl python python3-pip cmake git libssl-dev zlib1g-dev \
11 | pkg-config libboost1.65-all-dev libx11-dev libx11-xcb-dev libxcb1-dev \
12 | libxkbcommon-dev libxcb-icccm4-dev libwayland-dev libxrandr-dev \
13 | libxcb-randr0-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-ewmh-dev \
14 | ninja-build
15 | RUN pip3 install --user wheezy.template
16 | RUN mkdir cmake && curl -L $CMAKE_URL | tar --strip-components=1 -xz -C cmake
17 |
18 | RUN mkdir -p vulkan/src
19 | WORKDIR vulkan/src
20 | RUN curl -O $BUILD_VULKAN_URL
21 | RUN python3 build-vulkan-sdk.py --cmake cmake --install_dir /vulkan $VULKAN_VER
22 |
23 | WORKDIR ../..
24 | ENV VULKAN_SDK=/vulkan
25 |
--------------------------------------------------------------------------------
/test/Dockerfile.cosmic:
--------------------------------------------------------------------------------
1 | FROM ubuntu:18.10
2 |
3 | ARG VULKAN_VER=1.1.101.0
4 | ARG BUILD_VULKAN_URL=https://raw.githubusercontent.com/usnistgov/hevx/master/test/build-vulkan-sdk.py
5 |
6 | RUN apt update -y
7 | RUN apt install -y curl python python3-pip cmake git pkg-config libssl-dev \
8 | zlib1g-dev libboost1.65-all-dev libx11-dev libx11-xcb-dev libxcb1-dev \
9 | libxkbcommon-dev libxcb-icccm4-dev libwayland-dev libxrandr-dev \
10 | libxcb-randr0-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-ewmh-dev \
11 | ninja-build
12 | RUN pip3 install --user wheezy.template
13 |
14 | RUN mkdir -p vulkan/src
15 | WORKDIR vulkan/src
16 | RUN curl -O $BUILD_VULKAN_URL
17 | RUN python3 build-vulkan-sdk.py --cmake cmake --install_dir /vulkan $VULKAN_VER
18 |
19 | WORKDIR ../..
20 | ENV VULKAN_SDK=/vulkan
21 |
--------------------------------------------------------------------------------
/test/Dockerfile.el7:
--------------------------------------------------------------------------------
1 | FROM centos:7.6.1810
2 |
3 | ARG VULKAN_VER=1.1.101.0
4 | ARG BUILD_VULKAN_URL=https://raw.githubusercontent.com/usnistgov/hevx/master/test/build-vulkan-sdk.py
5 |
6 | RUN yum update -y
7 | RUN yum install -y centos-release-scl epel-release
8 | RUN yum install -y devtoolset-8\* python34 git cmake3 boost-\* glm-devel \
9 | openssl-devel libpng-devel wayland-devel libpciaccess-devel libX11-devel \
10 | libXpresent libxcb xcb-util libxcb-devel libXrandr-devel xcb-util-wm-devel \
11 | xcb-util-keysyms-devel ninja-build
12 | RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
13 | RUN python3 get-pip.py
14 | RUN pip3 install --user wheezy.template
15 |
16 | RUN mkdir -p vulkan/src
17 | WORKDIR vulkan/src
18 | RUN curl -O $BUILD_VULKAN_URL
19 | RUN python3 build-vulkan-sdk.py --cmake cmake3 --install_dir /vulkan $VULKAN_VER
20 |
21 | WORKDIR ../..
22 | ENV VULKAN_SDK=/vulkan
23 |
--------------------------------------------------------------------------------
/test/Dockerfile.f28:
--------------------------------------------------------------------------------
1 | FROM fedora:28
2 |
3 | ARG VULKAN_VER=1.1.101.0
4 | ARG BUILD_VULKAN_URL=https://raw.githubusercontent.com/usnistgov/hevx/master/test/build-vulkan-sdk.py
5 |
6 | ARG CMAKE_VER=3.12.4
7 | ARG CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VER/cmake-$CMAKE_VER-Linux-x86_64.tar.gz
8 |
9 | RUN dnf update -y
10 | RUN dnf install -y python git cmake gcc-c++ make boost-\* openssl-devel \
11 | glm-devel libpng-devel wayland-devel libpciaccess-devel libX11-devel \
12 | libXpresent libxcb xcb-util libxcb-devel libXrandr-devel xcb-util-wm-devel \
13 | xcb-util-keysyms-devel ninja-build
14 | RUN pip3 install --user wheezy.template
15 | RUN mkdir cmake && curl -L $CMAKE_URL | tar --strip-components=1 -xz -C cmake
16 |
17 | RUN mkdir -p vulkan/src
18 | WORKDIR vulkan/src
19 | RUN curl -O $BUILD_VULKAN_URL
20 | RUN python3 build-vulkan-sdk.py --cmake cmake --install_dir /vulkan $VULKAN_VER
21 |
22 | WORKDIR ../..
23 | ENV VULKAN_SDK=/vulkan
24 |
--------------------------------------------------------------------------------
/test/Dockerfile.f29:
--------------------------------------------------------------------------------
1 | FROM fedora:29
2 |
3 | ARG VULKAN_VER=1.1.101.0
4 | ARG BUILD_VULKAN_URL=https://raw.githubusercontent.com/usnistgov/hevx/master/test/build-vulkan-sdk.py
5 |
6 | RUN dnf update -y
7 | RUN dnf install -y python git cmake gcc-c++ make boost-\* openssl-devel \
8 | glm-devel libpng-devel wayland-devel libpciaccess-devel libX11-devel \
9 | libXpresent libxcb xcb-util libxcb-devel libXrandr-devel xcb-util-wm-devel \
10 | xcb-util-keysyms-devel ninja-build
11 | RUN pip3 install --user wheezy.template
12 |
13 | RUN mkdir -p vulkan/src
14 | WORKDIR vulkan/src
15 | RUN curl -O $BUILD_VULKAN_URL
16 | RUN python3 build-vulkan-sdk.py --cmake cmake --install_dir /vulkan $VULKAN_VER
17 |
18 | WORKDIR ../..
19 | ENV VULKAN_SDK=/vulkan
20 |
--------------------------------------------------------------------------------
/test/README.md:
--------------------------------------------------------------------------------
1 | These are support files for continuous integration testing of HEVx.
2 |
3 | The CI testing runs on [Travis CI](https://travis-ci.org/usnistgov/hevx) and
4 | uses Docker images for the build platform matrix.
5 |
6 | The `Dockerfile.*` files in this directory are used to build the docker images.
7 |
8 | The Dockerfile files use the `build-vulkan-sdk.py` to build the VulkanSDK.
9 |
10 | The `hevx-ci.sh` and `create-report.py` files are used for nightly builds
11 | outside of Travis CI.
--------------------------------------------------------------------------------
/test/create-report.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | from argparse import ArgumentParser
3 | import os
4 | import re
5 | import shutil
6 | import sys
7 | import tempfile
8 | import xml.etree.ElementTree as ET
9 |
10 | PAGE_HEADER = """
11 |
12 |
13 | HEVx Test Results
14 |
19 |
20 |
21 | Summary
22 |
23 | Time | {date_time} |
24 | Passed | {num_passed} |
25 | Failed | {num_failed} |
26 |
"""
27 |
28 | PAGE_FOOTER = """
29 | """
30 |
31 | TABLE_HEADER = """ {title}
32 |
33 | Name | Execution Time (s) | Completion Status |
"""
34 |
35 | TABLE_ITEM = \
36 | """ {name} | {execution_time} | {completion_status} |
"""
37 |
38 | TABLE_FOOTER = """
"""
39 |
40 | INDEX_PAGE = """
41 |
42 |
43 | HEVx Continuous Integration
44 |
49 |
50 |
51 | Summary Results
52 |
53 | Date | Passed | Failed | Details |
54 |
55 |
56 |
57 | """
58 |
59 | INDEX_ITEM = """ {} | {} | {} | Details |
"""
60 |
61 | def log_msg(msg, is_error=False):
62 | global args
63 | if is_error or not args.silent:
64 | print("create-report: {}".format(msg))
65 |
66 | def parse_test(test):
67 | values = dict()
68 | values['name'] = test.find('./Name').text
69 | values['execution_time'] = test.find('./Results/NamedMeasurement[@name="Execution Time"]/Value').text
70 | values['completion_status'] = test.find('./Results/NamedMeasurement[@name="Completion Status"]/Value').text
71 | return values
72 |
73 | def write_report(html_dir, html_fn, test_root):
74 | passed_tests = test_root.findall('./Testing/Test[@Status="passed"]')
75 | failed_tests = test_root.findall('./Testing/Test[@Status="failed"]')
76 |
77 | values = dict()
78 | values['date_time'] = test_root.find('./Testing/StartDateTime').text
79 | values['num_passed'] = len(passed_tests)
80 | values['num_failed'] = len(failed_tests)
81 |
82 | html_path = os.path.join(html_dir, html_fn)
83 | log_msg("writing report to {}".format(html_path))
84 | with open(html_path, 'w') as fh:
85 | fh.write(PAGE_HEADER.format(**values))
86 |
87 | fh.write(TABLE_HEADER.format(title="Passed Tests"))
88 | for test in passed_tests:
89 | fh.write(TABLE_ITEM.format(**parse_test(test)))
90 | fh.write(TABLE_FOOTER)
91 |
92 | fh.write(TABLE_HEADER.format(title="Failed Tests"))
93 | for test in failed_tests:
94 | fh.write(TABLE_ITEM.format(**parse_test(test)))
95 | fh.write(TABLE_FOOTER)
96 |
97 | fh.write(PAGE_FOOTER)
98 |
99 | return (values['num_passed'], values['num_failed'])
100 |
101 | def update_index(index_path, date_time, num_passed, num_failed, html_fn):
102 | log_msg("updating index at {}".format(index_path))
103 | with open(index_path, 'r') as fh_in:
104 | index_html = fh_in.readlines()
105 | out_fn = None
106 |
107 | with tempfile.NamedTemporaryFile('w', delete=False) as fh_out:
108 | out_fn = fh_out.name
109 | for line in index_html:
110 | if re.search('', line):
111 | fh_out.write(INDEX_ITEM.format(date_time, num_passed, num_failed, html_fn))
112 | fh_out.write(line)
113 | else:
114 | fh_out.write(line)
115 |
116 | if out_fn is not None:
117 | shutil.copystat(index_path, out_fn)
118 | shutil.move(out_fn, index_path)
119 |
120 | def create_report():
121 | global args
122 |
123 | base_dir = os.path.join(args.test_dir, args.build_config, 'Testing')
124 | if not os.path.isdir(base_dir):
125 | log_msg("{} is not an existing directory; exiting".format(base_dir), True)
126 | sys.exit(1)
127 |
128 | exclude_dirs = ['TAG', 'Temporary']
129 | out_dirs = [d for d in os.scandir(base_dir) if d.name not in exclude_dirs]
130 | out_dirs.sort(key=lambda d: d.stat().st_atime, reverse=True)
131 |
132 | test_dir = os.path.join(base_dir, out_dirs[0]);
133 | log_msg("reading CTest output from {}".format(test_dir))
134 |
135 | test_root = ET.parse(os.path.join(test_dir, 'Test.xml')).getroot()
136 | date_time = test_root.find('./Testing/StartDateTime').text
137 |
138 | html_fn = '_'.join(date_time.split(' ')) + '.html'
139 | num_passed, num_failed = write_report(args.html_dir, html_fn, test_root)
140 |
141 | index_path = os.path.join(args.html_dir, 'index.html')
142 | if not os.path.exists(index_path):
143 | log_msg("creating index at {}".format(index_path))
144 | with open(index_path, 'w') as fh:
145 | fh.write(INDEX_PAGE)
146 | update_index(index_path, date_time, num_passed, num_failed, html_fn)
147 |
148 | def parse_args():
149 | global args
150 |
151 | parser = ArgumentParser(description="Create HTML report from CTest XML output.")
152 | parser.add_argument('-s', '--silent', action='store_true',
153 | help="Silent or quiet mode. Don't show messages.")
154 | parser.add_argument('-O', dest='html_dir',
155 | help="Root of HTML output.")
156 | parser.add_argument('-C', dest='build_config',
157 | help="CMake build configuration.")
158 | parser.add_argument('test_dir', help="Root of CTest output.")
159 |
160 | args = parser.parse_args()
161 |
162 | if __name__ == "__main__":
163 | parse_args()
164 | create_report()
165 |
--------------------------------------------------------------------------------
/test/hevx-ci.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # VulkanSDK Location
4 | export VULKAN_SDK=$HOME/local/VulkanSDK/1.1.114.0/x86_64
5 |
6 | # Build configuration to test
7 | BUILD_CONFIG="RelWithDebInfo"
8 |
9 | # URL of CTest Script
10 | URL=https://raw.githubusercontent.com/usnistgov/hevx/master/test/CTestScript.cmake
11 |
12 | ##
13 | ## Nothing below here should have to be changed
14 | ##
15 |
16 | PATH=$PATH:$HOME/bin
17 |
18 | if [ -z $1 ]; then
19 | HTML_ROOT="$HOME/public_html/hevx/ci"
20 | else
21 | HTML_ROOT="$1"
22 | fi
23 |
24 | if [ -z $2 ]; then
25 | TEST_ROOT="/local/tmp/$USER/hevx-ci"
26 | else
27 | if [ -a $2 ]; then
28 | echo "hevx-ci: $2 exists: exiting."
29 | exit 1
30 | fi
31 | TEST_ROOT="$2"
32 | fi
33 |
34 | function cleanup {
35 | \rm -fv $scriptfile
36 | \rm -fv $lockfile
37 | echo rm -rf $TEST_ROOT
38 | \rm -rf $TEST_ROOT
39 | }
40 |
41 | trap "cleanup" 0
42 | lockfile=/tmp/hevx-ci.lockfile
43 |
44 | if [ -f $lockfile ]; then
45 | echo -n "hevx-ci: $lockfile exists "
46 | pid=$(cat $lockfile)
47 | if [ -e /proc/$pid ]; then echo "and pid $pid is running: exiting."
48 | else echo "but pid $pid is dead: updating lock and continuing."
49 | fi
50 | fi
51 | (\umask 0; echo $$ >> $lockfile)
52 |
53 | scriptfile=$(\mktemp)
54 | \curl -s $URL | sed -e 's/Experimental/Nightly/' > $scriptfile
55 |
56 | starttime_arg="-DCTEST_NIGHTLY_START_TIME=\"20:00:00 EST\""
57 | dashboardroot_arg="-DCTEST_DASHBOARD_ROOT=$TEST_ROOT"
58 | testtype_arg="-DCTEST_CONFIGURATION_TYPE=$BUILD_CONFIG"
59 | CTEST_ARGS="-VV $starttime_arg $dashboardroot_arg $testtype_arg -S $scriptfile"
60 | EXTRA_ARGS="-DEXTRA_CONFIG:STRING='-DPYTHON_EXECUTABLE=/usr/bin/python3'"
61 |
62 | REPORT_ARGS="-C $BUILD_CONFIG -O $HTML_ROOT $TEST_ROOT"
63 |
64 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
65 |
66 | echo "scl enable devtoolset-8 -- ctest3 $EXTRA_ARGS $CTEST_ARGS"
67 | \scl enable devtoolset-8 -- ctest3 $EXTRA_ARGS $CTEST_ARGS
68 |
69 | echo "python3 $SCRIPT_DIR/create-report.py $REPORT_ARGS"
70 | \python3 $SCRIPT_DIR/create-report.py $REPORT_ARGS
71 |
--------------------------------------------------------------------------------
/third_party/Abseil.cmake:
--------------------------------------------------------------------------------
1 | #set(ABSL_RUN_TESTS ${BUILD_DEPENDENCY_TESTING} CACHE BOOL "" FORCE)
2 | set(ABSL_RUN_TESTS OFF CACHE BOOL "" FORCE)
3 |
4 | message(STATUS "Populating abseil")
5 | FetchContent_Populate(abseil
6 | GIT_REPOSITORY https://github.com/abseil/abseil-cpp
7 | GIT_SHALLOW TRUE # Abseil adheres to live-at-head
8 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/abseil
9 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
10 | QUIET
11 | )
12 |
13 | add_subdirectory(${abseil_SOURCE_DIR} ${abseil_BINARY_DIR})
14 |
--------------------------------------------------------------------------------
/third_party/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(FetchContent)
2 |
3 | # The following packages must be included first and in this order
4 | include(GoogleTest.cmake)
5 | include(GLM.cmake)
6 | include(Vulkan.cmake)
7 |
8 | # These packages can be included in any order
9 | include(Abseil.cmake)
10 | #include(Expected.cmake)
11 | add_subdirectory(expected)
12 | include(FlextGL.cmake)
13 | include(Fmtlib.cmake)
14 | include(Glslang.cmake)
15 | include(GSL.cmake)
16 | include(ImGui.cmake)
17 | include(JSON.cmake)
18 | add_subdirectory(mikktspace)
19 | add_subdirectory(miniball)
20 | include(Portaudio.cmake)
21 | include(Protobuf.cmake)
22 | include(Spdlog.cmake)
23 | include(STB.cmake)
24 | include(TBB.cmake)
25 | include(VRPN.cmake)
26 | include(VulkanMemoryAllocator.cmake)
27 | include(Websocketpp.cmake)
28 |
29 | # These packages must be included last
30 | include(Cpprestsdk.cmake)
31 |
--------------------------------------------------------------------------------
/third_party/Cpprestsdk.cmake:
--------------------------------------------------------------------------------
1 | set(_cpprestsdk_git_tag v2.10.10)
2 |
3 | set(BUILD_TESTS OFF CACHE BOOL "" FORCE)
4 | set(BUILD_SAMPLES OFF CACHE BOOL "" FORCE)
5 | set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
6 |
7 | message(STATUS "Populating cpprestsdk")
8 | FetchContent_Populate(cpprestsdk
9 | GIT_REPOSITORY https://github.com/Microsoft/cpprestsdk
10 | GIT_SHALLOW TRUE GIT_TAG ${_cpprestsdk_git_tag}
11 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/cpprestsdk
12 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
13 | QUIET
14 | )
15 |
16 | add_subdirectory(${cpprestsdk_SOURCE_DIR} ${cpprestsdk_BINARY_DIR})
17 | add_library(cpprestsdk::cpprest ALIAS cpprest)
18 |
--------------------------------------------------------------------------------
/third_party/FlextGL.cmake:
--------------------------------------------------------------------------------
1 | message(STATUS "Populating flextgl")
2 | FetchContent_Populate(flextgl
3 | GIT_REPOSITORY https://github.com/mosra/flextgl
4 | GIT_SHALLOW TRUE # flextGL "should be" stable at HEAD
5 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/flextgl
6 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
7 | QUIET
8 | )
9 |
10 | set(FLEXTGL_SOURCE_DIR ${flextgl_SOURCE_DIR} CACHE STRING "" FORCE)
11 |
--------------------------------------------------------------------------------
/third_party/Fmtlib.cmake:
--------------------------------------------------------------------------------
1 | set(_fmtlib_git_tag 5.2.1)
2 |
3 | # fmtlib testing locally includes gmock/gtest which conflicts
4 | set(FMT_TEST OFF CACHE BOOL "" FORCE)
5 |
6 | message(STATUS "Populating fmtlib")
7 | FetchContent_Populate(fmtlib
8 | GIT_REPOSITORY https://github.com/fmtlib/fmt
9 | GIT_SHALLOW TRUE GIT_TAG ${_fmtlib_git_tag}
10 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/fmtlib
11 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
12 | QUIET
13 | )
14 |
15 | add_subdirectory(${fmtlib_SOURCE_DIR} ${fmtlib_BINARY_DIR})
16 |
--------------------------------------------------------------------------------
/third_party/GLM.cmake:
--------------------------------------------------------------------------------
1 | set(_glm_git_tag 0.9.9.6)
2 |
3 | set(GLM_TEST_ENABLE ${BUILD_DEPENDENCY_TESTING} CACHE BOOL "" FORCE)
4 |
5 | message(STATUS "Populating glm")
6 | FetchContent_Populate(glm
7 | GIT_REPOSITORY https://github.com/g-truc/glm
8 | GIT_SHALLOW TRUE GIT_TAG ${_glm_git_tag}
9 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/glm
10 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
11 | QUIET
12 | )
13 |
14 | add_subdirectory(${glm_SOURCE_DIR} ${glm_BINARY_DIR}) # for tests
15 | add_library(glm INTERFACE)
16 | target_include_directories(glm INTERFACE ${glm_SOURCE_DIR})
17 |
--------------------------------------------------------------------------------
/third_party/GSL.cmake:
--------------------------------------------------------------------------------
1 | #set(GSL_TEST ${BUILD_DEPENDENCY_TESTING} CACHE BOOL "" FORCE)
2 | set(GSL_TEST OFF CACHE BOOL "" FORCE)
3 |
4 | message(STATUS "Populating gsl")
5 | FetchContent_Populate(gsl
6 | GIT_REPOSITORY https://github.com/Microsoft/GSL
7 | GIT_SHALLOW TRUE # GSL *should* be stable at HEAD
8 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/gsl
9 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
10 | QUIET
11 | )
12 |
13 | add_subdirectory(${gsl_SOURCE_DIR} ${gsl_BINARY_DIR})
14 |
--------------------------------------------------------------------------------
/third_party/GSL.natvis:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 | {_Data._What,nasb}
11 |
12 |
13 |
14 |
15 | {{ invoke = {invoke_}, action = {f_} }}
16 |
17 | - invoke_
18 | - f_
19 |
20 |
21 |
22 |
23 |
24 |
25 | {{ extent = {storage_.size_} }}
26 |
27 |
28 | storage_.size_
29 | storage_.data_
30 |
31 |
32 |
33 |
34 |
35 |
36 | {{ extent = {extent} }}
37 |
38 |
39 | extent
40 | storage_.data_
41 |
42 |
43 |
44 |
45 |
46 |
47 | {span_.storage_.data_,[span_.storage_.size_]na}
48 |
49 | - span_.storage_.size_
50 |
51 | span_.storage_.size_
52 | span_.storage_.data_
53 |
54 |
55 |
56 |
57 |
58 |
59 | {span_.storage_.data_,[span_.extent]na}
60 |
61 | - span_.extent
62 |
63 | span_.extent
64 | span_.storage_.data_
65 |
66 |
67 |
68 |
69 |
70 |
71 | {span_.storage_.data_,[span_.storage_.size_]na}
72 |
73 | - span_.storage_.size_
74 |
75 | span_.storage_.size_
76 | span_.storage_.data_
77 |
78 |
79 |
80 |
81 |
82 |
83 | {span_.storage_.data_,[span_.extent]na}
84 |
85 | - span_.extent
86 |
87 | span_.extent
88 | span_.storage_.data_
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | value = {*ptr_}
97 |
98 |
99 |
--------------------------------------------------------------------------------
/third_party/Glslang.cmake:
--------------------------------------------------------------------------------
1 | set(url https://github.com/KhronosGroup/glslang)
2 | #set(commit e06c7e9a515b716c731bda13f507546f107775d1) # sdk-1.1.106.0
3 |
4 | if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/glslang/CMakeLists.txt)
5 | if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/glslang)
6 | file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/glslang)
7 | endif()
8 |
9 | execute_process(
10 | COMMAND ${GIT_EXECUTABLE} clone ${url} glslang
11 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
12 | RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out
13 | )
14 | if(res)
15 | message(FATAL_ERROR "Unable to clone glslang source: ${out}")
16 | endif()
17 |
18 | #execute_process(
19 | #COMMAND ${GIT_EXECUTABLE} reset --hard ${commit}
20 | #WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/glslang
21 | #RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out
22 | #)
23 | #if(res)
24 | #message(FATAL_ERROR "Unable to checkout glslang source: ${out}")
25 | #endif()
26 |
27 | execute_process(
28 | COMMAND ${Python3_EXECUTABLE} update_glslang_sources.py
29 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/glslang
30 | RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out
31 | )
32 | if(res)
33 | message(FATAL_ERROR "Unable to update glslang sources: ${out}")
34 | endif()
35 | endif()
36 |
37 | set(BUILD_TESTING OFF)
38 |
39 | message(STATUS "Populating glslang")
40 | add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/glslang
41 | ${CMAKE_CURRENT_BINARY_DIR}/glslang-build
42 | )
--------------------------------------------------------------------------------
/third_party/GoogleTest.cmake:
--------------------------------------------------------------------------------
1 | set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
2 |
3 | message(STATUS "Populating googletest")
4 | FetchContent_Populate(googletest
5 | GIT_REPOSITORY https://github.com/google/googletest
6 | GIT_SHALLOW TRUE # GoogleTest adheres to live-at-head
7 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/googletest
8 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
9 | QUIET
10 | )
11 |
12 | add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
13 |
--------------------------------------------------------------------------------
/third_party/ImGui.cmake:
--------------------------------------------------------------------------------
1 | message(STATUS "Populating imgui")
2 | FetchContent_Populate(imgui
3 | GIT_REPOSITORY https://github.com/ocornut/imgui
4 | GIT_SHALLOW TRUE # imgui "should" be stable at head
5 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/imgui
6 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
7 | QUIET
8 | )
9 |
10 | file(REMOVE ${imgui_SOURCE_DIR}/imconfig.h)
11 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/imconfig.h DESTINATION ${imgui_SOURCE_DIR})
12 | add_library(imgui
13 | ${imgui_SOURCE_DIR}/imgui.cpp
14 | ${imgui_SOURCE_DIR}/imgui_demo.cpp
15 | ${imgui_SOURCE_DIR}/imgui_draw.cpp
16 | ${imgui_SOURCE_DIR}/imgui_widgets.cpp
17 | )
18 |
19 | target_include_directories(imgui PUBLIC ${imgui_SOURCE_DIR})
20 | target_link_libraries(imgui PUBLIC glm)
21 |
--------------------------------------------------------------------------------
/third_party/JSON.cmake:
--------------------------------------------------------------------------------
1 | set(JSON_BuildTests ${BUILD_DEPENDENCY_TESTING} CACHE BOOL "" FORCE)
2 |
3 | message(STATUS "Populating json")
4 | FetchContent_Populate(json
5 | GIT_REPOSITORY https://github.com/nlohmann/json
6 | GIT_SHALLOW TRUE # json HEAD "should be" stable
7 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/json
8 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
9 | QUIET
10 | )
11 |
12 | add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR})
13 |
--------------------------------------------------------------------------------
/third_party/Portaudio.cmake:
--------------------------------------------------------------------------------
1 | set(_portaudio_git_tag pa_stable_v190600_20161030)
2 |
3 | message(STATUS "Populating Portaudio")
4 | FetchContent_Populate(portaudio
5 | GIT_REPOSITORY https://git.assembla.com/portaudio.git
6 | GIT_SHALLOW TRUE GIT_TAG ${_portaudio_git_tag}
7 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/portaudio
8 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
9 | QUIET
10 | )
11 |
12 | add_subdirectory(${portaudio_SOURCE_DIR} ${portaudio_BINARY_DIR})
13 | add_library(portaudio::portaudio_static ALIAS portaudio_static)
14 |
--------------------------------------------------------------------------------
/third_party/Protobuf.cmake:
--------------------------------------------------------------------------------
1 | set(_protobuf_git_tag v3.6.1)
2 |
3 | set(protobuf_WITH_ZLIB OFF CACHE BOOL "" FORCE)
4 | set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "" FORCE)
5 | #set(protobuf_BUILD_TESTS ${BUILD_DEPENDENCY_TESTING} CACHE BOOL "" FORCE)
6 | set(protobuf_BUILD_TESTS OFF CACHE BOOL "" FORCE)
7 |
8 | message(STATUS "Populating protobuf")
9 | FetchContent_Populate(protobuf
10 | GIT_REPOSITORY https://github.com/protocolbuffers/protobuf
11 | GIT_SHALLOW TRUE GIT_TAG ${_protobuf_git_tag}
12 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf
13 | SOURCE_SUBDIR cmake
14 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
15 | QUIET
16 | )
17 |
18 | add_subdirectory(${protobuf_SOURCE_DIR}/cmake ${protobuf_BINARY_DIR})
19 | set(PROTOBUF_INCLUDE_DIR ${protobuf_SOURCE_DIR}/src CACHE PATH "" FORCE)
20 |
--------------------------------------------------------------------------------
/third_party/STB.cmake:
--------------------------------------------------------------------------------
1 | message(STATUS "Populating stb")
2 | FetchContent_Populate(stb
3 | GIT_REPOSITORY https://github.com/nothings/stb
4 | GIT_SHALLOW TRUE # stb HEAD "should be" stable
5 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/stb
6 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
7 | QUIET
8 | )
9 |
10 | file(WRITE ${stb_BINARY_DIR}/stb_image.cc
11 | "#define STB_IMAGE_IMPLEMENTATION\n\
12 | #include \"stb_image.h\"")
13 |
14 | file(WRITE ${stb_BINARY_DIR}/stb_image_resize.cc
15 | "#define STB_IMAGE_RESIZE_IMPLEMENTATION\n\
16 | #include \"stb_image_resize.h\"")
17 |
18 | add_library(stb
19 | ${stb_BINARY_DIR}/stb_image.cc ${stb_BINARY_DIR}/stb_image_resize.cc)
20 | target_include_directories(stb PUBLIC ${stb_SOURCE_DIR})
21 |
--------------------------------------------------------------------------------
/third_party/Spdlog.cmake:
--------------------------------------------------------------------------------
1 | set(_spdlog_git_tag v1.1.0)
2 |
3 | #set(SPDLOG_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
4 | #set(SPDLOG_BUILD_BENCH OFF CACHE BOOL "" FORCE)
5 | #set(SPDLOG_BUILD_TESTING ${BUILD_DEPENDENCY_TESTING} CACHE BOOL "" FORCE)
6 |
7 | message(STATUS "Populating spdlog")
8 | FetchContent_Populate(spdlog
9 | GIT_REPOSITORY https://github.com/gabime/spdlog
10 | GIT_SHALLOW TRUE GIT_TAG ${_spdlog_git_tag}
11 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/spdlog
12 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
13 | QUIET
14 | )
15 |
16 | file(REMOVE ${spdlog_SOURCE_DIR}/include/spdlog/tweakme.h)
17 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tweakme.h
18 | DESTINATION ${spdlog_SOURCE_DIR}/include/spdlog)
19 | add_library(spdlog INTERFACE)
20 | target_include_directories(spdlog INTERFACE ${spdlog_SOURCE_DIR}/include
21 | $
22 | )
23 |
--------------------------------------------------------------------------------
/third_party/TBB.cmake:
--------------------------------------------------------------------------------
1 | set(_tbb_prefix "tbb2018_20180618oss")
2 |
3 | if(WIN32)
4 | set(_tbb_fn "${_tbb_prefix}_win.zip")
5 | elseif(UNIX)
6 | set(_tbb_fn "${_tbb_prefix}_lin.tgz")
7 | endif()
8 |
9 | set(_tbb_rel "2018_U5")
10 | set(_tbb_url "https://github.com/01org/tbb/releases/download/${_tbb_rel}")
11 |
12 | if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${_tbb_fn}")
13 | message(STATUS "Fetching tbb")
14 | file(DOWNLOAD "${_tbb_url}/${_tbb_fn}" ${CMAKE_CURRENT_BINARY_DIR}/${_tbb_fn})
15 | execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${_tbb_fn}
16 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
17 | endif()
18 |
19 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/${_tbb_prefix}")
20 | find_package(TBB REQUIRED tbb)
21 |
22 | if(WIN32)
23 | get_filename_component(_tbb_lib_dir ${TBB_DIR}/../lib/intel64/vc14 ABSOLUTE)
24 | get_filename_component(_tbb_bin_dir ${TBB_DIR}/../bin/intel64/vc14 ABSOLUTE)
25 | elseif(UNIX)
26 | get_filename_component(_tbb_lib_dir ${TBB_DIR}/../lib/intel64/gcc4.7 ABSOLUTE)
27 | get_filename_component(_tbb_bin_dir ${TBB_DIR}/../bin/intel64/gcc4.7 ABSOLUTE)
28 | endif()
29 |
30 | set(TBB_LIBRARY_DIR ${_tbb_lib_dir}
31 | CACHE PATH "The directory containing the TBB libraries" FORCE)
32 | set(TBB_BINARY_DIR ${_tbb_bin_dir}
33 | CACHE PATH "The directory containing the TBB binaries" FORCE)
34 |
--------------------------------------------------------------------------------
/third_party/VRPN.cmake:
--------------------------------------------------------------------------------
1 | set(_vrpn_git_tag version_07.34)
2 |
3 | set(VRPN_BUILD_CLIENT_LIBRARY ON CACHE BOOL "" FORCE)
4 | set(VRPN_BUILD_SERVER_LIBRARY ON CACHE BOOL "" FORCE)
5 | set(VRPN_BUILD_CLIENTS ON CACHE BOOL "" FORCE)
6 | set(VRPN_BUILD_SERVERS ON CACHE BOOL "" FORCE)
7 | set(VRPN_INSTALL TRUE CACHE BOOL "" FORCE)
8 |
9 | message(STATUS "Populating VRPN")
10 | FetchContent_Populate(vrpn
11 | GIT_REPOSITORY https://github.com/vrpn/vrpn
12 | GIT_SHALLOW TRUE GIT_TAG ${_vrpn_git_tag}
13 | PATCH_COMMAND
14 | ${CMAKE_COMMAND} -E remove "${CMAKE_CURRENT_BINARY_DIR}/vrpn/cmake/cmake-4.0.0-modules/autoinclude.cmake"
15 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/vrpn
16 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
17 | QUIET
18 | )
19 |
20 | add_subdirectory(${vrpn_SOURCE_DIR} ${vrpn_BINARY_DIR})
21 |
--------------------------------------------------------------------------------
/third_party/Vulkan.cmake:
--------------------------------------------------------------------------------
1 | set(Vulkan_VERSION 1.1.114.0)
2 |
3 | find_package(Vulkan ${Vulkan_VERSION} REQUIRED)
4 | set_target_properties(Vulkan::Vulkan PROPERTIES IMPORTED_GLOBAL TRUE)
5 |
6 | get_filename_component(Vulkan_LIBRARY_DIR ${Vulkan_LIBRARY} DIRECTORY CACHE)
7 | get_filename_component(Vulkan_SDK_DIR ${Vulkan_LIBRARY_DIR}/.. ABSOLUTE CACHE)
8 |
--------------------------------------------------------------------------------
/third_party/VulkanMemoryAllocator.cmake:
--------------------------------------------------------------------------------
1 | set(_vulkanmemoryallocator_git_tag v2.2.0)
2 |
3 | message(STATUS "Populating build dependency: VulkanMemoryAllocator")
4 | FetchContent_Populate(VulkanMemoryAllocator
5 | GIT_REPOSITORY https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
6 | GIT_SHALLOW TRUE GIT_TAG ${_vulkanmemoryallocator_git_tag}
7 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
8 | QUIET
9 | )
10 |
11 | if(NOT EXISTS ${vulkanmemoryallocator_BINARY_DIR}/vk_mem_alloc.cc)
12 | file(WRITE ${vulkanmemoryallocator_BINARY_DIR}/vk_mem_alloc.cc
13 | "#define VMA_IMPLEMENTATION\n#include \"vk_mem_alloc.h\"")
14 | endif()
15 |
16 | add_library(vma ${vulkanmemoryallocator_BINARY_DIR}/vk_mem_alloc.cc)
17 | target_include_directories(vma
18 | PUBLIC
19 | ${vulkanmemoryallocator_SOURCE_DIR}/src
20 | ${VulkanHeaders_INCLUDE_DIR}
21 | )
22 | target_link_libraries(vma PUBLIC Vulkan::Vulkan)
23 | target_compile_definitions(vma
24 | PUBLIC
25 | $<$:WIN32_LEAN_AND_MEAN>
26 | PRIVATE
27 | $<$:VK_USE_PLATFORM_XCB_KHR VK_USE_PLATFORM_XCB_XRANDR_EXT>
28 | $<$:VK_USE_PLATFORM_WIN32_KHR>
29 | )
30 |
--------------------------------------------------------------------------------
/third_party/Websocketpp.cmake:
--------------------------------------------------------------------------------
1 | set(_websocketpp_git_tag 0.8.1)
2 |
3 | set(BUILD_TESTS OFF CACHE BOOL "" FORCE)
4 |
5 | message(STATUS "Populating websocketpp")
6 | FetchContent_Populate(websocketpp
7 | GIT_REPOSITORY https://github.com/zaphoyd/websocketpp
8 | GIT_SHALLOW TRUE GIT_TAG ${_websocketpp_git_tag}
9 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/websocketpp
10 | UPDATE_DISCONNECTED ${THIRD_PARTY_UPDATE_DISCONNECTED}
11 | QUIET
12 | )
13 |
14 | add_subdirectory(${websocketpp_SOURCE_DIR} ${websocketpp_BINARY_DIR})
15 |
--------------------------------------------------------------------------------
/third_party/expected/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(expected INTERFACE)
2 | target_include_directories(expected INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
3 |
4 |
--------------------------------------------------------------------------------
/third_party/imconfig.h:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------------
2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI
3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
5 | //-----------------------------------------------------------------------------
6 | // A) You may edit imconfig.h (and not overwrite it when updating imgui, or maintain a patch/branch with your modifications to imconfig.h)
7 | // B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h"
8 | // If you do so you need to make sure that configuration settings are defined consistently _everywhere_ dear imgui is used, which include
9 | // the imgui*.cpp files but also _any_ of your code that uses imgui. This is because some compile-time options have an affect on data structures.
10 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
11 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using.
12 | //-----------------------------------------------------------------------------
13 |
14 | #pragma once
15 |
16 | //---- Define assertion handler. Defaults to calling assert().
17 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
18 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
19 |
20 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows.
21 | //#define IMGUI_API __declspec( dllexport )
22 | //#define IMGUI_API __declspec( dllimport )
23 |
24 | //---- Don't define obsolete functions/enums names. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
25 | #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
26 |
27 | //---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)
28 | //---- It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp.
29 | //#define IMGUI_DISABLE_DEMO_WINDOWS
30 |
31 | //---- Don't implement some functions to reduce linkage requirements.
32 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.
33 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow.
34 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function.
35 | //#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself if you don't want to link with vsnprintf.
36 | //#define IMGUI_DISABLE_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 wrapper so you can implement them yourself. Declare your prototypes in imconfig.h.
37 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
38 |
39 | //---- Include imgui_user.h at the end of imgui.h as a convenience
40 | //#define IMGUI_INCLUDE_IMGUI_USER_H
41 |
42 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another)
43 | //#define IMGUI_USE_BGRA_PACKED_COLOR
44 |
45 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
46 | // By default the embedded implementations are declared static and not available outside of imgui cpp files.
47 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
48 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
49 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
50 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
51 |
52 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
53 | // This will be inlined as part of ImVec2 and ImVec4 class declarations.
54 |
55 | #include "glm/vec2.hpp"
56 | #include "glm/vec4.hpp"
57 |
58 | #define IM_VEC2_CLASS_EXTRA \
59 | ImVec2(const glm::vec2& f) { \
60 | x = f.x; \
61 | y = f.y; \
62 | } \
63 | operator glm::vec2() const { return glm::vec2(x, y); }
64 |
65 | #define IM_VEC4_CLASS_EXTRA \
66 | ImVec4(const glm::vec4& f) { \
67 | x = f.x; \
68 | y = f.y; \
69 | z = f.z; \
70 | w = f.w; \
71 | } \
72 | operator glm::vec4() const { return glm::vec4(x, y, z, w); }
73 |
74 | //---- Use 32-bit vertex indices (default is 16-bit) to allow meshes with more than 64K vertices. Render function needs to support it.
75 | //#define ImDrawIdx unsigned int
76 |
77 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
78 | /*
79 | namespace ImGui
80 | {
81 | void MyFunction(const char* name, const MyMatrix44& v);
82 | }
83 | */
84 |
--------------------------------------------------------------------------------
/third_party/mikktspace/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(mikktspace mikktspace.c)
2 | target_include_directories(mikktspace PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
--------------------------------------------------------------------------------
/third_party/mikktspace/mikktspace-license.txt:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2011 by Morten S. Mikkelsen
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | *
8 | * Permission is granted to anyone to use this software for any purpose,
9 | * including commercial applications, and to alter it and redistribute it
10 | * freely, subject to the following restrictions:
11 | *
12 | * 1. The origin of this software must not be misrepresented; you must not
13 | * claim that you wrote the original software. If you use this software
14 | * in a product, an acknowledgment in the product documentation would be
15 | * appreciated but is not required.
16 | * 2. Altered source versions must be plainly marked as such, and must not be
17 | * misrepresented as being the original software.
18 | * 3. This notice may not be removed or altered from any source distribution.
19 | */
--------------------------------------------------------------------------------
/third_party/miniball/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(miniball INTERFACE)
2 | target_include_directories(miniball INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
3 |
--------------------------------------------------------------------------------
/third_party/tweakme.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright(c) 2015 Gabi Melman.
3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT)
4 | //
5 |
6 | #pragma once
7 |
8 | ///////////////////////////////////////////////////////////////////////////////
9 | //
10 | // Edit this file to squeeze more performance, and to customize supported
11 | // features
12 | //
13 | ///////////////////////////////////////////////////////////////////////////////
14 |
15 | ///////////////////////////////////////////////////////////////////////////////
16 | // Under Linux, the much faster CLOCK_REALTIME_COARSE clock can be used.
17 | // This clock is less accurate - can be off by dozens of millis - depending on
18 | // the kernel HZ.
19 | // Uncomment to use it instead of the regular clock.
20 | //
21 | // #define SPDLOG_CLOCK_COARSE
22 | ///////////////////////////////////////////////////////////////////////////////
23 |
24 | ///////////////////////////////////////////////////////////////////////////////
25 | // Uncomment if date/time logging is not needed and never appear in the log
26 | // pattern.
27 | // This will prevent spdlog from querying the clock on each log call.
28 | //
29 | // WARNING: If the log pattern contains any date/time while this flag is on, the
30 | // result is undefined.
31 | // You must set new pattern(spdlog::set_pattern(..") without any
32 | // date/time in it
33 | //
34 | // #define SPDLOG_NO_DATETIME
35 | ///////////////////////////////////////////////////////////////////////////////
36 |
37 | ///////////////////////////////////////////////////////////////////////////////
38 | // Uncomment if thread id logging is not needed (i.e. no %t in the log pattern).
39 | // This will prevent spdlog from querying the thread id on each log call.
40 | //
41 | // WARNING: If the log pattern contains thread id (i.e, %t) while this flag is
42 | // on, the result is undefined.
43 | //
44 | // #define SPDLOG_NO_THREAD_ID
45 | ///////////////////////////////////////////////////////////////////////////////
46 |
47 | ///////////////////////////////////////////////////////////////////////////////
48 | // Uncomment to prevent spdlog from caching thread ids in thread local storage.
49 | // By default spdlog saves thread ids in tls to gain a few micros for each call.
50 | //
51 | // WARNING: if your program forks, UNCOMMENT this flag to prevent undefined
52 | // thread ids in the children logs.
53 | //
54 | // #define SPDLOG_DISABLE_TID_CACHING
55 | ///////////////////////////////////////////////////////////////////////////////
56 |
57 | ///////////////////////////////////////////////////////////////////////////////
58 | // Uncomment if logger name logging is not needed.
59 | // This will prevent spdlog from copying the logger name on each log call.
60 | //
61 | // #define SPDLOG_NO_NAME
62 | ///////////////////////////////////////////////////////////////////////////////
63 |
64 | ///////////////////////////////////////////////////////////////////////////////
65 | // Uncomment to enable the SPDLOG_DEBUG/SPDLOG_TRACE macros.
66 | //
67 | // #define SPDLOG_DEBUG_ON
68 | // #define SPDLOG_TRACE_ON
69 | ///////////////////////////////////////////////////////////////////////////////
70 |
71 | ///////////////////////////////////////////////////////////////////////////////
72 | // Uncomment to avoid spdlog's usage of atomic log levels
73 | // Use only if your code never modifies a logger's log levels concurrently by
74 | // different threads.
75 | //
76 | // #define SPDLOG_NO_ATOMIC_LEVELS
77 | ///////////////////////////////////////////////////////////////////////////////
78 |
79 | ///////////////////////////////////////////////////////////////////////////////
80 | // Uncomment to enable usage of wchar_t for file names on Windows.
81 | //
82 | // #define SPDLOG_WCHAR_FILENAMES
83 | ///////////////////////////////////////////////////////////////////////////////
84 |
85 | ///////////////////////////////////////////////////////////////////////////////
86 | // Uncomment to override default eol ("\n" or "\r\n" under Linux/Windows)
87 | //
88 | // #define SPDLOG_EOL ";-)\n"
89 | ///////////////////////////////////////////////////////////////////////////////
90 |
91 | ///////////////////////////////////////////////////////////////////////////////
92 | // Uncomment to use your own copy of the fmt library instead of spdlog's copy.
93 | // In this case spdlog will try to include so set your -I flag
94 | // accordingly.
95 | //
96 | #define SPDLOG_FMT_EXTERNAL
97 | ///////////////////////////////////////////////////////////////////////////////
98 |
99 | ///////////////////////////////////////////////////////////////////////////////
100 | // Uncomment to enable wchar_t support (convert to utf8)
101 | //
102 | // #define SPDLOG_WCHAR_TO_UTF8_SUPPORT
103 | ///////////////////////////////////////////////////////////////////////////////
104 |
105 | ///////////////////////////////////////////////////////////////////////////////
106 | // Uncomment to prevent child processes from inheriting log file descriptors
107 | //
108 | // #define SPDLOG_PREVENT_CHILD_FD
109 | ///////////////////////////////////////////////////////////////////////////////
110 |
111 | ///////////////////////////////////////////////////////////////////////////////
112 | // Uncomment if your compiler doesn't support the "final" keyword.
113 | // The final keyword allows more optimizations in release
114 | // mode with recent compilers. See GCC's documentation for -Wsuggest-final-types
115 | // for instance.
116 | //
117 | // #define SPDLOG_NO_FINAL
118 | ///////////////////////////////////////////////////////////////////////////////
119 |
120 | ///////////////////////////////////////////////////////////////////////////////
121 | // Uncomment to enable message counting feature.
122 | // Use the %i in the logger pattern to display log message sequence id.
123 | //
124 | // #define SPDLOG_ENABLE_MESSAGE_COUNTER
125 | ///////////////////////////////////////////////////////////////////////////////
126 |
127 | ///////////////////////////////////////////////////////////////////////////////
128 | // Uncomment to customize level names (e.g. "MT TRACE")
129 | //
130 | // #define SPDLOG_LEVEL_NAMES { "MY TRACE", "MY DEBUG", "MY INFO", "MY WARNING",
131 | // "MY ERROR", "MY CRITICAL", "OFF" }
132 | ///////////////////////////////////////////////////////////////////////////////
133 |
--------------------------------------------------------------------------------