Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DirectX 11 Version #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

cmake_minimum_required(VERSION 3.12.1)

option (GFX_API_DX11 "Build with DX11" ON)
option (GFX_API_DX12 "Build with DX12" ON)
option (GFX_API_VK "Build with Vulkan" ON)

Expand All @@ -31,6 +32,8 @@ else()

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

set(GFX_API_DX11 OFF)

if(GFX_API STREQUAL DX12)
set(GFX_API_DX12 ON)
set(GFX_API_VK OFF)
Expand Down Expand Up @@ -73,6 +76,7 @@ add_compile_options(/MP)
add_compile_definitions($<$<CONFIG:RelWithDebInfo>:USE_PIX>)

# override build options in ffx-fsr2-api cmake
option (FFX_FSR2_API_DX11 "Build FSR 2.0 DX11 backend" ${GFX_API_DX11})
option (FFX_FSR2_API_DX12 "Build FSR 2.0 DX12 backend" ${GFX_API_DX12})
option (FFX_FSR2_API_VK "Build FSR 2.0 Vulkan backend" ${GFX_API_VK})

Expand All @@ -88,4 +92,7 @@ endif()
if(GFX_API_DX12)
add_subdirectory(src/DX12)
endif()
if(GFX_API_DX11)
add_subdirectory(src/DX11)
endif()

19 changes: 19 additions & 0 deletions build/GenerateSolutionDX11.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@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.
)

:: Call CMake
mkdir DX11
cd DX11
cmake -A x64 ..\.. -DGFX_API_DX11=ON -DGFX_API_DX12=OFF -DGFX_API_VK=OFF
cd ..
19 changes: 19 additions & 0 deletions build/GenerateSolutionDX11DLL.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@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.
)

:: Call CMake
mkdir DX11
cd DX11
cmake -A x64 ..\.. -DGFX_API_DX11=ON -DGFX_API_DX12=OFF -DGFX_API_VK=OFF -DFSR2_BUILD_AS_DLL=1
cd ..
6 changes: 6 additions & 0 deletions media/dx11/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The media files in the tank and ui subfolders are from the Microsoft DirectX SDK Samples:
https://github.com/walbourn/directx-sdk-samples

(The files in tank are from the softparticles media folder in the Microsoft DirectX SDK Samples.)

They are distributed under the terms of the MIT License.
21 changes: 21 additions & 0 deletions media/dx11/tank/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Microsoft Corp

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.

Binary file added media/dx11/tank/TankScene.sdkmesh
Binary file not shown.
Binary file added media/dx11/tank/colorgradient.dds
Binary file not shown.
Binary file added media/dx11/tank/desert_sky.dds
Binary file not shown.
Binary file added media/dx11/tank/desertsky.sdkmesh
Binary file not shown.
Binary file added media/dx11/tank/ground_diff.dds
Binary file not shown.
Binary file added media/dx11/tank/ground_norm.dds
Binary file not shown.
Binary file added media/dx11/tank/left_engine_diff.dds
Binary file not shown.
Binary file added media/dx11/tank/left_engine_norm.dds
Binary file not shown.
Binary file added media/dx11/tank/smokevol1.dds
Binary file not shown.
Binary file added media/dx11/tank/turret_diff.dds
Binary file not shown.
Binary file added media/dx11/tank/turret_norm.dds
Binary file not shown.
Binary file added media/dx11/ui/AMD_FidelityFX.dds
Binary file not shown.
Binary file added media/dx11/ui/Font.dds
Binary file not shown.
21 changes: 21 additions & 0 deletions media/dx11/ui/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Microsoft Corp

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.

Binary file added media/dx11/ui/dxutcontrols.dds
Binary file not shown.
49 changes: 49 additions & 0 deletions src/DX11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This file is part of the FidelityFX SDK.
#
# Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

add_subdirectory(framework/dxut)
add_subdirectory(framework/amd_sdk)
add_subdirectory(framework/amd_lib)

set(FSR2_Sample_DX11_SOURCES
FSR2DX11Sample.cpp
FSR2DX11Sample.h
Fsr2Wrapper.cpp
Fsr2Wrapper.h
ResourceFiles/GPUOpenIcon.rc
ResourceFiles/dpiaware.manifest
)

set(FSR2_Sample_DX11_SHADERS
${CMAKE_CURRENT_SOURCE_DIR}/Shaders/FSR2DX11Sample.hlsl
)
set(FSR2_Sample_DX11_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/FSR2_Sample_DX11.json
)

copyTargetCommand("${FSR2_Sample_DX11_SHADERS}" ${CMAKE_HOME_DIRECTORY}/bin/ShaderLibDX/dx11 dx11_sample_shaders)
copyTargetCommand("${FSR2_Sample_DX11_CONFIG}" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} dx11_sample_config)

add_executable(FSR2_Sample_DX11 WIN32 ${FSR2_Sample_DX11_SOURCES} ${FSR2_Sample_DX11_SHADERS})
target_link_libraries(FSR2_Sample_DX11 PUBLIC comctl32 Usp10 NJSON amd_lib_minimal amd_sdk_minimal d3dcompiler D3D11 ffx_fsr2_api_x64 ffx_fsr2_api_dx11_x64)
set_target_properties(FSR2_Sample_DX11 PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin" DEBUG_POSTFIX "d")
target_compile_definitions(FSR2_Sample_DX11 PRIVATE _UNICODE UNICODE)
add_dependencies(FSR2_Sample_DX11 dx11_sample_shaders dx11_sample_config)
Loading