Skip to content

Commit

Permalink
FidelityFX LPM sample release v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rys committed Apr 26, 2021
1 parent 41f6e27 commit cb5fd82
Show file tree
Hide file tree
Showing 51 changed files with 4,415 additions and 2,972 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variables:
SampleName: LPMSample
CMakeConfig: -G "Visual Studio 15 2017" -A x64
CMakeConfig: -G "Visual Studio 16 2019" -A x64
GIT_SUBMODULE_STRATEGY: normal

stages:
Expand Down Expand Up @@ -58,4 +58,4 @@ package_sample:
- "%SampleName%/NOTICES.txt"
- "%SampleName%/media"
- "%SampleName%_VK.bat"
- "%SampleName%_DX12.bat"
- "%SampleName%_DX12.bat"
27 changes: 25 additions & 2 deletions ffx-lpm/ffx_a.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,30 @@
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//------------------------------------------------------------------------------------------------------------------------------
// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/LICENCE.txt
///******************************************************************************
// The MIT License (MIT)
//
// Copyright (c) <2014> <Michal Drobot>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ********************************************************************************
// ABOUT
// =====
// For questions and comments, feel free to contact the author directly: timothy.lottes@amd.com
Expand Down Expand Up @@ -137,7 +161,6 @@
// Requires standard C types: stdint.h
// Requires a collection of standard math intrinsics.
// - Requires VS2013 when not using GCC to get exp2() and log2().
// - https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/
//------------------------------------------------------------------------------------------------------------------------------
// This provides a minimum subset of functionality compared to the GPU parts.
//==============================================================================================================================
Expand Down Expand Up @@ -296,7 +319,7 @@
A_STATIC AD1 AAbsD1(AD1 a){return fabs(a);}
A_STATIC AF1 AAbsF1(AF1 a){return fabsf(a);}
A_STATIC AU1 AAbsSU1(AU1 a){return AU1_(abs(ASU1_(a)));}
A_STATIC AL1 AAbsSL1(AL1 a){return AL1_(labs(ASL1_(a)));}
A_STATIC AL1 AAbsSL1(AL1 a){return AL1_(llabs(ASL1_(a)));}
#endif
//------------------------------------------------------------------------------------------------------------------------------
#ifdef A_GCC
Expand Down
78 changes: 57 additions & 21 deletions sample/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
cmake_minimum_required(VERSION 3.4)
set(CMAKE_GENERATOR_PLATFORM x64)
cmake_minimum_required(VERSION 3.6)

project (LPMSample_${GFX_API})
option (GFX_API_DX12 "Build with DX12" ON)
option (GFX_API_VK "Build with Vulkan" ON)

if(NOT DEFINED GFX_API)
project (LPMSample)
else()
project (LPMSample_${GFX_API})

set_property(DIRECTORY ${CMAKE_PROJECT_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})

if(GFX_API STREQUAL DX12)
set(GFX_API_DX12 ON)
set(GFX_API_VK OFF)
elseif(GFX_API STREQUAL VK)
set(GFX_API_DX12 OFF)
set(GFX_API_VK ON)
else()
message(STATUS "----------------------------------------------------------------------------------------")
message(STATUS "")
message(STATUS "** Almost there!!")
message(STATUS "")
message(STATUS " This framework supports DX12 and VULKAN, you need to invoke cmake in one of these ways:")
message(STATUS "")
message(STATUS " Examples:")
message(STATUS " Generate selected one:")
message(STATUS " cmake <project_root_dir> -DGFX_API=DX12")
message(STATUS " cmake <project_root_dir> -DGFX_API=VK")
message(STATUS " Generate with switches (Default is ON):")
message(STATUS " cmake <project_root_dir> [-DGFX_API_DX12=ON|OFF] [-DGFX_API_VK=ON|OFF]")
message(STATUS "")
message(STATUS "----------------------------------------------------------------------------------------")
message(FATAL_ERROR "")
endif()
endif()

# Check MSVC toolset version, Visual Studio 2019 required
if(MSVC_TOOLSET_VERSION VERSION_LESS 142)
message(FATAL_ERROR "Cannot find MSVC toolset version 142 or greater. Please make sure Visual Studio 2019 or newer installed")
endif()

# ouput exe to bin directory
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin)
Expand All @@ -10,27 +47,26 @@ foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_HOME_DIRECTORY}/bin )
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )

add_compile_options(/MP /MT)

# reference libs used by both backends
add_subdirectory(libs/cauldron)
add_subdirectory(src/Common)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
# application icon
set(icon_src
${CMAKE_CURRENT_SOURCE_DIR}/libs/cauldron/src/common/Icon/GPUOpenChip.ico
${CMAKE_CURRENT_SOURCE_DIR}/libs/cauldron/src/common/Icon/resource.h
${CMAKE_CURRENT_SOURCE_DIR}/libs/cauldron/src/common/Icon/Cauldron_Common.rc
)

if(GFX_API STREQUAL DX12)
add_subdirectory(src/DX12)
elseif(GFX_API STREQUAL VK)
if(GFX_API_VK)
find_package(Vulkan REQUIRED)
add_subdirectory(src/VK)
else()
message(STATUS "----------------------------------------------------------------------------------------")
message(STATUS "")
message(STATUS "** Almost there!!")
message(STATUS "")
message(STATUS " This framework supports DX12 or VULKAN, you need to invoke cmake in one of these ways:")
message(STATUS "")
message(STATUS " Examples:")
message(STATUS " cmake <project_root_dir> -DGFX_API=DX12")
message(STATUS " cmake <project_root_dir> -DGFX_API=VK")
message(STATUS "")
message(STATUS "----------------------------------------------------------------------------------------")
message(FATAL_ERROR "")
endif()
endif()
if(GFX_API_DX12)
add_subdirectory(src/DX12)
endif()

set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/libs/cauldron/src/common/Icon/Cauldron_Common.rc PROPERTIES VS_TOOL_OVERRIDE "Resource compiler")
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/libs/cauldron/src/common/Icon/GPUOpenChip.ico PROPERTIES VS_TOOL_OVERRIDE "Image")
54 changes: 52 additions & 2 deletions sample/build/GenerateSolutions.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,59 @@
@echo off
setlocal enabledelayedexpansion

echo Checking pre-requisites...

:: Check if CMake is installed
cmake --version > nul 2>&1
if %errorlevel% NEQ 0 (
echo Cannot find path to cmake. Is CMake installed? Exiting...
exit /b -1
) else (
echo CMake - Ready.
)

:: Check if submodule is initialized (first time) to avoid CMake file not found errors
if not exist ..\libs\cauldron\common.cmake (
echo File: common.cmake doesn't exist in '.\libs\cauldron\' - Initializing submodule...

:: attempt to initialize submodule
cd ..
echo.
git submodule sync --recursive
git submodule update --init --recursive
cd build


:: check if submodule initialized properly
if not exist ..\libs\cauldron\common.cmake (
echo.
echo '..\libs\cauldron\common.cmake is still not there.'
echo Could not initialize submodule. Make sure all the submodules are initialized and updated.
echo Exiting...
echo.
exit /b -1
) else (
echo Cauldron - Ready.
)
) else (
echo Cauldron - Ready.
)

:: Check if VULKAN_SDK is installed but don't bail out
if "%VULKAN_SDK%"=="" (
echo Vulkan SDK is not installed -Environment variable VULKAN_SDK is not defined- : Please install the latest Vulkan SDK from LunarG.
) else (
echo Vulkan SDK - Ready : %VULKAN_SDK%
)


:: Call CMake
mkdir DX12
cd DX12
cmake ..\.. -DGFX_API=DX12
cmake -A x64 ..\.. -DGFX_API=DX12
cd ..

mkdir VK
cd VK
cmake ..\.. -DGFX_API=VK
cmake -A x64 ..\.. -DGFX_API=VK
cd ..
28 changes: 28 additions & 0 deletions sample/common.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# enables multithreading compilation
#

add_compile_options(/MP)

#
# includes cauldron's helper cmakes
#
include(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/cauldron/common.cmake)

#
# Add manifest so the app uses the right DPI settings
#
function(addManifest PROJECT_NAME)
IF (MSVC)
IF (CMAKE_MAJOR_VERSION LESS 3)
MESSAGE(WARNING "CMake version 3.0 or newer is required use build variable TARGET_FILE")
ELSE()
ADD_CUSTOM_COMMAND(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\dpiawarescaling.manifest\" -inputresource:\"$<TARGET_FILE:${PROJECT_NAME}>\"\;\#1 -outputresource:\"$<TARGET_FILE:${PROJECT_NAME}>\"\;\#1
COMMENT "Adding display aware manifest..."
)
ENDIF()
ENDIF(MSVC)
endfunction()
2 changes: 1 addition & 1 deletion sample/libs/cauldron
Submodule cauldron updated 323 files
10 changes: 10 additions & 0 deletions sample/src/Common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include(${CMAKE_CURRENT_SOURCE_DIR}/../../common.cmake)

add_library(LPMSample_Common INTERFACE)

set(config
${CMAKE_CURRENT_SOURCE_DIR}/../Common/LPMSample.json
)

copyTargetCommand("${config}" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} copied_common_config)
add_dependencies(LPMSample_Common copied_common_config)
82 changes: 82 additions & 0 deletions sample/src/Common/LPMSample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"globals": {
"CpuValidationLayerEnabled": false,
"GpuValidationLayerEnabled": false,
"AGSEnabled": true,
"presentationMode": 0,
"width": 1920,
"height": 1080,
"activeScene": 0,
"benchmark": false,
"vsync": false,
"stablePowerState": false,
"fontsize": 13
},
"scenes": [
{
"name": "Campfire",
"directory": "..\\media\\campfire\\",
"filename": "Campfire_scene_groundscaled.gltf",
"toneMapper": 0,
"emmisiveFactor": 1,
"intensity": 10,
"exposure": 1,
"activeCamera": 0,
"camera": {
"defaultFrom": [ -53.5, -26.0, -49.0 ],
"defaultTo": [ -52.0, -26.0, -47.0 ]
},
"colorspace": 0,
"BenchmarkSettings": {
"timeStep": 1,
"timeStart": 0,
"timeEnd": 10000,
"exitWhenTimeEnds": true,
"resultsFilename": "Campfire.csv",
"warmUpFrames": 200,
"sequence": {
"timeStart": 0,
"timeEnd": 2000,
"keyFrames": [
{
"time": 1000,
"from": [ -53.5, -26.0, -49.0 ],
"to": [ -52.0, -26.0, -47.0 ],
"screenShotName": "camera1.jpg"
}
]
}
}
},
{
"name": "Luxo Double Checker",
"directory": "..\\media\\color_ramp_bt2020_dcip3\\",
"filename": "LuxoDoubleChecker_EXR_ARGB_16F_1.DDS",
"toneMapper": 0,
"exposure": 1,
"colorspace": 0
},
{
"name": "DCI P3 1000 Nits",
"directory": "..\\media\\color_ramp_bt2020_dcip3\\",
"filename": "dcip3_1000_EXR_ARGB_16F_1.DDS",
"toneMapper": 0,
"exposure": 1,
"colorspace": 1
},
{
"name": "REC 2020 1000 Nits",
"directory": "..\\media\\color_ramp_bt2020_dcip3\\",
"filename": "bt2020_1000_EXR_ARGB_16F_1.DDS",
"toneMapper": 0,
"exposure": 1,
"colorspace": 2
},
{
"name": "Rec 709 5000 Nits",
"toneMapper": 0,
"exposure": 1,
"colorspace": 0
}
]
}
Loading

0 comments on commit cb5fd82

Please sign in to comment.