├── .gitattributes ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── amd_depthoffieldfx ├── build │ ├── AMD_DepthOfFieldFX_2015.sln │ ├── AMD_DepthOfFieldFX_2015.vcxproj │ ├── AMD_DepthOfFieldFX_2015.vcxproj.filters │ ├── AMD_DepthOfFieldFX_2017.sln │ ├── AMD_DepthOfFieldFX_2017.vcxproj │ └── AMD_DepthOfFieldFX_2017.vcxproj.filters ├── doc │ └── GDC2017 - Karl Hillesland - Cinematic Depth of Field.pdf ├── inc │ └── AMD_DepthOfFieldFX.h ├── premake │ └── premake5.lua └── src │ ├── AMD_DepthOfFieldFX.cpp │ ├── AMD_DepthOfFieldFX_Opaque.cpp │ ├── AMD_DepthOfFieldFX_Opaque.h │ ├── AMD_DepthOfFieldFX_Precompiled.h │ └── Shaders │ ├── DepthOfFieldFX_FastFilterDOF.hlsl │ ├── build │ └── fxc_compile_depthoffieldfx_all.bat │ └── inc │ ├── CS_BOX_FAST_FILTER_SETUP.inc │ ├── CS_DOUBLE_VERTICAL_INTEGRATE.inc │ ├── CS_FAST_FILTER_SETUP.inc │ ├── CS_FAST_FILTER_SETUP_QUARTER_RES.inc │ ├── CS_READ_FINAL_RESULT.inc │ └── CS_VERTICAL_INTEGRATE.inc ├── amd_depthoffieldfx_sample ├── build │ ├── DepthOfFieldFX_Sample_2015.sln │ ├── DepthOfFieldFX_Sample_2015.vcxproj │ ├── DepthOfFieldFX_Sample_2015.vcxproj.filters │ ├── DepthOfFieldFX_Sample_2017.sln │ ├── DepthOfFieldFX_Sample_2017.vcxproj │ └── DepthOfFieldFX_Sample_2017.vcxproj.filters ├── media │ ├── Thumbnail.png │ ├── readme.txt │ ├── tank │ │ ├── MIT.txt │ │ ├── TankScene.sdkmesh │ │ ├── colorgradient.dds │ │ ├── desert_sky.dds │ │ ├── desertsky.sdkmesh │ │ ├── ground_diff.dds │ │ ├── ground_norm.dds │ │ ├── left_engine_diff.dds │ │ ├── left_engine_norm.dds │ │ ├── smokevol1.dds │ │ ├── turret_diff.dds │ │ └── turret_norm.dds │ └── ui │ │ ├── Font.dds │ │ ├── MIT.txt │ │ └── dxutcontrols.dds ├── premake │ └── premake5.lua └── src │ ├── DepthOfFieldFX_Sample.cpp │ ├── DepthOfFieldFX_Sample.h │ ├── ResourceFiles │ ├── DepthOfFieldFX_Sample.rc │ ├── dpiaware.manifest │ └── resource.h │ └── Shaders │ ├── DepthOfFieldFX_CsCalcDOF.hlsl │ └── DepthOfFieldFX_Sample.hlsl ├── amd_lib └── shared │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE.txt │ ├── README.md │ ├── common │ └── inc │ │ └── AMD_Types.h │ ├── d3d11 │ ├── build │ │ ├── AMD_LIB_2015.vcxproj │ │ ├── AMD_LIB_2015.vcxproj.filters │ │ ├── AMD_LIB_2017.vcxproj │ │ ├── AMD_LIB_2017.vcxproj.filters │ │ ├── AMD_LIB_Minimal_2015.vcxproj │ │ ├── AMD_LIB_Minimal_2015.vcxproj.filters │ │ ├── AMD_LIB_Minimal_2017.vcxproj │ │ └── AMD_LIB_Minimal_2017.vcxproj.filters │ ├── inc │ │ └── AMD_LIB.h │ ├── premake │ │ ├── premake5.lua │ │ └── premake5_minimal.lua │ └── src │ │ ├── AMD_Buffer.cpp │ │ ├── AMD_Buffer.h │ │ ├── AMD_Common.cpp │ │ ├── AMD_Common.h │ │ ├── AMD_FullscreenPass.cpp │ │ ├── AMD_FullscreenPass.h │ │ ├── AMD_Rand.cpp │ │ ├── AMD_Rand.h │ │ ├── AMD_SaveRestoreState.cpp │ │ ├── AMD_SaveRestoreState.h │ │ ├── AMD_Serialize.cpp │ │ ├── AMD_Serialize.h │ │ ├── AMD_Texture2D.cpp │ │ ├── AMD_Texture2D.h │ │ ├── AMD_UnitCube.cpp │ │ ├── AMD_UnitCube.h │ │ ├── DirectXTex │ │ ├── DDSTextureLoader.cpp │ │ ├── DDSTextureLoader.h │ │ ├── MIT.txt │ │ ├── ReadMe.txt │ │ ├── ScreenGrab.cpp │ │ └── ScreenGrab.h │ │ └── Shaders │ │ ├── AMD_FullscreenPass.hlsl │ │ ├── AMD_Quaternion.hlsl │ │ ├── AMD_UnitCube.hlsl │ │ ├── SeparableFilter │ │ ├── FilterCommon.hlsl │ │ ├── FilterKernel.hlsl │ │ ├── HorizontalFilter.hlsl │ │ └── VerticalFilter.hlsl │ │ ├── build │ │ ├── fxc_compile_fullscreen_pass.bat │ │ └── fxc_compile_unit_cube.bat │ │ └── inc │ │ ├── GS_FULLSCREEN_INDEX_RT.inc │ │ ├── PS_FULLSCREEN.inc │ │ ├── PS_UNIT_CUBE.inc │ │ ├── VS_CLIP_SPACE_CUBE.inc │ │ ├── VS_FULLSCREEN.inc │ │ ├── VS_FULLSCREEN_INDEX_RT.inc │ │ ├── VS_SCREENQUAD.inc │ │ └── VS_UNIT_CUBE.inc │ └── d3d12 │ └── inc │ └── d3dx12.h ├── framework └── d3d11 │ ├── amd_sdk │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE.txt │ ├── README.md │ ├── build │ │ ├── AMD_SDK_2015.vcxproj │ │ ├── AMD_SDK_2015.vcxproj.filters │ │ ├── AMD_SDK_2017.vcxproj │ │ ├── AMD_SDK_2017.vcxproj.filters │ │ ├── AMD_SDK_Minimal_2015.vcxproj │ │ ├── AMD_SDK_Minimal_2015.vcxproj.filters │ │ ├── AMD_SDK_Minimal_2017.vcxproj │ │ └── AMD_SDK_Minimal_2017.vcxproj.filters │ ├── inc │ │ ├── AMD_SDK.h │ │ └── ShaderCacheSampleHelper.h │ ├── media │ │ ├── AMD.dds │ │ ├── AMD.ico │ │ └── amd_logo_black.png │ ├── premake │ │ ├── premake5.lua │ │ └── premake5_minimal.lua │ └── src │ │ ├── AMD_Mesh.cpp │ │ ├── AMD_Mesh.h │ │ ├── Geometry.cpp │ │ ├── Geometry.h │ │ ├── HUD.cpp │ │ ├── HUD.h │ │ ├── HelperFunctions.cpp │ │ ├── HelperFunctions.h │ │ ├── LineRender.cpp │ │ ├── LineRender.h │ │ ├── Magnify.cpp │ │ ├── Magnify.h │ │ ├── MagnifyTool.cpp │ │ ├── MagnifyTool.h │ │ ├── ShaderCache.cpp │ │ ├── ShaderCache.h │ │ ├── ShaderCacheSampleHelper.cpp │ │ ├── Shaders │ │ ├── Line.hlsl │ │ └── Sprite.hlsl │ │ ├── Sprite.cpp │ │ ├── Sprite.h │ │ ├── Timer.cpp │ │ ├── Timer.h │ │ ├── crc.cpp │ │ └── crc.h │ └── dxut │ ├── .gitattributes │ ├── .gitignore │ ├── Core │ ├── DDSTextureLoader.cpp │ ├── DDSTextureLoader.h │ ├── DXUT.cpp │ ├── DXUT.h │ ├── DXUTDevice11.cpp │ ├── DXUTDevice11.h │ ├── DXUT_2015.vcxproj │ ├── DXUT_2017.vcxproj │ ├── DXUTmisc.cpp │ ├── DXUTmisc.h │ ├── ScreenGrab.cpp │ ├── ScreenGrab.h │ ├── WICTextureLoader.cpp │ ├── WICTextureLoader.h │ ├── dxerr.cpp │ ├── dxerr.h │ └── premake5.lua │ ├── MIT.txt │ ├── Optional │ ├── DXUTLockFreePipe.h │ ├── DXUTOpt_2015.vcxproj │ ├── DXUTOpt_2017.vcxproj │ ├── DXUTcamera.cpp │ ├── DXUTcamera.h │ ├── DXUTgui.cpp │ ├── DXUTgui.h │ ├── DXUTguiIME.cpp │ ├── DXUTguiIME.h │ ├── DXUTres.cpp │ ├── DXUTres.h │ ├── DXUTsettingsdlg.cpp │ ├── DXUTsettingsdlg.h │ ├── ImeUi.cpp │ ├── ImeUi.h │ ├── SDKmesh.cpp │ ├── SDKmesh.h │ ├── SDKmisc.cpp │ ├── SDKmisc.h │ ├── directx.ico │ └── premake5.lua │ └── ReadMe.txt └── premake ├── LICENSE.txt ├── amd_premake_util.lua ├── gpuopen_depthoffieldfx_update_vs_files.bat ├── gpuopen_fx_update_vs_files.bat └── premake5.exe /.gitattributes: -------------------------------------------------------------------------------- 1 | # This is a windows-only project. Force CRLF. 2 | * text eol=crlf 3 | 4 | # Explicit settings for specific file types. 5 | *.h eol=crlf 6 | *.hpp eol=crlf 7 | *.inc eol=crlf 8 | *.cpp eol=crlf 9 | *.inl eol=crlf 10 | *.hlsl eol=crlf 11 | *.rc eol=crlf 12 | *.manifest eol=crlf 13 | *.vcxproj eol=crlf 14 | *.filters eol=crlf 15 | *.props eol=crlf 16 | *.sln eol=crlf 17 | *.bat eol=crlf 18 | *.txt eol=crlf 19 | *.lua eol=crlf 20 | *.md eol=crlf 21 | *.py eol=crlf 22 | *.svg eol=crlf 23 | *.mtl eol=crlf 24 | *.pdf binary 25 | *.pps binary 26 | *.ppsx binary 27 | *.ico binary 28 | *.png binary 29 | *.bmp binary 30 | *.dds binary 31 | *.DDS binary 32 | *.sdkmesh binary 33 | *.ply binary 34 | *.obj binary 35 | *.chm binary 36 | *.lib binary 37 | *.dll binary 38 | *.exe binary 39 | 40 | # Ensure precompiled shader files are detected as C++. 41 | # Otherwise, if there are a lot of them, the repo can 42 | # get incorrectly marked as Assembly. 43 | amd_depthoffieldfx/src/Shaders/inc/*.inc linguist-language=C++ 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, etc. 2 | 3 | # User-specific files 4 | *.suo 5 | *.user 6 | 7 | # Build results 8 | VS*/ 9 | [Dd]esktop_*/ 10 | DepthOfFieldFX_Sample_Debug_*.* 11 | DepthOfFieldFX_Sample_Release_*.* 12 | amd_depthoffieldfx/lib/GPUOpen_DepthOfFieldFX_*.* 13 | amd_depthoffieldfx_sample/bin/ 14 | 15 | # Visual Studo 2015 cache/options directory 16 | .vs/ 17 | 18 | # Visual C++ cache files 19 | ipch/ 20 | *.aps 21 | *.ncb 22 | *.opensdf 23 | *.sdf 24 | *.cachefile 25 | *.opendb 26 | *.VC.db 27 | 28 | # Visual Studio profiler 29 | *.psess 30 | *.vsp 31 | *.vspx 32 | 33 | # Installshield output folder 34 | [Ee]xpress/ 35 | 36 | # Backup & report files from converting an old project file 37 | # to a newer Visual Studio version. Backup files are not needed, 38 | # because we have git ;-) 39 | _UpgradeReport_Files/ 40 | Backup*/ 41 | UpgradeLog*.XML 42 | UpgradeLog*.htm 43 | 44 | # Shader cache 45 | [Bb]in/Shaders/ 46 | HashDigest.html 47 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AMD DepthOfFieldFX 2 | 3 | ![AMD DepthOfFieldFX](http://gpuopen-effects.github.io/media/effects/depthoffieldfx_thumbnail.png) 4 | 5 | The DepthOfFieldFX library provides a GCN-optimized Compute Shader implementation of Depth of Field using the Fast Filter Spreading approach put forth by Todd Jerome Kosloff, Justin Hensley, and Brian A. Barsky in their 2009 paper – *Fast Filter Spreading and its Applications*. 6 | 7 |
8 | Latest release 9 |
10 | 11 | The library implements depth of field using a Bartlett and Box filter. There is an option to run the Bartlett at quarter resolution for improved performance in some cases. The advantage of this approach is a fixed performance cost that is not dependent on kernel size. The library takes the scene Color Buffer and Circle of Confusion buffer as input and an Unordered Access View for the final results. 12 | 13 | ### Prerequisites 14 | * AMD Radeon™ GCN-based GPU (HD 7000 series or newer) 15 | * Or other DirectX® 11 compatible discrete GPU with Shader Model 5 support 16 | * 64-bit Windows® 7 (SP1 with the [Platform Update](https://msdn.microsoft.com/en-us/library/windows/desktop/jj863687.aspx)), Windows® 8.1, or Windows® 10 17 | * Visual Studio® 2015 or Visual Studio® 2017 18 | 19 | ### Getting started 20 | * Visual Studio solutions for VS2015 and VS2017 can be found in the `amd_depthoffieldfx_sample\build` directory. 21 | * There are also solutions for just the core library in the `amd_depthoffieldfx\build` directory. 22 | * Additional documentation is available in the `amd_depthoffieldfx\doc` directory. 23 | 24 | ### Premake 25 | The Visual Studio solutions and projects in this repo were generated with Premake. If you need to regenerate the Visual Studio files, double-click on `gpuopen_geometryfx_update_vs_files.bat` in the `premake` directory. 26 | 27 | For Visual Studio 2015 and 2017, this version of Premake adds the `WindowsTargetPlatformVersion` element to the project file to specify which version of the Windows SDK will be used. To change `WindowsTargetPlatformVersion` for Visual Studio 2015 and 2017, change the value for `_AMD_WIN_SDK_VERSION` in `premake\amd_premake_util.lua` and regenerate the Visual Studio files. 28 | 29 | ### Third-Party Software 30 | * DXUT is distributed under the terms of the MIT License. See `framework\d3d11\dxut\MIT.txt`. 31 | * Premake is distributed under the terms of the BSD License. See `premake\LICENSE.txt`. 32 | 33 | DXUT is only used by the sample, not the core library. Only first-party software (specifically `amd_depthoffieldfx` and `amd_lib`) is needed to build the DepthOfFieldFX library. 34 | 35 | ### Attribution 36 | * AMD, the AMD Arrow logo, Radeon, and combinations thereof are either registered trademarks or trademarks of Advanced Micro Devices, Inc. in the United States and/or other countries. 37 | * Microsoft, DirectX, Visual Studio, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. 38 | -------------------------------------------------------------------------------- /amd_depthoffieldfx/build/AMD_DepthOfFieldFX_2015.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AMD_DepthOfFieldFX", "AMD_DepthOfFieldFX_2015.vcxproj", "{9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | DLL_Debug|Win32 = DLL_Debug|Win32 9 | DLL_Debug|x64 = DLL_Debug|x64 10 | DLL_Release_MT|Win32 = DLL_Release_MT|Win32 11 | DLL_Release_MT|x64 = DLL_Release_MT|x64 12 | DLL_Release|Win32 = DLL_Release|Win32 13 | DLL_Release|x64 = DLL_Release|x64 14 | Lib_Debug|Win32 = Lib_Debug|Win32 15 | Lib_Debug|x64 = Lib_Debug|x64 16 | Lib_Release|Win32 = Lib_Release|Win32 17 | Lib_Release|x64 = Lib_Release|x64 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Debug|Win32.ActiveCfg = DLL_Debug|Win32 21 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Debug|Win32.Build.0 = DLL_Debug|Win32 22 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Debug|x64.ActiveCfg = DLL_Debug|x64 23 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Debug|x64.Build.0 = DLL_Debug|x64 24 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release_MT|Win32.ActiveCfg = DLL_Release_MT|Win32 25 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release_MT|Win32.Build.0 = DLL_Release_MT|Win32 26 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release_MT|x64.ActiveCfg = DLL_Release_MT|x64 27 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release_MT|x64.Build.0 = DLL_Release_MT|x64 28 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release|Win32.ActiveCfg = DLL_Release|Win32 29 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release|Win32.Build.0 = DLL_Release|Win32 30 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release|x64.ActiveCfg = DLL_Release|x64 31 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release|x64.Build.0 = DLL_Release|x64 32 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Debug|Win32.ActiveCfg = Lib_Debug|Win32 33 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Debug|Win32.Build.0 = Lib_Debug|Win32 34 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Debug|x64.ActiveCfg = Lib_Debug|x64 35 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Debug|x64.Build.0 = Lib_Debug|x64 36 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Release|Win32.ActiveCfg = Lib_Release|Win32 37 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Release|Win32.Build.0 = Lib_Release|Win32 38 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Release|x64.ActiveCfg = Lib_Release|x64 39 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Release|x64.Build.0 = Lib_Release|x64 40 | EndGlobalSection 41 | GlobalSection(SolutionProperties) = preSolution 42 | HideSolutionNode = FALSE 43 | EndGlobalSection 44 | EndGlobal 45 | -------------------------------------------------------------------------------- /amd_depthoffieldfx/build/AMD_DepthOfFieldFX_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {1F80880B-8B89-887C-1405-9F7C800D947C} 6 | 7 | 8 | {2DAB880B-99B4-887C-2230-9F7C8E38947C} 9 | 10 | 11 | {06ADC7FB-7262-40F1-FB56-3AC8670B37F5} 12 | 13 | 14 | 15 | 16 | inc 17 | 18 | 19 | src 20 | 21 | 22 | src 23 | 24 | 25 | 26 | 27 | src 28 | 29 | 30 | src 31 | 32 | 33 | 34 | 35 | src\Shaders 36 | 37 | 38 | -------------------------------------------------------------------------------- /amd_depthoffieldfx/build/AMD_DepthOfFieldFX_2017.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AMD_DepthOfFieldFX", "AMD_DepthOfFieldFX_2017.vcxproj", "{9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | DLL_Debug|Win32 = DLL_Debug|Win32 9 | DLL_Debug|x64 = DLL_Debug|x64 10 | DLL_Release_MT|Win32 = DLL_Release_MT|Win32 11 | DLL_Release_MT|x64 = DLL_Release_MT|x64 12 | DLL_Release|Win32 = DLL_Release|Win32 13 | DLL_Release|x64 = DLL_Release|x64 14 | Lib_Debug|Win32 = Lib_Debug|Win32 15 | Lib_Debug|x64 = Lib_Debug|x64 16 | Lib_Release|Win32 = Lib_Release|Win32 17 | Lib_Release|x64 = Lib_Release|x64 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Debug|Win32.ActiveCfg = DLL_Debug|Win32 21 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Debug|Win32.Build.0 = DLL_Debug|Win32 22 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Debug|x64.ActiveCfg = DLL_Debug|x64 23 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Debug|x64.Build.0 = DLL_Debug|x64 24 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release_MT|Win32.ActiveCfg = DLL_Release_MT|Win32 25 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release_MT|Win32.Build.0 = DLL_Release_MT|Win32 26 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release_MT|x64.ActiveCfg = DLL_Release_MT|x64 27 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release_MT|x64.Build.0 = DLL_Release_MT|x64 28 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release|Win32.ActiveCfg = DLL_Release|Win32 29 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release|Win32.Build.0 = DLL_Release|Win32 30 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release|x64.ActiveCfg = DLL_Release|x64 31 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.DLL_Release|x64.Build.0 = DLL_Release|x64 32 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Debug|Win32.ActiveCfg = Lib_Debug|Win32 33 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Debug|Win32.Build.0 = Lib_Debug|Win32 34 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Debug|x64.ActiveCfg = Lib_Debug|x64 35 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Debug|x64.Build.0 = Lib_Debug|x64 36 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Release|Win32.ActiveCfg = Lib_Release|Win32 37 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Release|Win32.Build.0 = Lib_Release|Win32 38 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Release|x64.ActiveCfg = Lib_Release|x64 39 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Lib_Release|x64.Build.0 = Lib_Release|x64 40 | EndGlobalSection 41 | GlobalSection(SolutionProperties) = preSolution 42 | HideSolutionNode = FALSE 43 | EndGlobalSection 44 | EndGlobal 45 | -------------------------------------------------------------------------------- /amd_depthoffieldfx/build/AMD_DepthOfFieldFX_2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {1F80880B-8B89-887C-1405-9F7C800D947C} 6 | 7 | 8 | {2DAB880B-99B4-887C-2230-9F7C8E38947C} 9 | 10 | 11 | {06ADC7FB-7262-40F1-FB56-3AC8670B37F5} 12 | 13 | 14 | 15 | 16 | inc 17 | 18 | 19 | src 20 | 21 | 22 | src 23 | 24 | 25 | 26 | 27 | src 28 | 29 | 30 | src 31 | 32 | 33 | 34 | 35 | src\Shaders 36 | 37 | 38 | -------------------------------------------------------------------------------- /amd_depthoffieldfx/doc/GDC2017 - Karl Hillesland - Cinematic Depth of Field.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx/doc/GDC2017 - Karl Hillesland - Cinematic Depth of Field.pdf -------------------------------------------------------------------------------- /amd_depthoffieldfx/inc/AMD_DepthOfFieldFX.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_DEPTHOFFIELDFX_H 24 | #define AMD_DEPTHOFFIELDFX_H 25 | 26 | #define AMD_DEPTHOFFIELDFX_VERSION_MAJOR 1 27 | #define AMD_DEPTHOFFIELDFX_VERSION_MINOR 0 28 | #define AMD_DEPTHOFFIELDFX_VERSION_PATCH 0 29 | 30 | // default to static lib 31 | #ifndef AMD_DEPTHOFFIELDFX_COMPILE_DYNAMIC_LIB 32 | #define AMD_DEPTHOFFIELDFX_COMPILE_DYNAMIC_LIB 0 33 | #endif 34 | 35 | #if AMD_DEPTHOFFIELDFX_COMPILE_DYNAMIC_LIB 36 | #ifdef AMD_DLL_EXPORT 37 | #define AMD_DEPTHOFFIELDFX_DLL_API __declspec(dllexport) 38 | #else 39 | #define AMD_DEPTHOFFIELDFX_DLL_API __declspec(dllimport) 40 | #endif 41 | #else // AMD_DEPTHOFFIELD_COMPILE_DYNAMIC_LIB 42 | #define AMD_DEPTHOFFIELDFX_DLL_API 43 | #endif // AMD_DEPTHOFFIELD_COMPILE_DYNAMIC_LIB 44 | 45 | #include "AMD_Types.h" 46 | 47 | namespace AMD { 48 | enum DEPTHOFFIELDFX_RETURN_CODE 49 | { 50 | DEPTHOFFIELDFX_RETURN_CODE_SUCCESS, 51 | DEPTHOFFIELDFX_RETURN_CODE_FAIL, 52 | DEPTHOFFIELDFX_RETURN_CODE_INVALID_PARAMS, 53 | DEPTHOFFIELDFX_RETURN_CODE_INVALID_DEVICE, 54 | DEPTHOFFIELDFX_RETURN_CODE_INVALID_DEVICE_CONTEXT, 55 | DEPTHOFFIELDFX_RETURN_CODE_INVALID_SURFACE, 56 | }; 57 | 58 | struct DEPTHOFFIELDFX_OPAQUE_DESC; 59 | 60 | struct DEPTHOFFIELDFX_DESC 61 | { 62 | /** 63 | FX Modules share a variety of trivial types such as vectors and 64 | camera structures. These types are declared inside an FX descriptor 65 | in order to avoid any collisions between different modules or app types. 66 | */ 67 | #pragma warning(push) 68 | #pragma warning(disable : 4201) // suppress nameless struct/union level 4 warnings 69 | AMD_DECLARE_BASIC_VECTOR_TYPE; 70 | #pragma warning(pop) 71 | AMD_DECLARE_CAMERA_TYPE; 72 | 73 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_DESC(); 74 | 75 | uint2 m_screenSize; 76 | uint m_scaleFactor; 77 | uint m_maxBlurRadius; 78 | 79 | ID3D11Device* m_pDevice; 80 | ID3D11DeviceContext* m_pDeviceContext; 81 | 82 | ID3D11ShaderResourceView* m_pCircleOfConfusionSRV; 83 | ID3D11ShaderResourceView* m_pColorSRV; 84 | ID3D11UnorderedAccessView* m_pResultUAV; 85 | 86 | DEPTHOFFIELDFX_OPAQUE_DESC* m_pOpaque; 87 | 88 | private: 89 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_DESC(const DEPTHOFFIELDFX_DESC&); 90 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_DESC& operator=(const DEPTHOFFIELDFX_DESC&); 91 | }; 92 | 93 | 94 | /** 95 | Get DepthOfFieldFX library version number 96 | This can be called before DEPTHOFFIELDFX_Initialize 97 | */ 98 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_GetVersion(uint* major, uint* minor, uint* patch); 99 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_Initialize(const DEPTHOFFIELDFX_DESC& desc); 100 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_Resize(const DEPTHOFFIELDFX_DESC& desc); 101 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_Render(const DEPTHOFFIELDFX_DESC& desc); 102 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_RenderQuarterRes(const DEPTHOFFIELDFX_DESC& desc); 103 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_RenderBox(const DEPTHOFFIELDFX_DESC& desc); 104 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_Release(const DEPTHOFFIELDFX_DESC& desc); 105 | } 106 | 107 | #endif // AMD_DEPTHOFFIELD_H 108 | -------------------------------------------------------------------------------- /amd_depthoffieldfx/premake/premake5.lua: -------------------------------------------------------------------------------- 1 | _AMD_LIBRARY_NAME = "DepthOfFieldFX" 2 | _AMD_LIBRARY_NAME_ALL_CAPS = string.upper(_AMD_LIBRARY_NAME) 3 | 4 | -- Set _AMD_LIBRARY_NAME before including amd_premake_util.lua 5 | dofile ("../../premake/amd_premake_util.lua") 6 | 7 | workspace ("AMD_" .. _AMD_LIBRARY_NAME) 8 | configurations { "DLL_Debug", "DLL_Release", "Lib_Debug", "Lib_Release", "DLL_Release_MT" } 9 | platforms { "Win32", "x64" } 10 | location "../build" 11 | filename ("AMD_" .. _AMD_LIBRARY_NAME .. _AMD_VS_SUFFIX) 12 | startproject ("AMD_" .. _AMD_LIBRARY_NAME) 13 | 14 | filter "platforms:Win32" 15 | system "Windows" 16 | architecture "x86" 17 | 18 | filter "platforms:x64" 19 | system "Windows" 20 | architecture "x64" 21 | 22 | project ("AMD_" .. _AMD_LIBRARY_NAME) 23 | language "C++" 24 | characterset "Unicode" 25 | location "../build" 26 | filename ("AMD_" .. _AMD_LIBRARY_NAME .. _AMD_VS_SUFFIX) 27 | uuid "9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD" 28 | targetdir "../lib/%{_AMD_LIBRARY_DIR_LAYOUT}" 29 | objdir "../build/%{_AMD_LIBRARY_DIR_LAYOUT}" 30 | warnings "Extra" 31 | exceptionhandling "Off" 32 | rtti "Off" 33 | 34 | -- Specify WindowsTargetPlatformVersion here for VS2015 35 | systemversion (_AMD_WIN_SDK_VERSION) 36 | 37 | files { "../inc/**.h", "../src/**.h", "../src/**.cpp", "../src/Shaders/**.hlsl" } 38 | includedirs { "../inc", "../../amd_lib/shared/common/inc" } 39 | 40 | filter "configurations:DLL_*" 41 | kind "SharedLib" 42 | defines { "_USRDLL", "AMD_%{_AMD_LIBRARY_NAME_ALL_CAPS}_COMPILE_DYNAMIC_LIB=1" } 43 | -- Copy DLL and import library to the lib directory 44 | postbuildcommands { amdLibPostbuildCommands() } 45 | postbuildmessage "Copying build output to lib directory..." 46 | 47 | filter "configurations:Lib_*" 48 | kind "StaticLib" 49 | defines { "_LIB", "AMD_%{_AMD_LIBRARY_NAME_ALL_CAPS}_COMPILE_DYNAMIC_LIB=0" } 50 | 51 | filter "configurations:*_Debug" 52 | defines { "WIN32", "_DEBUG", "_WINDOWS", "_WIN32_WINNT=0x0601" } 53 | flags { "FatalWarnings" } 54 | -- add "d" to the end of the library name for debug builds 55 | targetsuffix "d" 56 | symbols "On" 57 | 58 | filter "configurations:*_Release" 59 | defines { "WIN32", "NDEBUG", "_WINDOWS", "_WIN32_WINNT=0x0601" } 60 | flags { "FatalWarnings" } 61 | optimize "On" 62 | 63 | filter "configurations:DLL_Release_MT" 64 | defines { "WIN32", "NDEBUG", "_WINDOWS", "_WIN32_WINNT=0x0601" } 65 | flags { "FatalWarnings" } 66 | -- link against the static runtime to avoid introducing a dependency 67 | -- on the particular version of Visual Studio used to build the DLLs 68 | flags { "StaticRuntime" } 69 | optimize "On" 70 | 71 | filter "action:vs*" 72 | -- specify exception handling model for Visual Studio to avoid 73 | -- "'noexcept' used with no exception handling mode specified" 74 | -- warning in vs2015 75 | buildoptions { "/EHsc" } 76 | 77 | filter "platforms:Win32" 78 | targetname "%{_AMD_LIBRARY_PREFIX}%{_AMD_LIBRARY_NAME}_x86" 79 | 80 | filter "platforms:x64" 81 | targetname "%{_AMD_LIBRARY_PREFIX}%{_AMD_LIBRARY_NAME}_x64" 82 | -------------------------------------------------------------------------------- /amd_depthoffieldfx/src/AMD_DepthOfFieldFX.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | // if the library is being compiled with "DYNAMIC_LIB" option 24 | // it should do dclspec(dllexport) 25 | #if AMD_DEPTHOFFIELDFX_COMPILE_DYNAMIC_LIB 26 | #define AMD_DLL_EXPORT 27 | #endif 28 | 29 | #include 30 | 31 | #include "AMD_DepthOfFieldFX.h" 32 | #include "AMD_DepthOfFieldFX_Opaque.h" 33 | 34 | #pragma warning(disable : 4100) // disable unreference formal parameter warnings for /W4 builds 35 | 36 | namespace AMD { 37 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_DESC::DEPTHOFFIELDFX_DESC() : m_pDevice(nullptr), m_pDeviceContext(nullptr), m_pCircleOfConfusionSRV(nullptr) 38 | { 39 | static DEPTHOFFIELDFX_OPAQUE_DESC opaque(*this); 40 | m_pOpaque = &opaque; 41 | } 42 | 43 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_GetVersion(uint* major, uint* minor, uint* patch) 44 | { 45 | *major = AMD_DEPTHOFFIELDFX_VERSION_MAJOR; 46 | *minor = AMD_DEPTHOFFIELDFX_VERSION_MINOR; 47 | *patch = AMD_DEPTHOFFIELDFX_VERSION_PATCH; 48 | return DEPTHOFFIELDFX_RETURN_CODE_SUCCESS; 49 | } 50 | 51 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_Initialize(const DEPTHOFFIELDFX_DESC& desc) 52 | { 53 | if (nullptr == desc.m_pDevice) 54 | { 55 | return DEPTHOFFIELDFX_RETURN_CODE_INVALID_DEVICE; 56 | } 57 | if (nullptr == desc.m_pDeviceContext) 58 | { 59 | return DEPTHOFFIELDFX_RETURN_CODE_INVALID_DEVICE_CONTEXT; 60 | } 61 | 62 | desc.m_pOpaque->initalize(desc); 63 | 64 | return DEPTHOFFIELDFX_RETURN_CODE_SUCCESS; 65 | } 66 | 67 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_Resize(const DEPTHOFFIELDFX_DESC& desc) 68 | { 69 | DEPTHOFFIELDFX_RETURN_CODE result = DEPTHOFFIELDFX_RETURN_CODE_SUCCESS; 70 | if ((desc.m_screenSize.x > 16384) 71 | || (desc.m_screenSize.y > 16384) 72 | || (desc.m_maxBlurRadius > 64)) 73 | { 74 | result = DEPTHOFFIELDFX_RETURN_CODE_INVALID_PARAMS; 75 | } 76 | else 77 | { 78 | result = desc.m_pOpaque->resize(desc); 79 | } 80 | return result; 81 | } 82 | 83 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_Render(const DEPTHOFFIELDFX_DESC& desc) 84 | { 85 | DEPTHOFFIELDFX_RETURN_CODE result = desc.m_pOpaque->render(desc); 86 | return result; 87 | } 88 | 89 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_RenderQuarterRes(const DEPTHOFFIELDFX_DESC& desc) 90 | { 91 | DEPTHOFFIELDFX_RETURN_CODE result = desc.m_pOpaque->render_quarter_res(desc); 92 | return result; 93 | } 94 | 95 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_RenderBox(const DEPTHOFFIELDFX_DESC& desc) 96 | { 97 | DEPTHOFFIELDFX_RETURN_CODE result = desc.m_pOpaque->render_box(desc); 98 | return result; 99 | } 100 | 101 | AMD_DEPTHOFFIELDFX_DLL_API DEPTHOFFIELDFX_RETURN_CODE DepthOfFieldFX_Release(const DEPTHOFFIELDFX_DESC& desc) 102 | { 103 | DEPTHOFFIELDFX_RETURN_CODE result = desc.m_pOpaque->release(); 104 | return result; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /amd_depthoffieldfx/src/AMD_DepthOfFieldFX_Opaque.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_DEPTHOFFIELDFX_OPAQUE_H 24 | #define AMD_DEPTHOFFIELDFX_OPAQUE_H 25 | 26 | #include "AMD_DepthOfFieldFX.h" 27 | 28 | #pragma warning(disable : 4127) // disable conditional expression is constant warnings 29 | 30 | namespace AMD { 31 | struct DEPTHOFFIELDFX_OPAQUE_DESC 32 | { 33 | public: 34 | #pragma warning(push) 35 | #pragma warning(disable : 4201) // suppress nameless struct/union level 4 warnings 36 | AMD_DECLARE_BASIC_VECTOR_TYPE; 37 | #pragma warning(pop) 38 | DEPTHOFFIELDFX_OPAQUE_DESC(const DEPTHOFFIELDFX_DESC& desc); 39 | 40 | DEPTHOFFIELDFX_RETURN_CODE initalize(const DEPTHOFFIELDFX_DESC& desc); 41 | DEPTHOFFIELDFX_RETURN_CODE resize(const DEPTHOFFIELDFX_DESC& desc); 42 | DEPTHOFFIELDFX_RETURN_CODE render(const DEPTHOFFIELDFX_DESC& desc); 43 | DEPTHOFFIELDFX_RETURN_CODE render_quarter_res(const DEPTHOFFIELDFX_DESC& desc); 44 | DEPTHOFFIELDFX_RETURN_CODE render_box(const DEPTHOFFIELDFX_DESC& desc); 45 | DEPTHOFFIELDFX_RETURN_CODE release(); 46 | 47 | DEPTHOFFIELDFX_RETURN_CODE create_shaders(const DEPTHOFFIELDFX_DESC& desc); 48 | static DEPTHOFFIELDFX_RETURN_CODE convert_result(HRESULT hResult); 49 | 50 | BOOL update_constant_buffer(const DEPTHOFFIELDFX_DESC& desc, uint padWidth, uint padHeight); 51 | void Bind_UAVs(const DEPTHOFFIELDFX_DESC& desc, ID3D11UnorderedAccessView* pUAV0, ID3D11UnorderedAccessView* pUAV1, ID3D11UnorderedAccessView* pUAV2); 52 | 53 | 54 | uint m_padding; 55 | uint m_bufferWidth; 56 | uint m_bufferHeight; 57 | 58 | ID3D11Buffer* m_pIntermediateBuffer; 59 | ID3D11Buffer* m_pIntermediateBufferTransposed; 60 | ID3D11UnorderedAccessView* m_pIntermediateUAV; 61 | ID3D11UnorderedAccessView* m_pIntermediateTransposedUAV; 62 | ID3D11Buffer* m_pDofParamsCB; 63 | ID3D11SamplerState* m_pPointSampler; 64 | 65 | ID3D11ComputeShader* m_pFastFilterSetupCS; 66 | ID3D11ComputeShader* m_pFastFilterSetupQuarterResCS; 67 | ID3D11ComputeShader* m_pBoxFastFilterSetupCS; 68 | ID3D11ComputeShader* m_pReadFinalResultCS; 69 | ID3D11ComputeShader* m_pVerticalIntegrateCS; 70 | ID3D11ComputeShader* m_pDoubleVerticalIntegrateCS; 71 | }; 72 | }; 73 | 74 | #endif // ndef AMD_DEPTHOFFIELDFX_OPAQUE_H 75 | -------------------------------------------------------------------------------- /amd_depthoffieldfx/src/AMD_DepthOfFieldFX_Precompiled.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #pragma once 24 | 25 | #include "Shaders\inc\CS_BOX_FAST_FILTER_SETUP.inc" 26 | #include "Shaders\inc\CS_DOUBLE_VERTICAL_INTEGRATE.inc" 27 | #include "Shaders\inc\CS_FAST_FILTER_SETUP.inc" 28 | #include "Shaders\inc\CS_FAST_FILTER_SETUP_QUARTER_RES.inc" 29 | #include "Shaders\inc\CS_READ_FINAL_RESULT.inc" 30 | #include "Shaders\inc\CS_VERTICAL_INTEGRATE.inc" 31 | -------------------------------------------------------------------------------- /amd_depthoffieldfx/src/Shaders/build/fxc_compile_depthoffieldfx_all.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | SET FXC_COMPILE_CS=fxc.exe /nologo /T cs_5_0 /O3 3 | 4 | echo Compiling DepthOfFieldFX_FastFilterDOF.hlsl 5 | %FXC_COMPILE_CS% /E FastFilterSetup /Vn g_csFastFilterSetup ..\DepthOfFieldFX_FastFilterDOF.hlsl /Fh ..\inc\CS_FAST_FILTER_SETUP.inc 6 | %FXC_COMPILE_CS% /E QuarterResFastFilterSetup /Vn g_csFastFilterSetupQuarterRes ..\DepthOfFieldFX_FastFilterDOF.hlsl /Fh ..\inc\CS_FAST_FILTER_SETUP_QUARTER_RES.inc 7 | %FXC_COMPILE_CS% /E BoxFastFilterSetup /Vn g_csBoxFastFilterSetup ..\DepthOfFieldFX_FastFilterDOF.hlsl /Fh ..\inc\CS_BOX_FAST_FILTER_SETUP.inc 8 | %FXC_COMPILE_CS% /E VerticalIntegrate /Vn g_csDoubleVerticalIntegrate ..\DepthOfFieldFX_FastFilterDOF.hlsl /Fh ..\inc\CS_DOUBLE_VERTICAL_INTEGRATE.inc 9 | %FXC_COMPILE_CS% /E VerticalIntegrate /Vn g_csVerticalIntegrate ..\DepthOfFieldFX_FastFilterDOF.hlsl /Fh ..\inc\CS_VERTICAL_INTEGRATE.inc /DDOUBLE_INTEGRATE=0 10 | %FXC_COMPILE_CS% /E ReadFinalResult /Vn g_csReadFinalResult ..\DepthOfFieldFX_FastFilterDOF.hlsl /Fh ..\inc\CS_READ_FINAL_RESULT.inc 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/build/DepthOfFieldFX_Sample_2015.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DepthOfFieldFX_Sample", "DepthOfFieldFX_Sample_2015.vcxproj", "{F20ABDC5-DD39-4F30-BAC0-D4D093A2A131}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AMD_DepthOfFieldFX", "..\..\AMD_DepthOfFieldFX\build\AMD_DepthOfFieldFX_2015.vcxproj", "{9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AMD_LIB_Minimal", "..\..\amd_lib\shared\d3d11\build\AMD_LIB_Minimal_2015.vcxproj", "{0D2AEA47-7909-69E3-8221-F4B9EE7FCF44}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AMD_SDK_Minimal", "..\..\framework\d3d11\amd_sdk\build\AMD_SDK_Minimal_2015.vcxproj", "{EBB939DC-98E4-49DF-B1F1-D2E80A11F60A}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DXUT", "..\..\framework\d3d11\dxut\Core\DXUT_2015.vcxproj", "{85344B7F-5AA0-4E12-A065-D1333D11F6CA}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DXUTOpt", "..\..\framework\d3d11\dxut\Optional\DXUTOpt_2015.vcxproj", "{61B333C2-C4F7-4CC1-A9BF-83F6D95588EB}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|x64 = Debug|x64 19 | Release|x64 = Release|x64 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {F20ABDC5-DD39-4F30-BAC0-D4D093A2A131}.Debug|x64.ActiveCfg = Debug|x64 23 | {F20ABDC5-DD39-4F30-BAC0-D4D093A2A131}.Debug|x64.Build.0 = Debug|x64 24 | {F20ABDC5-DD39-4F30-BAC0-D4D093A2A131}.Release|x64.ActiveCfg = Release|x64 25 | {F20ABDC5-DD39-4F30-BAC0-D4D093A2A131}.Release|x64.Build.0 = Release|x64 26 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Debug|x64.ActiveCfg = DLL_Debug|x64 27 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Debug|x64.Build.0 = DLL_Debug|x64 28 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Release|x64.ActiveCfg = DLL_Release|x64 29 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Release|x64.Build.0 = DLL_Release|x64 30 | {0D2AEA47-7909-69E3-8221-F4B9EE7FCF44}.Debug|x64.ActiveCfg = Debug|x64 31 | {0D2AEA47-7909-69E3-8221-F4B9EE7FCF44}.Debug|x64.Build.0 = Debug|x64 32 | {0D2AEA47-7909-69E3-8221-F4B9EE7FCF44}.Release|x64.ActiveCfg = Release|x64 33 | {0D2AEA47-7909-69E3-8221-F4B9EE7FCF44}.Release|x64.Build.0 = Release|x64 34 | {EBB939DC-98E4-49DF-B1F1-D2E80A11F60A}.Debug|x64.ActiveCfg = Debug|x64 35 | {EBB939DC-98E4-49DF-B1F1-D2E80A11F60A}.Debug|x64.Build.0 = Debug|x64 36 | {EBB939DC-98E4-49DF-B1F1-D2E80A11F60A}.Release|x64.ActiveCfg = Release|x64 37 | {EBB939DC-98E4-49DF-B1F1-D2E80A11F60A}.Release|x64.Build.0 = Release|x64 38 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA}.Debug|x64.ActiveCfg = Debug|x64 39 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA}.Debug|x64.Build.0 = Debug|x64 40 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA}.Release|x64.ActiveCfg = Release|x64 41 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA}.Release|x64.Build.0 = Release|x64 42 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB}.Debug|x64.ActiveCfg = Debug|x64 43 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB}.Debug|x64.Build.0 = Debug|x64 44 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB}.Release|x64.ActiveCfg = Release|x64 45 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB}.Release|x64.Build.0 = Release|x64 46 | EndGlobalSection 47 | GlobalSection(SolutionProperties) = preSolution 48 | HideSolutionNode = FALSE 49 | EndGlobalSection 50 | EndGlobal 51 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/build/DepthOfFieldFX_Sample_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {00A967FA-6C69-E330-35A4-2CAEA123280D} 6 | 7 | 8 | {EFAC8DF2-5B8C-0C8E-64A4-9764D00273EF} 9 | 10 | 11 | 12 | 13 | 14 | ResourceFiles 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ResourceFiles 23 | 24 | 25 | Shaders 26 | 27 | 28 | Shaders 29 | 30 | 31 | 32 | 33 | ResourceFiles 34 | 35 | 36 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/build/DepthOfFieldFX_Sample_2017.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DepthOfFieldFX_Sample", "DepthOfFieldFX_Sample_2017.vcxproj", "{F20ABDC5-DD39-4F30-BAC0-D4D093A2A131}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AMD_DepthOfFieldFX", "..\..\AMD_DepthOfFieldFX\build\AMD_DepthOfFieldFX_2017.vcxproj", "{9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AMD_LIB_Minimal", "..\..\amd_lib\shared\d3d11\build\AMD_LIB_Minimal_2017.vcxproj", "{0D2AEA47-7909-69E3-8221-F4B9EE7FCF44}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AMD_SDK_Minimal", "..\..\framework\d3d11\amd_sdk\build\AMD_SDK_Minimal_2017.vcxproj", "{EBB939DC-98E4-49DF-B1F1-D2E80A11F60A}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DXUT", "..\..\framework\d3d11\dxut\Core\DXUT_2017.vcxproj", "{85344B7F-5AA0-4E12-A065-D1333D11F6CA}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DXUTOpt", "..\..\framework\d3d11\dxut\Optional\DXUTOpt_2017.vcxproj", "{61B333C2-C4F7-4CC1-A9BF-83F6D95588EB}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|x64 = Debug|x64 19 | Release|x64 = Release|x64 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {F20ABDC5-DD39-4F30-BAC0-D4D093A2A131}.Debug|x64.ActiveCfg = Debug|x64 23 | {F20ABDC5-DD39-4F30-BAC0-D4D093A2A131}.Debug|x64.Build.0 = Debug|x64 24 | {F20ABDC5-DD39-4F30-BAC0-D4D093A2A131}.Release|x64.ActiveCfg = Release|x64 25 | {F20ABDC5-DD39-4F30-BAC0-D4D093A2A131}.Release|x64.Build.0 = Release|x64 26 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Debug|x64.ActiveCfg = DLL_Debug|x64 27 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Debug|x64.Build.0 = DLL_Debug|x64 28 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Release|x64.ActiveCfg = DLL_Release|x64 29 | {9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD}.Release|x64.Build.0 = DLL_Release|x64 30 | {0D2AEA47-7909-69E3-8221-F4B9EE7FCF44}.Debug|x64.ActiveCfg = Debug|x64 31 | {0D2AEA47-7909-69E3-8221-F4B9EE7FCF44}.Debug|x64.Build.0 = Debug|x64 32 | {0D2AEA47-7909-69E3-8221-F4B9EE7FCF44}.Release|x64.ActiveCfg = Release|x64 33 | {0D2AEA47-7909-69E3-8221-F4B9EE7FCF44}.Release|x64.Build.0 = Release|x64 34 | {EBB939DC-98E4-49DF-B1F1-D2E80A11F60A}.Debug|x64.ActiveCfg = Debug|x64 35 | {EBB939DC-98E4-49DF-B1F1-D2E80A11F60A}.Debug|x64.Build.0 = Debug|x64 36 | {EBB939DC-98E4-49DF-B1F1-D2E80A11F60A}.Release|x64.ActiveCfg = Release|x64 37 | {EBB939DC-98E4-49DF-B1F1-D2E80A11F60A}.Release|x64.Build.0 = Release|x64 38 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA}.Debug|x64.ActiveCfg = Debug|x64 39 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA}.Debug|x64.Build.0 = Debug|x64 40 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA}.Release|x64.ActiveCfg = Release|x64 41 | {85344B7F-5AA0-4E12-A065-D1333D11F6CA}.Release|x64.Build.0 = Release|x64 42 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB}.Debug|x64.ActiveCfg = Debug|x64 43 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB}.Debug|x64.Build.0 = Debug|x64 44 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB}.Release|x64.ActiveCfg = Release|x64 45 | {61B333C2-C4F7-4CC1-A9BF-83F6D95588EB}.Release|x64.Build.0 = Release|x64 46 | EndGlobalSection 47 | GlobalSection(SolutionProperties) = preSolution 48 | HideSolutionNode = FALSE 49 | EndGlobalSection 50 | EndGlobal 51 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/build/DepthOfFieldFX_Sample_2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {00A967FA-6C69-E330-35A4-2CAEA123280D} 6 | 7 | 8 | {EFAC8DF2-5B8C-0C8E-64A4-9764D00273EF} 9 | 10 | 11 | 12 | 13 | 14 | ResourceFiles 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ResourceFiles 23 | 24 | 25 | Shaders 26 | 27 | 28 | Shaders 29 | 30 | 31 | 32 | 33 | ResourceFiles 34 | 35 | 36 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/Thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/Thumbnail.png -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/readme.txt: -------------------------------------------------------------------------------- 1 | The media files in the tank and ui subfolders are from the Microsoft DirectX SDK Samples: 2 | https://github.com/walbourn/directx-sdk-samples 3 | 4 | (The files in tank are from the softparticles media folder in the Microsoft DirectX SDK Samples.) 5 | 6 | They are distributed under the terms of the MIT License. -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/MIT.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft Corp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | software and associated documentation files (the "Software"), to deal in the Software 7 | without restriction, including without limitation the rights to use, copy, modify, 8 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies 13 | or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 17 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 19 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 20 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/TankScene.sdkmesh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/TankScene.sdkmesh -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/colorgradient.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/colorgradient.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/desert_sky.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/desert_sky.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/desertsky.sdkmesh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/desertsky.sdkmesh -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/ground_diff.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/ground_diff.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/ground_norm.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/ground_norm.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/left_engine_diff.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/left_engine_diff.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/left_engine_norm.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/left_engine_norm.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/smokevol1.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/smokevol1.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/turret_diff.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/turret_diff.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/tank/turret_norm.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/tank/turret_norm.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/ui/Font.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/ui/Font.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/ui/MIT.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft Corp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | software and associated documentation files (the "Software"), to deal in the Software 7 | without restriction, including without limitation the rights to use, copy, modify, 8 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies 13 | or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 17 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 19 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 20 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/media/ui/dxutcontrols.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_depthoffieldfx_sample/media/ui/dxutcontrols.dds -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/premake/premake5.lua: -------------------------------------------------------------------------------- 1 | _AMD_LIBRARY_NAME = "DepthOfFieldFX" 2 | _AMD_LIBRARY_NAME_ALL_CAPS = string.upper(_AMD_LIBRARY_NAME) 3 | 4 | -- Set _AMD_LIBRARY_NAME before including amd_premake_util.lua 5 | dofile ("../../premake/amd_premake_util.lua") 6 | 7 | workspace (_AMD_LIBRARY_NAME .. "_Sample") 8 | configurations { "Debug", "Release" } 9 | platforms { "x64" } 10 | location "../build" 11 | filename (_AMD_LIBRARY_NAME .. "_Sample" .. _AMD_VS_SUFFIX) 12 | startproject (_AMD_LIBRARY_NAME .. "_Sample") 13 | 14 | filter "platforms:x64" 15 | system "Windows" 16 | architecture "x64" 17 | 18 | externalproject ("AMD_" .. _AMD_LIBRARY_NAME) 19 | kind "SharedLib" 20 | language "C++" 21 | location "../../AMD_%{_AMD_LIBRARY_NAME}/build" 22 | filename ("AMD_" .. _AMD_LIBRARY_NAME .. _AMD_VS_SUFFIX) 23 | uuid "9F90CCF8-1A71-4E96-9825-10D2C0EBDFBD" 24 | configmap { 25 | ["Debug"] = "DLL_Debug", 26 | ["Release"] = "DLL_Release" } 27 | 28 | externalproject "AMD_LIB_Minimal" 29 | kind "StaticLib" 30 | language "C++" 31 | location "../../amd_lib/shared/d3d11/build" 32 | filename ("AMD_LIB_Minimal" .. _AMD_VS_SUFFIX) 33 | uuid "0D2AEA47-7909-69E3-8221-F4B9EE7FCF44" 34 | 35 | externalproject "AMD_SDK_Minimal" 36 | kind "StaticLib" 37 | language "C++" 38 | location "../../framework/d3d11/amd_sdk/build" 39 | filename ("AMD_SDK_Minimal" .. _AMD_VS_SUFFIX) 40 | uuid "EBB939DC-98E4-49DF-B1F1-D2E80A11F60A" 41 | 42 | externalproject "DXUT" 43 | kind "StaticLib" 44 | language "C++" 45 | location "../../framework/d3d11/dxut/Core" 46 | filename ("DXUT" .. _AMD_VS_SUFFIX) 47 | uuid "85344B7F-5AA0-4E12-A065-D1333D11F6CA" 48 | 49 | externalproject "DXUTOpt" 50 | kind "StaticLib" 51 | language "C++" 52 | location "../../framework/d3d11/dxut/Optional" 53 | filename ("DXUTOpt" .. _AMD_VS_SUFFIX) 54 | uuid "61B333C2-C4F7-4CC1-A9BF-83F6D95588EB" 55 | 56 | project (_AMD_LIBRARY_NAME .. "_Sample") 57 | kind "WindowedApp" 58 | language "C++" 59 | characterset "Unicode" 60 | location "../build" 61 | filename (_AMD_LIBRARY_NAME .. "_Sample" .. _AMD_VS_SUFFIX) 62 | uuid "F20ABDC5-DD39-4F30-BAC0-D4D093A2A131" 63 | targetdir "../bin" 64 | objdir "../build/%{_AMD_SAMPLE_DIR_LAYOUT}" 65 | warnings "Extra" 66 | floatingpoint "Fast" 67 | symbols "On" 68 | 69 | -- Specify WindowsTargetPlatformVersion here for VS2015 70 | systemversion (_AMD_WIN_SDK_VERSION) 71 | 72 | -- Copy DLLs to the local bin directory 73 | postbuildcommands { amdSamplePostbuildCommands(false, false) } 74 | postbuildmessage "Copying dependencies..." 75 | 76 | files { "../src/**.h", "../src/**.cpp", "../src/**.rc", "../src/**.manifest", "../src/**.hlsl" } 77 | includedirs { "../src/ResourceFiles", "../../AMD_%{_AMD_LIBRARY_NAME}/inc", "../../amd_lib/shared/common/inc", "../../amd_lib/shared/d3d11/inc", "../../framework/d3d11/amd_sdk/inc", "../../framework/d3d11/dxut/Core", "../../framework/d3d11/dxut/Optional" } 78 | links { "AMD_%{_AMD_LIBRARY_NAME}", "AMD_LIB_Minimal", "AMD_SDK_Minimal", "DXUT", "DXUTOpt", "d3dcompiler", "dxguid", "winmm", "comctl32", "Usp10", "Shlwapi" } 79 | defines { "AMD_%{_AMD_LIBRARY_NAME_ALL_CAPS}_COMPILE_DYNAMIC_LIB=1" } 80 | 81 | filter "configurations:Debug" 82 | defines { "WIN32", "_DEBUG", "DEBUG", "PROFILE", "_WINDOWS", "_WIN32_WINNT=0x0601" } 83 | flags { "FatalWarnings" } 84 | targetsuffix ("_Debug" .. _AMD_VS_SUFFIX) 85 | 86 | filter "configurations:Release" 87 | defines { "WIN32", "NDEBUG", "PROFILE", "_WINDOWS", "_WIN32_WINNT=0x0601" } 88 | flags { "LinkTimeOptimization", "FatalWarnings" } 89 | targetsuffix ("_Release" .. _AMD_VS_SUFFIX) 90 | optimize "On" 91 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/src/ResourceFiles/DepthOfFieldFX_Sample.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #define IDC_STATIC -1 11 | #include 12 | 13 | 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | #undef APSTUDIO_READONLY_SYMBOLS 17 | 18 | ///////////////////////////////////////////////////////////////////////////// 19 | // English (U.S.) resources 20 | 21 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 22 | #ifdef _WIN32 23 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 24 | #pragma code_page(1252) 25 | #endif //_WIN32 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | // 29 | // Icon 30 | // 31 | 32 | // Icon with lowest ID value placed first to ensure application icon 33 | // remains consistent on all systems. 34 | IDI_MAIN_ICON ICON "..\\..\\AMD_SDK\\media\\AMD.ico" 35 | 36 | #ifdef APSTUDIO_INVOKED 37 | ///////////////////////////////////////////////////////////////////////////// 38 | // 39 | // TEXTINCLUDE 40 | // 41 | 42 | 1 TEXTINCLUDE 43 | BEGIN 44 | "resource.h\0" 45 | END 46 | 47 | 2 TEXTINCLUDE 48 | BEGIN 49 | "#define IDC_STATIC -1\r\n" 50 | "#include \r\n" 51 | "\r\n" 52 | "\r\n" 53 | "\0" 54 | END 55 | 56 | 3 TEXTINCLUDE 57 | BEGIN 58 | "\r\n" 59 | "\0" 60 | END 61 | 62 | #endif // APSTUDIO_INVOKED 63 | 64 | #endif // English (U.S.) resources 65 | ///////////////////////////////////////////////////////////////////////////// 66 | 67 | 68 | 69 | #ifndef APSTUDIO_INVOKED 70 | ///////////////////////////////////////////////////////////////////////////// 71 | // 72 | // Generated from the TEXTINCLUDE 3 resource. 73 | // 74 | 75 | 76 | ///////////////////////////////////////////////////////////////////////////// 77 | #endif // not APSTUDIO_INVOKED 78 | 79 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/src/ResourceFiles/dpiaware.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True/PM 5 | 6 | 7 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/src/ResourceFiles/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by DepthOfFieldFX_Sample.rc 4 | // 5 | #define IDI_MAIN_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 113 12 | #define _APS_NEXT_COMMAND_VALUE 40029 13 | #define _APS_NEXT_CONTROL_VALUE 1000 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /amd_depthoffieldfx_sample/src/Shaders/DepthOfFieldFX_CsCalcDOF.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | 24 | Texture2D tDepth : register(t0); 25 | Texture2D tCoc : register(t0); 26 | RWTexture2D uCoC : register(u0); 27 | RWTexture2D uDebugVisCoc : register(u0); 28 | 29 | cbuffer CalcDOFParams 30 | { 31 | uint2 ScreenParams; 32 | float zNear; 33 | float zFar; 34 | float focusDistance; 35 | float fStop; 36 | float focalLength; 37 | float maxRadius; 38 | float forceCoC; 39 | }; 40 | 41 | 42 | float CocFromDepth(float sceneDepth, float focusDistance, float fStop, float focalLength) 43 | { 44 | const float cocScale = (focalLength * focalLength) / fStop; // move to constant buffer 45 | const float distanceToLense = sceneDepth - focalLength; 46 | const float distanceToFocusPlane = distanceToLense - focusDistance; 47 | float coc = (distanceToLense > 0.0) ? (cocScale * (distanceToFocusPlane / distanceToLense)) : 0.0; 48 | 49 | coc = clamp(coc * float(ScreenParams.x) * 0.5, -maxRadius, maxRadius); 50 | 51 | return coc; 52 | } 53 | 54 | /////////////////////////////////////// 55 | // compute camera-space depth for current pixel 56 | float CameraDepth(float depth, float zNear, float zFar) 57 | { 58 | float invRange = 1.0 / (zFar - zNear); 59 | return (-zFar * zNear) * invRange / (depth - zFar * invRange); 60 | } 61 | 62 | 63 | [numthreads(8, 8, 1)] 64 | void CalcDOF(uint3 threadID : SV_DispatchThreadID) 65 | { 66 | if ((threadID.x < ScreenParams.x) && (threadID.y < ScreenParams.y)) 67 | { 68 | const float depth = tDepth.Load(int3(threadID.xy, 0), 0); 69 | const float camDepth = CameraDepth(depth, zNear, zFar); 70 | float CoC = clamp(CocFromDepth(camDepth, focusDistance, fStop, focalLength), -maxRadius, maxRadius); 71 | if (abs(forceCoC) > 0.25) 72 | { 73 | CoC = -forceCoC; 74 | } 75 | uCoC[int2(threadID.xy)] = CoC; 76 | } 77 | } 78 | 79 | 80 | [numthreads(8, 8, 1)] 81 | void DebugVisDOF(uint3 Tid : SV_DispatchThreadID) 82 | { 83 | float4 colorMap[] = { 84 | { 0.0, 0.0, 0.2, 1.0 }, { 0.0, 0.4, 0.2, 1.0 }, { 0.4, 0.4, 0.0, 1.0 }, { 1.0, 0.2, 0.0, 1.0 }, { 1.0, 0.0, 0.0, 1.0 }, 85 | }; 86 | 87 | const uint2 texCoord = Tid.xy; 88 | const float Coc = tCoc.Load(int3(texCoord, 0)); 89 | float value = min((abs(min(Coc, float(maxRadius))) - 1) / (float(maxRadius - 1) / 4.0), 3.99); 90 | int offset = int(floor(value)); 91 | float t = frac(value); 92 | float4 result = lerp(colorMap[offset], colorMap[offset + 1], t); 93 | if (abs(Coc) < 1.0) 94 | { 95 | result = float4(0.0, 0.0, 0.1, 1.0); 96 | } 97 | 98 | uDebugVisCoc[texCoord] = result; 99 | } 100 | -------------------------------------------------------------------------------- /amd_lib/shared/.gitattributes: -------------------------------------------------------------------------------- 1 | # This is a windows-only project. Force CRLF. 2 | * text eol=crlf 3 | 4 | # Explicit settings for specific file types. 5 | *.h eol=crlf 6 | *.hpp eol=crlf 7 | *.inc eol=crlf 8 | *.cpp eol=crlf 9 | *.inl eol=crlf 10 | *.hlsl eol=crlf 11 | *.vcxproj eol=crlf 12 | *.filters eol=crlf 13 | *.props eol=crlf 14 | *.sln eol=crlf 15 | *.bat eol=crlf 16 | *.txt eol=crlf 17 | *.lua eol=crlf 18 | *.md eol=crlf 19 | *.pdf binary 20 | *.ppsx binary 21 | *.ico binary 22 | *.png binary 23 | *.dds binary 24 | *.dll binary 25 | *.exe binary 26 | 27 | # Ensure precompiled shader files are detected as C++. 28 | # Otherwise, if there are a lot of them, the repo can 29 | # get incorrectly marked as Assembly. 30 | src/Shaders/inc/*.inc linguist-language=C++ 31 | -------------------------------------------------------------------------------- /amd_lib/shared/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, etc. 2 | 3 | # User-specific files 4 | *.suo 5 | *.user 6 | 7 | # Build results 8 | [Dd]esktop_*/ 9 | lib/ 10 | 11 | # Visual Studo 2015 cache/options directory 12 | .vs/ 13 | 14 | # Visual C++ cache files 15 | ipch/ 16 | *.aps 17 | *.ncb 18 | *.opensdf 19 | *.sdf 20 | *.cachefile 21 | 22 | # Visual Studio profiler 23 | *.psess 24 | *.vsp 25 | *.vspx 26 | 27 | # Installshield output folder 28 | [Ee]xpress/ 29 | 30 | # Backup & report files from converting an old project file 31 | # to a newer Visual Studio version. Backup files are not needed, 32 | # because we have git ;-) 33 | _UpgradeReport_Files/ 34 | Backup*/ 35 | UpgradeLog*.XML 36 | UpgradeLog*.htm 37 | -------------------------------------------------------------------------------- /amd_lib/shared/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /amd_lib/shared/README.md: -------------------------------------------------------------------------------- 1 | # AMD LIB 2 | 3 | The AMD LIB project contains common code shared by [GPUOpen Effects](https://github.com/GPUOpen-Effects/) libraries. 4 | 5 | ### Prerequisites 6 | * AMD Radeon™ GCN-based GPU (HD 7000 series or newer) 7 | * 64-bit Windows® 7 (SP1 with the [Platform Update](https://msdn.microsoft.com/en-us/library/windows/desktop/jj863687.aspx)), Windows® 8.1, or Windows® 10 8 | * Visual Studio® 2013 or Visual Studio® 2015 9 | 10 | ### Getting Started 11 | * Visual Studio projects for VS2013 and VS2015 can be found in the `build` directory. 12 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/build/AMD_LIB_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {AEFEE3F6-9AA0-0ECD-835B-22216F9C951D} 6 | 7 | 8 | {B7381BB1-A3F0-5CFE-0CF8-355AF8CEF7EE} 9 | 10 | 11 | {1F80880B-8B89-887C-1405-9F7C800D947C} 12 | 13 | 14 | {2DAB880B-99B4-887C-2230-9F7C8E38947C} 15 | 16 | 17 | {60ABEBC9-4C79-DFCF-350D-50F6217ABB34} 18 | 19 | 20 | {06ADC7FB-7262-40F1-FB56-3AC8670B37F5} 21 | 22 | 23 | {4AE40765-B6F1-354B-3FD8-3136ABE40102} 24 | 25 | 26 | 27 | 28 | common\inc 29 | 30 | 31 | inc 32 | 33 | 34 | src 35 | 36 | 37 | src 38 | 39 | 40 | src 41 | 42 | 43 | src 44 | 45 | 46 | src 47 | 48 | 49 | src 50 | 51 | 52 | src 53 | 54 | 55 | src 56 | 57 | 58 | src\DirectXTex 59 | 60 | 61 | src\DirectXTex 62 | 63 | 64 | 65 | 66 | src 67 | 68 | 69 | src 70 | 71 | 72 | src 73 | 74 | 75 | src 76 | 77 | 78 | src 79 | 80 | 81 | src 82 | 83 | 84 | src 85 | 86 | 87 | src 88 | 89 | 90 | src\DirectXTex 91 | 92 | 93 | src\DirectXTex 94 | 95 | 96 | 97 | 98 | src\Shaders 99 | 100 | 101 | src\Shaders 102 | 103 | 104 | src\Shaders 105 | 106 | 107 | src\Shaders\SeparableFilter 108 | 109 | 110 | src\Shaders\SeparableFilter 111 | 112 | 113 | src\Shaders\SeparableFilter 114 | 115 | 116 | src\Shaders\SeparableFilter 117 | 118 | 119 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/build/AMD_LIB_2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {AEFEE3F6-9AA0-0ECD-835B-22216F9C951D} 6 | 7 | 8 | {B7381BB1-A3F0-5CFE-0CF8-355AF8CEF7EE} 9 | 10 | 11 | {1F80880B-8B89-887C-1405-9F7C800D947C} 12 | 13 | 14 | {2DAB880B-99B4-887C-2230-9F7C8E38947C} 15 | 16 | 17 | {60ABEBC9-4C79-DFCF-350D-50F6217ABB34} 18 | 19 | 20 | {06ADC7FB-7262-40F1-FB56-3AC8670B37F5} 21 | 22 | 23 | {4AE40765-B6F1-354B-3FD8-3136ABE40102} 24 | 25 | 26 | 27 | 28 | common\inc 29 | 30 | 31 | inc 32 | 33 | 34 | src 35 | 36 | 37 | src 38 | 39 | 40 | src 41 | 42 | 43 | src 44 | 45 | 46 | src 47 | 48 | 49 | src 50 | 51 | 52 | src 53 | 54 | 55 | src 56 | 57 | 58 | src\DirectXTex 59 | 60 | 61 | src\DirectXTex 62 | 63 | 64 | 65 | 66 | src 67 | 68 | 69 | src 70 | 71 | 72 | src 73 | 74 | 75 | src 76 | 77 | 78 | src 79 | 80 | 81 | src 82 | 83 | 84 | src 85 | 86 | 87 | src 88 | 89 | 90 | src\DirectXTex 91 | 92 | 93 | src\DirectXTex 94 | 95 | 96 | 97 | 98 | src\Shaders 99 | 100 | 101 | src\Shaders 102 | 103 | 104 | src\Shaders 105 | 106 | 107 | src\Shaders\SeparableFilter 108 | 109 | 110 | src\Shaders\SeparableFilter 111 | 112 | 113 | src\Shaders\SeparableFilter 114 | 115 | 116 | src\Shaders\SeparableFilter 117 | 118 | 119 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/build/AMD_LIB_Minimal_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {AEFEE3F6-9AA0-0ECD-835B-22216F9C951D} 6 | 7 | 8 | {B7381BB1-A3F0-5CFE-0CF8-355AF8CEF7EE} 9 | 10 | 11 | {1F80880B-8B89-887C-1405-9F7C800D947C} 12 | 13 | 14 | {2DAB880B-99B4-887C-2230-9F7C8E38947C} 15 | 16 | 17 | {60ABEBC9-4C79-DFCF-350D-50F6217ABB34} 18 | 19 | 20 | {06ADC7FB-7262-40F1-FB56-3AC8670B37F5} 21 | 22 | 23 | {4AE40765-B6F1-354B-3FD8-3136ABE40102} 24 | 25 | 26 | 27 | 28 | common\inc 29 | 30 | 31 | inc 32 | 33 | 34 | src 35 | 36 | 37 | src 38 | 39 | 40 | src 41 | 42 | 43 | src 44 | 45 | 46 | src 47 | 48 | 49 | src 50 | 51 | 52 | src 53 | 54 | 55 | src 56 | 57 | 58 | src\DirectXTex 59 | 60 | 61 | src\DirectXTex 62 | 63 | 64 | 65 | 66 | src 67 | 68 | 69 | src 70 | 71 | 72 | src 73 | 74 | 75 | src 76 | 77 | 78 | src 79 | 80 | 81 | src 82 | 83 | 84 | src 85 | 86 | 87 | src 88 | 89 | 90 | src\DirectXTex 91 | 92 | 93 | src\DirectXTex 94 | 95 | 96 | 97 | 98 | src\Shaders 99 | 100 | 101 | src\Shaders 102 | 103 | 104 | src\Shaders 105 | 106 | 107 | src\Shaders\SeparableFilter 108 | 109 | 110 | src\Shaders\SeparableFilter 111 | 112 | 113 | src\Shaders\SeparableFilter 114 | 115 | 116 | src\Shaders\SeparableFilter 117 | 118 | 119 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/build/AMD_LIB_Minimal_2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {AEFEE3F6-9AA0-0ECD-835B-22216F9C951D} 6 | 7 | 8 | {B7381BB1-A3F0-5CFE-0CF8-355AF8CEF7EE} 9 | 10 | 11 | {1F80880B-8B89-887C-1405-9F7C800D947C} 12 | 13 | 14 | {2DAB880B-99B4-887C-2230-9F7C8E38947C} 15 | 16 | 17 | {60ABEBC9-4C79-DFCF-350D-50F6217ABB34} 18 | 19 | 20 | {06ADC7FB-7262-40F1-FB56-3AC8670B37F5} 21 | 22 | 23 | {4AE40765-B6F1-354B-3FD8-3136ABE40102} 24 | 25 | 26 | 27 | 28 | common\inc 29 | 30 | 31 | inc 32 | 33 | 34 | src 35 | 36 | 37 | src 38 | 39 | 40 | src 41 | 42 | 43 | src 44 | 45 | 46 | src 47 | 48 | 49 | src 50 | 51 | 52 | src 53 | 54 | 55 | src 56 | 57 | 58 | src\DirectXTex 59 | 60 | 61 | src\DirectXTex 62 | 63 | 64 | 65 | 66 | src 67 | 68 | 69 | src 70 | 71 | 72 | src 73 | 74 | 75 | src 76 | 77 | 78 | src 79 | 80 | 81 | src 82 | 83 | 84 | src 85 | 86 | 87 | src 88 | 89 | 90 | src\DirectXTex 91 | 92 | 93 | src\DirectXTex 94 | 95 | 96 | 97 | 98 | src\Shaders 99 | 100 | 101 | src\Shaders 102 | 103 | 104 | src\Shaders 105 | 106 | 107 | src\Shaders\SeparableFilter 108 | 109 | 110 | src\Shaders\SeparableFilter 111 | 112 | 113 | src\Shaders\SeparableFilter 114 | 115 | 116 | src\Shaders\SeparableFilter 117 | 118 | 119 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/inc/AMD_LIB.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: AMD_LIB.h 25 | // 26 | // Library include file, to drag in all AMD LIB helper classes and functions. 27 | //-------------------------------------------------------------------------------------- 28 | #ifndef AMD_LIB_H 29 | #define AMD_LIB_H 30 | 31 | // AMD helper classes and functions 32 | #include "AMD_Types.h" 33 | 34 | #include "../src/AMD_Common.h" 35 | #include "../src/AMD_Texture2D.h" 36 | #include "../src/AMD_Buffer.h" 37 | #include "../src/AMD_Rand.h" 38 | #include "../src/AMD_SaveRestoreState.h" 39 | #include "../src/AMD_FullscreenPass.h" 40 | #include "../src/AMD_UnitCube.h" 41 | 42 | #ifdef _DEBUG 43 | #include "../src/AMD_Serialize.h" 44 | #include "../src/DirectXTex/DDSTextureLoader.h" 45 | #include "../src/DirectXTex/ScreenGrab.h" 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/premake/premake5.lua: -------------------------------------------------------------------------------- 1 | dofile ("../../../../premake/amd_premake_util.lua") 2 | 3 | workspace "AMD_LIB" 4 | configurations { "Debug", "Release", "Release_MT" } 5 | platforms { "Win32", "x64" } 6 | location "../build" 7 | filename ("AMD_LIB" .. _AMD_VS_SUFFIX) 8 | startproject "AMD_LIB" 9 | 10 | filter "platforms:Win32" 11 | system "Windows" 12 | architecture "x86" 13 | 14 | filter "platforms:x64" 15 | system "Windows" 16 | architecture "x64" 17 | 18 | project "AMD_LIB" 19 | kind "StaticLib" 20 | language "C++" 21 | characterset "Unicode" 22 | location "../build" 23 | filename ("AMD_LIB" .. _AMD_VS_SUFFIX) 24 | uuid "0D2AEA47-7909-69E3-8221-F4B9EE7FCF44" 25 | targetdir "../lib" 26 | objdir "../build/%{_AMD_LIBRARY_DIR_LAYOUT}" 27 | warnings "Extra" 28 | floatingpoint "Fast" 29 | exceptionhandling "Off" 30 | rtti "Off" 31 | 32 | -- Specify WindowsTargetPlatformVersion here for VS2015 33 | systemversion (_AMD_WIN_SDK_VERSION) 34 | 35 | files { "../inc/**.h", "../src/**.h", "../src/**.cpp", "../src/**.inl", "../src/**.hlsl", "../../common/inc/*.h", "../../../ags_lib/inc/*.h" } 36 | includedirs { "../inc", "../../common/inc", "../../../ags_lib/inc" } 37 | 38 | filter "configurations:Debug" 39 | defines { "WIN32", "_DEBUG", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 40 | flags { "FatalWarnings" } 41 | -- add "d" to the end of the library name for debug builds 42 | targetsuffix "d" 43 | symbols "On" 44 | 45 | filter "configurations:Release" 46 | defines { "WIN32", "NDEBUG", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 47 | flags { "FatalWarnings" } 48 | optimize "On" 49 | 50 | filter "configurations:Release_MT" 51 | defines { "WIN32", "NDEBUG", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 52 | flags { "FatalWarnings" } 53 | -- link against the static runtime to avoid introducing a dependency 54 | -- on the particular version of Visual Studio used to build the DLLs 55 | flags { "StaticRuntime" } 56 | -- add "mt" to the end of the library name for Release_MT builds 57 | targetsuffix "mt" 58 | optimize "On" 59 | 60 | filter "action:vs*" 61 | -- specify exception handling model for Visual Studio to avoid 62 | -- "'noexcept' used with no exception handling mode specified" 63 | -- warning in vs2015 64 | buildoptions { "/EHsc" } 65 | 66 | filter "platforms:Win32" 67 | targetname "amd_lib_x86%{_AMD_VS_SUFFIX}" 68 | 69 | filter "platforms:x64" 70 | targetname "amd_lib_x64%{_AMD_VS_SUFFIX}" 71 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/premake/premake5_minimal.lua: -------------------------------------------------------------------------------- 1 | dofile ("../../../../premake/amd_premake_util.lua") 2 | 3 | workspace "AMD_LIB_Minimal" 4 | configurations { "Debug", "Release", "Release_MT" } 5 | platforms { "Win32", "x64" } 6 | location "../build" 7 | filename ("AMD_LIB_Minimal" .. _AMD_VS_SUFFIX) 8 | startproject "AMD_LIB_Minimal" 9 | 10 | filter "platforms:Win32" 11 | system "Windows" 12 | architecture "x86" 13 | 14 | filter "platforms:x64" 15 | system "Windows" 16 | architecture "x64" 17 | 18 | project "AMD_LIB_Minimal" 19 | kind "StaticLib" 20 | language "C++" 21 | characterset "Unicode" 22 | location "../build" 23 | filename ("AMD_LIB_Minimal" .. _AMD_VS_SUFFIX) 24 | uuid "0D2AEA47-7909-69E3-8221-F4B9EE7FCF44" 25 | targetdir "../lib" 26 | objdir "../build/%{_AMD_LIBRARY_DIR_LAYOUT_MINIMAL}" 27 | warnings "Extra" 28 | floatingpoint "Fast" 29 | exceptionhandling "Off" 30 | rtti "Off" 31 | 32 | -- Specify WindowsTargetPlatformVersion here for VS2015 33 | systemversion (_AMD_WIN_SDK_VERSION) 34 | 35 | files { "../inc/**.h", "../src/**.h", "../src/**.cpp", "../src/**.inl", "../src/**.hlsl", "../../common/inc/*.h" } 36 | includedirs { "../inc", "../../common/inc" } 37 | defines { "AMD_LIB_MINIMAL" } 38 | 39 | filter "configurations:Debug" 40 | defines { "WIN32", "_DEBUG", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 41 | flags { "FatalWarnings" } 42 | -- add "d" to the end of the library name for debug builds 43 | targetsuffix "d" 44 | symbols "On" 45 | 46 | filter "configurations:Release" 47 | defines { "WIN32", "NDEBUG", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 48 | flags { "FatalWarnings" } 49 | optimize "On" 50 | 51 | filter "configurations:Release_MT" 52 | defines { "WIN32", "NDEBUG", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 53 | flags { "FatalWarnings" } 54 | -- link against the static runtime to avoid introducing a dependency 55 | -- on the particular version of Visual Studio used to build the DLLs 56 | flags { "StaticRuntime" } 57 | -- add "mt" to the end of the library name for Release_MT builds 58 | targetsuffix "mt" 59 | optimize "On" 60 | 61 | filter "action:vs*" 62 | -- specify exception handling model for Visual Studio to avoid 63 | -- "'noexcept' used with no exception handling mode specified" 64 | -- warning in vs2015 65 | buildoptions { "/EHsc" } 66 | 67 | filter "platforms:Win32" 68 | targetname "amd_lib_minimal_x86%{_AMD_VS_SUFFIX}" 69 | 70 | filter "platforms:x64" 71 | targetname "amd_lib_minimal_x64%{_AMD_VS_SUFFIX}" 72 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/AMD_Buffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_LIB_BUFFER_H 24 | #define AMD_LIB_BUFFER_H 25 | 26 | #include 27 | #include 28 | 29 | namespace AMD 30 | { 31 | class Buffer 32 | { 33 | public: 34 | ID3D11Buffer * _b1d; 35 | ID3D11ShaderResourceView * _srv; 36 | ID3D11UnorderedAccessView * _uav; 37 | ID3D11Buffer * _staging_b1d; 38 | ID3D11Buffer * _staging_counter_b1d; 39 | 40 | uint _size_in_bytes; 41 | 42 | Buffer(); 43 | ~Buffer(); 44 | void Release(); 45 | HRESULT CreateBuffer( ID3D11Device * device, 46 | unsigned int uSizeInBytes, 47 | unsigned int uSizeOfStructure = 0, 48 | unsigned int uCPUAccess = 0, 49 | unsigned int uBindFlags = D3D11_BIND_SHADER_RESOURCE, 50 | D3D11_USAGE usage = D3D11_USAGE_DEFAULT, 51 | DXGI_FORMAT SRV_Format = DXGI_FORMAT_UNKNOWN, 52 | DXGI_FORMAT UAV_Format = DXGI_FORMAT_UNKNOWN, 53 | unsigned int uUAVFlags = 0, 54 | unsigned int uB1DFlags = 0, 55 | void * data = NULL); 56 | 57 | int UAVCounter( ID3D11DeviceContext * context ); 58 | void ReadStgBuffer( ID3D11DeviceContext * context, void * ptr); 59 | }; 60 | } 61 | 62 | #endif // AMD_LIB_BUFFER_H 63 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/AMD_Common.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "AMD_LIB.h" 29 | 30 | #pragma warning(disable : 4100) 31 | 32 | namespace AMD 33 | { 34 | void outputDebugString(const char * format, ...) 35 | { 36 | #if defined (DEBUG) || defined (_DEBUG) 37 | assert(format != NULL); 38 | 39 | static char string[1024]; 40 | 41 | va_list argptr; 42 | va_start(argptr, format); 43 | vsprintf_s(string, format, argptr); 44 | va_end(argptr); 45 | 46 | OutputDebugStringA(string); 47 | #endif 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/AMD_Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_LIB_COMMON_H 24 | #define AMD_LIB_COMMON_H 25 | 26 | namespace AMD 27 | { 28 | void outputDebugString(const char * format, ...); 29 | } 30 | 31 | #if defined(_DEBUG) || defined(DEBUG) 32 | #define AMD_OUTPUT_DEBUG_STRING(format, ...) AMD::outputDebugString(format, ##__VA_ARGS__) 33 | #else 34 | #define AMD_OUTPUT_DEBUG_STRING(format, ...) 35 | #endif 36 | 37 | #endif // AMD_LIB_COMMON_H 38 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/AMD_FullscreenPass.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_LIB_FULLSCREEN_PASS_H 24 | #define AMD_LIB_FULLSCREEN_PASS_H 25 | 26 | #include 27 | 28 | namespace AMD 29 | { 30 | extern "C++" 31 | { 32 | HRESULT CreateFullscreenPass(ID3D11VertexShader** ppVS, ID3D11Device* pDevice); 33 | HRESULT CreateScreenQuadPass(ID3D11VertexShader** ppVS, ID3D11Device* pDevice); 34 | HRESULT CreateFullscreenPass(ID3D11PixelShader** ppPS, ID3D11Device* pDevice); 35 | 36 | HRESULT RenderFullscreenPass( 37 | ID3D11DeviceContext* pDeviceContext, 38 | D3D11_VIEWPORT Viewport, 39 | ID3D11VertexShader* pVS, 40 | ID3D11PixelShader* pPS, 41 | D3D11_RECT* pScissor, unsigned int uNumSR, 42 | ID3D11Buffer** ppCB, unsigned int uNumCBs, 43 | ID3D11SamplerState** ppSamplers, unsigned int uNumSamplers, 44 | ID3D11ShaderResourceView** ppSRVs, unsigned int uNumSRVs, 45 | ID3D11RenderTargetView** ppRTVs, unsigned int uNumRTVs, 46 | ID3D11UnorderedAccessView**ppUAVs, unsigned int uStartUAV, unsigned int uNumUAVs, 47 | ID3D11DepthStencilView* pDSV, 48 | ID3D11DepthStencilState* pOutputDSS, unsigned int uStencilRef, 49 | ID3D11BlendState * pOutputBS, 50 | ID3D11RasterizerState * pOutputRS); 51 | 52 | HRESULT RenderFullscreenInstancedPass( 53 | ID3D11DeviceContext* pDeviceContext, 54 | D3D11_VIEWPORT Viewport, 55 | ID3D11VertexShader* pVS, 56 | ID3D11GeometryShader* pGS, 57 | ID3D11PixelShader* pPS, 58 | D3D11_RECT* pScissor, unsigned int uNumSR, 59 | ID3D11Buffer** ppCB, unsigned int uNumCBs, 60 | ID3D11SamplerState** ppSamplers, unsigned int uNumSamplers, 61 | ID3D11ShaderResourceView** ppSRVs, unsigned int uNumSRVs, 62 | ID3D11RenderTargetView** ppRTVs, unsigned int uNumRTVs, 63 | ID3D11UnorderedAccessView** ppUAVs, unsigned int uStartUAV, unsigned int uNumUAVs, 64 | ID3D11DepthStencilView* pDSV, 65 | ID3D11DepthStencilState* pOutputDSS, unsigned int uStencilRef, 66 | ID3D11BlendState * pOutputBS, 67 | ID3D11RasterizerState * pOutputRS, 68 | unsigned int instanceCount); 69 | 70 | HRESULT RenderFullscreenAlignedQuads( 71 | ID3D11DeviceContext* pDeviceContext, 72 | D3D11_VIEWPORT Viewport, 73 | ID3D11VertexShader* pVS, 74 | ID3D11PixelShader* pPS, 75 | D3D11_RECT* pScissor, unsigned int uNumSR, 76 | ID3D11Buffer** ppCB, unsigned int uNumCBs, 77 | ID3D11SamplerState** ppSamplers, unsigned int uNumSamplers, 78 | ID3D11ShaderResourceView** ppSRVs, unsigned int uNumSRVs, 79 | ID3D11RenderTargetView** ppRTVs, unsigned int uNumRTVs, 80 | ID3D11DepthStencilView* pDSV, 81 | ID3D11DepthStencilState* pOutputDSS, unsigned int uStencilRef, 82 | ID3D11BlendState * pOutputBS, 83 | ID3D11RasterizerState * pOutputRS, 84 | int nCount); 85 | } 86 | } 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/AMD_Rand.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #include "AMD_Types.h" 24 | #include "AMD_Rand.h" 25 | 26 | #pragma warning (disable : 4996) 27 | 28 | namespace AMD 29 | { 30 | float noise(uint x) 31 | { 32 | x = (x<<13) ^ x; 33 | return ( 1.0f - ( (x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f); 34 | } 35 | 36 | float random_float(uint seed, float a, float b) 37 | { 38 | float random = noise(seed) + 1.0f; 39 | 40 | return a + random * 0.5f * (b - a); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/AMD_Rand.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_LIB_RAND_H 24 | #define AMD_LIB_RAND_H 25 | 26 | #include "AMD_Types.h" 27 | 28 | namespace AMD 29 | { 30 | float noise(uint seed); 31 | float random_float(uint seed, float a, float b); 32 | } 33 | 34 | #endif //AMD_LIB_RAND_H 35 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/AMD_Serialize.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_LIB_SERIALIZE_H 24 | #define AMD_LIB_SERIALIZE_H 25 | 26 | #include "AMD_Types.h" 27 | 28 | // forward declarations 29 | struct _iobuf; 30 | typedef struct _iobuf FILE; 31 | 32 | namespace AMD 33 | { 34 | void serialize_string(FILE * file, char * name); 35 | 36 | void serialize_float(FILE * file, const char * name, float * v); 37 | void serialize_float2(FILE * file, const char * name, float * v); 38 | void serialize_float3(FILE * file, const char * name, float * v); 39 | void serialize_float4(FILE * file, const char * name, float * v); 40 | void serialize_uint(FILE * file, const char * name, uint32 * v); 41 | void serialize_uint2(FILE * file, const char * name, uint32 * v); 42 | void serialize_uint3(FILE * file, const char * name, uint32 * v); 43 | void serialize_uint4(FILE * file, const char * name, uint32 * v); 44 | void serialize_float4x4(FILE * file, const char * name, float * v); 45 | 46 | void deserialize_float(FILE * file, char * name, float * v, bool use_float = false); 47 | void deserialize_float2(FILE * file, char * name, float * v, bool use_float = false); 48 | void deserialize_float3(FILE * file, char * name, float * v, bool use_float = false); 49 | void deserialize_float4(FILE * file, char * name, float * v, bool use_float = false); 50 | void deserialize_uint(FILE * file, char * name, uint32 * v); 51 | void deserialize_uint2(FILE * file, char * name, uint32 * v); 52 | void deserialize_uint3(FILE * file, char * name, uint32 * v); 53 | void deserialize_uint4(FILE * file, char * name, uint32 * v); 54 | void deserialize_float4x4(FILE * file, char * name, float * v, bool use_float = false); 55 | 56 | void deserialize_string(FILE * file, char * name); 57 | } 58 | 59 | 60 | #define AMD_SERIALIZE_STRING_FLOAT_PTR(x) #x, (float *) &x 61 | #define AMD_SERIALIZE_STRING_UINT_PTR(x) #x, (uint *) &x 62 | 63 | 64 | #endif //AMD_LIB_SERIALIZE_H 65 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/AMD_Texture2D.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_LIB_TEXTURE_2D_H 24 | #define AMD_LIB_TEXTURE_2D_H 25 | 26 | #include 27 | 28 | // forward declarations 29 | struct AGSContext; 30 | 31 | namespace AMD 32 | { 33 | class Texture2D 34 | { 35 | public: 36 | ID3D11Texture2D * _t2d; 37 | ID3D11ShaderResourceView * _srv; 38 | ID3D11ShaderResourceView * _srv_cube; 39 | ID3D11RenderTargetView * _rtv; 40 | ID3D11RenderTargetView * _rtv_cube[6]; 41 | ID3D11DepthStencilView * _dsv; 42 | ID3D11DepthStencilView * _dsv_cube[6]; 43 | ID3D11DepthStencilView * _dsv_ro; 44 | ID3D11UnorderedAccessView * _uav; 45 | 46 | unsigned int _width; 47 | unsigned int _height; 48 | unsigned int _array; 49 | unsigned int _mips; 50 | unsigned int _sample; 51 | 52 | Texture2D(); 53 | ~Texture2D(); 54 | 55 | void Release(); 56 | 57 | HRESULT CreateSurface( ID3D11Device * pDevice, 58 | unsigned int uWidth, 59 | unsigned int uHeight, 60 | unsigned int uSampleCount /*= 1*/, 61 | unsigned int uArraySize /*= 1*/, 62 | unsigned int uMipLevels /*= 1*/, 63 | DXGI_FORMAT T2D_Format /* = DXGI_FORMAT_UNKNOWN */, 64 | DXGI_FORMAT SRV_Format /* = DXGI_FORMAT_UNKNOWN */, 65 | DXGI_FORMAT RTV_Format /* = DXGI_FORMAT_UNKNOWN */, 66 | DXGI_FORMAT DSV_Format /* = DXGI_FORMAT_UNKNOWN */, 67 | DXGI_FORMAT UAV_Format /* = DXGI_FORMAT_UNKNOWN */, 68 | DXGI_FORMAT DSV_RO_Format /* = DXGI_FORMAT_UNKNOWN */, 69 | D3D11_USAGE usage /* = D3D11_USAGE_DEFAULT */, 70 | bool bCube, 71 | unsigned int pitch /* = 0 */, 72 | void * data /*= NULL */, 73 | AGSContext * agsContext /* = NULL*/, 74 | int cfxTransferType /*= (AGSAfrTransferType)0*/); 75 | }; 76 | } 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/AMD_UnitCube.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_LIB_UNIT_CUBE_H 24 | #define AMD_LIB_UNIT_CUBE_H 25 | 26 | #include 27 | 28 | namespace AMD 29 | { 30 | HRESULT CreateUnitCube(ID3D11VertexShader** ppVS, ID3D11Device* pDevice); 31 | HRESULT CreateUnitCube(ID3D11PixelShader** ppPS, ID3D11Device* pDevice); 32 | 33 | HRESULT CreateClipSpaceCube(ID3D11VertexShader** ppVS, ID3D11Device* pDevice); 34 | 35 | HRESULT RenderUnitCube(ID3D11DeviceContext* pDeviceContext, 36 | D3D11_VIEWPORT VP, 37 | D3D11_RECT* pSR, unsigned int uNumSR, 38 | ID3D11RasterizerState * pRS, 39 | ID3D11BlendState * pBS, const float bsFactor[], 40 | ID3D11DepthStencilState* pDSS, unsigned int stencilRef, 41 | ID3D11VertexShader* pVS, 42 | ID3D11HullShader* pHS, 43 | ID3D11DomainShader* pDS, 44 | ID3D11GeometryShader* pGS, 45 | ID3D11PixelShader* pPS, 46 | ID3D11Buffer** ppCB, unsigned int uStartCB, unsigned int uNumCB, 47 | ID3D11SamplerState** ppSS, unsigned int uStartSS, unsigned int uNumSS, 48 | ID3D11ShaderResourceView** ppSRV, unsigned int uStartSRV, unsigned int uNumSRV, 49 | ID3D11RenderTargetView** ppRTV, unsigned int uNumRTV, 50 | ID3D11DepthStencilView* pDSV); 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/DirectXTex/MIT.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft Corp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | software and associated documentation files (the "Software"), to deal in the Software 7 | without restriction, including without limitation the rights to use, copy, modify, 8 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies 13 | or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 17 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 19 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 20 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/DirectXTex/ScreenGrab.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/amd_lib/shared/d3d11/src/DirectXTex/ScreenGrab.cpp -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/DirectXTex/ScreenGrab.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ScreenGrab.h 3 | // 4 | // Function for capturing a 2D texture and saving it to a file (aka a 'screenshot' 5 | // when used on a Direct3D 11 Render Target). 6 | // 7 | // Note these functions are useful as a light-weight runtime screen grabber. For 8 | // full-featured texture capture, DDS writer, and texture processing pipeline, 9 | // see the 'Texconv' sample and the 'DirectXTex' library. 10 | // 11 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 12 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 13 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 14 | // PARTICULAR PURPOSE. 15 | // 16 | // Copyright (c) Microsoft Corporation. All rights reserved. 17 | // 18 | // http://go.microsoft.com/fwlink/?LinkId=248926 19 | // http://go.microsoft.com/fwlink/?LinkId=248929 20 | //-------------------------------------------------------------------------------------- 21 | 22 | #ifdef _MSC_VER 23 | #pragma once 24 | #endif 25 | 26 | #include 27 | 28 | #include 29 | 30 | #pragma warning(push) 31 | #pragma warning(disable : 4005) 32 | #include 33 | #pragma warning(pop) 34 | 35 | #include 36 | 37 | namespace DirectX 38 | { 39 | HRESULT SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, 40 | _In_ ID3D11Resource* pSource, 41 | _In_z_ LPCWSTR fileName ); 42 | 43 | #if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8) 44 | 45 | HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, 46 | _In_ ID3D11Resource* pSource, 47 | _In_ REFGUID guidContainerFormat, 48 | _In_z_ LPCWSTR fileName, 49 | _In_opt_ const GUID* targetFormat = nullptr, 50 | _In_opt_ std::function setCustomProps = nullptr ); 51 | 52 | #endif 53 | } -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/Shaders/AMD_FullscreenPass.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_LIB_FULLSCREEN_PASS_HLSL 24 | #define AMD_LIB_FULLSCREEN_PASS_HLSL 25 | 26 | struct PS_FullscreenInput 27 | { 28 | float4 position : SV_POSITION; 29 | float2 texCoord : TEXCOORD0; 30 | }; 31 | 32 | struct GS_FullscreenIndexRTInput 33 | { 34 | float4 position : SV_POSITION; 35 | float2 texCoord : TEXCOORD0; 36 | uint rtIndex : RT_INDEX; 37 | }; 38 | 39 | struct PS_FullscreenIndexRTInput 40 | { 41 | float4 position : SV_POSITION; 42 | float2 texCoord : TEXCOORD0; 43 | uint rtIndex : SV_RenderTargetArrayIndex; 44 | }; 45 | 46 | // The ScreenQuad shader is used to clear a subregion of a depth map 47 | // Cleaning a rectangle in depth map is otherwise problematic 48 | PS_FullscreenInput vsScreenQuad(uint vertexId : SV_VERTEXID) 49 | { 50 | 51 | PS_FullscreenInput vertex[6] = 52 | { 53 | { -1.0f, -1.0f, 1.0f, 1.0f }, { 0.0f, 1.0f }, 54 | { -1.0f, 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f }, 55 | { 1.0f, -1.0f, 1.0f, 1.0f }, { 1.0f, 1.0f }, 56 | { 1.0f, -1.0f, 1.0f, 1.0f }, { 1.0f, 1.0f }, 57 | { -1.0f, 1.0f, 1.0f, 1.0f }, { 0.0f, 0.0f }, 58 | { 1.0f, 1.0f, 1.0f, 1.0f }, { 1.0f, 0.0f }, 59 | }; 60 | 61 | return vertex[vertexId % 6]; 62 | } 63 | 64 | PS_FullscreenInput vsFullscreen(uint vertexId : SV_VERTEXID) 65 | { 66 | 67 | PS_FullscreenInput vertex[3] = 68 | { 69 | { -1.0f, -1.0f, 0.0f, 1.0f }, { 0.0f, 1.0f }, 70 | { -1.0f, 3.0f, 0.0f, 1.0f }, { 0.0f, -1.0f }, 71 | { 3.0f, -1.0f, 0.0f, 1.0f }, { 2.0f, 1.0f } 72 | }; 73 | 74 | return vertex[vertexId % 3]; 75 | } 76 | 77 | GS_FullscreenIndexRTInput vsFullscreenIndexRT(uint indexId : SV_VERTEXID) 78 | { 79 | GS_FullscreenIndexRTInput vertex[3] = 80 | { 81 | { -1.0f, -1.0f, 0.0f, 1.0f }, { 0.0f, 1.0f }, 0, 82 | { -1.0f, 3.0f, 0.0f, 1.0f }, { 0.0f, -1.0f }, 0, 83 | { 3.0f, -1.0f, 0.0f, 1.0f }, { 2.0f, 1.0f }, 0 84 | }; 85 | 86 | uint vertexId = indexId % 3; 87 | uint instanceId = indexId / 3; 88 | 89 | GS_FullscreenIndexRTInput Out = vertex[vertexId]; 90 | Out.rtIndex = instanceId; 91 | 92 | return Out; 93 | } 94 | 95 | [maxvertexcount(3)] 96 | void gsFullscreenIndexRT(triangle GS_FullscreenIndexRTInput In[3], inout TriangleStream OutStream) 97 | { 98 | PS_FullscreenIndexRTInput Out; 99 | 100 | for (int i = 0; i < 3; i++) 101 | { 102 | PS_FullscreenIndexRTInput Out; 103 | Out.position = In[i].position; 104 | Out.texCoord = In[i].texCoord; 105 | Out.rtIndex = In[i].rtIndex; 106 | OutStream.Append(Out); 107 | } 108 | OutStream.RestartStrip(); 109 | } 110 | 111 | SamplerState g_ssFullscreen : register(s0); 112 | Texture2D g_t2dFullscreen : register(t0); 113 | 114 | float4 psFullscreen(PS_FullscreenInput In) : SV_Target0 115 | { 116 | return g_t2dFullscreen.Sample(g_ssFullscreen, In.texCoord).xyzw; 117 | } 118 | 119 | #endif // AMD_LIB_FULLSCREEN_PASS_HLSL 120 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/Shaders/AMD_Quaternion.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | #ifndef AMD_LIB_QUATERNION_HLSL 24 | #define AMD_LIB_QUATERNION_HLSL 25 | 26 | float4 MakeQuaternion(float angle_radian, float3 axis) 27 | { 28 | // create quaternion using angle and rotation axis 29 | float4 quaternion; 30 | float halfAngle = 0.5f * angle_radian; 31 | float sinHalf = sin(halfAngle); 32 | 33 | quaternion.w = cos(halfAngle); 34 | quaternion.xyz = sinHalf * axis.xyz; 35 | 36 | return quaternion; 37 | } 38 | 39 | float4 InverseQuaternion(float4 q) 40 | { 41 | float lengthSqr = q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w; 42 | 43 | if (lengthSqr < 0.001) 44 | { 45 | return float4(0, 0, 0, 1.0f); 46 | } 47 | 48 | q.x = -q.x / lengthSqr; 49 | q.y = -q.y / lengthSqr; 50 | q.z = -q.z / lengthSqr; 51 | q.w = q.w / lengthSqr; 52 | 53 | return q; 54 | } 55 | 56 | float3 MultQuaternionAndVector(float4 q, float3 v) 57 | { 58 | float3 uv, uuv; 59 | float3 qvec = float3(q.x, q.y, q.z); 60 | uv = cross(qvec, v); 61 | uuv = cross(qvec, uv); 62 | uv *= (2.0f * q.w); 63 | uuv *= 2.0f; 64 | 65 | return v + uv + uuv; 66 | } 67 | 68 | float4 MultQuaternionAndQuaternion(float4 qA, float4 qB) 69 | { 70 | float4 q; 71 | 72 | q.w = qA.w * qB.w - qA.x * qB.x - qA.y * qB.y - qA.z * qB.z; 73 | q.x = qA.w * qB.x + qA.x * qB.w + qA.y * qB.z - qA.z * qB.y; 74 | q.y = qA.w * qB.y + qA.y * qB.w + qA.z * qB.x - qA.x * qB.z; 75 | q.z = qA.w * qB.z + qA.z * qB.w + qA.x * qB.y - qA.y * qB.x; 76 | 77 | return q; 78 | } 79 | 80 | float4 AngularVelocityToSpin(float4 orientation, float3 angular_veloctiy) 81 | { 82 | return 0.5f * MultQuaternionAndQuaternion(float4(angular_veloctiy.xyz, 0), orientation); 83 | } 84 | 85 | float3 MultWorldInertiaInvAndVector(float4 orientation, float3 inertia, float3 vec) 86 | { 87 | float4 inv_orientation = float4(-orientation.xyz, orientation.w) / length(orientation); 88 | float3 inv_inertia = 1.0f / inertia; 89 | 90 | float3 InertiaInv_RotT_vec = inv_inertia * MultQuaternionAndVector(inv_orientation, vec ); 91 | float3 Rot_InertiaInv_RotT_vec = MultQuaternionAndVector(orientation, InertiaInv_RotT_vec ); 92 | 93 | return Rot_InertiaInv_RotT_vec; 94 | } 95 | 96 | #endif // AMD_LIB_QUATERNION_HLSL 97 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/Shaders/AMD_UnitCube.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | struct PS_UnitCubeInput 24 | { 25 | float4 ss_position : SV_Position; 26 | }; 27 | 28 | struct UnitCubeTransform 29 | { 30 | float4x4 m_tr; 31 | float4x4 m_inverse; 32 | float4x4 m_forward; 33 | float4 m_color; 34 | }; 35 | 36 | cbuffer CB_UNIT_CUBE_TRANSFORM : register (c0) 37 | { 38 | UnitCubeTransform g_UnitCubeTransform; 39 | } 40 | 41 | SamplerState g_ssUnitCube : register(s0); 42 | Texture2D g_t2dUnitCube : register(t0); 43 | 44 | PS_UnitCubeInput vsClipSpaceCube( uint vertex_id : SV_VERTEXID ) 45 | { 46 | float4 vertex[] = 47 | { 48 | { -1.0000, -1.0000, 1.0000, 1 }, 49 | { -1.0000, -1.0000, -0.0000, 1 }, 50 | { 1.0000, -1.0000, -0.0000, 1 }, 51 | { 1.0000, -1.0000, 1.0000, 1 }, 52 | { -1.0000, 1.0000, 1.0000, 1 }, 53 | { 1.0000, 1.0000, 1.0000, 1 }, 54 | { 1.0000, 1.0000, -0.0000, 1 }, 55 | { -1.0000, 1.0000, -0.0000, 1 } 56 | }; 57 | 58 | int index[]= 59 | { 60 | 1, 2, 3, 61 | 3, 4, 1, 62 | 5, 6, 7, 63 | 7, 8, 5, 64 | 1, 4, 6, 65 | 6, 5, 1, 66 | 4, 3, 7, 67 | 7, 6, 4, 68 | 3, 2, 8, 69 | 8, 7, 3, 70 | 2, 1, 5, 71 | 5, 8, 2 72 | }; 73 | 74 | PS_UnitCubeInput Output; 75 | Output.ss_position = mul (vertex[index[vertex_id] - 1], g_UnitCubeTransform.m_tr ); 76 | 77 | return Output; 78 | } 79 | 80 | PS_UnitCubeInput vsUnitCube( uint vertex_id : SV_VERTEXID ) 81 | { 82 | float4 vertex[] = 83 | { 84 | { -1.0000, -1.0000, 1.0000, 1 }, 85 | { -1.0000, -1.0000, -1.0000, 1 }, 86 | { 1.0000, -1.0000, -1.0000, 1 }, 87 | { 1.0000, -1.0000, 1.0000, 1 }, 88 | { -1.0000, 1.0000, 1.0000, 1 }, 89 | { 1.0000, 1.0000, 1.0000, 1 }, 90 | { 1.0000, 1.0000, -1.0000, 1 }, 91 | { -1.0000, 1.0000, -1.0000, 1 } 92 | }; 93 | 94 | int index[]= 95 | { 96 | 1, 2, 3, 97 | 3, 4, 1, 98 | 5, 6, 7, 99 | 7, 8, 5, 100 | 1, 4, 6, 101 | 6, 5, 1, 102 | 4, 3, 7, 103 | 7, 6, 4, 104 | 3, 2, 8, 105 | 8, 7, 3, 106 | 2, 1, 5, 107 | 5, 8, 2 108 | }; 109 | 110 | PS_UnitCubeInput Output; 111 | Output.ss_position = mul (vertex[index[vertex_id] - 1], g_UnitCubeTransform.m_tr ); 112 | 113 | return Output; 114 | } 115 | 116 | float4 psUnitCube( PS_UnitCubeInput In ) : SV_Target0 117 | { 118 | return g_UnitCubeTransform.m_color; 119 | } 120 | -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/Shaders/build/fxc_compile_fullscreen_pass.bat: -------------------------------------------------------------------------------- 1 | fxc.exe /nologo /T vs_5_0 /E vsFullscreen /O1 /Fh ..\inc\VS_FULLSCREEN.inc /Vn VS_FULLSCREEN_Data ..\AMD_FullscreenPass.hlsl 2 | fxc.exe /nologo /T vs_5_0 /E vsScreenQuad /O1 /Fh ..\inc\VS_SCREENQUAD.inc /Vn VS_SCREENQUAD_Data ..\AMD_FullscreenPass.hlsl 3 | 4 | fxc.exe /nologo /T vs_5_0 /E vsFullscreenIndexRT /O1 /Fh ..\inc\VS_FULLSCREEN_INDEX_RT.inc /Vn VS_FULLSCREEN_INDEX_RT_Data ..\AMD_FullscreenPass.hlsl 5 | fxc.exe /nologo /T gs_5_0 /E gsFullscreenIndexRT /O1 /Fh ..\inc\GS_FULLSCREEN_INDEX_RT.inc /Vn GS_FULLSCREEN_INDEX_RT_Data ..\AMD_FullscreenPass.hlsl 6 | fxc.exe /nologo /T ps_5_0 /E psFullscreen /O1 /Fh ..\inc\PS_FULLSCREEN.inc /Vn PS_FULLSCREEN_Data ..\AMD_FullscreenPass.hlsl -------------------------------------------------------------------------------- /amd_lib/shared/d3d11/src/Shaders/build/fxc_compile_unit_cube.bat: -------------------------------------------------------------------------------- 1 | fxc.exe /nologo /T vs_5_0 /E vsUnitCube /O1 /Fh ..\inc\VS_UNIT_CUBE.inc /Vn VS_UNIT_CUBE_Data ..\AMD_UnitCube.hlsl 2 | fxc.exe /nologo /T ps_5_0 /E psUnitCube /O1 /Fh ..\inc\PS_UNIT_CUBE.inc /Vn PS_UNIT_CUBE_Data ..\AMD_UnitCube.hlsl 3 | 4 | fxc.exe /nologo /T vs_5_0 /E vsClipSpaceCube /O1 /Fh ..\inc\VS_CLIP_SPACE_CUBE.inc /Vn VS_CLIP_SPACE_CUBE_Data ..\AMD_UnitCube.hlsl -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/.gitattributes: -------------------------------------------------------------------------------- 1 | # This is a windows-only project. Force CRLF. 2 | * text eol=crlf 3 | 4 | # Explicit settings for specific file types. 5 | *.h eol=crlf 6 | *.cpp eol=crlf 7 | *.inl eol=crlf 8 | *.hlsl eol=crlf 9 | *.rc eol=crlf 10 | *.manifest eol=crlf 11 | *.vcxproj eol=crlf 12 | *.filters eol=crlf 13 | *.props eol=crlf 14 | *.sln eol=crlf 15 | *.bat eol=crlf 16 | *.txt eol=crlf 17 | *.lua eol=crlf 18 | *.md eol=crlf 19 | *.pdf binary 20 | *.ppsx binary 21 | *.ico binary 22 | *.png binary 23 | *.dds binary 24 | *.sdkmesh binary 25 | *.dll binary 26 | *.exe binary 27 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, etc. 2 | 3 | # User-specific files 4 | *.suo 5 | *.user 6 | 7 | # Build results 8 | [Dd]esktop_*/ 9 | lib/ 10 | 11 | # Visual Studo 2015 cache/options directory 12 | .vs/ 13 | 14 | # Visual C++ cache files 15 | ipch/ 16 | *.aps 17 | *.ncb 18 | *.opensdf 19 | *.sdf 20 | *.cachefile 21 | 22 | # Visual Studio profiler 23 | *.psess 24 | *.vsp 25 | *.vspx 26 | 27 | # Installshield output folder 28 | [Ee]xpress/ 29 | 30 | # Backup & report files from converting an old project file 31 | # to a newer Visual Studio version. Backup files are not needed, 32 | # because we have git ;-) 33 | _UpgradeReport_Files/ 34 | Backup*/ 35 | UpgradeLog*.XML 36 | UpgradeLog*.htm 37 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/README.md: -------------------------------------------------------------------------------- 1 | # AMD SDK 2 | 3 | 4 | The AMD SDK project contains utility code used by the samples that are part of the [GPUOpen Effects](https://github.com/GPUOpen-Effects/) repos. 5 | 6 | ### Prerequisites 7 | * AMD Radeon™ GCN-based GPU (HD 7000 series or newer) 8 | * 64-bit Windows® 7 (SP1 with the [Platform Update](https://msdn.microsoft.com/en-us/library/windows/desktop/jj863687.aspx)), Windows® 8.1, or Windows® 10 9 | * Visual Studio® 2013 or Visual Studio® 2015 10 | 11 | ### Getting Started 12 | * Visual Studio projects for VS2013 and VS2015 can be found in the `build` directory. 13 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/build/AMD_SDK_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {1F80880B-8B89-887C-1405-9F7C800D947C} 6 | 7 | 8 | {2DAB880B-99B4-887C-2230-9F7C8E38947C} 9 | 10 | 11 | {06ADC7FB-7262-40F1-FB56-3AC8670B37F5} 12 | 13 | 14 | 15 | 16 | inc 17 | 18 | 19 | inc 20 | 21 | 22 | src 23 | 24 | 25 | src 26 | 27 | 28 | src 29 | 30 | 31 | src 32 | 33 | 34 | src 35 | 36 | 37 | src 38 | 39 | 40 | src 41 | 42 | 43 | src 44 | 45 | 46 | src 47 | 48 | 49 | src 50 | 51 | 52 | src 53 | 54 | 55 | 56 | 57 | src 58 | 59 | 60 | src 61 | 62 | 63 | src 64 | 65 | 66 | src 67 | 68 | 69 | src 70 | 71 | 72 | src 73 | 74 | 75 | src 76 | 77 | 78 | src 79 | 80 | 81 | src 82 | 83 | 84 | src 85 | 86 | 87 | src 88 | 89 | 90 | src 91 | 92 | 93 | 94 | 95 | src\Shaders 96 | 97 | 98 | src\Shaders 99 | 100 | 101 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/build/AMD_SDK_2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {1F80880B-8B89-887C-1405-9F7C800D947C} 6 | 7 | 8 | {2DAB880B-99B4-887C-2230-9F7C8E38947C} 9 | 10 | 11 | {06ADC7FB-7262-40F1-FB56-3AC8670B37F5} 12 | 13 | 14 | 15 | 16 | inc 17 | 18 | 19 | inc 20 | 21 | 22 | src 23 | 24 | 25 | src 26 | 27 | 28 | src 29 | 30 | 31 | src 32 | 33 | 34 | src 35 | 36 | 37 | src 38 | 39 | 40 | src 41 | 42 | 43 | src 44 | 45 | 46 | src 47 | 48 | 49 | src 50 | 51 | 52 | src 53 | 54 | 55 | 56 | 57 | src 58 | 59 | 60 | src 61 | 62 | 63 | src 64 | 65 | 66 | src 67 | 68 | 69 | src 70 | 71 | 72 | src 73 | 74 | 75 | src 76 | 77 | 78 | src 79 | 80 | 81 | src 82 | 83 | 84 | src 85 | 86 | 87 | src 88 | 89 | 90 | src 91 | 92 | 93 | 94 | 95 | src\Shaders 96 | 97 | 98 | src\Shaders 99 | 100 | 101 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/build/AMD_SDK_Minimal_2015.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {1F80880B-8B89-887C-1405-9F7C800D947C} 6 | 7 | 8 | {2DAB880B-99B4-887C-2230-9F7C8E38947C} 9 | 10 | 11 | {06ADC7FB-7262-40F1-FB56-3AC8670B37F5} 12 | 13 | 14 | 15 | 16 | inc 17 | 18 | 19 | inc 20 | 21 | 22 | src 23 | 24 | 25 | src 26 | 27 | 28 | src 29 | 30 | 31 | src 32 | 33 | 34 | src 35 | 36 | 37 | src 38 | 39 | 40 | src 41 | 42 | 43 | src 44 | 45 | 46 | src 47 | 48 | 49 | src 50 | 51 | 52 | src 53 | 54 | 55 | 56 | 57 | src 58 | 59 | 60 | src 61 | 62 | 63 | src 64 | 65 | 66 | src 67 | 68 | 69 | src 70 | 71 | 72 | src 73 | 74 | 75 | src 76 | 77 | 78 | src 79 | 80 | 81 | src 82 | 83 | 84 | src 85 | 86 | 87 | src 88 | 89 | 90 | src 91 | 92 | 93 | 94 | 95 | src\Shaders 96 | 97 | 98 | src\Shaders 99 | 100 | 101 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/build/AMD_SDK_Minimal_2017.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {1F80880B-8B89-887C-1405-9F7C800D947C} 6 | 7 | 8 | {2DAB880B-99B4-887C-2230-9F7C8E38947C} 9 | 10 | 11 | {06ADC7FB-7262-40F1-FB56-3AC8670B37F5} 12 | 13 | 14 | 15 | 16 | inc 17 | 18 | 19 | inc 20 | 21 | 22 | src 23 | 24 | 25 | src 26 | 27 | 28 | src 29 | 30 | 31 | src 32 | 33 | 34 | src 35 | 36 | 37 | src 38 | 39 | 40 | src 41 | 42 | 43 | src 44 | 45 | 46 | src 47 | 48 | 49 | src 50 | 51 | 52 | src 53 | 54 | 55 | 56 | 57 | src 58 | 59 | 60 | src 61 | 62 | 63 | src 64 | 65 | 66 | src 67 | 68 | 69 | src 70 | 71 | 72 | src 73 | 74 | 75 | src 76 | 77 | 78 | src 79 | 80 | 81 | src 82 | 83 | 84 | src 85 | 86 | 87 | src 88 | 89 | 90 | src 91 | 92 | 93 | 94 | 95 | src\Shaders 96 | 97 | 98 | src\Shaders 99 | 100 | 101 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/inc/AMD_SDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: AMD_SDK.h 25 | // 26 | // Library include file, to drag in all AMD SDK helper classes and functions. 27 | //-------------------------------------------------------------------------------------- 28 | #ifndef AMD_SDK_H 29 | #define AMD_SDK_H 30 | 31 | #define VENDOR_ID_AMD (0x1002) 32 | #define VENDOR_ID_NVIDIA (0x10DE) 33 | #define VENDOR_ID_INTEL (0x8086) 34 | 35 | // DXUT helper code 36 | #include "DXUT.h" 37 | #include "DXUTmisc.h" 38 | #include "DXUTgui.h" 39 | #include "SDKmisc.h" 40 | #include "SDKMesh.h" 41 | 42 | // AMD helper classes and functions 43 | #include "..\\src\\Timer.h" 44 | #include "..\\src\\ShaderCache.h" 45 | #include "..\\src\\HelperFunctions.h" 46 | #include "..\\src\\Sprite.h" 47 | #include "..\\src\\Magnify.h" 48 | #include "..\\src\\MagnifyTool.h" 49 | #include "..\\src\\HUD.h" 50 | #include "..\\src\\Geometry.h" 51 | #include "..\\src\\LineRender.h" 52 | #include "..\\src\\AMD_Mesh.h" 53 | 54 | #ifndef ARRAYSIZE 55 | #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0])) 56 | #endif 57 | 58 | // Profile helpers for timing and marking up as D3D perf blocks 59 | #define AMD_PROFILE_RED D3DCOLOR_XRGB( 255, 0, 0 ) 60 | #define AMD_PROFILE_GREEN D3DCOLOR_XRGB( 0, 255, 0 ) 61 | #define AMD_PROFILE_BLUE D3DCOLOR_XRGB( 0, 0, 255 ) 62 | 63 | #define AMDProfileBegin( col, name ) DXUT_BeginPerfEvent( col, name ); TIMER_Begin( col, name ) 64 | #define AMDProfileEnd() TIMER_End() DXUT_EndPerfEvent(); 65 | 66 | struct AMDProfileEventClass 67 | { 68 | AMDProfileEventClass( unsigned int col, LPCWSTR name ) { AMDProfileBegin( col, name ); } 69 | ~AMDProfileEventClass() { AMDProfileEnd() } 70 | }; 71 | 72 | #define AMDProfileEvent( col, name ) AMDProfileEventClass _amd_profile_event( col, name ) 73 | 74 | #endif // AMD_SDK_H 75 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/inc/ShaderCacheSampleHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: ShaderCacheSampleHelper.h 25 | // 26 | // Helpers to implement the DXUT related ShaderCache interface in samples. 27 | //-------------------------------------------------------------------------------------- 28 | #ifndef AMD_SDK_SHADER_CACHE_SAMPLE_HELPER_H 29 | #define AMD_SDK_SHADER_CACHE_SAMPLE_HELPER_H 30 | 31 | 32 | class CDXUTControl; 33 | class CDXUTTextHelper; 34 | typedef long HRESULT; 35 | typedef unsigned int UINT; 36 | 37 | namespace AMD 38 | { 39 | 40 | class HUD; 41 | class ShaderCache; 42 | 43 | //-------------------------------------------------------------------------------------- 44 | // UI control IDs 45 | //-------------------------------------------------------------------------------------- 46 | extern const int g_MaxApplicationControlID; 47 | 48 | enum SHADER_CACHE_SAMPLE_HELPER_IDC 49 | { 50 | AMD_IDC_START = 0, 51 | AMD_IDC_BUTTON_SHOW_SHADERCACHE_UI = AMD_IDC_START, 52 | AMD_IDC_BUTTON_RECOMPILESHADERS_CHANGED, 53 | AMD_IDC_BUTTON_RECOMPILESHADERS_GLOBAL, 54 | AMD_IDC_BUTTON_RECREATE_SHADERS, 55 | AMD_IDC_CHECKBOX_AUTORECOMPILE_SHADERS, 56 | AMD_IDC_CHECKBOX_SHOW_SHADER_ERRORS, 57 | AMD_IDC_CHECKBOX_SHOW_ISA_GPR_PRESSURE, 58 | AMD_IDC_STATIC_TARGET_ISA, 59 | AMD_IDC_STATIC_TARGET_ISA_INFO, 60 | AMD_IDC_COMBOBOX_TARGET_ISA, 61 | AMD_IDC_END 62 | }; 63 | 64 | template< typename T > 65 | T GetEnum( T i_AMDEnum ) 66 | { 67 | return static_cast< T > ( g_MaxApplicationControlID + i_AMDEnum ); 68 | } 69 | 70 | void InitApp( ShaderCache& r_ShaderCache, HUD& r_HUD, int& iY, const bool i_bAdvancedShaderCacheGUI_VisibleByDefault = false ); 71 | void ProcessUIChanges(); 72 | void RenderHUDUpdates( CDXUTTextHelper* i_pTxtHelper ); 73 | void __stdcall OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext ); 74 | 75 | } // namespace AMD 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/media/AMD.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/framework/d3d11/amd_sdk/media/AMD.dds -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/media/AMD.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/framework/d3d11/amd_sdk/media/AMD.ico -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/media/amd_logo_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/framework/d3d11/amd_sdk/media/amd_logo_black.png -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/premake/premake5.lua: -------------------------------------------------------------------------------- 1 | dofile ("../../../../premake/amd_premake_util.lua") 2 | 3 | workspace "AMD_SDK" 4 | configurations { "Debug", "Release" } 5 | platforms { "x64" } 6 | location "../build" 7 | filename ("AMD_SDK" .. _AMD_VS_SUFFIX) 8 | startproject "AMD_SDK" 9 | 10 | filter "platforms:x64" 11 | system "Windows" 12 | architecture "x64" 13 | 14 | project "AMD_SDK" 15 | kind "StaticLib" 16 | language "C++" 17 | characterset "Unicode" 18 | location "../build" 19 | filename ("AMD_SDK" .. _AMD_VS_SUFFIX) 20 | uuid "EBB939DC-98E4-49DF-B1F1-D2E80A11F60A" 21 | targetdir "../lib" 22 | objdir "../build/%{_AMD_SAMPLE_DIR_LAYOUT}" 23 | warnings "Extra" 24 | floatingpoint "Fast" 25 | symbols "On" 26 | 27 | -- Specify WindowsTargetPlatformVersion here for VS2015 28 | systemversion (_AMD_WIN_SDK_VERSION) 29 | 30 | files { "../inc/**.h", "../src/**.h", "../src/**.cpp", "../src/**.hlsl" } 31 | includedirs { "../../dxut/Core", "../../dxut/Optional", "../../../../third_party/assimp/include" } 32 | 33 | filter "configurations:Debug" 34 | defines { "WIN32", "_DEBUG", "DEBUG", "PROFILE", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 35 | flags { "FatalWarnings" } 36 | targetsuffix ("_Debug" .. _AMD_VS_SUFFIX) 37 | 38 | filter "configurations:Release" 39 | defines { "WIN32", "NDEBUG", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 40 | flags { "LinkTimeOptimization", "FatalWarnings" } 41 | targetsuffix ("_Release" .. _AMD_VS_SUFFIX) 42 | optimize "On" 43 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/premake/premake5_minimal.lua: -------------------------------------------------------------------------------- 1 | dofile ("../../../../premake/amd_premake_util.lua") 2 | 3 | workspace "AMD_SDK_Minimal" 4 | configurations { "Debug", "Release" } 5 | platforms { "x64" } 6 | location "../build" 7 | filename ("AMD_SDK_Minimal" .. _AMD_VS_SUFFIX) 8 | startproject "AMD_SDK_Minimal" 9 | 10 | filter "platforms:x64" 11 | system "Windows" 12 | architecture "x64" 13 | 14 | project "AMD_SDK_Minimal" 15 | kind "StaticLib" 16 | language "C++" 17 | characterset "Unicode" 18 | location "../build" 19 | filename ("AMD_SDK_Minimal" .. _AMD_VS_SUFFIX) 20 | uuid "EBB939DC-98E4-49DF-B1F1-D2E80A11F60A" 21 | targetdir "../lib" 22 | objdir "../build/%{_AMD_SAMPLE_DIR_LAYOUT_MINIMAL}" 23 | warnings "Extra" 24 | floatingpoint "Fast" 25 | symbols "On" 26 | 27 | -- Specify WindowsTargetPlatformVersion here for VS2015 28 | systemversion (_AMD_WIN_SDK_VERSION) 29 | 30 | files { "../inc/**.h", "../src/**.h", "../src/**.cpp", "../src/**.hlsl" } 31 | includedirs { "../../dxut/Core", "../../dxut/Optional" } 32 | defines { "AMD_SDK_MINIMAL" } 33 | 34 | filter "configurations:Debug" 35 | defines { "WIN32", "_DEBUG", "DEBUG", "PROFILE", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 36 | flags { "FatalWarnings" } 37 | targetsuffix ("_Debug" .. _AMD_VS_SUFFIX) 38 | 39 | filter "configurations:Release" 40 | defines { "WIN32", "NDEBUG", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 41 | flags { "LinkTimeOptimization", "FatalWarnings" } 42 | targetsuffix ("_Release" .. _AMD_VS_SUFFIX) 43 | optimize "On" 44 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/src/AMD_Mesh.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: AMD_Mesh.h 25 | // 26 | // Convenience wrapper for loading and drawing models with Assimp or DXUT sdkmesh. 27 | //-------------------------------------------------------------------------------------- 28 | #ifndef AMD_SDK_MESH_H 29 | #define AMD_SDK_MESH_H 30 | 31 | #include 32 | #include 33 | 34 | #ifndef AMD_SAFE_RELEASE 35 | #define AMD_SAFE_RELEASE(p) { if (p) { p->Release(); p = NULL; } } 36 | #endif 37 | 38 | class CDXUTSDKMesh; 39 | 40 | namespace AMD 41 | { 42 | class Mesh 43 | { 44 | ID3D11Buffer * _b1d_vertex; 45 | ID3D11Buffer * _b1d_index; 46 | std::vector _t2d; 47 | 48 | struct MaterialGroup 49 | { 50 | int _first_index; 51 | int _index_count; 52 | int _texture_index; 53 | 54 | MaterialGroup() 55 | : _first_index(0) 56 | , _index_count(0) 57 | , _texture_index(0) 58 | {} 59 | }; 60 | 61 | struct Vertex 62 | { 63 | float position[3]; 64 | float normal[3]; 65 | float uv[2]; 66 | }; 67 | 68 | std::vector _material_group; 69 | 70 | char _name[128]; 71 | int _id; 72 | 73 | public: 74 | CDXUTSDKMesh m_sdkMesh; 75 | bool m_isSdkMesh; 76 | 77 | Mesh(); 78 | ~Mesh(); 79 | 80 | std::vector _vertex; 81 | std::vector _index; 82 | std::vector _srv; 83 | 84 | HRESULT Create(ID3D11Device * pDevice, const char * path, const char * name, bool sdkmesh = false); 85 | 86 | HRESULT Render(ID3D11DeviceContext * pContext); 87 | HRESULT Release(); 88 | 89 | ID3D11ShaderResourceView ** srv(); 90 | }; 91 | 92 | } // namespace AMD 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/src/Geometry.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: Geometry.cpp 25 | // 26 | // Classes for geometric primitives and collision and visibility testing 27 | //-------------------------------------------------------------------------------------- 28 | #include "DXUT.h" 29 | #include "Geometry.h" 30 | 31 | using namespace DirectX; 32 | 33 | //-------------------------------------------------------------------------------------- 34 | // Helper function to normalize a plane 35 | //-------------------------------------------------------------------------------------- 36 | static void NormalizePlane( XMFLOAT4* pPlaneEquation ) 37 | { 38 | float mag; 39 | 40 | mag = sqrtf( pPlaneEquation->x * pPlaneEquation->x + 41 | pPlaneEquation->y * pPlaneEquation->y + 42 | pPlaneEquation->z * pPlaneEquation->z ); 43 | 44 | pPlaneEquation->x = pPlaneEquation->x / mag; 45 | pPlaneEquation->y = pPlaneEquation->y / mag; 46 | pPlaneEquation->z = pPlaneEquation->z / mag; 47 | pPlaneEquation->w = pPlaneEquation->w / mag; 48 | } 49 | 50 | 51 | //-------------------------------------------------------------------------------------- 52 | // Extract all 6 plane equations from frustum denoted by supplied matrix 53 | //-------------------------------------------------------------------------------------- 54 | void ExtractPlanesFromFrustum( XMFLOAT4* pPlaneEquation, const XMMATRIX* pMatrix, bool bNormalize ) 55 | { 56 | XMFLOAT4X4 TempMat; 57 | XMStoreFloat4x4( &TempMat, *pMatrix); 58 | 59 | // Left clipping plane 60 | pPlaneEquation[0].x = TempMat._14 + TempMat._11; 61 | pPlaneEquation[0].y = TempMat._24 + TempMat._21; 62 | pPlaneEquation[0].z = TempMat._34 + TempMat._31; 63 | pPlaneEquation[0].w = TempMat._44 + TempMat._41; 64 | 65 | // Right clipping plane 66 | pPlaneEquation[1].x = TempMat._14 - TempMat._11; 67 | pPlaneEquation[1].y = TempMat._24 - TempMat._21; 68 | pPlaneEquation[1].z = TempMat._34 - TempMat._31; 69 | pPlaneEquation[1].w = TempMat._44 - TempMat._41; 70 | 71 | // Top clipping plane 72 | pPlaneEquation[2].x = TempMat._14 - TempMat._12; 73 | pPlaneEquation[2].y = TempMat._24 - TempMat._22; 74 | pPlaneEquation[2].z = TempMat._34 - TempMat._32; 75 | pPlaneEquation[2].w = TempMat._44 - TempMat._42; 76 | 77 | // Bottom clipping plane 78 | pPlaneEquation[3].x = TempMat._14 + TempMat._12; 79 | pPlaneEquation[3].y = TempMat._24 + TempMat._22; 80 | pPlaneEquation[3].z = TempMat._34 + TempMat._32; 81 | pPlaneEquation[3].w = TempMat._44 + TempMat._42; 82 | 83 | // Near clipping plane 84 | pPlaneEquation[4].x = TempMat._13; 85 | pPlaneEquation[4].y = TempMat._23; 86 | pPlaneEquation[4].z = TempMat._33; 87 | pPlaneEquation[4].w = TempMat._43; 88 | 89 | // Far clipping plane 90 | pPlaneEquation[5].x = TempMat._14 - TempMat._13; 91 | pPlaneEquation[5].y = TempMat._24 - TempMat._23; 92 | pPlaneEquation[5].z = TempMat._34 - TempMat._33; 93 | pPlaneEquation[5].w = TempMat._44 - TempMat._43; 94 | 95 | // Normalize the plane equations, if requested 96 | if ( bNormalize ) 97 | { 98 | NormalizePlane( &pPlaneEquation[0] ); 99 | NormalizePlane( &pPlaneEquation[1] ); 100 | NormalizePlane( &pPlaneEquation[2] ); 101 | NormalizePlane( &pPlaneEquation[3] ); 102 | NormalizePlane( &pPlaneEquation[4] ); 103 | NormalizePlane( &pPlaneEquation[5] ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/src/Geometry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: Geometry.h 25 | // 26 | // Classes for geometric primitives and collision and visibility testing. 27 | //-------------------------------------------------------------------------------------- 28 | #ifndef AMD_SDK_GEOMETRY_H 29 | #define AMD_SDK_GEOMETRY_H 30 | 31 | namespace AMD 32 | { 33 | void ExtractPlanesFromFrustum( DirectX::XMFLOAT4* pPlaneEquation, const DirectX::XMMATRIX* pMatrix, bool bNormalize = true ); 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/src/HUD.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: HUD.h 25 | // 26 | // Class definition for the AMD standard HUD interface. 27 | //-------------------------------------------------------------------------------------- 28 | #ifndef AMD_SDK_HUD_H 29 | #define AMD_SDK_HUD_H 30 | 31 | #include "Sprite.h" 32 | 33 | namespace AMD 34 | { 35 | 36 | class HUD 37 | { 38 | public: 39 | 40 | // AMD standard HUD defines for GUI spacing 41 | static const int iElementDelta = 25; 42 | static const int iGroupDelta = ( iElementDelta * 2 ); 43 | static const int iDialogWidth = 250; 44 | static const int iElementHeight = 24; 45 | static const int iElementWidth = 170; 46 | static const int iElementOffset = ( iDialogWidth - iElementWidth ) / 2; 47 | static const int iElementDropHeight = 35; 48 | 49 | // Public access to the CDXUTDialog is allowed for ease of use in the sample 50 | CDXUTDialog m_GUI; 51 | 52 | // Constructor / destructor 53 | HUD(); 54 | ~HUD(); 55 | 56 | // Various hook functions 57 | HRESULT OnCreateDevice( ID3D11Device* pd3dDevice ); 58 | void OnDestroyDevice(); 59 | void OnResizedSwapChain( const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc ); 60 | void OnRender( float fElapsedTime ); 61 | 62 | private: 63 | 64 | // The private AMD logo texture, and sprite object 65 | Sprite m_Sprite; 66 | ID3D11ShaderResourceView* m_pLogoSRV; 67 | }; 68 | 69 | 70 | class Slider : public CDXUTControl 71 | { 72 | public: 73 | 74 | Slider( CDXUTDialog& dialog, int id, int& y, const wchar_t* label, int min, int max, int& value ); 75 | Slider( CDXUTDialog& dialog, int id, int& y, const wchar_t* label, float min, float max, float step, float& value ); 76 | virtual ~Slider() {} 77 | 78 | void OnGuiEvent(); 79 | void SetEnabled( bool enable ); 80 | void SetVisible( bool visible ); 81 | void SetValue( int value ); 82 | void SetValue( float value ); 83 | 84 | private: 85 | 86 | Slider& operator=( const Slider& ); 87 | 88 | int m_Min, m_Max; 89 | float m_MinFloat, m_MaxFloat; 90 | 91 | bool m_UseFloat; 92 | int& m_Value; 93 | float& m_ValueFloat; 94 | 95 | const wchar_t* m_szLabel; 96 | CDXUTSlider* m_pSlider; 97 | CDXUTStatic* m_pLabel; 98 | }; 99 | 100 | } // namespace AMD 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/src/LineRender.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: LineRender.h 25 | // 26 | // Helper to render 3d colored lines. 27 | //-------------------------------------------------------------------------------------- 28 | #ifndef AMD_SDK_LINE_RENDER_H 29 | #define AMD_SDK_LINE_RENDER_H 30 | 31 | // forward declarations 32 | namespace DirectX 33 | { 34 | struct BoundingBox; 35 | } 36 | 37 | namespace AMD 38 | { 39 | 40 | class LineRender 41 | { 42 | public: 43 | 44 | LineRender(); 45 | ~LineRender(); 46 | 47 | void OnCreateDevice( ID3D11Device* pDevice, ID3D11DeviceContext* pImmediateContext, int nMaxLines ); 48 | void OnDestroyDevice(); 49 | 50 | void AddLine( const DirectX::XMFLOAT3& p0, const DirectX::XMFLOAT3& p1, const D3DCOLOR& color ); 51 | void AddLines( const DirectX::XMFLOAT3* pPoints, int nNumLines, const D3DCOLOR& color ); 52 | void AddBox( const DirectX::BoundingBox& box, const D3DCOLOR& color ); 53 | 54 | void Render( const DirectX::XMMATRIX& viewProj ); 55 | 56 | private: 57 | 58 | struct Vertex 59 | { 60 | DirectX::XMFLOAT3 m_Position; 61 | DWORD m_Color; 62 | }; 63 | 64 | struct ConstantBuffer 65 | { 66 | DirectX::XMMATRIX m_ViewProj; 67 | }; 68 | 69 | ID3D11DeviceContext* m_pImmediateContext; 70 | ID3D11InputLayout* m_pInputLayout; 71 | ID3D11VertexShader* m_pVertexShader; 72 | ID3D11PixelShader* m_pPixelShader; 73 | ID3D11Buffer* m_pConstantBuffer; 74 | ID3D11Buffer* m_pVertexBuffer; 75 | Vertex* m_pCPUCopy; 76 | int m_MaxLines; 77 | int m_NumLines; 78 | }; 79 | 80 | } 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/src/Magnify.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: Magnify.h 25 | // 26 | // Magnify class definition. This class magnifies a region of a given surface 27 | // and renders a scaled sprite at the given position on the screen. 28 | //-------------------------------------------------------------------------------------- 29 | #ifndef AMD_SDK_MAGNIFY_H 30 | #define AMD_SDK_MAGNIFY_H 31 | 32 | #include "Sprite.h" 33 | 34 | namespace AMD 35 | { 36 | 37 | class Magnify 38 | { 39 | public: 40 | 41 | // Constructor / destructor 42 | Magnify(); 43 | ~Magnify(); 44 | 45 | // Hooks for the DX SDK Framework 46 | HRESULT OnCreateDevice( ID3D11Device* pd3dDevice ); 47 | void OnDestroyDevice(); 48 | void OnResizedSwapChain( const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc ); 49 | 50 | // Set methods 51 | void SetPixelRegion( int nPixelRegion ); 52 | void SetScale( int nScale ); 53 | void SetDepthRangeMin( float fDepthRangeMin ); 54 | void SetDepthRangeMax( float fDepthRangeMax ); 55 | void SetSourceResource( ID3D11Resource* pSourceResource, DXGI_FORMAT Format, 56 | int nWidth, int nHeight, int nSamples ); 57 | void SetSubSampleIndex( int nSubSampleIndex ); 58 | 59 | // Captures a region, at the current cursor position, for magnification 60 | void Capture( POINT& Point ); 61 | 62 | // Render the magnified region, at the capture location 63 | void RenderBackground(); 64 | void RenderMagnifiedRegion(); 65 | 66 | private: 67 | 68 | // Private methods 69 | void SetPosition( int nPositionX, int nPositionY ); 70 | void CreateInternalResources(); 71 | 72 | private: 73 | 74 | // Magnification settings 75 | int m_nPositionX; 76 | int m_nPositionY; 77 | int m_nPixelRegion; 78 | int m_nHalfPixelRegion; 79 | int m_nScale; 80 | float m_fDepthRangeMin; 81 | float m_fDepthRangeMax; 82 | int m_nBackBufferWidth; 83 | int m_nBackBufferHeight; 84 | int m_nSubSampleIndex; 85 | 86 | // Helper class for plotting the magnified region 87 | Sprite m_Sprite; 88 | 89 | // Source resource data 90 | ID3D11Resource* m_pSourceResource; 91 | ID3D11Texture2D* m_pResolvedSourceResource; 92 | ID3D11Texture2D* m_pCopySourceResource; 93 | ID3D11ShaderResourceView* m_pResolvedSourceResourceSRV; 94 | ID3D11ShaderResourceView* m_pCopySourceResourceSRV; 95 | ID3D11ShaderResourceView* m_pSourceResourceSRV1; 96 | DXGI_FORMAT m_SourceResourceFormat; 97 | int m_nSourceResourceWidth; 98 | int m_nSourceResourceHeight; 99 | int m_nSourceResourceSamples; 100 | DXGI_FORMAT m_DepthFormat; 101 | DXGI_FORMAT m_DepthSRVFormat; 102 | bool m_bDepthFormat; 103 | }; 104 | 105 | } // namespace AMD 106 | 107 | #endif // AMD_SDK_MAGNIFY_H 108 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/src/MagnifyTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // File: MagnifyTool.h 25 | // 26 | // MagnifyTool class definition. This class implements a user interface based upon 27 | // the DXUT framework for the Magnify class. 28 | //-------------------------------------------------------------------------------------- 29 | #ifndef AMD_SDK_MAGNIFY_TOOL_H 30 | #define AMD_SDK_MAGNIFY_TOOL_H 31 | 32 | #include "Magnify.h" 33 | 34 | namespace AMD 35 | { 36 | 37 | // GUI defines 38 | enum MAGNIFY_TOOL_IDC 39 | { 40 | IDC_MAGNIFY_STATIC_CAPTION = 19 + 1024, 41 | IDC_MAGNIFY_CHECKBOX_ENABLE, 42 | IDC_MAGNIFY_CHECKBOX_STICKY, 43 | IDC_MAGNIFY_STATIC_PIXEL_REGION, 44 | IDC_MAGNIFY_SLIDER_PIXEL_REGION, 45 | IDC_MAGNIFY_STATIC_SCALE, 46 | IDC_MAGNIFY_SLIDER_SCALE 47 | }; 48 | 49 | 50 | class MagnifyTool 51 | { 52 | public: 53 | 54 | // Constructor / destructor 55 | MagnifyTool(); 56 | ~MagnifyTool(); 57 | 58 | // Set methods 59 | void SetSourceResources( ID3D11Resource* pSourceRTResource, DXGI_FORMAT RTFormat, 60 | int nWidth, int nHeight, int nSamples ); 61 | void SetPixelRegion( int nPixelRegion ) { m_Magnify.SetPixelRegion( nPixelRegion ); } 62 | void SetScale( int nScale ) { m_Magnify.SetScale( nScale ); } 63 | 64 | // Hooks for the DX SDK Framework 65 | void InitApp( CDXUTDialog* pUI, int& iStartHeight, bool bSupportStickyMode = false ); 66 | HRESULT OnCreateDevice( ID3D11Device* pd3dDevice ); 67 | void OnResizedSwapChain( ID3D11Device* pd3dDevice, IDXGISwapChain *pSwapChain, 68 | const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext, 69 | int nPositionX, int nPositionY ); 70 | void OnDestroyDevice(); 71 | void OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext ); 72 | bool IsEnabled(); 73 | 74 | // Render 75 | void Render(); 76 | 77 | private: 78 | 79 | // UI helper methods 80 | void EnableTool( bool bEnable ); 81 | void EnableUI( bool bEnable ); 82 | 83 | private: 84 | 85 | // The DXUT dialog 86 | CDXUTDialog* m_pMagnifyUI; 87 | 88 | // Pointer to the Magnify class 89 | AMD::Magnify m_Magnify; 90 | 91 | // The source resources 92 | ID3D11Resource* m_pSourceRTResource; 93 | DXGI_FORMAT m_RTFormat; 94 | int m_nWidth; 95 | int m_nHeight; 96 | int m_nSamples; 97 | bool m_bReleaseRTOnResize; 98 | bool m_bMouseDownLastFrame; 99 | bool m_bStickyShowing; 100 | POINT m_StickyPoint; 101 | }; 102 | 103 | } // namespace AMD 104 | 105 | #endif // AMD_SDK_MAGNIFY_TOOL_H 106 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/src/Shaders/Line.hlsl: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | 23 | cbuffer Constants : register ( b0 ) 24 | { 25 | matrix viewProj; 26 | }; 27 | 28 | 29 | struct VertexInput 30 | { 31 | float4 pos : POSITION; 32 | float4 color : COLOR; 33 | }; 34 | 35 | 36 | void LineVS( in VertexInput input, out float4 color : COLOR0, out float4 screenpos : SV_Position ) 37 | { 38 | color = input.color; 39 | screenpos = mul( float4( input.pos.xyz, 1 ), viewProj ); 40 | } 41 | 42 | 43 | float4 LinePS( in float4 color : COLOR0 ) : SV_Target 44 | { 45 | return color; 46 | }; 47 | -------------------------------------------------------------------------------- /framework/d3d11/amd_sdk/src/crc.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | * 3 | * Filename: crc.h 4 | * 5 | * Description: A header file describing the various CRC standards. 6 | * 7 | * Notes: 8 | * 9 | * 10 | * Copyright (c) 2000 by Michael Barr. This software is placed into 11 | * the public domain and may be used for any purpose. However, this 12 | * notice must not be changed or removed and no warranty is either 13 | * expressed or implied by its publication or distribution. 14 | **********************************************************************/ 15 | 16 | #ifndef _crc_h 17 | #define _crc_h 18 | 19 | #ifndef FALSE 20 | #define FALSE 0 21 | #endif 22 | #ifndef TRUE 23 | #define TRUE 1 24 | #endif 25 | 26 | /* 27 | * Select the CRC standard from the list that follows. 28 | */ 29 | #define CRC32 30 | 31 | 32 | #if defined(CRC_CCITT) 33 | 34 | typedef unsigned short crc; 35 | 36 | #define CRC_NAME "CRC-CCITT" 37 | #define POLYNOMIAL 0x1021 38 | #define INITIAL_REMAINDER 0xFFFF 39 | #define FINAL_XOR_VALUE 0x0000 40 | #define REFLECT_DATA FALSE 41 | #define REFLECT_REMAINDER FALSE 42 | #define CHECK_VALUE 0x29B1 43 | 44 | #elif defined(CRC16) 45 | 46 | typedef unsigned short crc; 47 | 48 | #define CRC_NAME "CRC-16" 49 | #define POLYNOMIAL 0x8005 50 | #define INITIAL_REMAINDER 0x0000 51 | #define FINAL_XOR_VALUE 0x0000 52 | #define REFLECT_DATA TRUE 53 | #define REFLECT_REMAINDER TRUE 54 | #define CHECK_VALUE 0xBB3D 55 | 56 | #elif defined(CRC32) 57 | 58 | typedef unsigned long crc; 59 | 60 | #define CRC_NAME "CRC-32" 61 | #define POLYNOMIAL 0x04C11DB7 62 | #define INITIAL_REMAINDER 0xFFFFFFFF 63 | #define FINAL_XOR_VALUE 0xFFFFFFFF 64 | #define REFLECT_DATA TRUE 65 | #define REFLECT_REMAINDER TRUE 66 | #define CHECK_VALUE 0xCBF43926 67 | 68 | #else 69 | 70 | #error "One of CRC_CCITT, CRC16, or CRC32 must be #define'd." 71 | 72 | #endif 73 | 74 | void crcInit(void); 75 | crc crcSlow(unsigned char const message[], int nBytes); 76 | crc crcFast(unsigned char const message[], int nBytes); 77 | 78 | 79 | #endif /* _crc_h */ -------------------------------------------------------------------------------- /framework/d3d11/dxut/.gitattributes: -------------------------------------------------------------------------------- 1 | # This is a windows-only project. Force CRLF. 2 | * text eol=crlf 3 | 4 | # Explicit settings for specific file types. 5 | *.h eol=crlf 6 | *.cpp eol=crlf 7 | *.inl eol=crlf 8 | *.hlsl eol=crlf 9 | *.rc eol=crlf 10 | *.manifest eol=crlf 11 | *.vcxproj eol=crlf 12 | *.filters eol=crlf 13 | *.props eol=crlf 14 | *.sln eol=crlf 15 | *.bat eol=crlf 16 | *.txt eol=crlf 17 | *.lua eol=crlf 18 | *.md eol=crlf 19 | *.pdf binary 20 | *.ppsx binary 21 | *.ico binary 22 | *.png binary 23 | *.dds binary 24 | *.sdkmesh binary 25 | *.dll binary 26 | *.exe binary 27 | -------------------------------------------------------------------------------- /framework/d3d11/dxut/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, etc. 2 | 3 | # User-specific files 4 | *.suo 5 | *.user 6 | 7 | # Build results 8 | [Bb]in/ 9 | 10 | # Visual Studo 2015 cache/options directory 11 | .vs/ 12 | 13 | # Visual C++ cache files 14 | ipch/ 15 | *.aps 16 | *.ncb 17 | *.opensdf 18 | *.sdf 19 | *.cachefile 20 | 21 | # Visual Studio profiler 22 | *.psess 23 | *.vsp 24 | *.vspx 25 | 26 | # Installshield output folder 27 | [Ee]xpress/ 28 | 29 | # Backup & report files from converting an old project file 30 | # to a newer Visual Studio version. Backup files are not needed, 31 | # because we have git ;-) 32 | _UpgradeReport_Files/ 33 | Backup*/ 34 | UpgradeLog*.XML 35 | UpgradeLog*.htm 36 | -------------------------------------------------------------------------------- /framework/d3d11/dxut/Core/ScreenGrab.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/framework/d3d11/dxut/Core/ScreenGrab.cpp -------------------------------------------------------------------------------- /framework/d3d11/dxut/Core/ScreenGrab.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ScreenGrab.h 3 | // 4 | // Function for capturing a 2D texture and saving it to a file (aka a 'screenshot' 5 | // when used on a Direct3D 11 Render Target). 6 | // 7 | // Note these functions are useful as a light-weight runtime screen grabber. For 8 | // full-featured texture capture, DDS writer, and texture processing pipeline, 9 | // see the 'Texconv' sample and the 'DirectXTex' library. 10 | // 11 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 12 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 13 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 14 | // PARTICULAR PURPOSE. 15 | // 16 | // Copyright (c) Microsoft Corporation. All rights reserved. 17 | // 18 | // http://go.microsoft.com/fwlink/?LinkId=248926 19 | // http://go.microsoft.com/fwlink/?LinkId=248929 20 | //-------------------------------------------------------------------------------------- 21 | 22 | #ifdef _MSC_VER 23 | #pragma once 24 | #endif 25 | 26 | #include 27 | 28 | #include 29 | 30 | #pragma warning(push) 31 | #pragma warning(disable : 4005) 32 | #include 33 | #pragma warning(pop) 34 | 35 | #include 36 | 37 | namespace DirectX 38 | { 39 | HRESULT SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, 40 | _In_ ID3D11Resource* pSource, 41 | _In_z_ LPCWSTR fileName ); 42 | 43 | HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, 44 | _In_ ID3D11Resource* pSource, 45 | _In_ REFGUID guidContainerFormat, 46 | _In_z_ LPCWSTR fileName, 47 | _In_opt_ const GUID* targetFormat = nullptr, 48 | _In_opt_ std::function setCustomProps = nullptr ); 49 | } -------------------------------------------------------------------------------- /framework/d3d11/dxut/Core/dxerr.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: DXErr.h 3 | // 4 | // DirectX Error Library 5 | // 6 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 7 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 8 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 9 | // PARTICULAR PURPOSE. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | //-------------------------------------------------------------------------------------- 13 | 14 | // This version only supports UNICODE. 15 | 16 | #pragma once 17 | 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | //-------------------------------------------------------------------------------------- 26 | // DXGetErrorString 27 | //-------------------------------------------------------------------------------------- 28 | const WCHAR* WINAPI DXGetErrorStringW( _In_ HRESULT hr ); 29 | 30 | #define DXGetErrorString DXGetErrorStringW 31 | 32 | //-------------------------------------------------------------------------------------- 33 | // DXGetErrorDescription has to be modified to return a copy in a buffer rather than 34 | // the original static string. 35 | //-------------------------------------------------------------------------------------- 36 | void WINAPI DXGetErrorDescriptionW( _In_ HRESULT hr, _Out_cap_(count) WCHAR* desc, _In_ size_t count ); 37 | 38 | #define DXGetErrorDescription DXGetErrorDescriptionW 39 | 40 | //-------------------------------------------------------------------------------------- 41 | // DXTrace 42 | // 43 | // Desc: Outputs a formatted error message to the debug stream 44 | // 45 | // Args: WCHAR* strFile The current file, typically passed in using the 46 | // __FILEW__ macro. 47 | // DWORD dwLine The current line number, typically passed in using the 48 | // __LINE__ macro. 49 | // HRESULT hr An HRESULT that will be traced to the debug stream. 50 | // CHAR* strMsg A string that will be traced to the debug stream (may be NULL) 51 | // BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. 52 | // 53 | // Return: The hr that was passed in. 54 | //-------------------------------------------------------------------------------------- 55 | HRESULT WINAPI DXTraceW( _In_z_ const WCHAR* strFile, _In_ DWORD dwLine, _In_ HRESULT hr, _In_opt_ const WCHAR* strMsg, _In_ bool bPopMsgBox ); 56 | 57 | #define DXTrace DXTraceW 58 | 59 | //-------------------------------------------------------------------------------------- 60 | // 61 | // Helper macros 62 | // 63 | //-------------------------------------------------------------------------------------- 64 | #if defined(DEBUG) || defined(_DEBUG) 65 | #define DXTRACE_MSG(str) DXTrace( __FILEW__, (DWORD)__LINE__, 0, str, false ) 66 | #define DXTRACE_ERR(str,hr) DXTrace( __FILEW__, (DWORD)__LINE__, hr, str, false ) 67 | #define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILEW__, (DWORD)__LINE__, hr, str, true ) 68 | #else 69 | #define DXTRACE_MSG(str) (0L) 70 | #define DXTRACE_ERR(str,hr) (hr) 71 | #define DXTRACE_ERR_MSGBOX(str,hr) (hr) 72 | #endif 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif //__cplusplus 77 | -------------------------------------------------------------------------------- /framework/d3d11/dxut/Core/premake5.lua: -------------------------------------------------------------------------------- 1 | dofile ("../../../../premake/amd_premake_util.lua") 2 | 3 | workspace "DXUT" 4 | configurations { "Debug", "Release" } 5 | platforms { "x64" } 6 | filename ("DXUT" .. _AMD_VS_SUFFIX) 7 | startproject "DXUT" 8 | 9 | filter "platforms:x64" 10 | system "Windows" 11 | architecture "x64" 12 | 13 | project "DXUT" 14 | kind "StaticLib" 15 | language "C++" 16 | characterset "Unicode" 17 | filename ("DXUT" .. _AMD_VS_SUFFIX) 18 | uuid "85344B7F-5AA0-4e12-A065-D1333D11F6CA" 19 | targetdir "Bin/%{_AMD_SAMPLE_DIR_LAYOUT}" 20 | objdir "Bin/%{_AMD_SAMPLE_DIR_LAYOUT}" 21 | warnings "Extra" 22 | floatingpoint "Fast" 23 | symbols "On" 24 | pchheader "DXUT.h" 25 | pchsource "DXUT.cpp" 26 | 27 | -- Specify WindowsTargetPlatformVersion here for VS2015 28 | systemversion (_AMD_WIN_SDK_VERSION) 29 | 30 | files { "*.h", "*.cpp" } 31 | 32 | filter "configurations:Debug" 33 | defines { "WIN32", "_DEBUG", "DEBUG", "PROFILE", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 34 | flags { "FatalWarnings" } 35 | 36 | filter "configurations:Release" 37 | defines { "WIN32", "NDEBUG", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 38 | flags { "LinkTimeOptimization", "FatalWarnings" } 39 | optimize "On" 40 | -------------------------------------------------------------------------------- /framework/d3d11/dxut/MIT.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft Corp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | software and associated documentation files (the "Software"), to deal in the Software 7 | without restriction, including without limitation the rights to use, copy, modify, 8 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies 13 | or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 17 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 19 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 20 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /framework/d3d11/dxut/Optional/DXUTres.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // File: dxutres.h 3 | // 4 | // Functions to create DXUT media from arrays in memory 5 | // 6 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 7 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 8 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 9 | // PARTICULAR PURPOSE. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // 13 | // http://go.microsoft.com/fwlink/?LinkId=320437 14 | //----------------------------------------------------------------------------- 15 | #pragma once 16 | 17 | HRESULT WINAPI DXUTCreateGUITextureFromInternalArray( _In_ ID3D11Device* pd3dDevice, _Outptr_ ID3D11Texture2D** ppTexture ); 18 | -------------------------------------------------------------------------------- /framework/d3d11/dxut/Optional/ImeUi.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ImeUi.h 3 | // 4 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 5 | // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 6 | // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 7 | // PARTICULAR PURPOSE. 8 | // 9 | // Copyright (c) Microsoft Corporation. All rights reserved. 10 | // 11 | // http://go.microsoft.com/fwlink/?LinkId=320437 12 | //-------------------------------------------------------------------------------------- 13 | #pragma once 14 | 15 | #include 16 | 17 | class CImeUiFont_Base 18 | { 19 | public: 20 | virtual void SetHeight( _In_ UINT uHeight ) 21 | { 22 | UNREFERENCED_PARAMETER(uHeight); 23 | }; // for backward compatibility 24 | virtual void SetColor( _In_ DWORD color ) = 0; 25 | virtual void SetPosition( _In_ int x, _In_ int y ) = 0; 26 | virtual void GetTextExtent( _In_z_ LPCTSTR szText, _Out_ DWORD* puWidth, _Out_ DWORD* puHeight ) = 0; 27 | virtual void DrawText( _In_z_ LPCTSTR pszText ) = 0; 28 | }; 29 | 30 | typedef struct 31 | { 32 | // symbol (Henkan-kyu) 33 | DWORD symbolColor; 34 | DWORD symbolColorOff; 35 | DWORD symbolColorText; 36 | BYTE symbolHeight; 37 | BYTE symbolTranslucence; 38 | BYTE symbolPlacement; 39 | CImeUiFont_Base* symbolFont; 40 | 41 | // candidate list 42 | DWORD candColorBase; 43 | DWORD candColorBorder; 44 | DWORD candColorText; 45 | 46 | // composition string 47 | DWORD compColorInput; 48 | DWORD compColorTargetConv; 49 | DWORD compColorConverted; 50 | DWORD compColorTargetNotConv; 51 | DWORD compColorInputErr; 52 | BYTE compTranslucence; 53 | DWORD compColorText; 54 | 55 | // caret 56 | BYTE caretWidth; 57 | BYTE caretYMargin; 58 | } IMEUI_APPEARANCE; 59 | 60 | typedef struct // D3DTLVERTEX compatible 61 | { 62 | float sx; 63 | float sy; 64 | float sz; 65 | float rhw; 66 | DWORD color; 67 | DWORD specular; 68 | float tu; 69 | float tv; 70 | } IMEUI_VERTEX; 71 | 72 | // IME States 73 | #define IMEUI_STATE_OFF 0 74 | #define IMEUI_STATE_ON 1 75 | #define IMEUI_STATE_ENGLISH 2 76 | 77 | // IME const 78 | #define MAX_CANDLIST 10 79 | 80 | // IME Flags 81 | #define IMEUI_FLAG_SUPPORT_CARET 0x00000001 82 | 83 | bool ImeUi_Initialize( _In_ HWND hwnd, _In_ bool bDisable = false ); 84 | void ImeUi_Uninitialize(); 85 | void ImeUi_SetAppearance( _In_opt_ const IMEUI_APPEARANCE* pia ); 86 | void ImeUi_GetAppearance( _Out_opt_ IMEUI_APPEARANCE* pia ); 87 | bool ImeUi_IgnoreHotKey( _In_ const MSG* pmsg ); 88 | LPARAM ImeUi_ProcessMessage( _In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wParam, _Inout_ LPARAM& lParam, _Out_ bool* trapped ); 89 | void ImeUi_SetScreenDimension( _In_ UINT width, _In_ UINT height ); 90 | void ImeUi_RenderUI( _In_ bool bDrawCompAttr = true, _In_ bool bDrawOtherUi = true ); 91 | void ImeUi_SetCaretPosition( _In_ UINT x, _In_ UINT y ); 92 | void ImeUi_SetCompStringAppearance( _In_ CImeUiFont_Base* pFont, _In_ DWORD color, _In_ const RECT* prc ); 93 | bool ImeUi_GetCaretStatus(); 94 | void ImeUi_SetInsertMode( _In_ bool bInsert ); 95 | void ImeUi_SetState( _In_ DWORD dwState ); 96 | DWORD ImeUi_GetState(); 97 | void ImeUi_EnableIme( _In_ bool bEnable ); 98 | bool ImeUi_IsEnabled(); 99 | void ImeUi_FinalizeString( _In_ bool bSend = false ); 100 | void ImeUi_ToggleLanguageBar( _In_ BOOL bRestore ); 101 | bool ImeUi_IsSendingKeyMessage(); 102 | void ImeUi_SetWindow( _In_ HWND hwnd ); 103 | UINT ImeUi_GetInputCodePage(); 104 | DWORD ImeUi_GetFlags(); 105 | void ImeUi_SetFlags( _In_ DWORD dwFlags, _In_ bool bSet ); 106 | 107 | WORD ImeUi_GetPrimaryLanguage(); 108 | DWORD ImeUi_GetImeId( _In_ UINT uIndex ); 109 | WORD ImeUi_GetLanguage(); 110 | LPTSTR ImeUi_GetIndicatior(); 111 | bool ImeUi_IsShowReadingWindow(); 112 | bool ImeUi_IsShowCandListWindow(); 113 | bool ImeUi_IsVerticalCand(); 114 | bool ImeUi_IsHorizontalReading(); 115 | TCHAR* ImeUi_GetCandidate( _In_ UINT idx ); 116 | TCHAR* ImeUi_GetCompositionString(); 117 | DWORD ImeUi_GetCandidateSelection(); 118 | DWORD ImeUi_GetCandidateCount(); 119 | BYTE* ImeUi_GetCompStringAttr(); 120 | DWORD ImeUi_GetImeCursorChars(); 121 | 122 | extern void ( CALLBACK*ImeUiCallback_DrawRect )( _In_ int x1, _In_ int y1, _In_ int x2, _In_ int y2, _In_ DWORD color ); 123 | extern void* ( __cdecl*ImeUiCallback_Malloc )( _In_ size_t bytes ); 124 | extern void ( __cdecl*ImeUiCallback_Free )( _In_ void* ptr ); 125 | extern void ( CALLBACK*ImeUiCallback_DrawFans )( _In_ const IMEUI_VERTEX* paVertex, _In_ UINT uNum ); 126 | extern void ( CALLBACK*ImeUiCallback_OnChar )( _In_ WCHAR wc ); 127 | -------------------------------------------------------------------------------- /framework/d3d11/dxut/Optional/directx.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/framework/d3d11/dxut/Optional/directx.ico -------------------------------------------------------------------------------- /framework/d3d11/dxut/Optional/premake5.lua: -------------------------------------------------------------------------------- 1 | dofile ("../../../../premake/amd_premake_util.lua") 2 | 3 | workspace "DXUTOpt" 4 | configurations { "Debug", "Release" } 5 | platforms { "x64" } 6 | filename ("DXUTOpt" .. _AMD_VS_SUFFIX) 7 | startproject "DXUTOpt" 8 | 9 | filter "platforms:x64" 10 | system "Windows" 11 | architecture "x64" 12 | 13 | project "DXUTOpt" 14 | kind "StaticLib" 15 | language "C++" 16 | characterset "Unicode" 17 | filename ("DXUTOpt" .. _AMD_VS_SUFFIX) 18 | uuid "61B333C2-C4F7-4cc1-A9BF-83F6D95588EB" 19 | targetdir "Bin/%{_AMD_SAMPLE_DIR_LAYOUT}" 20 | objdir "Bin/%{_AMD_SAMPLE_DIR_LAYOUT}" 21 | warnings "Extra" 22 | floatingpoint "Fast" 23 | symbols "On" 24 | pchheader "DXUT.h" 25 | pchsource "DXUTres.cpp" 26 | 27 | -- Specify WindowsTargetPlatformVersion here for VS2015 28 | systemversion (_AMD_WIN_SDK_VERSION) 29 | 30 | files { "*.h", "*.cpp" } 31 | includedirs { "../Core" } 32 | 33 | filter "configurations:Debug" 34 | defines { "WIN32", "_DEBUG", "DEBUG", "PROFILE", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 35 | flags { "FatalWarnings" } 36 | 37 | filter "configurations:Release" 38 | defines { "WIN32", "NDEBUG", "_WINDOWS", "_LIB", "_WIN32_WINNT=0x0601" } 39 | flags { "LinkTimeOptimization", "FatalWarnings" } 40 | optimize "On" 41 | -------------------------------------------------------------------------------- /premake/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003-2016 Jason Perkins and individual contributors. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of Premake nor the names of its contributors may be 15 | used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /premake/amd_premake_util.lua: -------------------------------------------------------------------------------- 1 | -- amd_premake_util.lua 2 | -- utility code shared by AMD build scripts 3 | 4 | -- _ACTION is a premake global variable and for our usage will be vs2013, vs2015, etc. 5 | -- Strip "vs" from this string to make a suffix for solution and project files. 6 | _AMD_VS_SUFFIX = "_" .. string.gsub(_ACTION, "vs", "") 7 | 8 | -- _ACTION is a premake global variable and for our usage will be vs2013, vs2015, etc. 9 | -- Make an allcaps version. We use this for some directory names. 10 | _AMD_ACTION_ALL_CAPS = string.upper(_ACTION) 11 | 12 | -- Specify the DLL prefix here 13 | _AMD_LIBRARY_PREFIX = "GPUOpen_" 14 | 15 | -- Specify build output directory structure here: e.g. VS2015\x64\DLL_Debug 16 | _AMD_SAMPLE_DIR_LAYOUT = "Desktop%{_AMD_VS_SUFFIX}/%{cfg.platform}/%{cfg.buildcfg}" 17 | _AMD_LIBRARY_DIR_LAYOUT = "%{_AMD_ACTION_ALL_CAPS}/%{cfg.platform}/%{cfg.buildcfg}" 18 | _AMD_LIBRARY_DIR_LAYOUT_BACKSLASH = "%{_AMD_ACTION_ALL_CAPS}\\%{cfg.platform}\\%{cfg.buildcfg}" 19 | 20 | -- Some projects have a "minimal dependencies" build. Give them a different output 21 | -- directory structure to avoid collisions with the full-dependencies version. 22 | _AMD_SAMPLE_DIR_LAYOUT_MINIMAL = "Desktop%{_AMD_VS_SUFFIX}/minimal/%{cfg.platform}/%{cfg.buildcfg}" 23 | _AMD_LIBRARY_DIR_LAYOUT_MINIMAL = "%{_AMD_ACTION_ALL_CAPS}/minimal/%{cfg.platform}/%{cfg.buildcfg}" 24 | 25 | -- Specify WindowsTargetPlatformVersion here for VS2015 26 | _AMD_WIN_SDK_VERSION = "8.1" 27 | 28 | -- command lines for Visual Studio build events 29 | _AMD_COPY_WIN_8_1_SDK_REDIST_TO_BIN = "if not exist \"..\\bin\\d3dcompiler_47.dll\" if exist \"$(ProgramFiles)\\Windows Kits\\8.1\\Redist\\D3D\\x64\\d3dcompiler_47.dll\" xcopy \"$(ProgramFiles)\\Windows Kits\\8.1\\Redist\\D3D\\x64\\d3dcompiler_47.dll\" \"..\\bin\" /H /R /Y > nul" 30 | _AMD_COPY_AGS_RLS_DLL_TO_BIN = "xcopy \"..\\..\\amd_lib\\ags_lib\\lib\\amd_ags_x64.dll\" \"..\\bin\" /H /R /Y > nul" 31 | _AMD_COPY_ASSIMP_RLS_DLL_TO_BIN = "xcopy \"..\\..\\third_party\\assimp\\lib\\assimp_x64%{_AMD_VS_SUFFIX}.dll\" \"..\\bin\" /H /R /Y > nul" 32 | 33 | -- touch the import lib so that the sample build will know the library was updated 34 | _AMD_TOUCH_IMPORT_LIB = "copy /b \"..\\lib\\%{_AMD_LIBRARY_DIR_LAYOUT_BACKSLASH}\\$(TargetName).lib\" +,, \"..\\lib\\%{_AMD_LIBRARY_DIR_LAYOUT_BACKSLASH}\\\" > nul" 35 | 36 | -- these are for copying the updated import lib and dll into the shared location 37 | _AMD_COPY_DLL = "xcopy \"..\\lib\\%{_AMD_LIBRARY_DIR_LAYOUT_BACKSLASH}\\$(TargetName).dll\" \"..\\lib\" /H /R /Y > nul" 38 | _AMD_COPY_IMPORT_LIB = "xcopy \"..\\lib\\%{_AMD_LIBRARY_DIR_LAYOUT_BACKSLASH}\\$(TargetName).lib\" \"..\\lib\" /H /R /Y > nul" 39 | 40 | -- post-build commands for samples 41 | function amdSamplePostbuildCommands(copyAgs, copyAssimp) 42 | local commands = {} 43 | local doCopyAgs = copyAgs or false 44 | local doCopyAssimp = copyAssimp or false 45 | -- copy d3dcompiler_47.dll from the 8.1 SDK to the local bin directory 46 | table.insert(commands, _AMD_COPY_WIN_8_1_SDK_REDIST_TO_BIN) 47 | -- copy the library DLLs to the local bin directory 48 | table.insert(commands, "if exist \"..\\..\\AMD_%{_AMD_LIBRARY_NAME}\\lib\\%{_AMD_LIBRARY_PREFIX}%{_AMD_LIBRARY_NAME}_x64d.dll\" xcopy \"..\\..\\AMD_%{_AMD_LIBRARY_NAME}\\lib\\%{_AMD_LIBRARY_PREFIX}%{_AMD_LIBRARY_NAME}_x64d.dll\" \"..\\bin\" /H /R /Y > nul") 49 | table.insert(commands, "if exist \"..\\..\\AMD_%{_AMD_LIBRARY_NAME}\\lib\\%{_AMD_LIBRARY_PREFIX}%{_AMD_LIBRARY_NAME}_x64.dll\" xcopy \"..\\..\\AMD_%{_AMD_LIBRARY_NAME}\\lib\\%{_AMD_LIBRARY_PREFIX}%{_AMD_LIBRARY_NAME}_x64.dll\" \"..\\bin\" /H /R /Y > nul") 50 | if doCopyAgs then 51 | -- copy the AGS DLLs to the local bin directory 52 | table.insert(commands, _AMD_COPY_AGS_RLS_DLL_TO_BIN) 53 | end 54 | if doCopyAssimp then 55 | -- copy the Open Asset Import Library (assimp) Release DLL to the local bin directory 56 | table.insert(commands, _AMD_COPY_ASSIMP_RLS_DLL_TO_BIN) 57 | end 58 | return commands 59 | end 60 | 61 | -- post-build commands for libraries 62 | function amdLibPostbuildCommands() 63 | local commands = {} 64 | -- touch the import library so that the sample build will know the library was updated 65 | table.insert(commands, _AMD_TOUCH_IMPORT_LIB) 66 | -- copy the DLL and import library into the lib directory 67 | table.insert(commands, _AMD_COPY_DLL) 68 | table.insert(commands, _AMD_COPY_IMPORT_LIB) 69 | return commands 70 | end 71 | -------------------------------------------------------------------------------- /premake/gpuopen_depthoffieldfx_update_vs_files.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | call gpuopen_fx_update_vs_files.bat amd_depthoffieldfx 3 | pause -------------------------------------------------------------------------------- /premake/gpuopen_fx_update_vs_files.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if %1.==. goto usage 4 | 5 | set arg1=%1 6 | 7 | :: strip off relative path 8 | if "%arg1:~0,3%" == "..\" set arg1=%arg1:~3% 9 | 10 | set startdir=%cd% 11 | cd "%~dp0" 12 | 13 | echo --- amd_lib --- 14 | cd ..\amd_lib\shared\d3d11\premake 15 | call :createvsfilesforsharedcode 16 | call :createvsfileswithminimaldependencies 17 | 18 | echo --- amd_sdk --- 19 | cd ..\..\..\..\framework\d3d11\amd_sdk\premake 20 | call :createvsfilesforsharedcode 21 | call :createvsfileswithminimaldependencies 22 | 23 | echo --- dxut core --- 24 | cd ..\..\dxut\Core 25 | call :createvsfilesforsharedcode 26 | 27 | echo --- dxut optional --- 28 | cd ..\Optional 29 | call :createvsfilesforsharedcode 30 | cd ..\..\..\..\ 31 | :: we don't keep solution files for amd_lib, amd_sdk, or dxut 32 | call :cleanslnfiles 33 | 34 | echo --- %arg1% --- 35 | cd %arg1%\premake 36 | call :createvsfiles 37 | cd ..\..\ 38 | 39 | :: sample, capture_viewer, etc. 40 | for /f %%a in ('dir /a:d /b %arg1%_* 2^>nul') do call :createvsfilesforsamples %%a 41 | 42 | cd "%startdir%" 43 | 44 | goto :EOF 45 | 46 | ::-------------------------- 47 | :: SUBROUTINES 48 | ::-------------------------- 49 | 50 | :: sample, capture_viewer, etc. 51 | :createvsfilesforsamples 52 | if exist %1\premake ( 53 | echo --- %1 --- 54 | cd %1\premake 55 | call :createvsfiles 56 | cd ..\..\ 57 | ) 58 | goto :EOF 59 | 60 | :: run premake for vs2015 and vs2017 61 | :createvsfiles 62 | ..\..\premake\premake5.exe vs2015 63 | ..\..\premake\premake5.exe vs2017 64 | goto :EOF 65 | 66 | :: run premake for vs2015 and vs2017 67 | :createvsfilesforsharedcode 68 | ..\..\..\..\premake\premake5.exe vs2015 69 | ..\..\..\..\premake\premake5.exe vs2017 70 | goto :EOF 71 | 72 | :: run premake for vs2013 and vs2015 73 | :createvsfileswithminimaldependencies 74 | ..\..\..\..\premake\premake5.exe --file=premake5_minimal.lua vs2015 75 | ..\..\..\..\premake\premake5.exe --file=premake5_minimal.lua vs2017 76 | goto :EOF 77 | 78 | :: delete unnecessary sln files 79 | :cleanslnfiles 80 | del /f /q amd_lib\shared\d3d11\build\AMD_LIB_2015.sln 81 | del /f /q amd_lib\shared\d3d11\build\AMD_LIB_2017.sln 82 | 83 | del /f /q amd_lib\shared\d3d11\build\AMD_LIB_Minimal_2015.sln 84 | del /f /q amd_lib\shared\d3d11\build\AMD_LIB_Minimal_2017.sln 85 | 86 | del /f /q framework\d3d11\amd_sdk\build\AMD_SDK_2015.sln 87 | del /f /q framework\d3d11\amd_sdk\build\AMD_SDK_2017.sln 88 | 89 | del /f /q framework\d3d11\amd_sdk\build\AMD_SDK_Minimal_2015.sln 90 | del /f /q framework\d3d11\amd_sdk\build\AMD_SDK_Minimal_2017.sln 91 | 92 | del /f /q framework\d3d11\dxut\Core\DXUT_2015.sln 93 | del /f /q framework\d3d11\dxut\Core\DXUT_2017.sln 94 | 95 | del /f /q framework\d3d11\dxut\Optional\DXUTOpt_2015.sln 96 | del /f /q framework\d3d11\dxut\Optional\DXUTOpt_2017.sln 97 | goto :EOF 98 | 99 | ::-------------------------- 100 | :: usage should be last 101 | ::-------------------------- 102 | 103 | :usage 104 | echo usage: %0 library_dir_name 105 | echo or: %0 ..\library_dir_name 106 | echo example: %0 AMD_AOFX 107 | echo or: %0 ..\AMD_AOFX 108 | -------------------------------------------------------------------------------- /premake/premake5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-Effects/DepthOfFieldFX/d6e07f36b4804975953958031536ab7876223d5b/premake/premake5.exe --------------------------------------------------------------------------------