Skip to content

Commit 929c172

Browse files
committed
glTFSample v1.4
1 parent 11f4bc7 commit 929c172

25 files changed

+2303
-1540
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ bld/
3838
# Visual Studio 2017 auto generated files
3939
Generated\ Files/
4040

41+
# Visual Studio 2019 Open Folder
42+
out/
43+
CMakeSettings.json
44+
4145
# MSTest test Results
4246
[Tt]est[Rr]esult*/
4347
[Bb]uild[Ll]og.*

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
variables:
22
SampleName: GLTFSample
3-
CMakeConfig: -G "Visual Studio 15 2017" -A x64
3+
CMakeConfig: -G "Visual Studio 16 2019" -A x64
44
CaudronMediaUrl: http://isvgit.amd.com/raguaviv/cauldron-media/-/archive/master/cauldron-media-master.zip
55
GIT_SUBMODULE_STRATEGY: normal
66

CMakeLists.txt

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,44 @@
1-
cmake_minimum_required(VERSION 3.4)
2-
set(CMAKE_GENERATOR_PLATFORM x64)
1+
cmake_minimum_required(VERSION 3.6)
32

4-
project (GLTFSample_${GFX_API})
3+
option (GFX_API_DX12 "Build with DX12" ON)
4+
option (GFX_API_VK "Build with Vulkan" ON)
5+
6+
if(NOT DEFINED GFX_API)
7+
project (GLTFSample)
8+
else()
9+
project (GLTFSample_${GFX_API})
10+
11+
set_property(DIRECTORY ${CMAKE_PROJECT_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
12+
13+
if(GFX_API STREQUAL DX12)
14+
set(GFX_API_DX12 ON)
15+
set(GFX_API_VK OFF)
16+
elseif(GFX_API STREQUAL VK)
17+
set(GFX_API_DX12 OFF)
18+
set(GFX_API_VK ON)
19+
else()
20+
message(STATUS "----------------------------------------------------------------------------------------")
21+
message(STATUS "")
22+
message(STATUS "** Almost there!!")
23+
message(STATUS "")
24+
message(STATUS " This framework supports DX12 and VULKAN, you need to invoke cmake in one of these ways:")
25+
message(STATUS "")
26+
message(STATUS " Examples:")
27+
message(STATUS " Generate selected one:")
28+
message(STATUS " cmake <project_root_dir> -DGFX_API=DX12")
29+
message(STATUS " cmake <project_root_dir> -DGFX_API=VK")
30+
message(STATUS " Generate with switches (Default is ON):")
31+
message(STATUS " cmake <project_root_dir> [-DGFX_API_DX12=ON|OFF] [-DGFX_API_VK=ON|OFF]")
32+
message(STATUS "")
33+
message(STATUS "----------------------------------------------------------------------------------------")
34+
message(FATAL_ERROR "")
35+
endif()
36+
endif()
37+
38+
# Check MSVC toolset version, Visual Studio 2019 required
39+
if(MSVC_TOOLSET_VERSION VERSION_LESS 142)
40+
message(FATAL_ERROR "Cannot find MSVC toolset version 142 or greater. Please make sure Visual Studio 2019 or newer installed")
41+
endif()
542

643
# ouput exe to bin directory
744
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin)
@@ -10,28 +47,26 @@ foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
1047
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_HOME_DIRECTORY}/bin )
1148
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
1249

50+
add_compile_options(/MP)
51+
1352
# reference libs used by both backends
1453
add_subdirectory(libs/cauldron)
54+
add_subdirectory(src/Common)
1555

16-
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
56+
# application icon
57+
set(icon_src
58+
${CMAKE_CURRENT_SOURCE_DIR}/libs/cauldron/src/common/Icon/GPUOpenChip.ico
59+
${CMAKE_CURRENT_SOURCE_DIR}/libs/cauldron/src/common/Icon/resource.h
60+
${CMAKE_CURRENT_SOURCE_DIR}/libs/cauldron/src/common/Icon/Cauldron_Common.rc
61+
)
1762

18-
if(GFX_API STREQUAL DX12)
19-
add_subdirectory(src/DX12)
20-
elseif(GFX_API STREQUAL VK)
63+
if(GFX_API_VK)
2164
find_package(Vulkan REQUIRED)
2265
add_subdirectory(src/VK)
23-
else()
24-
message(STATUS "----------------------------------------------------------------------------------------")
25-
message(STATUS "")
26-
message(STATUS "** Almost there!!")
27-
message(STATUS "")
28-
message(STATUS " This framework supports DX12 or VULKAN, you need to invoke cmake in one of these ways:")
29-
message(STATUS "")
30-
message(STATUS " Examples:")
31-
message(STATUS " cmake <project_root_dir> -DGFX_API=DX12")
32-
message(STATUS " cmake <project_root_dir> -DGFX_API=VK")
33-
message(STATUS "")
34-
message(STATUS "----------------------------------------------------------------------------------------")
35-
message(FATAL_ERROR "")
66+
endif()
67+
if(GFX_API_DX12)
68+
add_subdirectory(src/DX12)
3669
endif()
3770

71+
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/libs/cauldron/src/common/Icon/Cauldron_Common.rc PROPERTIES VS_TOOL_OVERRIDE "Resource compiler")
72+
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/libs/cauldron/src/common/Icon/GPUOpenChip.ico PROPERTIES VS_TOOL_OVERRIDE "Image")

build/GenerateSolutions.bat

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,59 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
echo Checking pre-requisites...
5+
6+
:: Check if CMake is installed
7+
cmake --version > nul 2>&1
8+
if %errorlevel% NEQ 0 (
9+
echo Cannot find path to cmake. Is CMake installed? Exiting...
10+
exit /b -1
11+
) else (
12+
echo CMake - Ready.
13+
)
14+
15+
:: Check if submodule is initialized (first time) to avoid CMake file not found errors
16+
if not exist ..\libs\cauldron\common.cmake (
17+
echo File: common.cmake doesn't exist in '.\libs\cauldron\' - Initializing submodule...
18+
19+
:: attempt to initialize submodule
20+
cd ..
21+
echo.
22+
git submodule sync --recursive
23+
git submodule update --init --recursive
24+
cd build
25+
26+
27+
:: check if submodule initialized properly
28+
if not exist ..\libs\cauldron\common.cmake (
29+
echo.
30+
echo '..\libs\cauldron\common.cmake is still not there.'
31+
echo Could not initialize submodule. Make sure all the submodules are initialized and updated.
32+
echo Exiting...
33+
echo.
34+
exit /b -1
35+
) else (
36+
echo Cauldron - Ready.
37+
)
38+
) else (
39+
echo Cauldron - Ready.
40+
)
41+
42+
:: Check if VULKAN_SDK is installed but don't bail out
43+
if "%VULKAN_SDK%"=="" (
44+
echo Vulkan SDK is not installed -Environment variable VULKAN_SDK is not defined- : Please install the latest Vulkan SDK from LunarG.
45+
) else (
46+
echo Vulkan SDK - Ready : %VULKAN_SDK%
47+
)
48+
49+
50+
:: Call CMake
151
mkdir DX12
252
cd DX12
3-
cmake ..\.. -DGFX_API=DX12
53+
cmake -A x64 ..\.. -DGFX_API=DX12
454
cd ..
555

656
mkdir VK
757
cd VK
8-
cmake ..\.. -DGFX_API=VK
58+
cmake -A x64 ..\.. -DGFX_API=VK
959
cd ..

libs/cauldron

Submodule cauldron updated 214 files

media/Cauldron-Media

screenshot.png

1.74 MB
Loading

src/Common/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../common.cmake)
2+
3+
add_library(GLTFSample_Common INTERFACE)
4+
5+
set(config
6+
${CMAKE_CURRENT_SOURCE_DIR}/../Common/GLTFSample.json
7+
)
8+
9+
copyTargetCommand("${config}" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} copied_common_config)
10+
add_dependencies(GLTFSample_Common copied_common_config)

src/Common/GLTFSample.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
"globals": {
33
"CpuValidationLayerEnabled": false,
44
"GpuValidationLayerEnabled": false,
5-
"fullScreen": false,
5+
"presentationMode": 0,
66
"width": 1920,
77
"height": 1080,
8-
"activeScene": 0,
8+
"activeScene": 1,
99
"benchmark": false,
10-
"stablePowerState": false
10+
"vsync": false,
11+
"stablePowerState": false,
12+
"FreesyncHDROptionEnabled": false,
13+
"fontsize": 13
1114
},
1215
"scenes": [
1316
{

src/DX12/CMakeLists.txt

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
1-
project (${PROJECT_NAME})
2-
3-
include(${CMAKE_CURRENT_SOURCE_DIR}/../../common.cmake)
4-
5-
add_compile_options(/MP)
6-
71
set(sources
82
GLTFSample.cpp
93
GLTFSample.h
10-
SampleRenderer.cpp
11-
SampleRenderer.h
4+
Renderer.cpp
5+
Renderer.h
6+
UI.cpp
7+
UI.h
128
stdafx.cpp
13-
stdafx.h)
14-
15-
set(common
16-
${CMAKE_CURRENT_SOURCE_DIR}/../Common/GLTFSample.json
17-
)
18-
19-
copyCommand("${common}" ${CMAKE_HOME_DIRECTORY}/bin)
9+
stdafx.h
10+
dpiawarescaling.manifest)
2011

2112
source_group("Sources" FILES ${sources})
22-
source_group("Common" FILES ${common})
23-
24-
add_executable(${PROJECT_NAME} WIN32 ${sources} ${common})
25-
target_link_libraries(${PROJECT_NAME} LINK_PUBLIC Cauldron_DX12 ImGUI amd_ags DXC d3dcompiler D3D12)
13+
source_group("Icon" FILES ${icon_src}) # defined in top-level CMakeLists.txt
2614

27-
set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin")
15+
add_executable(GLTFSample_DX12 WIN32 ${sources} ${common} ${icon_src})
16+
target_link_libraries(GLTFSample_DX12 LINK_PUBLIC GLTFSample_Common Cauldron_DX12 ImGUI amd_ags d3dcompiler D3D12)
2817

29-
addManifest(${PROJECT_NAME})
18+
set_target_properties(GLTFSample_DX12 PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" DEBUG_POSTFIX "d")

0 commit comments

Comments
 (0)