├── LICENSE.txt
├── README.md
├── build
├── platforms
│ └── vs2015
│ │ ├── GFSDK_SSAO.sln
│ │ ├── GFSDK_SSAO_D3D11.vcxproj
│ │ ├── GFSDK_SSAO_D3D11.vcxproj.filters
│ │ ├── GFSDK_SSAO_D3D11_UWP.vcxproj
│ │ ├── GFSDK_SSAO_D3D11_UWP.vcxproj.filters
│ │ ├── GFSDK_SSAO_D3D12.vcxproj
│ │ ├── GFSDK_SSAO_D3D12.vcxproj.filters
│ │ ├── GFSDK_SSAO_D3D12_UWP.vcxproj
│ │ ├── GFSDK_SSAO_D3D12_UWP.vcxproj.filters
│ │ ├── GFSDK_SSAO_GL.vcxproj
│ │ ├── GFSDK_SSAO_GL.vcxproj.filters
│ │ ├── GFSDK_SSAO_Shaders_D3D11.vcxproj
│ │ ├── GFSDK_SSAO_Shaders_D3D11.vcxproj.filters
│ │ ├── GFSDK_SSAO_Shaders_GL.vcxproj
│ │ ├── GFSDK_SSAO_Shaders_GL.vcxproj.filters
│ │ └── Resource.rc
└── tools
│ ├── ShaderBuildTool
│ ├── ShaderBuildTool.cpp
│ ├── ShaderBuildTool.sln
│ ├── ShaderBuildTool.vcxproj
│ ├── ShaderBuildTool.vcxproj.filters
│ ├── stdafx.cpp
│ ├── stdafx.h
│ └── targetver.h
│ └── Stringify
│ ├── Stringify.cpp
│ ├── Stringify.sln
│ ├── Stringify.vcxproj
│ ├── Stringify.vcxproj.filters
│ ├── stdafx.cpp
│ ├── stdafx.h
│ └── targetver.h
├── doc
├── .buildinfo
├── _images
│ ├── AOBias_0_0.png
│ ├── AOBias_0_3.png
│ ├── AO_Radius_1.png
│ ├── AO_Radius_4.png
│ ├── BackgroundAO_OFF.png
│ ├── BackgroundAO_ON.png
│ ├── Blur_Radius_4.png
│ ├── Blur_Sharpness_0.png
│ ├── Blur_Sharpness_8.png
│ ├── ForegroundAO_OFF.png
│ ├── ForegroundAO_ON.png
│ ├── No_Blur.png
│ ├── hbao-plus-in-tom-clancys-splinter-cell-blacklist-2.jpg
│ ├── pipeline_with_input_normals.png
│ └── pipeline_without_input_normals.png
├── _sources
│ ├── changelog.txt
│ ├── index.txt
│ ├── product.txt
│ ├── releasenotes.txt
│ └── sphinx
│ │ └── python-2.7.5
│ │ └── Lib
│ │ └── site-packages
│ │ ├── Sphinx-1.2.dist-info
│ │ └── DESCRIPTION.txt
│ │ ├── setuptools-2.1.dist-info
│ │ └── DESCRIPTION.txt
│ │ ├── sphinx
│ │ └── ext
│ │ │ └── autosummary
│ │ │ └── templates
│ │ │ └── autosummary
│ │ │ ├── base.txt
│ │ │ ├── class.txt
│ │ │ └── module.txt
│ │ └── tests
│ │ └── roots
│ │ └── test-only-directive
│ │ ├── contents.txt
│ │ └── only.txt
├── _static
│ ├── AOBias_0_0.png
│ ├── AOBias_0_3.png
│ ├── AO_Radius_1.png
│ ├── AO_Radius_4.png
│ ├── BackgroundAO_OFF.png
│ ├── BackgroundAO_ON.png
│ ├── Blur_Radius_4.png
│ ├── Blur_Sharpness_0.png
│ ├── Blur_Sharpness_8.png
│ ├── DINWebPro-Black.woff
│ ├── DINWebPro-BlackIta.woff
│ ├── DINWebPro-Bold.woff
│ ├── DINWebPro-BoldIta.woff
│ ├── DINWebPro-Ita.woff
│ ├── DINWebPro-Light.woff
│ ├── DINWebPro-LightIta.woff
│ ├── DINWebPro-Medium.woff
│ ├── DINWebPro-MediumIta.woff
│ ├── DINWebPro.woff
│ ├── ForegroundAO_OFF.png
│ ├── ForegroundAO_ON.png
│ ├── No_Blur.png
│ ├── application.css
│ ├── bootstrap.css
│ ├── bootstrap.js
│ ├── default.css
│ ├── developerzone_gameworks_logo.png
│ ├── doctools.js
│ ├── hbao-plus-in-tom-clancys-splinter-cell-blacklist-2.jpg
│ ├── jquery.js
│ ├── minus.gif
│ ├── nvidia-logo-header.png
│ ├── pipeline_with_input_normals.png
│ ├── pipeline_without_input_normals.png
│ ├── plus.gif
│ ├── pygments.css
│ ├── searchtools.js
│ ├── sidebar.js
│ ├── space.gif
│ ├── styleguide.css
│ └── underscore.js
├── changelog.html
├── genindex.html
├── index.html
├── objects.inv
├── product.html
├── releasenotes.html
├── search.html
├── searchindex.js
└── sphinx
│ └── python-2.7.5
│ └── Lib
│ └── site-packages
│ ├── Sphinx-1.2.dist-info
│ └── DESCRIPTION.html
│ ├── setuptools-2.1.dist-info
│ └── DESCRIPTION.html
│ ├── sphinx
│ └── ext
│ │ └── autosummary
│ │ └── templates
│ │ └── autosummary
│ │ ├── base.html
│ │ ├── class.html
│ │ └── module.html
│ └── tests
│ └── roots
│ └── test-only-directive
│ ├── contents.html
│ └── only.html
├── include
└── GFSDK_SSAO.h
├── lib
├── GFSDK_SSAO_D3D11.win32.dll
├── GFSDK_SSAO_D3D11.win32.lib
├── GFSDK_SSAO_D3D11.win64.dll
├── GFSDK_SSAO_D3D11.win64.lib
├── GFSDK_SSAO_D3D12.win32.dll
├── GFSDK_SSAO_D3D12.win32.lib
├── GFSDK_SSAO_D3D12.win64.dll
└── GFSDK_SSAO_D3D12.win64.lib
├── samples
└── dual_layer
│ ├── D3D11
│ ├── media
│ │ ├── Meshes
│ │ │ ├── cube.obj
│ │ │ └── shaderBall.obj
│ │ ├── StaticMesh.hlsl
│ │ └── directx.ico
│ └── src
│ │ ├── Camera.cpp
│ │ ├── Camera.h
│ │ ├── D3D11Mesh.cpp
│ │ ├── D3D11Mesh.h
│ │ ├── DeviceManager11.cpp
│ │ ├── DeviceManager11.h
│ │ ├── GPUTimers.cpp
│ │ ├── GPUTimers.h
│ │ ├── HBAOSample.cpp
│ │ ├── HBAOSample.h
│ │ ├── HBAOSampleD3D11.cpp
│ │ ├── HBAOSampleD3D11.h
│ │ ├── Main.cpp
│ │ ├── Mesh.cpp
│ │ ├── Mesh.h
│ │ ├── MeshRenderer.cpp
│ │ ├── MeshRenderer.h
│ │ ├── SSAO11.rc
│ │ ├── SSAO11_2015.vcxproj
│ │ ├── SSAO11_2015.vcxproj.filters
│ │ ├── Scene.cpp
│ │ ├── Scene.h
│ │ ├── SceneRenderer.cpp
│ │ ├── SceneRenderer.h
│ │ ├── imgui
│ │ ├── imconfig.h
│ │ ├── imgui.cpp
│ │ ├── imgui.h
│ │ ├── imgui_demo.cpp
│ │ ├── imgui_draw.cpp
│ │ ├── imgui_impl_dx11.cpp
│ │ ├── imgui_impl_dx11.h
│ │ ├── imgui_internal.h
│ │ ├── stb_rect_pack.h
│ │ ├── stb_textedit.h
│ │ └── stb_truetype.h
│ │ └── tiny_obj_loader.h
│ └── D3D12
│ ├── media
│ ├── Meshes
│ │ ├── cube.obj
│ │ └── shaderBall.obj
│ └── StaticMesh.hlsl
│ └── src
│ ├── Camera.cpp
│ ├── Camera.h
│ ├── D3D12Mesh.cpp
│ ├── D3D12Mesh.h
│ ├── DeviceManager12.cpp
│ ├── DeviceManager12.h
│ ├── GPUTimers.cpp
│ ├── GPUTimers.h
│ ├── HBAOSample.cpp
│ ├── HBAOSample.h
│ ├── HBAOSampleD3D12.cpp
│ ├── HBAOSampleD3D12.h
│ ├── Main.cpp
│ ├── Mesh.cpp
│ ├── Mesh.h
│ ├── MeshRenderer.cpp
│ ├── MeshRenderer.h
│ ├── SSAO12_2015.vcxproj
│ ├── SSAO12_2015.vcxproj.filters
│ ├── Scene.cpp
│ ├── Scene.h
│ ├── SceneRenderer.cpp
│ ├── SceneRenderer.h
│ ├── d3dx12.h
│ ├── imgui
│ ├── imconfig.h
│ ├── imgui.cpp
│ ├── imgui.h
│ ├── imgui_demo.cpp
│ ├── imgui_draw.cpp
│ ├── imgui_impl_dx12.cpp
│ ├── imgui_impl_dx12.h
│ ├── imgui_internal.h
│ ├── stb_rect_pack.h
│ ├── stb_textedit.h
│ └── stb_truetype.h
│ └── tiny_obj_loader.h
└── src
├── API.cpp
├── AppState_DX11.cpp
├── AppState_DX11.h
├── AppState_GL.cpp
├── AppState_GL.h
├── BuildVersion.h
├── Common.h
├── Common_DX12.h
├── Common_GL.h
├── ConstantBuffers.cpp
├── ConstantBuffers.h
├── GLSLProgram.h
├── InputDepthInfo.h
├── InputNormalInfo.h
├── InputViewport.h
├── MathUtil.h
├── MatrixView.h
├── NVAPI
├── amd64
│ └── nvapi64.lib
├── nvapi.h
├── nvapi_lite_common.h
├── nvapi_lite_d3dext.h
├── nvapi_lite_salend.h
├── nvapi_lite_salstart.h
├── nvapi_lite_sli.h
├── nvapi_lite_stereo.h
├── nvapi_lite_surround.h
└── x86
│ └── nvapi.lib
├── OutputInfo.h
├── PerfMarkers.h
├── PipelineStateObjects_DX12.cpp
├── PipelineStateObjects_DX12.h
├── ProjectionMatrixInfo.cpp
├── ProjectionMatrixInfo.h
├── RandomTexture.cpp
├── RandomTexture.h
├── RenderTargets_DX11.h
├── RenderTargets_DX12.h
├── RenderTargets_GL.h
├── Renderer_DX11.cpp
├── Renderer_DX11.h
├── Renderer_DX12.cpp
├── Renderer_DX12.h
├── Renderer_GL.cpp
├── Renderer_GL.h
├── Shaders_DX11.cpp
├── Shaders_DX11.h
├── Shaders_DX12.cpp
├── Shaders_DX12.h
├── Shaders_GL.cpp
├── Shaders_GL.h
├── States_DX11.cpp
├── States_DX11.h
├── States_DX12.cpp
├── States_DX12.h
├── States_GL.cpp
├── States_GL.h
├── TextureUtil.h
├── TimestampQueries.h
├── UserTexture.h
├── VAO_GL.h
├── Viewports.h
├── d3dx12.h
└── shaders
├── HLSLcc.exe
├── ShaderBuildTool.exe
├── Stringify.exe
├── compile_glsl.bat
├── compile_hlsl.bat
├── d3dcompiler_47.dll
├── fxc.exe
├── helper_fxc.bat
├── helper_hlsl_cc.bat
├── out
├── D3D11
│ ├── BlurX_PS.cpp
│ ├── BlurX_PS.h
│ ├── BlurY_PS.cpp
│ ├── BlurY_PS.h
│ ├── CoarseAO_GS.cpp
│ ├── CoarseAO_GS.h
│ ├── CoarseAO_PS.cpp
│ ├── CoarseAO_PS.h
│ ├── CopyDepth_PS.cpp
│ ├── CopyDepth_PS.h
│ ├── DebugAO_PS.cpp
│ ├── DebugAO_PS.h
│ ├── DebugNormals_PS.cpp
│ ├── DebugNormals_PS.h
│ ├── DeinterleaveDepth_PS.cpp
│ ├── DeinterleaveDepth_PS.h
│ ├── FullScreenTriangle_VS.cpp
│ ├── FullScreenTriangle_VS.h
│ ├── LinearizeDepth_PS.cpp
│ ├── LinearizeDepth_PS.h
│ ├── ReconstructNormal_PS.cpp
│ ├── ReconstructNormal_PS.h
│ ├── ReinterleaveAO_PS.cpp
│ └── ReinterleaveAO_PS.h
└── GL
│ ├── BlurX_PS.cpp
│ ├── BlurX_PS.h
│ ├── BlurY_PS.cpp
│ ├── BlurY_PS.h
│ ├── CoarseAO_PS.cpp
│ ├── CoarseAO_PS.h
│ ├── CopyDepth_PS.cpp
│ ├── CopyDepth_PS.h
│ ├── DebugNormals_PS.cpp
│ ├── DebugNormals_PS.h
│ ├── DeinterleaveDepth_PS.cpp
│ ├── DeinterleaveDepth_PS.h
│ ├── LinearizeDepth_PS.cpp
│ ├── LinearizeDepth_PS.h
│ ├── ReconstructNormal_PS.cpp
│ ├── ReconstructNormal_PS.h
│ ├── ReinterleaveAO_PS.cpp
│ └── ReinterleaveAO_PS.h
└── src
├── BlurX_PS.hlsl
├── BlurY_PS.hlsl
├── Blur_Common.hlsl
├── CoarseAO_GS.hlsl
├── CoarseAO_PS.hlsl
├── ConstantBuffers.hlsl
├── CopyDepth_PS.hlsl
├── DebugAO_PS.hlsl
├── DebugNormals_PS.hlsl
├── DeinterleaveDepth_PS.hlsl
├── FetchNormal_Common.hlsl
├── FullScreenTriangle_VS.hlsl
├── LinearizeDepth_PS.hlsl
├── ReconstructNormal_Common.hlsl
├── ReconstructNormal_PS.hlsl
├── ReinterleaveAO_PS.hlsl
└── SharedDefines.h
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Nvidia Source Code License (1-Way Commercial)
2 |
3 | 1. Definitions
4 |
5 | “Licensor” means any person or entity that distributes its Work. “Software”
6 | means the original work of authorship made available under this License. “Work”
7 | means the Software and any additions to or derivative works of the Software that
8 | are made available under this License. The terms “reproduce,” “reproduction,”
9 | “derivative works,” and “distribution” have the meaning as provided under U.S.
10 | copyright law; provided, however, that for the purposes of this License,
11 | derivative works shall not include works that remain separable from, or merely
12 | link (or bind by name) to the interfaces of, the Work. Works, including the
13 | Software, are “made available” under this License by including in or with the
14 | Work either (a) a copyright notice referencing the applicability of this License
15 | to the Work, or (b) a copy of this License.
16 |
17 | 2. License Grants
18 |
19 | 2.1 Copyright Grant. Subject to the terms and conditions of this License, each
20 | Licensor grants to you a perpetual, worldwide, non-exclusive, royalty-free,
21 | copyright license to reproduce, prepare derivative works of, publicly display,
22 | publicly perform, sublicense and distribute its Work and any resulting
23 | derivative works in any form.
24 |
25 | 3. Limitations
26 |
27 | 3.1 Redistribution. You may reproduce or distribute the Work only if (a) you do
28 | so under this License, (b) you include a complete copy of this License with your
29 | distribution, and (c) you retain without modification any copyright, patent,
30 | trademark, or attribution notices that are present in the Work.
31 |
32 | 3.2 Derivative Works. You may specify that additional or different terms apply
33 | to the use, reproduction, and distribution of your derivative works of the Work
34 | (“Your Terms”) only if you identify the specific derivative works that are
35 | subject to Your Terms. Notwithstanding Your Terms, this License (including the
36 | redistribution requirements in Section 3.1) will continue to apply to the Work
37 | itself.
38 |
39 | 3.3 Patent Claims. If you bring or threaten to bring a patent claim against any
40 | Licensor (including any claim, cross-claim or counterclaim in a lawsuit) to
41 | enforce any patents that you allege are infringed by any Work, then your rights
42 | under this License from such Licensor (including the grant in Sections 2.1)
43 | will terminate immediately.
44 |
45 | 3.4 Trademarks. This License does not grant any rights to use any Licensor’s or
46 | its affiliates’ names, logos, or trademarks, except as necessary to reproduce
47 | the notices described in this License.
48 |
49 | 3.5 Termination. If you violate any term of this License, then your rights under
50 | this License (including the grant in Section 2.1) will terminate
51 | immediately.
52 |
53 | 4. Disclaimer of Warranty.
54 |
55 | THE WORK IS PROVIDED “AS IS” WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
56 | EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
57 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT.
58 | YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER THIS LICENSE.
59 |
60 | 5. Limitation of Liability.
61 |
62 | EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL THEORY,
63 | WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE SHALL ANY
64 | LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL,
65 | INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATED TO THIS LICENSE,
66 | THE USE OR INABILITY TO USE THE WORK (INCLUDING BUT NOT LIMITED TO LOSS OF
67 | GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS OR DATA, COMPUTER FAILURE OR
68 | MALFUNCTION, OR ANY OTHER COMMERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR
69 | HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
70 |
--------------------------------------------------------------------------------
/build/platforms/vs2015/GFSDK_SSAO_Shaders_D3D11.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Shader Includes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Shaders
19 |
20 |
21 | Shaders
22 |
23 |
24 | Shaders
25 |
26 |
27 | Shaders
28 |
29 |
30 | Shaders
31 |
32 |
33 | Shaders
34 |
35 |
36 | Shaders
37 |
38 |
39 | Shaders
40 |
41 |
42 | Shaders
43 |
44 |
45 | Shaders
46 |
47 |
48 | Shaders
49 |
50 |
51 | Shaders
52 |
53 |
54 |
--------------------------------------------------------------------------------
/build/platforms/vs2015/GFSDK_SSAO_Shaders_GL.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Shader Includes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Shaders
19 |
20 |
21 | Shaders
22 |
23 |
24 | Shaders
25 |
26 |
27 | Shaders
28 |
29 |
30 | Shaders
31 |
32 |
33 | Shaders
34 |
35 |
36 | Shaders
37 |
38 |
39 | Shaders
40 |
41 |
42 | Shaders
43 |
44 |
45 |
--------------------------------------------------------------------------------
/build/platforms/vs2015/Resource.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/build/platforms/vs2015/Resource.rc
--------------------------------------------------------------------------------
/build/tools/ShaderBuildTool/ShaderBuildTool.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ShaderBuildTool", "ShaderBuildTool.vcxproj", "{438B73C1-A960-4F8E-B23C-DB6E3AEBC0DE}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {438B73C1-A960-4F8E-B23C-DB6E3AEBC0DE}.Debug|x64.ActiveCfg = Debug|x64
17 | {438B73C1-A960-4F8E-B23C-DB6E3AEBC0DE}.Debug|x64.Build.0 = Debug|x64
18 | {438B73C1-A960-4F8E-B23C-DB6E3AEBC0DE}.Debug|x86.ActiveCfg = Debug|Win32
19 | {438B73C1-A960-4F8E-B23C-DB6E3AEBC0DE}.Debug|x86.Build.0 = Debug|Win32
20 | {438B73C1-A960-4F8E-B23C-DB6E3AEBC0DE}.Release|x64.ActiveCfg = Release|x64
21 | {438B73C1-A960-4F8E-B23C-DB6E3AEBC0DE}.Release|x64.Build.0 = Release|x64
22 | {438B73C1-A960-4F8E-B23C-DB6E3AEBC0DE}.Release|x86.ActiveCfg = Release|Win32
23 | {438B73C1-A960-4F8E-B23C-DB6E3AEBC0DE}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/build/tools/ShaderBuildTool/ShaderBuildTool.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 |
--------------------------------------------------------------------------------
/build/tools/ShaderBuildTool/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // ShaderBuildTool.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/build/tools/ShaderBuildTool/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifdef _MSC_VER
9 | #define _CRT_SECURE_NO_WARNINGS
10 | #endif
11 |
12 | #include "targetver.h"
13 |
14 | #include
15 | #include
16 |
17 |
18 |
19 | // TODO: reference additional headers your program requires here
20 |
--------------------------------------------------------------------------------
/build/tools/ShaderBuildTool/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/build/tools/Stringify/Stringify.cpp:
--------------------------------------------------------------------------------
1 | #define _CRT_SECURE_NO_WARNINGS
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | int main(int argc, char* argv[])
8 | {
9 | if (argc != 4)
10 | {
11 | fprintf(stderr, "Usage: %s TEXT_FILENAME VARIABLE_NAME OUTPUT_FILE\n", argv[0]);
12 | exit(1);
13 | }
14 |
15 | const char* pFilenameIn = argv[1];
16 | const char* pVariableName = argv[2];
17 | const char *pFilenameOut = argv[3];
18 |
19 | FILE *fpIn = fopen(pFilenameIn, "rb");
20 | fseek(fpIn, 0, SEEK_END);
21 | long fileSize = ftell(fpIn);
22 | fseek(fpIn, 0, SEEK_SET);
23 | std::vector entireFile(fileSize);
24 | fread(entireFile.data(), 1, (size_t)fileSize, fpIn);
25 | entireFile.push_back(0);
26 | fseek(fpIn, 0, SEEK_SET);
27 |
28 | if (!fpIn)
29 | {
30 | fprintf(stderr, "Error: Failed to open %s\n", pFilenameIn);
31 | exit(1);
32 | }
33 |
34 | FILE *fpOut = fopen(pFilenameOut, "w");
35 | if (!fpOut)
36 | {
37 | fprintf(stderr, "Error: Failed to open %s\n", pFilenameOut);
38 | exit(1);
39 | }
40 |
41 | // fprintf(fpOut, "// static const char* %s =\n", pVariableName);
42 | //
43 | // char row[1024];
44 | // while (fgets(row, sizeof(row), fpIn))
45 | // {
46 | // row[strlen(row) - 1] = row[strlen(row) - 2] = 0; // remove \r\n
47 | //
48 | // fprintf(fpOut, "// \"%s\\n\"", row);
49 | // }
50 | //
51 | // fprintf(fpOut, "// ;\n");
52 |
53 | fprintf(fpOut, "static const char %s[] =\n{", pVariableName);
54 |
55 | for (size_t i = 0; i < entireFile.size(); ++i)
56 | {
57 | fprintf(fpOut, "0x%X, ", (uint32_t)entireFile[i]);
58 | if (i % 16 == 15)
59 | {
60 | fprintf(fpOut, "\n");
61 | }
62 | }
63 | fprintf(fpOut, "};\n");
64 |
65 | fclose(fpIn);
66 | fclose(fpOut);
67 | return 0;
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/build/tools/Stringify/Stringify.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Stringify", "Stringify.vcxproj", "{199AEFC4-A2BC-4837-9D0D-69BEB794F681}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {199AEFC4-A2BC-4837-9D0D-69BEB794F681}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {199AEFC4-A2BC-4837-9D0D-69BEB794F681}.Debug|Win32.Build.0 = Debug|Win32
14 | {199AEFC4-A2BC-4837-9D0D-69BEB794F681}.Release|Win32.ActiveCfg = Release|Win32
15 | {199AEFC4-A2BC-4837-9D0D-69BEB794F681}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/build/tools/Stringify/Stringify.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 |
23 |
24 | Source Files
25 |
26 |
27 |
--------------------------------------------------------------------------------
/build/tools/Stringify/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // Stringify.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/build/tools/Stringify/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifdef _MSC_VER
9 | #define _CRT_SECURE_NO_WARNINGS
10 | #endif
11 |
12 | #include "targetver.h"
13 |
14 | #include
15 | #include
16 | #include
17 |
18 |
19 | // TODO: reference additional headers your program requires here
20 |
--------------------------------------------------------------------------------
/build/tools/Stringify/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/doc/.buildinfo:
--------------------------------------------------------------------------------
1 | # Sphinx build info version 1
2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3 | config: 3f951263be95a5a0330b5527f90d88af
4 | tags: 645f666f9bcd5a90fca523b33c5a78b7
5 |
--------------------------------------------------------------------------------
/doc/_images/AOBias_0_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/AOBias_0_0.png
--------------------------------------------------------------------------------
/doc/_images/AOBias_0_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/AOBias_0_3.png
--------------------------------------------------------------------------------
/doc/_images/AO_Radius_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/AO_Radius_1.png
--------------------------------------------------------------------------------
/doc/_images/AO_Radius_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/AO_Radius_4.png
--------------------------------------------------------------------------------
/doc/_images/BackgroundAO_OFF.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/BackgroundAO_OFF.png
--------------------------------------------------------------------------------
/doc/_images/BackgroundAO_ON.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/BackgroundAO_ON.png
--------------------------------------------------------------------------------
/doc/_images/Blur_Radius_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/Blur_Radius_4.png
--------------------------------------------------------------------------------
/doc/_images/Blur_Sharpness_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/Blur_Sharpness_0.png
--------------------------------------------------------------------------------
/doc/_images/Blur_Sharpness_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/Blur_Sharpness_8.png
--------------------------------------------------------------------------------
/doc/_images/ForegroundAO_OFF.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/ForegroundAO_OFF.png
--------------------------------------------------------------------------------
/doc/_images/ForegroundAO_ON.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/ForegroundAO_ON.png
--------------------------------------------------------------------------------
/doc/_images/No_Blur.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/No_Blur.png
--------------------------------------------------------------------------------
/doc/_images/hbao-plus-in-tom-clancys-splinter-cell-blacklist-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/hbao-plus-in-tom-clancys-splinter-cell-blacklist-2.jpg
--------------------------------------------------------------------------------
/doc/_images/pipeline_with_input_normals.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/pipeline_with_input_normals.png
--------------------------------------------------------------------------------
/doc/_images/pipeline_without_input_normals.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_images/pipeline_without_input_normals.png
--------------------------------------------------------------------------------
/doc/_sources/index.txt:
--------------------------------------------------------------------------------
1 | .. Replace existing content with product specific content. Layout for this page should be consistent for all products.
2 | Use the root `toctree` directive to include documents
3 |
4 | |PRODUCTNAME|
5 | ======================================
6 |
7 | .. Replace the content. Layout should not change
8 |
9 | NVIDIA ShadowWorks - HBAO+ improves upon existing Ambient Occlusion techniques to add richer, more detailed, more realistic shadows around objects that occlude rays of light. Compared to previous techniques, HBAO+ is faster, more efficient, and significantly better.
10 |
11 |
12 | Learn more about |PRODUCTNAME|
13 | ------------------------------
14 | * Visit the `product home page`_ on `NVIDIA Developer`_
15 |
16 | * View Documentation :ref:`search`
17 |
18 | .. Other links to highlight:
19 | .. Link to archived docs
20 | .. Any other archived (version-specific) docs can be linked here as well.
21 |
22 | **Browse Documentation**
23 |
24 | .. toctree::
25 | :maxdepth: 1
26 |
27 | product
28 | changelog
29 | .. releasenotes
30 |
31 | .. Reference only product TOT pages here.
32 | .. productOld
33 | .. productOlder
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/doc/_sources/releasenotes.txt:
--------------------------------------------------------------------------------
1 | .. Replace existing content with product specific content. Layout for this page should be consistent for all products.
2 |
3 | Release Notes
4 | =======================================
5 |
6 | |PRODUCTNAMEDOCRELEASEBOLD|
7 |
8 | NVIDIA HBAO+ improves upon existing Ambient Occlusion techniques to add richer, more detailed, more realistic shadows around objects that occlude rays of light. Compared to previous techniques, HBAO+ is faster, more efficient, and significantly better.
9 |
10 |
11 | What's New
12 | -----------------------
13 |
14 | **General**
15 |
16 | |VERSIONBOLD|
17 |
18 | * Added support for a second input depth texture (to reduce halo artifacts behind foreground objects)
19 | * Removed support for OpenGL.
20 |
21 | .. -----------------------
22 |
23 | .. * `Forums`_
24 |
25 | .. * `Report a bug`_
26 |
27 | .. If links above are used, replace URL below.
28 | .. _Forums: http://devtalk.nvidia.com
29 | .. _Report a bug: http://developer.nvidia.com/contact
30 |
31 | .. toctree::
32 | :maxdepth: 1
33 |
--------------------------------------------------------------------------------
/doc/_sources/sphinx/python-2.7.5/Lib/site-packages/Sphinx-1.2.dist-info/DESCRIPTION.txt:
--------------------------------------------------------------------------------
1 | Sphinx is a tool that makes it easy to create intelligent and beautiful
2 | documentation for Python projects (or other documents consisting of multiple
3 | reStructuredText sources), written by Georg Brandl. It was originally created
4 | for the new Python documentation, and has excellent facilities for Python
5 | project documentation, but C/C++ is supported as well, and more languages are
6 | planned.
7 |
8 | Sphinx uses reStructuredText as its markup language, and many of its strengths
9 | come from the power and straightforwardness of reStructuredText and its parsing
10 | and translating suite, the Docutils.
11 |
12 | Among its features are the following:
13 |
14 | * Output formats: HTML (including derivative formats such as HTML Help, Epub
15 | and Qt Help), plain text, manual pages and LaTeX or direct PDF output
16 | using rst2pdf
17 | * Extensive cross-references: semantic markup and automatic links
18 | for functions, classes, glossary terms and similar pieces of information
19 | * Hierarchical structure: easy definition of a document tree, with automatic
20 | links to siblings, parents and children
21 | * Automatic indices: general index as well as a module index
22 | * Code handling: automatic highlighting using the Pygments highlighter
23 | * Flexible HTML output using the Jinja 2 templating engine
24 | * Various extensions are available, e.g. for automatic testing of snippets
25 | and inclusion of appropriately formatted docstrings
26 | * Setuptools integration
27 |
28 | A development egg can be found `here
29 | `_.
30 |
31 |
32 |
--------------------------------------------------------------------------------
/doc/_sources/sphinx/python-2.7.5/Lib/site-packages/sphinx/ext/autosummary/templates/autosummary/base.txt:
--------------------------------------------------------------------------------
1 | {{ fullname }}
2 | {{ underline }}
3 |
4 | .. currentmodule:: {{ module }}
5 |
6 | .. auto{{ objtype }}:: {{ objname }}
7 |
--------------------------------------------------------------------------------
/doc/_sources/sphinx/python-2.7.5/Lib/site-packages/sphinx/ext/autosummary/templates/autosummary/class.txt:
--------------------------------------------------------------------------------
1 | {{ fullname }}
2 | {{ underline }}
3 |
4 | .. currentmodule:: {{ module }}
5 |
6 | .. autoclass:: {{ objname }}
7 |
8 | {% block methods %}
9 | .. automethod:: __init__
10 |
11 | {% if methods %}
12 | .. rubric:: Methods
13 |
14 | .. autosummary::
15 | {% for item in methods %}
16 | ~{{ name }}.{{ item }}
17 | {%- endfor %}
18 | {% endif %}
19 | {% endblock %}
20 |
21 | {% block attributes %}
22 | {% if attributes %}
23 | .. rubric:: Attributes
24 |
25 | .. autosummary::
26 | {% for item in attributes %}
27 | ~{{ name }}.{{ item }}
28 | {%- endfor %}
29 | {% endif %}
30 | {% endblock %}
31 |
--------------------------------------------------------------------------------
/doc/_sources/sphinx/python-2.7.5/Lib/site-packages/sphinx/ext/autosummary/templates/autosummary/module.txt:
--------------------------------------------------------------------------------
1 | {{ fullname }}
2 | {{ underline }}
3 |
4 | .. automodule:: {{ fullname }}
5 |
6 | {% block functions %}
7 | {% if functions %}
8 | .. rubric:: Functions
9 |
10 | .. autosummary::
11 | {% for item in functions %}
12 | {{ item }}
13 | {%- endfor %}
14 | {% endif %}
15 | {% endblock %}
16 |
17 | {% block classes %}
18 | {% if classes %}
19 | .. rubric:: Classes
20 |
21 | .. autosummary::
22 | {% for item in classes %}
23 | {{ item }}
24 | {%- endfor %}
25 | {% endif %}
26 | {% endblock %}
27 |
28 | {% block exceptions %}
29 | {% if exceptions %}
30 | .. rubric:: Exceptions
31 |
32 | .. autosummary::
33 | {% for item in exceptions %}
34 | {{ item }}
35 | {%- endfor %}
36 | {% endif %}
37 | {% endblock %}
38 |
--------------------------------------------------------------------------------
/doc/_sources/sphinx/python-2.7.5/Lib/site-packages/tests/roots/test-only-directive/contents.txt:
--------------------------------------------------------------------------------
1 | test-only-directive
2 | ===================
3 |
4 | .. toctree::
5 |
6 | only
7 |
--------------------------------------------------------------------------------
/doc/_static/AOBias_0_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/AOBias_0_0.png
--------------------------------------------------------------------------------
/doc/_static/AOBias_0_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/AOBias_0_3.png
--------------------------------------------------------------------------------
/doc/_static/AO_Radius_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/AO_Radius_1.png
--------------------------------------------------------------------------------
/doc/_static/AO_Radius_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/AO_Radius_4.png
--------------------------------------------------------------------------------
/doc/_static/BackgroundAO_OFF.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/BackgroundAO_OFF.png
--------------------------------------------------------------------------------
/doc/_static/BackgroundAO_ON.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/BackgroundAO_ON.png
--------------------------------------------------------------------------------
/doc/_static/Blur_Radius_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/Blur_Radius_4.png
--------------------------------------------------------------------------------
/doc/_static/Blur_Sharpness_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/Blur_Sharpness_0.png
--------------------------------------------------------------------------------
/doc/_static/Blur_Sharpness_8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/Blur_Sharpness_8.png
--------------------------------------------------------------------------------
/doc/_static/DINWebPro-Black.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/DINWebPro-Black.woff
--------------------------------------------------------------------------------
/doc/_static/DINWebPro-BlackIta.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/DINWebPro-BlackIta.woff
--------------------------------------------------------------------------------
/doc/_static/DINWebPro-Bold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/DINWebPro-Bold.woff
--------------------------------------------------------------------------------
/doc/_static/DINWebPro-BoldIta.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/DINWebPro-BoldIta.woff
--------------------------------------------------------------------------------
/doc/_static/DINWebPro-Ita.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/DINWebPro-Ita.woff
--------------------------------------------------------------------------------
/doc/_static/DINWebPro-Light.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/DINWebPro-Light.woff
--------------------------------------------------------------------------------
/doc/_static/DINWebPro-LightIta.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/DINWebPro-LightIta.woff
--------------------------------------------------------------------------------
/doc/_static/DINWebPro-Medium.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/DINWebPro-Medium.woff
--------------------------------------------------------------------------------
/doc/_static/DINWebPro-MediumIta.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/DINWebPro-MediumIta.woff
--------------------------------------------------------------------------------
/doc/_static/DINWebPro.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/DINWebPro.woff
--------------------------------------------------------------------------------
/doc/_static/ForegroundAO_OFF.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/ForegroundAO_OFF.png
--------------------------------------------------------------------------------
/doc/_static/ForegroundAO_ON.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/ForegroundAO_ON.png
--------------------------------------------------------------------------------
/doc/_static/No_Blur.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/No_Blur.png
--------------------------------------------------------------------------------
/doc/_static/default.css:
--------------------------------------------------------------------------------
1 | a.headerlink {
2 | color: #ffffff;
3 | font-size: 0.8em;
4 | padding: 0 4px 0 4px;
5 | text-decoration: none;
6 | }
7 |
8 | a.headerlink:hover {
9 | background-color: #ffffff;
10 | color: #c60f0f;
11 | }
12 |
13 | #sidebar_toc ul {
14 | list-style-type: none;
15 | }
16 |
17 | .toc_handle {
18 | background : transparent
19 | url(space.gif);
20 | background-repeat : no-repeat;
21 | background-position: center bottom;
22 | display : block;
23 | float : left;
24 | width : 9px;
25 | height : 15px;
26 | }
27 |
28 | .toc_collapsed {
29 | background : transparent
30 | url(plus.gif);
31 | background-repeat : no-repeat;
32 | background-position: center bottom;
33 | cursor : pointer;
34 | }
35 |
36 | .toc_expanded {
37 | background : transparent
38 | url(minus.gif);
39 | background-repeat : no-repeat;
40 | background-position: center bottom;
41 | cursor : pointer;
42 | }
43 |
44 | body {
45 | -webkit-animation-duration: 0.1s;
46 | -webkit-animation-name: fontfix;
47 | -webkit-animation-iteration-count: 1;
48 | -webkit-animation-timing-function: linear;
49 | -webkit-animation-delay: 0.5s;
50 | }
51 |
52 | @-webkit-keyframes fontfix{
53 | from{ opacity: 1; }
54 | to{ opacity: 1; }
55 | }
--------------------------------------------------------------------------------
/doc/_static/developerzone_gameworks_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/developerzone_gameworks_logo.png
--------------------------------------------------------------------------------
/doc/_static/hbao-plus-in-tom-clancys-splinter-cell-blacklist-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/hbao-plus-in-tom-clancys-splinter-cell-blacklist-2.jpg
--------------------------------------------------------------------------------
/doc/_static/minus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/minus.gif
--------------------------------------------------------------------------------
/doc/_static/nvidia-logo-header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/nvidia-logo-header.png
--------------------------------------------------------------------------------
/doc/_static/pipeline_with_input_normals.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/pipeline_with_input_normals.png
--------------------------------------------------------------------------------
/doc/_static/pipeline_without_input_normals.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/pipeline_without_input_normals.png
--------------------------------------------------------------------------------
/doc/_static/plus.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/plus.gif
--------------------------------------------------------------------------------
/doc/_static/space.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/_static/space.gif
--------------------------------------------------------------------------------
/doc/_static/styleguide.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #fcfcfc;
3 | }
4 | .example {
5 | padding: 20px;
6 | border: 1px solid #efefef;
7 | }
8 | .doc-section {
9 | padding-top: 60px;
10 | margin-top: -60px;
11 | }
12 | /*
13 | * Side navigation
14 | *
15 | * Scrollspy and affixed enhanced navigation to highlight sections and secondary
16 | * sections of docs content.
17 | */
18 | /* By default it's not affixed in mobile views, so undo that */
19 | .bs-sidebar.affix {
20 | position: static;
21 | }
22 | /* First level of nav */
23 | .bs-sidenav {
24 | padding-top: 10px;
25 | padding-bottom: 10px;
26 | text-shadow: 0 1px 0 #fff;
27 | background-color: #f7f5fa;
28 | border-radius: 5px;
29 | }
30 | /* All levels of nav */
31 | .bs-sidebar .nav > li > a {
32 | display: block;
33 | color: #716b7a;
34 | padding: 5px 20px;
35 | }
36 | .bs-sidebar .nav > li > a:hover,
37 | .bs-sidebar .nav > li > a:focus {
38 | text-decoration: none;
39 | background-color: #e5e3e9;
40 | border-right: 1px solid #dbd8e0;
41 | }
42 | .bs-sidebar .nav > .active > a,
43 | .bs-sidebar .nav > .active:hover > a,
44 | .bs-sidebar .nav > .active:focus > a {
45 | font-weight: bold;
46 | color: #563d7c;
47 | background-color: transparent;
48 | border-right: 1px solid #563d7c;
49 | }
50 | /* Nav: second level (shown on .active) */
51 | .bs-sidebar .nav .nav {
52 | margin-bottom: 8px;
53 | }
54 | .bs-sidebar .nav .nav > li > a {
55 | padding-top: 3px;
56 | padding-bottom: 3px;
57 | padding-left: 30px;
58 | font-size: 90%;
59 | }
60 | /* Show and affix the side nav when space allows it */
61 | @media (min-width: 992px) {
62 | .bs-sidebar .nav > .active > ul {
63 | display: block;
64 | }
65 | /* Widen the fixed sidebar */
66 | .bs-sidebar.affix,
67 | .bs-sidebar.affix-bottom {
68 | width: 213px;
69 | }
70 | .bs-sidebar.affix {
71 | position: fixed;
72 | /* Undo the static from mobile first approach */
73 | top: 80px;
74 | }
75 | .bs-sidebar.affix-bottom {
76 | position: absolute;
77 | /* Undo the static from mobile first approach */
78 | }
79 | .bs-sidebar.affix-bottom .bs-sidenav,
80 | .bs-sidebar.affix .bs-sidenav {
81 | margin-top: 0;
82 | margin-bottom: 0;
83 | }
84 | }
85 | @media (min-width: 1200px) {
86 | /* Widen the fixed sidebar again */
87 | .bs-sidebar.affix-bottom,
88 | .bs-sidebar.affix {
89 | width: 263px;
90 | }
91 | }
92 | .show-grid {
93 | margin-bottom: 15px;
94 | }
95 | .show-grid [class^="col-"] {
96 | padding-top: 10px;
97 | padding-bottom: 10px;
98 | background-color: #eee;
99 | border: 1px solid #ddd;
100 | background-color: rgba(86, 61, 124, 0.15);
101 | border: 1px solid rgba(86, 61, 124, 0.2);
102 | }
103 |
--------------------------------------------------------------------------------
/doc/objects.inv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/doc/objects.inv
--------------------------------------------------------------------------------
/lib/GFSDK_SSAO_D3D11.win32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/lib/GFSDK_SSAO_D3D11.win32.dll
--------------------------------------------------------------------------------
/lib/GFSDK_SSAO_D3D11.win32.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/lib/GFSDK_SSAO_D3D11.win32.lib
--------------------------------------------------------------------------------
/lib/GFSDK_SSAO_D3D11.win64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/lib/GFSDK_SSAO_D3D11.win64.dll
--------------------------------------------------------------------------------
/lib/GFSDK_SSAO_D3D11.win64.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/lib/GFSDK_SSAO_D3D11.win64.lib
--------------------------------------------------------------------------------
/lib/GFSDK_SSAO_D3D12.win32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/lib/GFSDK_SSAO_D3D12.win32.dll
--------------------------------------------------------------------------------
/lib/GFSDK_SSAO_D3D12.win32.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/lib/GFSDK_SSAO_D3D12.win32.lib
--------------------------------------------------------------------------------
/lib/GFSDK_SSAO_D3D12.win64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/lib/GFSDK_SSAO_D3D12.win64.dll
--------------------------------------------------------------------------------
/lib/GFSDK_SSAO_D3D12.win64.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/lib/GFSDK_SSAO_D3D12.win64.lib
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/media/Meshes/cube.obj:
--------------------------------------------------------------------------------
1 | o Cube
2 | v 9.900001 9.900000 19.800001
3 | v 9.900001 -9.900001 19.800001
4 | v -9.900002 -9.899999 19.800001
5 | v -9.899997 9.900004 19.800001
6 | v 9.900005 9.899995 0.000000
7 | v 9.899994 -9.900006 0.000000
8 | v -9.900004 -9.899997 0.000000
9 | v -9.900000 9.900001 0.000000
10 | vn -0.0000 0.0000 -1.0000
11 | vn 0.0000 0.0000 1.0000
12 | vn -1.0000 0.0000 -0.0000
13 | vn 0.0000 1.0000 -0.0000
14 | vn 1.0000 -0.0000 -0.0000
15 | vn -0.0000 -1.0000 0.0000
16 | s off
17 | f 2//1 4//1 1//1
18 | f 8//2 6//2 5//2
19 | f 5//3 2//3 1//3
20 | f 6//4 3//4 2//4
21 | f 7//5 4//5 3//5
22 | f 1//6 8//6 5//6
23 | f 2//1 3//1 4//1
24 | f 8//2 7//2 6//2
25 | f 5//3 6//3 2//3
26 | f 6//4 7//4 3//4
27 | f 7//5 8//5 4//5
28 | f 1//6 4//6 8//6
29 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/media/StaticMesh.hlsl:
--------------------------------------------------------------------------------
1 | cbuffer PerFrame : register(b0)
2 | {
3 | row_major float4x4 MatView;
4 | row_major float4x4 MatViewProj;
5 | };
6 |
7 | cbuffer PerObject : register(b1)
8 | {
9 | row_major float4x4 MatWorld;
10 | };
11 |
12 | struct VSInput
13 | {
14 | float4 Position : POSITION;
15 | };
16 |
17 | struct PSInput
18 | {
19 | float4 Position : SV_Position;
20 | float3 ViewPosition : VIEWPOSITION;
21 | };
22 |
23 | void VSMain(in VSInput In, out PSInput Out)
24 | {
25 | Out.Position = mul(In.Position, MatWorld);
26 | Out.ViewPosition = mul(Out.Position, (float3x3)MatView);
27 | Out.Position = mul(Out.Position, MatViewProj);
28 | }
29 |
30 | void PSMain(in PSInput In, out float4 Out : SV_Target)
31 | {
32 | float3 Normal = -normalize(cross(ddx(In.ViewPosition), ddy(In.ViewPosition)));
33 | Out = float4(1.0, 1.0, 0.0, 1.0);
34 | Out = float4(Normal * 0.5 + 0.5, 1.0);
35 | }
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/media/directx.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/samples/dual_layer/D3D11/media/directx.ico
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/Camera.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include "Camera.h"
12 |
13 | Camera::Camera()
14 | {
15 | InitProjectionMatrix(1280, 720);
16 |
17 | mPosition = { -5.0f, -5.0f, 3.0f };
18 | mViewVector = XMVector3Normalize({ -4.0f, -4.0f, -2.0f });
19 | UpdateViewMatrix();
20 | }
21 |
22 | void Camera::InitProjectionMatrix(uint32_t width, uint32_t height, float zNear, float zFar)
23 | {
24 | mMatProj = XMMatrixPerspectiveFovRH(XMConvertToRadians(60.0f), (float)width / (float)height, zNear, zFar);
25 | UpdateViewMatrix();
26 | }
27 |
28 | void Camera::MoveForward(float dt)
29 | {
30 | mPosition += mViewVector * dt;
31 | UpdateViewMatrix();
32 | }
33 |
34 | void Camera::MoveRight(float dt)
35 | {
36 | mPosition += XMMatrixTranspose(mMatView).r[0] * dt;
37 | UpdateViewMatrix();
38 | }
39 |
40 | void Camera::AdvanceAngles(float yaw, float pitch)
41 | {
42 | XMMATRIX matBasisVecs = XMMatrixTranspose(mMatView);
43 |
44 | XMMATRIX matRot = XMMatrixRotationY(yaw);// *XMMatrixRotationX(pitch);
45 |
46 | mViewVector = XMVector3Rotate(mViewVector, XMQuaternionRotationAxis(matBasisVecs.r[1], yaw));
47 | mViewVector = XMVector3Rotate(mViewVector, XMQuaternionRotationAxis(matBasisVecs.r[0], pitch));
48 | UpdateViewMatrix();
49 | }
50 |
51 | void Camera::UpdateViewMatrix()
52 | {
53 | mMatView = XMMatrixLookAtRH(mPosition, mPosition + mViewVector, { 0.0f, 0.0f, 1.0f });
54 | mMatViewProj = XMMatrixMultiply(mMatView, mMatProj);
55 | }
56 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/Camera.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 |
13 | #include
14 | using namespace DirectX;
15 |
16 | class Camera
17 | {
18 | public:
19 | Camera();
20 |
21 | union
22 | {
23 | struct
24 | {
25 | XMMATRIX mMatView;
26 | XMMATRIX mMatViewProj;
27 | };
28 | float PerFrameData[32];
29 | };
30 | XMMATRIX mMatProj;
31 |
32 | void InitProjectionMatrix(uint32_t width, uint32_t height, float zNear = 0.01f, float zFar = 10000.0f);
33 | void MoveForward(float dt);
34 | void MoveRight(float dt);
35 | void AdvanceAngles(float yaw, float pitch);
36 |
37 | void UpdateViewMatrix();
38 |
39 | XMVECTOR mPosition;
40 | XMVECTOR mViewVector;
41 | };
42 |
43 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/D3D11Mesh.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #define _SCL_SECURE_NO_WARNINGS
12 | #include "D3D11Mesh.h"
13 |
14 | bool D3D11Mesh::InitializeFromMesh(ID3D11Device* device, Mesh& mesh)
15 | {
16 | mNumIndices = (uint32_t)mesh.mIndices.size();
17 |
18 | uint32_t vertexBufferSize = (uint32_t)mesh.mVertices.size() * sizeof(decltype(mesh.mVertices)::value_type);
19 | uint32_t indexBufferSize = (uint32_t)mesh.mIndices.size() * sizeof(decltype(mesh.mIndices)::value_type);
20 |
21 | D3D11_BUFFER_DESC bufferDesc{};
22 | D3D11_SUBRESOURCE_DATA initialData{};
23 |
24 | bufferDesc.ByteWidth = vertexBufferSize;
25 | bufferDesc.Usage = D3D11_USAGE_DEFAULT;
26 | bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
27 | bufferDesc.CPUAccessFlags = 0;
28 | bufferDesc.MiscFlags = 0;
29 | bufferDesc.StructureByteStride = 0;
30 |
31 | initialData.pSysMem = mesh.mVertices.data();
32 | initialData.SysMemPitch = 0;
33 | initialData.SysMemSlicePitch = 0;
34 | device->CreateBuffer(&bufferDesc, &initialData, &mVertexBuffer);
35 |
36 |
37 | bufferDesc.ByteWidth = indexBufferSize;
38 | bufferDesc.Usage = D3D11_USAGE_DEFAULT;
39 | bufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
40 | bufferDesc.CPUAccessFlags = 0;
41 | bufferDesc.MiscFlags = 0;
42 | bufferDesc.StructureByteStride = 0;
43 |
44 | initialData.pSysMem = mesh.mIndices.data();
45 | initialData.SysMemPitch = 0;
46 | initialData.SysMemSlicePitch = 0;
47 | device->CreateBuffer(&bufferDesc, &initialData, &mIndexBuffer);
48 |
49 | return true;
50 | }
51 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/D3D11Mesh.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #include "Mesh.h"
13 | #include
14 | #include
15 | #include
16 |
17 | using namespace DirectX;
18 | using namespace Microsoft::WRL;
19 |
20 | class D3D11Mesh
21 | {
22 | public:
23 | bool InitializeFromMesh(ID3D11Device* device, Mesh& mesh);
24 | uint32_t mNumIndices;
25 | XMMATRIX mMatWorld;
26 | ComPtr mVertexBuffer;
27 | ComPtr mIndexBuffer;
28 | };
29 |
30 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/GPUTimers.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #pragma warning( disable : 4995 )
13 | #include
14 | #include
15 |
16 | typedef int RenderTimeId;
17 |
18 | //--------------------------------------------------------------------------------
19 | struct GPUTimerState
20 | {
21 | bool TimestampQueryInFlight;
22 | ID3D11Query* pGPUTimersBegin;
23 | ID3D11Query* pGPUTimersEnd;
24 | float GPUTimeInMS;
25 | };
26 |
27 | //--------------------------------------------------------------------------------
28 | class GPUTimers
29 | {
30 | public:
31 | void Create(ID3D11Device* pD3DDevice, UINT NumTimers);
32 | void Release();
33 |
34 | void BeginFrame(ID3D11DeviceContext* pDeviceContext);
35 | void EndFrame(ID3D11DeviceContext* pDeviceContext);
36 |
37 | void StartTimer(ID3D11DeviceContext* pDeviceContext, UINT Id);
38 | void StopTimer(ID3D11DeviceContext* pDeviceContext, UINT Id);
39 |
40 | float GetGPUTimeInMS(UINT Id);
41 |
42 | protected:
43 | bool m_DisjointQueryInFlight;
44 | ID3D11Query* m_pDisjointTimestampQuery;
45 | std::vector m_Timers;
46 | };
47 |
48 | //--------------------------------------------------------------------------------
49 | class GPUTimer
50 | {
51 | public:
52 | GPUTimer(GPUTimers* pGPUTimers, ID3D11DeviceContext* pDeviceContext, RenderTimeId Id)
53 | : m_pGPUTimers(pGPUTimers)
54 | , m_pDeviceContext(pDeviceContext)
55 | , m_RenderTimeId(Id)
56 | {
57 | m_pGPUTimers->StartTimer(m_pDeviceContext, m_RenderTimeId);
58 | }
59 | ~GPUTimer()
60 | {
61 | m_pGPUTimers->StopTimer(m_pDeviceContext, m_RenderTimeId);
62 | }
63 |
64 | private:
65 | GPUTimers* m_pGPUTimers;
66 | ID3D11DeviceContext* m_pDeviceContext;
67 | RenderTimeId m_RenderTimeId;
68 | };
69 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/HBAOSample.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #include "Scene.h"
13 | #include "Camera.h"
14 | #include "GFSDK_SSAO.h"
15 |
16 | enum GPUTimeId
17 | {
18 | GPU_TIME_AO,
19 | NUM_GPU_TIMES
20 | };
21 |
22 | class HBAOSample
23 | {
24 | public:
25 | virtual void Initialize() {};
26 | virtual void Run() = 0;
27 | virtual void RenderUI();
28 |
29 | protected:
30 | void InitializeHBAOParameters();
31 |
32 | Scene mScene;
33 | Camera mCamera;
34 | uint32_t mWindowWidth = 1280;
35 | uint32_t mWindowHeight = 720;
36 | float mFrameTimeMs;
37 | GFSDK_SSAO_Parameters mAOParameters;
38 | };
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/HBAOSampleD3D11.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include "HBAOSample.h"
12 | #include "DeviceManager11.h"
13 | #include
14 | #include
15 | #include "SceneRenderer.h"
16 |
17 | #include
18 |
19 | using namespace Microsoft::WRL;
20 | class HBAOSampleD3D11 : public HBAOSample, public IVisualController
21 | {
22 | public:
23 | void Initialize() override;
24 | void Run() override;
25 |
26 | void Render(RenderTargetView RTV) override;
27 | void BackBufferResized(uint32_t width, uint32_t height, uint32_t sampleCount) override;
28 |
29 | private:
30 | bool InitializeHBAOPlus();
31 | bool InitializeRenderTargets();
32 | LRESULT MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
33 |
34 | DeviceManager mDeviceManager;
35 | ComPtr mDepthStencil[2];
36 | ComPtr mNormalsGBuffer;
37 | ComPtr mDepthStencilView[2];
38 | ComPtr mDepthSRV[2];
39 |
40 | ID3D11Device* mDevice = nullptr;
41 | ID3D11DeviceContext* mDeviceContext = nullptr;
42 |
43 | ID3D12CommandQueue* mCommandQueue;
44 |
45 | SceneRenderer mSceneRenderer;
46 |
47 | GFSDK_SSAO_InputData_D3D11 mSSAOInputData;
48 | GFSDK_SSAO_Context_D3D11* mSSAOContext;
49 | };
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/Main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include
12 | #include "HBAOSampleD3D11.h"
13 |
14 | INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nShowCmd)
15 | {
16 | HBAOSampleD3D11 hbaoSample;
17 | hbaoSample.Initialize();
18 | hbaoSample.Run();
19 | return 0;
20 | }
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/Mesh.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include "Mesh.h"
12 |
13 | #define TINYOBJLOADER_IMPLEMENTATION
14 | #include "tiny_obj_loader.h"
15 |
16 | std::shared_ptr Mesh::LoadFromFile(const std::string& filename)
17 | {
18 | std::shared_ptr mesh = std::make_shared();
19 | std::ifstream inputFile(filename);
20 | tinyobj::attrib_t attrib;
21 | std::vector shapes;
22 | std::vector materials;
23 | std::string err;
24 |
25 | tinyobj::LoadObj(&attrib, &shapes, &materials, &err, &inputFile, nullptr, true);
26 |
27 | tinyobj::shape_t& shape = shapes[0];
28 |
29 |
30 | for (auto& index : shape.mesh.indices)
31 | {
32 | mesh->mIndices.push_back((uint32_t)index.vertex_index);
33 | }
34 |
35 | Vertex vertex{};
36 | for (uint32_t i = 0; i < attrib.vertices.size() / 3; ++i)
37 | {
38 | memcpy(vertex.Position, &attrib.vertices[i * 3], sizeof(float) * 3);
39 | mesh->mVertices.push_back(vertex);
40 | }
41 | return mesh;
42 | }
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/Mesh.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 |
18 | class Mesh
19 | {
20 | public:
21 | struct Vertex
22 | {
23 | float Position[3];
24 | };
25 |
26 | static std::shared_ptr LoadFromFile(const std::string& filename);
27 |
28 | //protected:
29 | std::vector mVertices;
30 | std::vector mIndices;
31 | };
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/MeshRenderer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include "MeshRenderer.h"
12 | #include
13 |
14 | #include "D3D11Mesh.h"
15 | #include "Camera.h"
16 |
17 | void MeshRenderer::Initialize(ID3D11Device* device)
18 | {
19 | D3D11_INPUT_ELEMENT_DESC inputLayout[] =
20 | {
21 | {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0}
22 | };
23 |
24 | ID3D10Blob* vs = nullptr;
25 | ID3D10Blob* ps = nullptr;
26 | ID3D10Blob* errors = nullptr;
27 |
28 | D3DCompileFromFile(L"..\\Media\\StaticMesh.hlsl", nullptr, nullptr, "VSMain", "vs_5_0", 0, 0, &vs, &errors);
29 | D3DCompileFromFile(L"..\\Media\\StaticMesh.hlsl", nullptr, nullptr, "PSMain", "ps_5_0", 0, 0, &ps, &errors);
30 |
31 | device->CreateInputLayout(inputLayout, ARRAYSIZE(inputLayout), vs->GetBufferPointer(), vs->GetBufferSize(), &mInputLayout);
32 |
33 | device->CreateVertexShader(vs->GetBufferPointer(), vs->GetBufferSize(), nullptr, &mVertexShader);
34 | device->CreatePixelShader(ps->GetBufferPointer(), ps->GetBufferSize(), nullptr, &mPixelShader);
35 |
36 | D3D11_RASTERIZER_DESC rasterizerDesc = CD3D11_RASTERIZER_DESC(D3D11_DEFAULT);
37 | rasterizerDesc.CullMode = D3D11_CULL_NONE;
38 | device->CreateRasterizerState(&rasterizerDesc, &mRasterizerState);
39 |
40 | D3D11_BLEND_DESC blendDesc = CD3D11_BLEND_DESC(D3D11_DEFAULT);
41 | device->CreateBlendState(&blendDesc, &mBlendState);
42 |
43 | D3D11_DEPTH_STENCIL_DESC depthStencilDesc = CD3D11_DEPTH_STENCIL_DESC(D3D11_DEFAULT);
44 | depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
45 | device->CreateDepthStencilState(&depthStencilDesc, &mDepthStencilState);
46 |
47 | D3D11_BUFFER_DESC bufferDesc = CD3D11_BUFFER_DESC(sizeof(XMMATRIX) * 2, D3D11_BIND_CONSTANT_BUFFER);
48 | device->CreateBuffer(&bufferDesc, nullptr, &mPerFrameCB);
49 |
50 | bufferDesc.ByteWidth = sizeof(XMMATRIX);
51 | device->CreateBuffer(&bufferDesc, nullptr, &mPerObjectCB);
52 | }
53 |
54 | void MeshRenderer::RenderMeshes(ID3D11DeviceContext* deviceContext, const std::vector& meshes, const Camera& camera)
55 | {
56 | deviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
57 | deviceContext->IASetInputLayout(mInputLayout.Get());
58 | deviceContext->VSSetShader(mVertexShader.Get(), nullptr, 0);
59 | deviceContext->PSSetShader(mPixelShader.Get(), nullptr, 0);
60 | deviceContext->RSSetState(mRasterizerState.Get());
61 | float kBlendFactor[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
62 | deviceContext->OMSetBlendState(mBlendState.Get(), kBlendFactor, 0xFFFFFFFF);
63 | deviceContext->OMSetDepthStencilState(mDepthStencilState.Get(), 0);
64 | ID3D11Buffer* constantBuffers[2] = { mPerFrameCB.Get(), mPerObjectCB.Get() };
65 | deviceContext->VSSetConstantBuffers(0, 2, constantBuffers);
66 | ID3D11Buffer* vertexBuffer = nullptr;
67 | UINT stride = sizeof(Mesh::Vertex);
68 | UINT offset = 0;
69 |
70 | deviceContext->UpdateSubresource(mPerFrameCB.Get(), 0, nullptr, camera.PerFrameData, 0, 0);
71 |
72 | for (const D3D11Mesh& mesh : meshes)
73 | {
74 | deviceContext->UpdateSubresource(mPerObjectCB.Get(), 0, nullptr, &mesh.mMatWorld, 0, 0);
75 | deviceContext->IASetIndexBuffer(mesh.mIndexBuffer.Get(), DXGI_FORMAT_R32_UINT, 0);
76 | vertexBuffer = mesh.mVertexBuffer.Get();
77 | deviceContext->IASetVertexBuffers(0, 1, &vertexBuffer, &stride, &offset);
78 | deviceContext->DrawIndexedInstanced(mesh.mNumIndices, 1, 0, 0, 0);
79 | }
80 | }
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/MeshRenderer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #include
13 | #include
14 | #include
15 |
16 | using namespace Microsoft::WRL;
17 |
18 | class Camera;
19 | class D3D11Mesh;
20 |
21 | class MeshRenderer
22 | {
23 | public:
24 | void Initialize(ID3D11Device* device);
25 | void RenderMeshes(ID3D11DeviceContext* deviceContext, const std::vector& meshes, const Camera& camera);
26 |
27 | private:
28 | //ComPtr mPSO;
29 | //ComPtr mRootSignature;
30 | ComPtr mInputLayout;
31 | ComPtr mRasterizerState;
32 | ComPtr mBlendState;
33 | ComPtr mDepthStencilState;
34 |
35 | ComPtr mVertexShader;
36 | ComPtr mPixelShader;
37 |
38 | ComPtr mPerFrameCB;
39 | ComPtr mPerObjectCB;
40 | };
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/SSAO11.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 |
4 | #define APSTUDIO_READONLY_SYMBOLS
5 | /////////////////////////////////////////////////////////////////////////////
6 | //
7 | // Generated from the TEXTINCLUDE 2 resource.
8 | //
9 | #include "WinResRc.h"
10 |
11 | /////////////////////////////////////////////////////////////////////////////
12 | #undef APSTUDIO_READONLY_SYMBOLS
13 |
14 | /////////////////////////////////////////////////////////////////////////////
15 | // English (U.S.) resources
16 |
17 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
18 | #ifdef _WIN32
19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
20 | #pragma code_page(1252)
21 | #endif //_WIN32
22 |
23 |
24 | #ifdef APSTUDIO_INVOKED
25 | /////////////////////////////////////////////////////////////////////////////
26 | //
27 | // TEXTINCLUDE
28 | //
29 |
30 | 1 TEXTINCLUDE
31 | BEGIN
32 | "resource.h\0"
33 | END
34 |
35 | 2 TEXTINCLUDE
36 | BEGIN
37 | "#include ""WinResRc.h""\r\n"
38 | "\0"
39 | END
40 |
41 | 3 TEXTINCLUDE
42 | BEGIN
43 | "\r\n"
44 | "\0"
45 | END
46 |
47 | #endif // APSTUDIO_INVOKED
48 |
49 |
50 | /////////////////////////////////////////////////////////////////////////////
51 | //
52 | // Icon
53 | //
54 |
55 | // Icon with lowest ID value placed first to ensure application icon
56 | // remains consistent on all systems.
57 | IDI_ICON1 ICON "..\\Media\\directx.ico"
58 | #endif // English (U.S.) resources
59 | /////////////////////////////////////////////////////////////////////////////
60 |
61 |
62 |
63 | #ifndef APSTUDIO_INVOKED
64 | /////////////////////////////////////////////////////////////////////////////
65 | //
66 | // Generated from the TEXTINCLUDE 3 resource.
67 | //
68 |
69 |
70 | /////////////////////////////////////////////////////////////////////////////
71 | #endif // not APSTUDIO_INVOKED
72 |
73 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/Scene.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include "Scene.h"
12 |
13 |
14 | bool Scene::InitializeDefault()
15 | {
16 | std::shared_ptr actorMesh = Mesh::LoadFromFile("..\\Media\\Meshes\\shaderBall.obj");
17 | std::shared_ptr cubeMesh = Mesh::LoadFromFile("..\\Media\\Meshes\\cube.obj");
18 |
19 | //
20 | // Layer 1 = Foreground meshes
21 | //
22 | Node node;
23 | node.mesh = actorMesh;
24 | node.layer = 1;
25 |
26 | for (uint32_t i = 0; i < 4; ++i)
27 | {
28 | node.matWorld = XMMatrixTranslation((i % 2) * 16.0f - 8.0f, (i / 2) * 16.0f - 8.0f, 0.0f);
29 | mNodes.push_back(node);
30 | }
31 |
32 | //
33 | // Layer 0 = Background meshes
34 | //
35 | node.mesh = cubeMesh;
36 | node.matWorld = XMMatrixIdentity();
37 | node.layer = 0;
38 |
39 | mNodes.push_back(node);
40 |
41 |
42 | return true;
43 | }
44 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/Scene.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #include "Mesh.h"
13 | #include
14 | #include
15 | using namespace DirectX;
16 |
17 | class Scene
18 | {
19 | public:
20 | struct Node
21 | {
22 | std::shared_ptr mesh;
23 | XMMATRIX matWorld;
24 | uint32_t layer;
25 | };
26 |
27 | enum class ESceneType
28 | {
29 | kShaderBall = 0,
30 | kCustom
31 | };
32 | using Nodes = std::vector;
33 |
34 | bool InitializeDefault();
35 |
36 | const Nodes& GetNodes() const { return mNodes; }
37 |
38 | private:
39 | Nodes mNodes;
40 | };
41 |
42 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/SceneRenderer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include "SceneRenderer.h"
12 | #include "Scene.h"
13 | #include "Camera.h"
14 |
15 | bool SceneRenderer::InitializeWithScene(ID3D11Device* device, Scene& scene)
16 | {
17 | mMeshRenderer.Initialize(device);
18 |
19 | for (auto& sceneNode : scene.GetNodes())
20 | {
21 | if (sceneNode.layer < kLayersCount)
22 | {
23 | mMeshes[sceneNode.layer].emplace_back();
24 |
25 | D3D11Mesh& mesh = mMeshes[sceneNode.layer].back();
26 |
27 | mesh.InitializeFromMesh(device, *sceneNode.mesh);
28 | mesh.mMatWorld = sceneNode.matWorld;
29 | }
30 | }
31 | return true;
32 | }
33 |
34 | void SceneRenderer::RenderLayer(ID3D11DeviceContext* deviceContext, uint32_t layer, const Camera& camera)
35 | {
36 | mMeshRenderer.RenderMeshes(deviceContext, mMeshes[layer], camera);
37 | }
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/SceneRenderer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #include "D3D11Mesh.h"
13 | #include "MeshRenderer.h"
14 |
15 | class Camera;
16 | class Scene;
17 |
18 | class SceneRenderer
19 | {
20 | public:
21 | bool InitializeWithScene(ID3D11Device* device, Scene& scene);
22 | void RenderLayer(ID3D11DeviceContext* deviceContext, uint32_t layer, const Camera& camera);
23 | static const uint32_t kLayersCount = 2;
24 |
25 | private:
26 | std::vector mMeshes[kLayersCount];
27 | MeshRenderer mMeshRenderer;
28 | };
29 |
30 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/imgui/imconfig.h:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------------
2 | // USER IMPLEMENTATION
3 | // This file contains compile-time options for ImGui.
4 | // Other options (memory allocation overrides, callbacks, etc.) can be set at runtime via the ImGuiIO structure - ImGui::GetIO().
5 | //-----------------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | //---- Define assertion handler. Defaults to calling assert().
10 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
11 |
12 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows.
13 | //#define IMGUI_API __declspec( dllexport )
14 | //#define IMGUI_API __declspec( dllimport )
15 |
16 | //---- Include imgui_user.inl at the end of imgui.cpp so you can include code that extends ImGui using its private data/functions.
17 | //#define IMGUI_INCLUDE_IMGUI_USER_INL
18 |
19 | //---- Include imgui_user.h at the end of imgui.h
20 | //#define IMGUI_INCLUDE_IMGUI_USER_H
21 |
22 | //---- Don't implement default handlers for Windows (so as not to link with OpenClipboard() and others Win32 functions)
23 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS
24 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS
25 |
26 | //---- Don't implement help and test window functionality (ShowUserGuide()/ShowStyleEditor()/ShowTestWindow() methods will be empty)
27 | //#define IMGUI_DISABLE_TEST_WINDOWS
28 |
29 | //---- Don't define obsolete functions names
30 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
31 |
32 | //---- Implement STB libraries in a namespace to avoid conflicts
33 | //#define IMGUI_STB_NAMESPACE ImGuiStb
34 |
35 | //---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.
36 | /*
37 | #define IM_VEC2_CLASS_EXTRA \
38 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
39 | operator MyVec2() const { return MyVec2(x,y); }
40 |
41 | #define IM_VEC4_CLASS_EXTRA \
42 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
43 | operator MyVec4() const { return MyVec4(x,y,z,w); }
44 | */
45 |
46 | //---- Freely implement extra functions within the ImGui:: namespace.
47 | //---- Declare helpers or widgets implemented in imgui_user.inl or elsewhere, so end-user doesn't need to include multiple files.
48 | //---- e.g. you can create variants of the ImGui::Value() helper for your low-level math types, or your own widgets/helpers.
49 | /*
50 | namespace ImGui
51 | {
52 | void Value(const char* prefix, const MyVec2& v, const char* float_format = NULL);
53 | void Value(const char* prefix, const MyVec4& v, const char* float_format = NULL);
54 | }
55 | */
56 |
57 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D11/src/imgui/imgui_impl_dx11.h:
--------------------------------------------------------------------------------
1 | // ImGui Win32 + DirectX11 binding
2 | // https://github.com/ocornut/imgui
3 |
4 | struct ID3D11Device;
5 | struct ID3D11DeviceContext;
6 |
7 | bool ImGui_ImplDX11_Init(void* hwnd, ID3D11Device* device, ID3D11DeviceContext* device_context);
8 | void ImGui_ImplDX11_Shutdown();
9 | void ImGui_ImplDX11_NewFrame();
10 |
11 | // Use if you want to reset your rendering device without losing ImGui state.
12 | void ImGui_ImplDX11_InvalidateDeviceObjects();
13 | bool ImGui_ImplDX11_CreateDeviceObjects();
14 |
15 | // Handler for Win32 messages, update mouse/keyboard data.
16 | // You may or not need this for your implementation, but it can serve as reference for handling inputs.
17 | // Commented out to avoid dragging dependencies on types. You can copy the extern declaration in your code.
18 | /*
19 | extern LRESULT ImGui_ImplDX11_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
20 | */
21 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/media/Meshes/cube.obj:
--------------------------------------------------------------------------------
1 | o Cube
2 | v 9.900001 9.900000 19.800001
3 | v 9.900001 -9.900001 19.800001
4 | v -9.900002 -9.899999 19.800001
5 | v -9.899997 9.900004 19.800001
6 | v 9.900005 9.899995 0.000000
7 | v 9.899994 -9.900006 0.000000
8 | v -9.900004 -9.899997 0.000000
9 | v -9.900000 9.900001 0.000000
10 | vn -0.0000 0.0000 -1.0000
11 | vn 0.0000 0.0000 1.0000
12 | vn -1.0000 0.0000 -0.0000
13 | vn 0.0000 1.0000 -0.0000
14 | vn 1.0000 -0.0000 -0.0000
15 | vn -0.0000 -1.0000 0.0000
16 | s off
17 | f 2//1 4//1 1//1
18 | f 8//2 6//2 5//2
19 | f 5//3 2//3 1//3
20 | f 6//4 3//4 2//4
21 | f 7//5 4//5 3//5
22 | f 1//6 8//6 5//6
23 | f 2//1 3//1 4//1
24 | f 8//2 7//2 6//2
25 | f 5//3 6//3 2//3
26 | f 6//4 7//4 3//4
27 | f 7//5 8//5 4//5
28 | f 1//6 4//6 8//6
29 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/media/StaticMesh.hlsl:
--------------------------------------------------------------------------------
1 | cbuffer PerFrame : register(b0)
2 | {
3 | row_major float4x4 MatView;
4 | row_major float4x4 MatViewProj;
5 | };
6 |
7 | cbuffer PerObject : register(b1)
8 | {
9 | row_major float4x4 MatWorld;
10 | };
11 |
12 | struct VSInput
13 | {
14 | float4 Position : POSITION;
15 | };
16 |
17 | struct PSInput
18 | {
19 | float4 Position : SV_Position;
20 | float3 ViewPosition : VIEWPOSITION;
21 | };
22 |
23 | void VSMain(in VSInput In, out PSInput Out)
24 | {
25 | Out.Position = mul(In.Position, MatWorld);
26 | Out.ViewPosition = mul(Out.Position, (float3x3)MatView);
27 | Out.Position = mul(Out.Position, MatViewProj);
28 | }
29 |
30 | void PSMain(in PSInput In, out float4 Out : SV_Target)
31 | {
32 | float3 Normal = -normalize(cross(ddx(In.ViewPosition), ddy(In.ViewPosition)));
33 | Out = float4(1.0, 1.0, 0.0, 1.0);
34 | Out = float4(Normal * 0.5 + 0.5, 1.0);
35 | }
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/Camera.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include "Camera.h"
12 |
13 | Camera::Camera()
14 | {
15 | InitProjectionMatrix(1280, 720);
16 |
17 | mPosition = { -5.0f, -5.0f, 3.0f };
18 | mViewVector = XMVector3Normalize({ -4.0f, -4.0f, -2.0f });
19 | UpdateViewMatrix();
20 | }
21 |
22 | void Camera::InitProjectionMatrix(uint32_t width, uint32_t height, float zNear, float zFar)
23 | {
24 | mMatProj = XMMatrixPerspectiveFovRH(XMConvertToRadians(60.0f), (float)width / (float)height, zNear, zFar);
25 | UpdateViewMatrix();
26 | }
27 |
28 | void Camera::MoveForward(float dt)
29 | {
30 | mPosition += mViewVector * dt;
31 | UpdateViewMatrix();
32 | }
33 |
34 | void Camera::MoveRight(float dt)
35 | {
36 | mPosition += XMMatrixTranspose(mMatView).r[0] * dt;
37 | UpdateViewMatrix();
38 | }
39 |
40 | void Camera::AdvanceAngles(float yaw, float pitch)
41 | {
42 | XMMATRIX matBasisVecs = XMMatrixTranspose(mMatView);
43 |
44 | XMMATRIX matRot = XMMatrixRotationY(yaw);// *XMMatrixRotationX(pitch);
45 |
46 | mViewVector = XMVector3Rotate(mViewVector, XMQuaternionRotationAxis(matBasisVecs.r[1], yaw));
47 | mViewVector = XMVector3Rotate(mViewVector, XMQuaternionRotationAxis(matBasisVecs.r[0], pitch));
48 | UpdateViewMatrix();
49 | }
50 |
51 | void Camera::UpdateViewMatrix()
52 | {
53 | mMatView = XMMatrixLookAtRH(mPosition, mPosition + mViewVector, { 0.0f, 0.0f, 1.0f });
54 | mMatViewProj = XMMatrixMultiply(mMatView, mMatProj);
55 | }
56 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/Camera.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 |
13 | #include
14 | using namespace DirectX;
15 |
16 | class Camera
17 | {
18 | public:
19 | Camera();
20 |
21 | union
22 | {
23 | struct
24 | {
25 | XMMATRIX mMatView;
26 | XMMATRIX mMatViewProj;
27 | };
28 | float PerFrameData[32];
29 | };
30 | XMMATRIX mMatProj;
31 |
32 | void InitProjectionMatrix(uint32_t width, uint32_t height, float zNear = 0.01f, float zFar = 10000.0f);
33 | void MoveForward(float dt);
34 | void MoveRight(float dt);
35 | void AdvanceAngles(float yaw, float pitch);
36 |
37 | void UpdateViewMatrix();
38 |
39 | XMVECTOR mPosition;
40 | XMVECTOR mViewVector;
41 | };
42 |
43 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/D3D12Mesh.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #define _SCL_SECURE_NO_WARNINGS
12 | #include "D3D12Mesh.h"
13 | #include "d3dx12.h"
14 |
15 | bool D3D12Mesh::InitializeFromMesh(ID3D12Device* device, Mesh& mesh)
16 | {
17 | mNumIndices = (uint32_t)mesh.mIndices.size();
18 |
19 | ID3D12Resource* vertexBuffer = nullptr;
20 | ID3D12Resource* indexBuffer = nullptr;
21 |
22 | uint32_t vertexBufferSize = (uint32_t)mesh.mVertices.size() * sizeof(decltype(mesh.mVertices)::value_type);
23 | uint32_t indexBufferSize = (uint32_t)mesh.mIndices.size() * sizeof(decltype(mesh.mIndices)::value_type);
24 |
25 | device->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD), D3D12_HEAP_FLAG_NONE, &CD3DX12_RESOURCE_DESC::Buffer(vertexBufferSize),
26 | D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&vertexBuffer));
27 |
28 | device->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD), D3D12_HEAP_FLAG_NONE, &CD3DX12_RESOURCE_DESC::Buffer(indexBufferSize),
29 | D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&indexBuffer));
30 |
31 | void* uploadPtr = nullptr;
32 | vertexBuffer->Map(0, nullptr, &uploadPtr);
33 | std::copy(mesh.mVertices.begin(), mesh.mVertices.end(), (decltype(mesh.mVertices)::value_type*)uploadPtr);
34 | vertexBuffer->Unmap(0, nullptr);
35 |
36 | indexBuffer->Map(0, nullptr, &uploadPtr);
37 | std::copy(mesh.mIndices.begin(), mesh.mIndices.end(), (decltype(mesh.mIndices)::value_type*)uploadPtr);
38 | indexBuffer->Unmap(0, nullptr);
39 |
40 | mVertexBuffer.BufferLocation = vertexBuffer->GetGPUVirtualAddress();
41 | mVertexBuffer.SizeInBytes = vertexBufferSize;
42 | mVertexBuffer.StrideInBytes = sizeof(decltype(mesh.mVertices)::value_type);
43 |
44 | mIndexBuffer.BufferLocation = indexBuffer->GetGPUVirtualAddress();
45 | mIndexBuffer.SizeInBytes = indexBufferSize;
46 | mIndexBuffer.Format = DXGI_FORMAT_R32_UINT;
47 |
48 | return true;
49 | }
50 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/D3D12Mesh.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #include "Mesh.h"
13 | #include
14 | #include
15 |
16 | using namespace DirectX;
17 |
18 | class D3D12Mesh
19 | {
20 | public:
21 | bool InitializeFromMesh(ID3D12Device* device, Mesh& mesh);
22 | uint32_t mNumIndices;
23 | XMMATRIX mMatWorld;
24 | D3D12_VERTEX_BUFFER_VIEW mVertexBuffer;
25 | D3D12_INDEX_BUFFER_VIEW mIndexBuffer;
26 | };
27 |
28 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/GPUTimers.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #pragma warning( disable : 4995 )
13 | #include
14 | #include
15 |
16 | typedef int RenderTimeId;
17 |
18 | //--------------------------------------------------------------------------------
19 | struct GPUTimerState
20 | {
21 | bool TimestampQueryInFlight;
22 | float GPUTimeInMS;
23 | };
24 |
25 | //--------------------------------------------------------------------------------
26 | class GPUTimers
27 | {
28 | public:
29 | void Create(ID3D12Device* pD3DDevice, ID3D12CommandQueue* pQueue, UINT NumTimers);
30 | void Release();
31 |
32 | void BeginFrame(ID3D12GraphicsCommandList* pCommandList);
33 | void EndFrame(ID3D12GraphicsCommandList* pCommandList);
34 |
35 | void StartTimer(ID3D12GraphicsCommandList* pCommandList, UINT Id);
36 | void StopTimer(ID3D12GraphicsCommandList* pCommandList, UINT Id);
37 |
38 | float GetGPUTimeInMS(UINT Id);
39 |
40 | protected:
41 | ID3D12QueryHeap* m_pQueryHeap;
42 | ID3D12Resource* m_pQueryResults;
43 | ID3D12CommandQueue* m_pQueue;
44 |
45 | std::vector m_Timers;
46 | };
47 |
48 | //--------------------------------------------------------------------------------
49 | class GPUTimer
50 | {
51 | public:
52 | GPUTimer(GPUTimers* pGPUTimers, ID3D12GraphicsCommandList* pDeviceContext, RenderTimeId Id)
53 | : m_pGPUTimers(pGPUTimers)
54 | , m_pDeviceContext(pDeviceContext)
55 | , m_RenderTimeId(Id)
56 | {
57 | m_pGPUTimers->StartTimer(m_pDeviceContext, m_RenderTimeId);
58 | }
59 | ~GPUTimer()
60 | {
61 | m_pGPUTimers->StopTimer(m_pDeviceContext, m_RenderTimeId);
62 | }
63 |
64 | private:
65 | GPUTimers* m_pGPUTimers;
66 | ID3D12GraphicsCommandList* m_pDeviceContext;
67 | RenderTimeId m_RenderTimeId;
68 | };
69 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/HBAOSample.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #include "Scene.h"
13 | #include "Camera.h"
14 | #include "GFSDK_SSAO.h"
15 |
16 | enum GPUTimeId
17 | {
18 | GPU_TIME_AO,
19 | NUM_GPU_TIMES
20 | };
21 |
22 | class HBAOSample
23 | {
24 | public:
25 | virtual void Initialize() {};
26 | virtual void Run() = 0;
27 | virtual void RenderUI();
28 |
29 | protected:
30 | void InitializeHBAOParameters();
31 |
32 | Scene mScene;
33 | Camera mCamera;
34 | uint32_t mWindowWidth = 1280;
35 | uint32_t mWindowHeight = 720;
36 | float mFrameTimeMs = 0.0f;
37 | GFSDK_SSAO_Parameters mAOParameters;
38 | };
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/HBAOSampleD3D12.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include
12 | #include "DeviceManager12.h"
13 | #include
14 | #include
15 | #include "SceneRenderer.h"
16 |
17 | #include
18 |
19 | using namespace Microsoft::WRL;
20 |
21 | class HBAOSampleD3D12 : public HBAOSample, public IVisualController
22 | {
23 | public:
24 | void Initialize() override;
25 | void Run() override;
26 |
27 | void Render(RenderTargetView RTV) override;
28 | void BackBufferResized(uint32_t width, uint32_t height, uint32_t sampleCount) override;
29 |
30 | private:
31 | bool InitializeHBAOPlus();
32 | bool InitializeRenderTargets();
33 | LRESULT MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override;
34 |
35 | DeviceManager mDeviceManager;
36 | ComPtr mCommandAllocator;
37 | ComPtr mCommandList;
38 | ComPtr mDepthStencil[2];
39 | ComPtr mNormalsGBuffer;
40 | D3D12_CPU_DESCRIPTOR_HANDLE mDepthStencilView[2];
41 | D3D12_CPU_DESCRIPTOR_HANDLE mDepthSRV[2];
42 | ComPtr mDSVDescriptorHeap;
43 | ID3D12Device* mDevice = nullptr;
44 |
45 | ID3D12CommandQueue* mCommandQueue;
46 | ComPtr mFence;
47 | uint64_t mFenceValue = 0;
48 |
49 | SceneRenderer mSceneRenderer;
50 |
51 | ComPtr mSSAODescriptorHeapCBVSRVUAV;
52 | ComPtr mSSAODescriptorHeapRTV;
53 | GFSDK_SSAO_InputData_D3D12 mSSAOInputData;
54 | GFSDK_SSAO_Context_D3D12* mSSAOContext;
55 | };
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/Main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include
12 | #include "HBAOSampleD3D12.h"
13 |
14 | INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nShowCmd)
15 | {
16 | HBAOSampleD3D12 hbaoSample;
17 | hbaoSample.Initialize();
18 | hbaoSample.Run();
19 | return 0;
20 | }
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/Mesh.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include "Mesh.h"
12 |
13 | #define TINYOBJLOADER_IMPLEMENTATION
14 | #include "tiny_obj_loader.h"
15 |
16 | #include
17 |
18 | std::shared_ptr Mesh::LoadFromFile(const std::string& filename)
19 | {
20 | std::shared_ptr mesh = std::make_shared();
21 | std::ifstream inputFile(filename);
22 | tinyobj::attrib_t attrib;
23 | std::vector shapes;
24 | std::vector materials;
25 | std::string err;
26 |
27 | tinyobj::LoadObj(&attrib, &shapes, &materials, &err, &inputFile, nullptr, true);
28 |
29 | if (shapes.size() == 0)
30 | {
31 | MessageBoxW(NULL, L"Mesh::LoadFromFile failed", L"Error!", MB_ICONEXCLAMATION | MB_OK);
32 | }
33 |
34 | tinyobj::shape_t& shape = shapes[0];
35 |
36 |
37 | for (auto& index : shape.mesh.indices)
38 | {
39 | mesh->mIndices.push_back((uint32_t)index.vertex_index);
40 | }
41 |
42 | Vertex vertex{};
43 | for (uint32_t i = 0; i < attrib.vertices.size() / 3; ++i)
44 | {
45 | memcpy(vertex.Position, &attrib.vertices[i * 3], sizeof(float) * 3);
46 | mesh->mVertices.push_back(vertex);
47 | }
48 | return mesh;
49 | }
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/Mesh.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 |
18 | class Mesh
19 | {
20 | public:
21 | struct Vertex
22 | {
23 | float Position[3];
24 | };
25 |
26 | static std::shared_ptr LoadFromFile(const std::string& filename);
27 |
28 | //protected:
29 | std::vector mVertices;
30 | std::vector mIndices;
31 | };
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/MeshRenderer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #include
13 | #include
14 | #include
15 |
16 | using namespace Microsoft::WRL;
17 |
18 | class Camera;
19 | class D3D12Mesh;
20 |
21 | class MeshRenderer
22 | {
23 | public:
24 | void Initialize(ID3D12Device* device);
25 | void RenderMeshes(ID3D12GraphicsCommandList* commandList, const std::vector& meshes, const Camera& camera);
26 |
27 | private:
28 | ComPtr mPSO;
29 | ComPtr mRootSignature;
30 | };
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/SSAO12_2015.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {07e78478-15b9-460a-ae19-d5e122d6440a}
6 |
7 |
8 | {463b2d13-addc-4ee4-9864-16ab1ce31461}
9 |
10 |
11 |
12 |
13 | src
14 |
15 |
16 | src
17 |
18 |
19 | src
20 |
21 |
22 | src
23 |
24 |
25 | src
26 |
27 |
28 | src
29 |
30 |
31 | src\imgui
32 |
33 |
34 | src\imgui
35 |
36 |
37 | src\imgui
38 |
39 |
40 | src\imgui
41 |
42 |
43 | src
44 |
45 |
46 | src
47 |
48 |
49 | src
50 |
51 |
52 | src
53 |
54 |
55 | src
56 |
57 |
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\imgui
79 |
80 |
81 | src\imgui
82 |
83 |
84 | src\imgui
85 |
86 |
87 | src\imgui
88 |
89 |
90 | src\imgui
91 |
92 |
93 | src\imgui
94 |
95 |
96 | src\imgui
97 |
98 |
99 | src
100 |
101 |
102 | src
103 |
104 |
105 | src
106 |
107 |
108 | src
109 |
110 |
111 | src
112 |
113 |
114 | src
115 |
116 |
117 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/Scene.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include "Scene.h"
12 |
13 |
14 | bool Scene::InitializeDefault()
15 | {
16 | std::shared_ptr actorMesh = Mesh::LoadFromFile("..\\Media\\Meshes\\shaderBall.obj");
17 | std::shared_ptr cubeMesh = Mesh::LoadFromFile("..\\Media\\Meshes\\cube.obj");
18 |
19 | Node node;
20 | node.mesh = actorMesh;
21 | node.layer = 1;
22 |
23 | for (uint32_t i = 0; i < 4; ++i)
24 | {
25 | node.matWorld = XMMatrixTranslation((i % 2) * 16.0f - 8.0f, (i / 2) * 16.0f - 8.0f, 0.0f);
26 | mNodes.push_back(node);
27 | }
28 |
29 | node.mesh = cubeMesh;
30 | node.matWorld = XMMatrixIdentity();
31 | node.layer = 0;
32 |
33 | mNodes.push_back(node);
34 |
35 |
36 | return true;
37 | }
38 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/Scene.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #include "Mesh.h"
13 | #include
14 | #include
15 | using namespace DirectX;
16 |
17 | class Scene
18 | {
19 | public:
20 | struct Node
21 | {
22 | std::shared_ptr mesh;
23 | XMMATRIX matWorld;
24 | uint32_t layer;
25 | };
26 |
27 | enum class ESceneType
28 | {
29 | kShaderBall = 0,
30 | kCustom
31 | };
32 | using Nodes = std::vector;
33 |
34 | bool InitializeDefault();
35 |
36 | const Nodes& GetNodes() const { return mNodes; }
37 |
38 | private:
39 | Nodes mNodes;
40 | };
41 |
42 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/SceneRenderer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #include "SceneRenderer.h"
12 | #include
13 | #include
14 |
15 | bool SceneRenderer::InitializeWithScene(ID3D12Device* device, Scene& scene)
16 | {
17 | mMeshRenderer.Initialize(device);
18 |
19 | for (auto& sceneNode : scene.GetNodes())
20 | {
21 | if (sceneNode.layer < kLayersCount)
22 | {
23 | mMeshes[sceneNode.layer].emplace_back();
24 |
25 | D3D12Mesh& mesh = mMeshes[sceneNode.layer].back();
26 |
27 | mesh.InitializeFromMesh(device, *sceneNode.mesh);
28 | mesh.mMatWorld = sceneNode.matWorld;
29 | }
30 | }
31 | return true;
32 | }
33 |
34 | void SceneRenderer::RenderLayer(ID3D12GraphicsCommandList* commandList, uint32_t layer, const Camera& camera)
35 | {
36 | mMeshRenderer.RenderMeshes(commandList, mMeshes[layer], camera);
37 | }
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/SceneRenderer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
3 | *
4 | * NVIDIA CORPORATION and its licensors retain all intellectual property
5 | * and proprietary rights in and to this software, related documentation
6 | * and any modifications thereto. Any use, reproduction, disclosure or
7 | * distribution of this software and related documentation without an express
8 | * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 | */
10 |
11 | #pragma once
12 | #include "D3D12Mesh.h"
13 | #include "MeshRenderer.h"
14 |
15 | class Camera;
16 | class Scene;
17 |
18 | class SceneRenderer
19 | {
20 | public:
21 | bool InitializeWithScene(ID3D12Device* device, Scene& scene);
22 | void RenderLayer(ID3D12GraphicsCommandList* commandList, uint32_t layer, const Camera& camera);
23 | static const uint32_t kLayersCount = 2;
24 |
25 | private:
26 | std::vector mMeshes[kLayersCount];
27 | MeshRenderer mMeshRenderer;
28 | };
29 |
30 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/imgui/imconfig.h:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------------
2 | // USER IMPLEMENTATION
3 | // This file contains compile-time options for ImGui.
4 | // Other options (memory allocation overrides, callbacks, etc.) can be set at runtime via the ImGuiIO structure - ImGui::GetIO().
5 | //-----------------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | //---- Define assertion handler. Defaults to calling assert().
10 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
11 |
12 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows.
13 | //#define IMGUI_API __declspec( dllexport )
14 | //#define IMGUI_API __declspec( dllimport )
15 |
16 | //---- Include imgui_user.inl at the end of imgui.cpp so you can include code that extends ImGui using its private data/functions.
17 | //#define IMGUI_INCLUDE_IMGUI_USER_INL
18 |
19 | //---- Include imgui_user.h at the end of imgui.h
20 | //#define IMGUI_INCLUDE_IMGUI_USER_H
21 |
22 | //---- Don't implement default handlers for Windows (so as not to link with OpenClipboard() and others Win32 functions)
23 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS
24 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS
25 |
26 | //---- Don't implement help and test window functionality (ShowUserGuide()/ShowStyleEditor()/ShowTestWindow() methods will be empty)
27 | //#define IMGUI_DISABLE_TEST_WINDOWS
28 |
29 | //---- Don't define obsolete functions names
30 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
31 |
32 | //---- Implement STB libraries in a namespace to avoid conflicts
33 | //#define IMGUI_STB_NAMESPACE ImGuiStb
34 |
35 | //---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.
36 | /*
37 | #define IM_VEC2_CLASS_EXTRA \
38 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
39 | operator MyVec2() const { return MyVec2(x,y); }
40 |
41 | #define IM_VEC4_CLASS_EXTRA \
42 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
43 | operator MyVec4() const { return MyVec4(x,y,z,w); }
44 | */
45 |
46 | //---- Freely implement extra functions within the ImGui:: namespace.
47 | //---- Declare helpers or widgets implemented in imgui_user.inl or elsewhere, so end-user doesn't need to include multiple files.
48 | //---- e.g. you can create variants of the ImGui::Value() helper for your low-level math types, or your own widgets/helpers.
49 | /*
50 | namespace ImGui
51 | {
52 | void Value(const char* prefix, const MyVec2& v, const char* float_format = NULL);
53 | void Value(const char* prefix, const MyVec4& v, const char* float_format = NULL);
54 | }
55 | */
56 |
57 |
--------------------------------------------------------------------------------
/samples/dual_layer/D3D12/src/imgui/imgui_impl_dx12.h:
--------------------------------------------------------------------------------
1 | // ImGui Win32 + DirectX12 binding
2 | // https://github.com/ocornut/imgui
3 |
4 | struct ID3D12Device;
5 | struct ID3D12DeviceContext;
6 | struct ID3D12DescriptorHeap;
7 | struct ID3D12GraphicsCommandList;
8 | struct ID3D12CommandQueue;
9 |
10 | bool ImGui_ImplDX12_Init(void* hwnd, ID3D12Device* device, ID3D12CommandQueue* pCmdQueue, ID3D12GraphicsCommandList* pCmdList, ID3D12DescriptorHeap* descHeap, unsigned int descHeapBaseOffset);
11 | void ImGui_ImplDX12_Shutdown();
12 | void ImGui_ImplDX12_NewFrame();
13 |
14 | // Use if you want to reset your rendering device without losing ImGui state.
15 | void ImGui_ImplDX12_InvalidateDeviceObjects();
16 | bool ImGui_ImplDX12_CreateDeviceObjects();
17 |
18 | // Handler for Win32 messages, update mouse/keyboard data.
19 | // You may or not need this for your implementation, but it can serve as reference for handling inputs.
20 | // Commented out to avoid dragging dependencies on types. You can copy the extern declaration in your code.
21 | /*
22 | extern LRESULT ImGui_ImplDX12_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
23 | */
24 |
--------------------------------------------------------------------------------
/src/AppState_DX11.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #pragma once
29 | #include "Common.h"
30 |
31 | namespace GFSDK
32 | {
33 | namespace SSAO
34 | {
35 | namespace D3D11
36 | {
37 |
38 | #if SUPPORT_D3D11
39 |
40 | //--------------------------------------------------------------------------------
41 | class AppState
42 | {
43 | public:
44 | AppState()
45 | {
46 | memset(this, 0, sizeof(*this));
47 | }
48 |
49 | void Save(ID3D11DeviceContext* pDeviceContext);
50 | void Restore(ID3D11DeviceContext* pDeviceContext);
51 | static void UnbindSRVs(ID3D11DeviceContext* pDeviceContext);
52 |
53 | private:
54 | static const int NumPSShaderResourceViews = 4;
55 | static const int NumPSSamplers = 2;
56 | static const int NumGSConstantBuffers = 4;
57 | static const int NumPSConstantBuffers = 4;
58 | static const int NumRenderTargetViews = 8;
59 |
60 | D3D11_VIEWPORT Viewport;
61 | D3D11_PRIMITIVE_TOPOLOGY Topology;
62 | ID3D11InputLayout* pInputLayout;
63 | ID3D11RasterizerState* pRasterizerState;
64 |
65 | ID3D11VertexShader* pVS;
66 | ID3D11HullShader* pHS;
67 | ID3D11DomainShader* pDS;
68 | ID3D11GeometryShader* pGS;
69 | ID3D11PixelShader* pPS;
70 | ID3D11ComputeShader* pCS;
71 |
72 | ID3D11ShaderResourceView* pPSShaderResourceViews[NumPSShaderResourceViews];
73 | ID3D11SamplerState* pPSSamplers[NumPSSamplers];
74 | ID3D11Buffer* pGSConstantBuffers[NumGSConstantBuffers];
75 | ID3D11Buffer* pPSConstantBuffers[NumPSConstantBuffers];
76 |
77 | ID3D11DepthStencilState* pDepthStencilState;
78 | UINT StencilRef;
79 | ID3D11BlendState* pBlendState;
80 | FLOAT BlendFactor[4];
81 | UINT SampleMask;
82 | ID3D11RenderTargetView* pRenderTargetViews[NumRenderTargetViews];
83 | ID3D11DepthStencilView* pDepthStencilView;
84 | };
85 |
86 | #endif // SUPPORT_D3D11
87 |
88 | } // namespace D3D11
89 | } // namespace SSAO
90 | } // namespace GFSDK
91 |
--------------------------------------------------------------------------------
/src/AppState_GL.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #pragma once
29 | #include "Common.h"
30 |
31 | namespace GFSDK
32 | {
33 | namespace SSAO
34 | {
35 | namespace GL
36 | {
37 |
38 | #if SUPPORT_GL
39 |
40 | //--------------------------------------------------------------------------------
41 | class AppState
42 | {
43 | public:
44 | AppState()
45 | {
46 | memset(this, 0, sizeof(*this));
47 | }
48 |
49 | void EnableState(const GFSDK_SSAO_GLFunctions& GL, GLboolean IsEnabled, GLenum Cap)
50 | {
51 | if (IsEnabled)
52 | {
53 | GL.glEnable(Cap);
54 | }
55 | else
56 | {
57 | GL.glDisable(Cap);
58 | }
59 | }
60 |
61 | void Save(const GFSDK_SSAO_GLFunctions& GL);
62 | void Restore(const GFSDK_SSAO_GLFunctions& GL);
63 |
64 | private:
65 | GLint m_DrawFBO;
66 | GLint m_VAO;
67 |
68 | GLint m_ContextUBO;
69 | GLint m_BindPointUBOs[3];
70 |
71 | GLint m_ActiveTexture;
72 | GLint m_TextureBinding2D;
73 | GLint m_TextureBinding2DArray;
74 |
75 | GLint m_Program;
76 |
77 | GLint m_Viewport[4];
78 | GLfloat m_PolygonOffsetFactor;
79 | GLfloat m_PolygonOffsetUnits;
80 |
81 | GLboolean m_CullFace;
82 | GLboolean m_ScissorTest;
83 | GLboolean m_Multisample;
84 | GLboolean m_DepthTest;
85 | GLboolean m_StencilTest;
86 | GLboolean m_ColorLogicOp;
87 | GLboolean m_SampleCoverage;
88 | GLboolean m_SampleAlphaToCoverage;
89 |
90 | GLboolean m_Blend;
91 | GLint m_BlendSrcRGB;
92 | GLint m_BlendDstRGB;
93 | GLint m_BlendSrcAlpha;
94 | GLint m_BlendDstAlpha;
95 | GLint m_BlendEquationRGB;
96 | GLint m_BlendEquationAlpha;
97 | GLfloat m_BlendColor[4];
98 | GLboolean m_ColorWriteMask[4];
99 | };
100 |
101 | #endif // SUPPORT_GL
102 |
103 | } // namespace GL
104 | } // namespace SSAO
105 | } // namespace GFSDK
106 |
--------------------------------------------------------------------------------
/src/BuildVersion.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #pragma once
29 |
30 | #include "Common.h"
31 |
32 | #ifdef ANDROID
33 | // Workaround for a compiler bug on Android
34 | #define BUILD_VERSION_CHECK_MAJOR 0
35 | #define BUILD_VERSION_CHECK_MINOR 0
36 | #define BUILD_VERSION_CHECK_BRANCH 0
37 | #else
38 | #define BUILD_VERSION_CHECK_MAJOR 1
39 | #define BUILD_VERSION_CHECK_MINOR 1
40 | #define BUILD_VERSION_CHECK_BRANCH 1
41 | #endif
42 |
43 | namespace GFSDK
44 | {
45 | namespace SSAO
46 | {
47 |
48 | class BuildVersion : public GFSDK_SSAO_Version
49 | {
50 | public:
51 | bool Match(const GFSDK_SSAO_Version &V)
52 | {
53 | return
54 | #if BUILD_VERSION_CHECK_MAJOR
55 | V.Major == Major &&
56 | #endif
57 | #if BUILD_VERSION_CHECK_MINOR
58 | V.Minor == Minor &&
59 | #endif
60 | #if BUILD_VERSION_CHECK_BRANCH
61 | V.Branch == Branch &&
62 | #endif
63 | V.Revision == Revision;
64 | }
65 | };
66 |
67 | } // namespace SSAO
68 | } // namespace GFSDK
69 |
--------------------------------------------------------------------------------
/src/Common.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #pragma once
29 |
30 | #include "GFSDK_SSAO.h"
31 | #include "shaders/src/SharedDefines.h"
32 |
33 | #include
34 | #include
35 | #include
36 |
37 | #if _WIN32
38 | #define snprintf sprintf_s
39 | #endif
40 |
41 | #if _DEBUG
42 | #define ASSERT(exp) assert(exp)
43 | #else
44 | #define ASSERT(exp) ((void)0)
45 | #endif
46 |
47 | #ifndef ANDROID
48 | #define ENABLE_EXCEPTIONS 1
49 | #endif
50 |
51 | #if ENABLE_EXCEPTIONS
52 | #define THROW_RUNTIME_ERROR() throw std::runtime_error("")
53 | #else
54 | #define THROW_RUNTIME_ERROR() ASSERT(0)
55 | #endif
56 |
57 | #define THROW_IF(exp) { if (exp) THROW_RUNTIME_ERROR(); }
58 | #define THROW_IF_FAILED(exp) { if (exp != S_OK) THROW_RUNTIME_ERROR(); }
59 | #define SAFE_D3D_CALL(exp) { if (exp != S_OK) ASSERT(0); }
60 |
61 | #define SIZEOF_ARRAY(A) (sizeof(A) / sizeof(A[0]))
62 | #define ZERO_ARRAY(A) memset(A, 0, sizeof(A));
63 | #define ZERO_STRUCT(S) memset(&S, 0, sizeof(S));
64 |
65 | #define ALIGNED_SIZE(size, align) ((size + (align - 1)) & ~(align - 1))
66 |
67 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } }
68 | #define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } }
69 | #define SAFE_RELEASE_ARRAY(A) { for (UINT i = 0; i < SIZEOF_ARRAY(A); ++i) { SAFE_RELEASE(A[i]); } }
70 |
71 | #undef STRINGIFY
72 | #define STRINGIFY(A) #A
73 |
74 | #undef STRINGIFY_MACRO
75 | #define STRINGIFY_MACRO(s) STRINGIFY(s)
76 |
77 | typedef GFSDK_SSAO_UINT UINT;
78 | typedef GFSDK_SSAO_FLOAT FLOAT;
79 |
80 | #if SUPPORT_D3D11
81 | #include
82 | #endif
83 |
84 | #if SUPPORT_D3D12
85 | #include "Common_DX12.h"
86 | #endif
87 |
88 | #include "MathUtil.h"
89 |
--------------------------------------------------------------------------------
/src/MathUtil.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #pragma once
29 |
30 | #include
31 | #include
32 | #include
33 |
34 | //--------------------------------------------------------------------------------
35 | // Defines
36 | //--------------------------------------------------------------------------------
37 | #undef min
38 | #undef max
39 |
40 | #undef Min
41 | #define Min(a,b) std::min(a,b)
42 |
43 | #undef Max
44 | #define Max(a,b) std::max(a,b)
45 |
46 | #undef Clamp
47 | #define Clamp(x,a,b) (Min(Max(x, a), b))
48 |
49 | #undef iDivUp
50 | #define iDivUp(a,b) ((a + b-1) / b)
51 |
52 | #undef D3DX_PI
53 | #define D3DX_PI 3.141592654f
54 |
55 | #undef EPSILON
56 | #define EPSILON 1.e-6f
57 |
58 | //--------------------------------------------------------------------------------
59 | // Types
60 | //--------------------------------------------------------------------------------
61 | namespace GFSDK
62 | {
63 | namespace SSAO
64 | {
65 |
66 | struct float2
67 | {
68 | float X,Y;
69 | };
70 |
71 | struct float3
72 | {
73 | float X,Y,Z;
74 | };
75 |
76 | struct float4
77 | {
78 | float X,Y,Z,W;
79 | };
80 |
81 | struct float4x4
82 | {
83 | float Data[4*4];
84 | };
85 |
86 | struct uint4
87 | {
88 | GFSDK_SSAO_UINT X,Y,Z,W;
89 | uint4() {}
90 | uint4(const GFSDK_SSAO_Version& V)
91 | {
92 | X = V.Major;
93 | Y = V.Minor;
94 | Z = V.Branch;
95 | W = V.Revision;
96 | }
97 | };
98 |
99 | } // namespace SSAO
100 | } // namespace GFSDK
101 |
--------------------------------------------------------------------------------
/src/MatrixView.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #pragma once
29 | #include "Common.h"
30 |
31 | namespace GFSDK
32 | {
33 | namespace SSAO
34 | {
35 |
36 | //--------------------------------------------------------------------------------
37 | class MatrixView
38 | {
39 | public:
40 | MatrixView(const GFSDK_SSAO_Matrix& Matrix)
41 | {
42 | m_pFloat4x4 = Matrix.Data.Array;
43 | m_IsRowMajor = (Matrix.Layout == GFSDK_SSAO_ROW_MAJOR_ORDER);
44 | }
45 |
46 | float operator() (UINT Row, UINT Col) const
47 | {
48 | ASSERT(Row < 4);
49 | ASSERT(Col < 4);
50 |
51 | if (!m_IsRowMajor)
52 | {
53 | std::swap(Row, Col);
54 | }
55 | return m_pFloat4x4[Row * 4 + Col];
56 | }
57 |
58 | private:
59 | const float* m_pFloat4x4;
60 | bool m_IsRowMajor;
61 | };
62 |
63 | } // namespace SSAO
64 | } // namespace GFSDK
65 |
--------------------------------------------------------------------------------
/src/NVAPI/amd64/nvapi64.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/NVAPI/amd64/nvapi64.lib
--------------------------------------------------------------------------------
/src/NVAPI/nvapi.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/NVAPI/nvapi.h
--------------------------------------------------------------------------------
/src/NVAPI/nvapi_lite_common.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/NVAPI/nvapi_lite_common.h
--------------------------------------------------------------------------------
/src/NVAPI/nvapi_lite_d3dext.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/NVAPI/nvapi_lite_d3dext.h
--------------------------------------------------------------------------------
/src/NVAPI/nvapi_lite_salend.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/NVAPI/nvapi_lite_salend.h
--------------------------------------------------------------------------------
/src/NVAPI/nvapi_lite_salstart.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/NVAPI/nvapi_lite_salstart.h
--------------------------------------------------------------------------------
/src/NVAPI/nvapi_lite_sli.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/NVAPI/nvapi_lite_sli.h
--------------------------------------------------------------------------------
/src/NVAPI/nvapi_lite_stereo.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/NVAPI/nvapi_lite_stereo.h
--------------------------------------------------------------------------------
/src/NVAPI/nvapi_lite_surround.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/NVAPI/nvapi_lite_surround.h
--------------------------------------------------------------------------------
/src/NVAPI/x86/nvapi.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/NVAPI/x86/nvapi.lib
--------------------------------------------------------------------------------
/src/PerfMarkers.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #if ENABLE_PERF_MARKERS
29 |
30 | #pragma once
31 |
32 | #if SUPPORT_D3D11
33 | #include
34 | #pragma comment(lib, "d3d9.lib")
35 | #endif
36 |
37 | #if SUPPORT_D3D12
38 | #include
39 | #include
40 | #endif
41 |
42 | namespace GFSDK
43 | {
44 | namespace SSAO
45 | {
46 |
47 | //--------------------------------------------------------------------------------
48 | #if SUPPORT_D3D11
49 | namespace D3D11
50 | {
51 |
52 | struct PerfMarkerScope
53 | {
54 | PerfMarkerScope(const WCHAR* EventName)
55 | {
56 | D3DPERF_BeginEvent(0xff808080, EventName);
57 | }
58 | ~PerfMarkerScope()
59 | {
60 | D3DPERF_EndEvent();
61 | }
62 | };
63 |
64 | #define PERF_MARKER_SCOPE(NAME) PerfMarkerScope PerfMarker(NAME)
65 |
66 | } // namespace D3D11
67 | #endif //SUPPORT_D3D11
68 |
69 | //--------------------------------------------------------------------------------
70 | #if SUPPORT_D3D12
71 | namespace D3D12
72 | {
73 |
74 | struct PerfMarkerScope
75 | {
76 | PerfMarkerScope()
77 | : m_pCmdList(NULL)
78 | {
79 | }
80 | PerfMarkerScope(ID3D12GraphicsCommandList* pCmdList, const WCHAR* EventName)
81 | {
82 | PIXBeginEvent(pCmdList, 0, EventName);
83 |
84 | m_pCmdList = pCmdList;
85 | }
86 | ~PerfMarkerScope()
87 | {
88 | PIXEndEvent(m_pCmdList);
89 |
90 | m_pCmdList = NULL;
91 | }
92 |
93 | private:
94 | ID3D12GraphicsCommandList* m_pCmdList;
95 | };
96 |
97 | #define PERF_MARKER_SCOPE(NAME) PerfMarkerScope PerfMarker(m_GraphicsContext.pCmdList, NAME)
98 |
99 | } // namespace D3D12
100 | #endif //SUPPORT_D3D12
101 |
102 | } // namespace SSAO
103 | } // namespace GFSDK
104 |
105 | #endif //ENABLE_PERF_MARKERS
106 |
--------------------------------------------------------------------------------
/src/ProjectionMatrixInfo.cpp:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #include "ProjectionMatrixInfo.h"
29 | #include "MatrixView.h"
30 |
31 | //--------------------------------------------------------------------------------
32 | GFSDK_SSAO_Status GFSDK::SSAO::ProjectionMatrixInfo::Init(const GFSDK_SSAO_Matrix& ProjectionMatrix, APIConventions API)
33 | {
34 | if (!IsValid(ProjectionMatrix))
35 | {
36 | return GFSDK_SSAO_INVALID_PROJECTION_MATRIX;
37 | }
38 |
39 | MatrixView m(ProjectionMatrix);
40 |
41 | // In matrices generated with D3DXMatrixPerspectiveFovRH
42 | // A = zf/(zn-zf)
43 | // B = zn*zf/(zn-zf)
44 | // C = -1
45 | float A = m(2,2);
46 | float B = m(3,2);
47 | float C = m(2,3);
48 |
49 | // In matrices generated with D3DXMatrixPerspectiveFovLH
50 | // A = -zf/(zn-zf)
51 | // B = zn*zf/(zn-zf)
52 | // C = 1
53 | if (C == 1.f)
54 | {
55 | A = -A;
56 | }
57 |
58 | // Rely on INFs to be generated in case of any divisions by zero
59 | m_ZNear = (API == API_GL) ? (B / (A - 1.f)) : (B / A);
60 | m_ZFar = B / (A + 1.f);
61 |
62 | // Some matrices may use negative m00 or m11 terms to flip X/Y axises
63 | m_TanHalfFovX = 1.f / (float)fabs(m(0,0));
64 | m_TanHalfFovY = 1.f / (float)fabs(m(1,1));
65 |
66 | return GFSDK_SSAO_OK;
67 | }
68 |
69 | //--------------------------------------------------------------------------------
70 | bool GFSDK::SSAO::ProjectionMatrixInfo::IsValid(const GFSDK_SSAO_Matrix& ProjectionMatrix)
71 | {
72 | MatrixView m(ProjectionMatrix);
73 |
74 | // Do not check m(2,0) and m(2,1) to allow off-centered projections
75 | // Do not check m(2,2) to allow reverse infinite projections
76 | return (m(0,0) != 0.0f && m(0,1) == 0.0f && m(0,2) == 0.0f && m(0,3) == 0.0f &&
77 | m(1,0) == 0.0f && m(1,1) != 0.0f && m(1,2) == 0.0f && m(1,3) == 0.0f &&
78 | fabs(m(2,3)) == 1.0f &&
79 | m(3,0) == 0.0f && m(3,1) == 0.0f && m(3,2) != 0.0f && m(3,3) == 0.0f);
80 | }
81 |
--------------------------------------------------------------------------------
/src/ProjectionMatrixInfo.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #pragma once
29 | #include "Common.h"
30 |
31 | namespace GFSDK
32 | {
33 | namespace SSAO
34 | {
35 |
36 | enum APIConventions
37 | {
38 | API_D3D11,
39 | API_GL
40 | };
41 |
42 | class ProjectionMatrixInfo
43 | {
44 | public:
45 | ProjectionMatrixInfo()
46 | : m_ZNear(0.f)
47 | , m_ZFar(0.f)
48 | , m_TanHalfFovX(0.f)
49 | , m_TanHalfFovY(0.f)
50 | {
51 | }
52 |
53 | GFSDK_SSAO_Status Init(const GFSDK_SSAO_Matrix& ProjectionMatrix, APIConventions API);
54 | static bool IsValid(const GFSDK_SSAO_Matrix& ProjectionMatrix);
55 |
56 | // Clamp to EPSILON to avoid any divisions by 0.f
57 | float GetInverseZNear() const
58 | {
59 | return Max(1.f / m_ZNear, EPSILON);
60 | }
61 | float GetInverseZFar() const
62 | {
63 | return Max(1.f / m_ZFar, EPSILON);
64 | }
65 |
66 | float GetTanHalfFovX() const
67 | {
68 | return m_TanHalfFovX;
69 | }
70 | float GetTanHalfFovY() const
71 | {
72 | return m_TanHalfFovY;
73 | }
74 |
75 | void GetDepthRange(GFSDK_SSAO_ProjectionMatrixDepthRange* pDepthRange)
76 | {
77 | pDepthRange->ZNear = 1.f / GetInverseZNear();
78 | pDepthRange->ZFar = 1.f / GetInverseZFar();
79 | }
80 |
81 | private:
82 | float m_ZNear;
83 | float m_ZFar;
84 | float m_TanHalfFovX;
85 | float m_TanHalfFovY;
86 | };
87 |
88 | } // namespace SSAO
89 | } // namespace GFSDK
90 |
--------------------------------------------------------------------------------
/src/RandomTexture.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #pragma once
29 | #include "Common.h"
30 |
31 | namespace GFSDK
32 | {
33 | namespace SSAO
34 | {
35 |
36 | //--------------------------------------------------------------------------------
37 | class RandomTexture
38 | {
39 | public:
40 | RandomTexture();
41 |
42 | float4 GetJitter(UINT SliceId)
43 | {
44 | ASSERT(SliceId < SIZEOF_ARRAY(m_Jitters));
45 | return m_Jitters[SliceId % SIZEOF_ARRAY(m_Jitters)];
46 | }
47 |
48 | float GetRandomNumber(UINT Index);
49 |
50 | protected:
51 | static const UINT MAX_MSAA_SAMPLE_COUNT = 8;
52 | float4 m_Jitters[RANDOM_TEXTURE_WIDTH * RANDOM_TEXTURE_WIDTH * MAX_MSAA_SAMPLE_COUNT];
53 | };
54 |
55 | #if SUPPORT_D3D11
56 | namespace D3D11
57 | {
58 |
59 | //--------------------------------------------------------------------------------
60 | class RandomTexture : public SSAO::RandomTexture
61 | {
62 | #if ENABLE_DEBUG_MODES
63 | public:
64 | RandomTexture()
65 | : SSAO::RandomTexture()
66 | , pTexture(NULL)
67 | , pSRV(NULL)
68 | {
69 | }
70 |
71 | void Create(ID3D11Device* pD3DDevice);
72 | void Release();
73 | ID3D11Texture2D* pTexture;
74 | ID3D11ShaderResourceView* pSRV;
75 | #endif
76 | };
77 |
78 | } // namespace D3D11
79 | #endif
80 |
81 | #if SUPPORT_D3D12
82 | namespace D3D12
83 | {
84 |
85 | //--------------------------------------------------------------------------------
86 | class RandomTexture : public SSAO::RandomTexture
87 | {
88 | #if ENABLE_DEBUG_MODES
89 | public:
90 | RandomTexture()
91 | : SSAO::RandomTexture()
92 | , pTexture(NULL)
93 | {
94 | }
95 |
96 | void Create(ID3D12Device* pD3DDevice);
97 | void Release();
98 | ID3D12Resource* pTexture; //ID3D12Texture2D* pTexture;
99 | GFSDK_SSAO_ShaderResourceView_D3D12 SRV; // ID3D12ShaderResourceView* pSRV;
100 | #endif
101 | };
102 |
103 | } // namespace D3D12
104 | #endif
105 |
106 | } // namespace SSAO
107 | } // namespace GFSDK
108 |
--------------------------------------------------------------------------------
/src/Shaders_DX11.cpp:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #if SUPPORT_D3D11
29 |
30 | #include "Shaders_DX11.h"
31 |
32 | namespace GFSDK
33 | {
34 | namespace SSAO
35 | {
36 | namespace D3D11
37 | {
38 |
39 | #include "shaders/out/D3D11/FullScreenTriangle_VS.cpp"
40 | #include "shaders/out/D3D11/CopyDepth_PS.cpp"
41 | #include "shaders/out/D3D11/LinearizeDepth_PS.cpp"
42 | #include "shaders/out/D3D11/DeinterleaveDepth_PS.cpp"
43 | #include "shaders/out/D3D11/DebugNormals_PS.cpp"
44 | #include "shaders/out/D3D11/ReconstructNormal_PS.cpp"
45 | #include "shaders/out/D3D11/ReinterleaveAO_PS.cpp"
46 | #include "shaders/out/D3D11/BlurX_PS.cpp"
47 | #include "shaders/out/D3D11/BlurY_PS.cpp"
48 | #include "shaders/out/D3D11/CoarseAO_PS.cpp"
49 | #include "shaders/out/D3D11/CoarseAO_GS.cpp"
50 |
51 | #if ENABLE_DEBUG_MODES
52 | #include "shaders/out/D3D11/DebugAO_PS.cpp"
53 | #endif
54 |
55 | } // namespace D3D11
56 | } // namespace SSAO
57 | } // namespace GFSDK
58 |
59 | #endif //SUPPORT_D3D11
60 |
--------------------------------------------------------------------------------
/src/Shaders_DX12.cpp:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #if SUPPORT_D3D12
29 |
30 | #include "Shaders_DX12.h"
31 |
32 | namespace GFSDK
33 | {
34 | namespace SSAO
35 | {
36 | namespace D3D12
37 | {
38 |
39 | #include "shaders/out/D3D11/FullScreenTriangle_VS.cpp"
40 | #include "shaders/out/D3D11/CopyDepth_PS.cpp"
41 | #include "shaders/out/D3D11/LinearizeDepth_PS.cpp"
42 | #include "shaders/out/D3D11/DeinterleaveDepth_PS.cpp"
43 | #include "shaders/out/D3D11/DebugNormals_PS.cpp"
44 | #include "shaders/out/D3D11/ReconstructNormal_PS.cpp"
45 | #include "shaders/out/D3D11/ReinterleaveAO_PS.cpp"
46 | #include "shaders/out/D3D11/BlurX_PS.cpp"
47 | #include "shaders/out/D3D11/BlurY_PS.cpp"
48 | #include "shaders/out/D3D11/CoarseAO_PS.cpp"
49 | #include "shaders/out/D3D11/CoarseAO_GS.cpp"
50 |
51 | } // namespace D3D12
52 | } // namespace SSAO
53 | } // namespace GFSDK
54 |
55 | #endif //SUPPORT_D3D12
56 |
--------------------------------------------------------------------------------
/src/States_GL.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #if SUPPORT_GL
29 |
30 | #pragma once
31 | #include "Common.h"
32 |
33 | namespace GFSDK
34 | {
35 | namespace SSAO
36 | {
37 | namespace GL
38 | {
39 |
40 | class States
41 | {
42 | public:
43 | static void SetSharedBlendState(const GFSDK_SSAO_GLFunctions& GL);
44 | static void SetBlendStateMultiplyPreserveAlpha(const GFSDK_SSAO_GLFunctions& GL);
45 | static void SetBlendStateDisabledPreserveAlpha(const GFSDK_SSAO_GLFunctions& GL);
46 | static void SetBlendStateDisabled(const GFSDK_SSAO_GLFunctions& GL);
47 | static void SetDepthStencilStateDisabled(const GFSDK_SSAO_GLFunctions& GL);
48 | static void SetRasterizerStateFullscreenNoScissor(const GFSDK_SSAO_GLFunctions& GL);
49 | static void SetCustomBlendState(const GFSDK_SSAO_GLFunctions& GL, const GFSDK_SSAO_CustomBlendState_GL& CustomBlendState);
50 | };
51 |
52 | } // namespace GL
53 | } // namespace SSAO
54 | } // namespace GFSDK
55 |
56 | #endif // SUPPORT_GL
57 |
--------------------------------------------------------------------------------
/src/TextureUtil.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #pragma once
29 | #include "Common.h"
30 |
31 | namespace GFSDK
32 | {
33 | namespace SSAO
34 | {
35 |
36 | #if SUPPORT_D3D11
37 |
38 | namespace D3D11
39 | {
40 |
41 | //--------------------------------------------------------------------------------
42 | class TextureUtil
43 | {
44 | public:
45 | static void GetDesc(ID3D11RenderTargetView* pRTV, D3D11_TEXTURE2D_DESC* pTextureDesc)
46 | {
47 | ID3D11Texture2D* pBaseTexture;
48 | pRTV->GetResource((ID3D11Resource**)&pBaseTexture);
49 |
50 | pBaseTexture->GetDesc(pTextureDesc);
51 | SAFE_RELEASE(pBaseTexture);
52 | }
53 | static void GetDesc(ID3D11ShaderResourceView* pSRV, D3D11_TEXTURE2D_DESC* pTextureDesc)
54 | {
55 | ID3D11Texture2D* pBaseTexture;
56 | pSRV->GetResource((ID3D11Resource**)&pBaseTexture);
57 |
58 | pBaseTexture->GetDesc(pTextureDesc);
59 | SAFE_RELEASE(pBaseTexture);
60 | }
61 | static void GetDesc(ID3D11DepthStencilView* pDSV, D3D11_TEXTURE2D_DESC* pTextureDesc)
62 | {
63 | ID3D11Texture2D* pBaseTexture;
64 | pDSV->GetResource((ID3D11Resource**)&pBaseTexture);
65 |
66 | pBaseTexture->GetDesc(pTextureDesc);
67 | SAFE_RELEASE(pBaseTexture);
68 | }
69 | };
70 |
71 | } // namespace D3D11
72 |
73 | #endif
74 |
75 | #if SUPPORT_D3D12
76 |
77 | namespace D3D12
78 | {
79 |
80 | //--------------------------------------------------------------------------------
81 | class TextureUtil
82 | {
83 | public:
84 | static void GetDesc(ID3D12Resource* pResource, D3D12_RESOURCE_DESC* pResourceDesc)
85 | {
86 | ZeroMemory(pResourceDesc, sizeof(D3D12_RESOURCE_DESC));
87 | *pResourceDesc = pResource->GetDesc();
88 | }
89 | };
90 |
91 | } // namespace D3D12
92 |
93 | #endif
94 |
95 | } // namespace SSAO
96 | } // namespace GFSDK
97 |
--------------------------------------------------------------------------------
/src/VAO_GL.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #if SUPPORT_GL
29 |
30 | #pragma once
31 | #include "Common.h"
32 |
33 | namespace GFSDK
34 | {
35 | namespace SSAO
36 | {
37 | namespace GL
38 | {
39 |
40 | class VAO
41 | {
42 | public:
43 | VAO() : m_VertexArrayObjectId(0)
44 | {
45 | }
46 |
47 | void Create(const GFSDK_SSAO_GLFunctions& GL)
48 | {
49 | GL.glGenVertexArrays(1, &m_VertexArrayObjectId);
50 | ASSERT_GL_ERROR(GL);
51 | }
52 |
53 | void Release(const GFSDK_SSAO_GLFunctions& GL)
54 | {
55 | GL.glDeleteVertexArrays(1, &m_VertexArrayObjectId);
56 | m_VertexArrayObjectId = 0;
57 | }
58 |
59 | void Bind(const GFSDK_SSAO_GLFunctions& GL)
60 | {
61 | GL.glBindVertexArray(m_VertexArrayObjectId);
62 | }
63 |
64 | private:
65 | GLuint m_VertexArrayObjectId;
66 | };
67 |
68 | } // namespace GL
69 | } // namespace SSAO
70 | } // namespace GFSDK
71 |
72 | #endif // SUPPORT_GL
73 |
--------------------------------------------------------------------------------
/src/Viewports.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #pragma once
29 | #include "Common.h"
30 | #include "InputViewport.h"
31 |
32 | namespace GFSDK
33 | {
34 | namespace SSAO
35 | {
36 |
37 | //--------------------------------------------------------------------------------
38 | struct Viewports
39 | {
40 | void SetFullResolution(UINT FullWidth, UINT FullHeight)
41 | {
42 | FullRes.TopLeftX = 0.f;
43 | FullRes.TopLeftY = 0.f;
44 | FullRes.Width = FLOAT(FullWidth);
45 | FullRes.Height = FLOAT(FullHeight);
46 | FullRes.MinDepth = 0.f;
47 | FullRes.MaxDepth = 1.f;
48 |
49 | QuarterRes = FullRes;
50 | QuarterRes.Width = FLOAT(iDivUp(FullWidth,4));
51 | QuarterRes.Height = FLOAT(iDivUp(FullHeight,4));
52 | }
53 |
54 | SSAO::InputViewport FullRes;
55 | SSAO::InputViewport QuarterRes;
56 | };
57 |
58 | } // namespace SSAO
59 | } // namespace GFSDK
60 |
--------------------------------------------------------------------------------
/src/shaders/HLSLcc.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/shaders/HLSLcc.exe
--------------------------------------------------------------------------------
/src/shaders/ShaderBuildTool.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/shaders/ShaderBuildTool.exe
--------------------------------------------------------------------------------
/src/shaders/Stringify.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/shaders/Stringify.exe
--------------------------------------------------------------------------------
/src/shaders/compile_glsl.bat:
--------------------------------------------------------------------------------
1 | @set OUTPUT_GLSL=%SBT_OUTPUT%.glsl
2 | @set OUTPUT_OBJ=%SBT_OUTPUT%.o
3 |
4 | @set FXC_CMD_LINE=/O3 /T %SBT_PROFILE% %SBT_INPUT% /E %SBT_ENTRY_POINT% %SBT_DEFINES% /Fo %OUTPUT_OBJ%
5 |
6 | @set HLSL_CC_CMD_LINE=-flags=1 -in=%OUTPUT_OBJ% -out=%OUTPUT_GLSL% -lang=150
7 |
8 | @set STRINGIFY_CMD_LINE=%OUTPUT_GLSL% %SBT_VARIABLE_NAME% %SBT_OUTPUT%
9 |
10 | @call %~dp0\helper_hlsl_cc
11 |
12 | @del %OUTPUT_GLSL%
13 | @del %OUTPUT_OBJ%
14 |
--------------------------------------------------------------------------------
/src/shaders/compile_hlsl.bat:
--------------------------------------------------------------------------------
1 | @set FXC_CMD_LINE=/Qstrip_reflect /O3 /T %SBT_PROFILE% %SBT_INPUT% /E %SBT_ENTRY_POINT% %SBT_DEFINES% /Vn %SBT_VARIABLE_NAME% /Fh %SBT_OUTPUT%
2 |
3 | @call %~dp0\helper_fxc
4 |
--------------------------------------------------------------------------------
/src/shaders/d3dcompiler_47.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/shaders/d3dcompiler_47.dll
--------------------------------------------------------------------------------
/src/shaders/fxc.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NVIDIAGameWorks/HBAOPlus/ea2885cfa9e07784648a028fdd0cb48a4c85da05/src/shaders/fxc.exe
--------------------------------------------------------------------------------
/src/shaders/helper_fxc.bat:
--------------------------------------------------------------------------------
1 | @if "%FXC_CMD_LINE%"=="" goto error
2 | @set FXC=%~dp0\fxc.exe
3 |
4 | @echo fxc %FXC_CMD_LINE%
5 |
6 | @%FXC% %FXC_CMD_LINE% >nul
7 | @if ERRORLEVEL 1 goto error
8 |
9 | :done
10 | @exit /B 0
11 |
12 | :error
13 | @echo %0: ERROR
14 | @exit /B 1
15 |
--------------------------------------------------------------------------------
/src/shaders/helper_hlsl_cc.bat:
--------------------------------------------------------------------------------
1 | @SET "HLSL_CC=%~dp0\HLSLcc.exe"
2 | @SET "STRINGIFY=%~dp0\Stringify.exe"
3 | @SET "HELPER_FXC=%~dp0\helper_fxc"
4 |
5 | @CALL %HELPER_FXC%
6 | @IF ERRORLEVEL 1 GOTO error
7 |
8 | :: static const unsigned int HLSLCC_FLAG_UNIFORM_BUFFER_OBJECT = 0x1;
9 | @%HLSL_CC% %HLSL_CC_CMD_LINE%
10 | @IF ERRORLEVEL 1 GOTO error
11 |
12 | @%STRINGIFY% %STRINGIFY_CMD_LINE%
13 | @IF ERRORLEVEL 1 GOTO error
14 |
15 | :done
16 | @EXIT /B 0
17 |
18 | :error
19 | @echo %0: ERROR
20 | @EXIT /B 1
21 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/BlurX_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef ENABLE_SHARPNESS_PROFILE_DEFINED
11 | #define ENABLE_SHARPNESS_PROFILE_DEFINED
12 | enum ENABLE_SHARPNESS_PROFILE
13 | {
14 | ENABLE_SHARPNESS_PROFILE_0,
15 | ENABLE_SHARPNESS_PROFILE_1,
16 | ENABLE_SHARPNESS_PROFILE_COUNT,
17 | };
18 | #endif
19 |
20 | #ifndef KERNEL_RADIUS_DEFINED
21 | #define KERNEL_RADIUS_DEFINED
22 | enum KERNEL_RADIUS
23 | {
24 | KERNEL_RADIUS_2,
25 | KERNEL_RADIUS_4,
26 | KERNEL_RADIUS_COUNT,
27 | };
28 | #endif
29 |
30 | };
31 |
32 | struct BlurX_PS
33 | {
34 | void Create(DevicePointer Device);
35 | void Release(DevicePointer Device);
36 | PixelShader& Get(ShaderPermutations::ENABLE_SHARPNESS_PROFILE A, ShaderPermutations::KERNEL_RADIUS B)
37 | {
38 | return m_Shader[A][B];
39 | }
40 |
41 | private:
42 | PixelShader m_Shader[ShaderPermutations::ENABLE_SHARPNESS_PROFILE_COUNT][ShaderPermutations::KERNEL_RADIUS_COUNT];
43 | #if _WIN32
44 | static_assert(ShaderPermutations::ENABLE_SHARPNESS_PROFILE_COUNT == 2, "");
45 | static_assert(ShaderPermutations::KERNEL_RADIUS_COUNT == 2, "");
46 | #endif
47 | };
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/BlurY_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef ENABLE_SHARPNESS_PROFILE_DEFINED
11 | #define ENABLE_SHARPNESS_PROFILE_DEFINED
12 | enum ENABLE_SHARPNESS_PROFILE
13 | {
14 | ENABLE_SHARPNESS_PROFILE_0,
15 | ENABLE_SHARPNESS_PROFILE_1,
16 | ENABLE_SHARPNESS_PROFILE_COUNT,
17 | };
18 | #endif
19 |
20 | #ifndef KERNEL_RADIUS_DEFINED
21 | #define KERNEL_RADIUS_DEFINED
22 | enum KERNEL_RADIUS
23 | {
24 | KERNEL_RADIUS_2,
25 | KERNEL_RADIUS_4,
26 | KERNEL_RADIUS_COUNT,
27 | };
28 | #endif
29 |
30 | };
31 |
32 | struct BlurY_PS
33 | {
34 | void Create(DevicePointer Device);
35 | void Release(DevicePointer Device);
36 | PixelShader& Get(ShaderPermutations::ENABLE_SHARPNESS_PROFILE A, ShaderPermutations::KERNEL_RADIUS B)
37 | {
38 | return m_Shader[A][B];
39 | }
40 |
41 | private:
42 | PixelShader m_Shader[ShaderPermutations::ENABLE_SHARPNESS_PROFILE_COUNT][ShaderPermutations::KERNEL_RADIUS_COUNT];
43 | #if _WIN32
44 | static_assert(ShaderPermutations::ENABLE_SHARPNESS_PROFILE_COUNT == 2, "");
45 | static_assert(ShaderPermutations::KERNEL_RADIUS_COUNT == 2, "");
46 | #endif
47 | };
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/CoarseAO_GS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | };
11 |
12 | struct CoarseAO_GS
13 | {
14 | void Create(DevicePointer Device);
15 | void Release(DevicePointer Device);
16 | GeometryShader& Get()
17 | {
18 | return m_Shader;
19 | }
20 |
21 | private:
22 | GeometryShader m_Shader;
23 | #if _WIN32
24 | #endif
25 | };
26 |
27 | };
28 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/CoarseAO_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef FETCH_GBUFFER_NORMAL_DEFINED
11 | #define FETCH_GBUFFER_NORMAL_DEFINED
12 | enum FETCH_GBUFFER_NORMAL
13 | {
14 | FETCH_GBUFFER_NORMAL_0,
15 | FETCH_GBUFFER_NORMAL_1,
16 | FETCH_GBUFFER_NORMAL_2,
17 | FETCH_GBUFFER_NORMAL_COUNT,
18 | };
19 | #endif
20 |
21 | #ifndef DEPTH_LAYER_COUNT_DEFINED
22 | #define DEPTH_LAYER_COUNT_DEFINED
23 | enum DEPTH_LAYER_COUNT
24 | {
25 | DEPTH_LAYER_COUNT_1,
26 | DEPTH_LAYER_COUNT_2,
27 | DEPTH_LAYER_COUNT_COUNT,
28 | };
29 | #endif
30 |
31 | #ifndef NUM_STEPS_DEFINED
32 | #define NUM_STEPS_DEFINED
33 | enum NUM_STEPS
34 | {
35 | NUM_STEPS_4,
36 | NUM_STEPS_8,
37 | NUM_STEPS_COUNT,
38 | };
39 | #endif
40 |
41 | };
42 |
43 | struct CoarseAO_PS
44 | {
45 | void Create(DevicePointer Device);
46 | void Release(DevicePointer Device);
47 | PixelShader& Get(ShaderPermutations::FETCH_GBUFFER_NORMAL A, ShaderPermutations::DEPTH_LAYER_COUNT B, ShaderPermutations::NUM_STEPS C)
48 | {
49 | return m_Shader[A][B][C];
50 | }
51 |
52 | private:
53 | PixelShader m_Shader[ShaderPermutations::FETCH_GBUFFER_NORMAL_COUNT][ShaderPermutations::DEPTH_LAYER_COUNT_COUNT][ShaderPermutations::NUM_STEPS_COUNT];
54 | #if _WIN32
55 | static_assert(ShaderPermutations::FETCH_GBUFFER_NORMAL_COUNT == 3, "");
56 | static_assert(ShaderPermutations::DEPTH_LAYER_COUNT_COUNT == 2, "");
57 | static_assert(ShaderPermutations::NUM_STEPS_COUNT == 2, "");
58 | #endif
59 | };
60 |
61 | };
62 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/CopyDepth_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef RESOLVE_DEPTH_DEFINED
11 | #define RESOLVE_DEPTH_DEFINED
12 | enum RESOLVE_DEPTH
13 | {
14 | RESOLVE_DEPTH_0,
15 | RESOLVE_DEPTH_1,
16 | RESOLVE_DEPTH_COUNT,
17 | };
18 | #endif
19 |
20 | #ifndef DEPTH_LAYER_COUNT_DEFINED
21 | #define DEPTH_LAYER_COUNT_DEFINED
22 | enum DEPTH_LAYER_COUNT
23 | {
24 | DEPTH_LAYER_COUNT_1,
25 | DEPTH_LAYER_COUNT_2,
26 | DEPTH_LAYER_COUNT_COUNT,
27 | };
28 | #endif
29 |
30 | };
31 |
32 | struct CopyDepth_PS
33 | {
34 | void Create(DevicePointer Device);
35 | void Release(DevicePointer Device);
36 | PixelShader& Get(ShaderPermutations::RESOLVE_DEPTH A, ShaderPermutations::DEPTH_LAYER_COUNT B)
37 | {
38 | return m_Shader[A][B];
39 | }
40 |
41 | private:
42 | PixelShader m_Shader[ShaderPermutations::RESOLVE_DEPTH_COUNT][ShaderPermutations::DEPTH_LAYER_COUNT_COUNT];
43 | #if _WIN32
44 | static_assert(ShaderPermutations::RESOLVE_DEPTH_COUNT == 2, "");
45 | static_assert(ShaderPermutations::DEPTH_LAYER_COUNT_COUNT == 2, "");
46 | #endif
47 | };
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/DebugAO_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef ENABLE_BLUR_DEFINED
11 | #define ENABLE_BLUR_DEFINED
12 | enum ENABLE_BLUR
13 | {
14 | ENABLE_BLUR_0,
15 | ENABLE_BLUR_1,
16 | ENABLE_BLUR_COUNT,
17 | };
18 | #endif
19 |
20 | #ifndef NUM_STEPS_DEFINED
21 | #define NUM_STEPS_DEFINED
22 | enum NUM_STEPS
23 | {
24 | NUM_STEPS_4,
25 | NUM_STEPS_8,
26 | NUM_STEPS_COUNT,
27 | };
28 | #endif
29 |
30 | };
31 |
32 | struct DebugAO_PS
33 | {
34 | void Create(DevicePointer Device);
35 | void Release(DevicePointer Device);
36 | PixelShader& Get(ShaderPermutations::ENABLE_BLUR A, ShaderPermutations::NUM_STEPS B)
37 | {
38 | return m_Shader[A][B];
39 | }
40 |
41 | private:
42 | PixelShader m_Shader[ShaderPermutations::ENABLE_BLUR_COUNT][ShaderPermutations::NUM_STEPS_COUNT];
43 | #if _WIN32
44 | static_assert(ShaderPermutations::ENABLE_BLUR_COUNT == 2, "");
45 | static_assert(ShaderPermutations::NUM_STEPS_COUNT == 2, "");
46 | #endif
47 | };
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/DebugNormals_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef FETCH_GBUFFER_NORMAL_DEFINED
11 | #define FETCH_GBUFFER_NORMAL_DEFINED
12 | enum FETCH_GBUFFER_NORMAL
13 | {
14 | FETCH_GBUFFER_NORMAL_0,
15 | FETCH_GBUFFER_NORMAL_1,
16 | FETCH_GBUFFER_NORMAL_2,
17 | FETCH_GBUFFER_NORMAL_COUNT,
18 | };
19 | #endif
20 |
21 | };
22 |
23 | struct DebugNormals_PS
24 | {
25 | void Create(DevicePointer Device);
26 | void Release(DevicePointer Device);
27 | PixelShader& Get(ShaderPermutations::FETCH_GBUFFER_NORMAL A)
28 | {
29 | return m_Shader[A];
30 | }
31 |
32 | private:
33 | PixelShader m_Shader[ShaderPermutations::FETCH_GBUFFER_NORMAL_COUNT];
34 | #if _WIN32
35 | static_assert(ShaderPermutations::FETCH_GBUFFER_NORMAL_COUNT == 3, "");
36 | #endif
37 | };
38 |
39 | };
40 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/DeinterleaveDepth_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef DEPTH_LAYER_COUNT_DEFINED
11 | #define DEPTH_LAYER_COUNT_DEFINED
12 | enum DEPTH_LAYER_COUNT
13 | {
14 | DEPTH_LAYER_COUNT_1,
15 | DEPTH_LAYER_COUNT_2,
16 | DEPTH_LAYER_COUNT_COUNT,
17 | };
18 | #endif
19 |
20 | };
21 |
22 | struct DeinterleaveDepth_PS
23 | {
24 | void Create(DevicePointer Device);
25 | void Release(DevicePointer Device);
26 | PixelShader& Get(ShaderPermutations::DEPTH_LAYER_COUNT A)
27 | {
28 | return m_Shader[A];
29 | }
30 |
31 | private:
32 | PixelShader m_Shader[ShaderPermutations::DEPTH_LAYER_COUNT_COUNT];
33 | #if _WIN32
34 | static_assert(ShaderPermutations::DEPTH_LAYER_COUNT_COUNT == 2, "");
35 | #endif
36 | };
37 |
38 | };
39 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/FullScreenTriangle_VS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | };
11 |
12 | struct FullScreenTriangle_VS
13 | {
14 | void Create(DevicePointer Device);
15 | void Release(DevicePointer Device);
16 | VertexShader& Get()
17 | {
18 | return m_Shader;
19 | }
20 |
21 | private:
22 | VertexShader m_Shader;
23 | #if _WIN32
24 | #endif
25 | };
26 |
27 | };
28 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/LinearizeDepth_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef RESOLVE_DEPTH_DEFINED
11 | #define RESOLVE_DEPTH_DEFINED
12 | enum RESOLVE_DEPTH
13 | {
14 | RESOLVE_DEPTH_0,
15 | RESOLVE_DEPTH_1,
16 | RESOLVE_DEPTH_COUNT,
17 | };
18 | #endif
19 |
20 | #ifndef DEPTH_LAYER_COUNT_DEFINED
21 | #define DEPTH_LAYER_COUNT_DEFINED
22 | enum DEPTH_LAYER_COUNT
23 | {
24 | DEPTH_LAYER_COUNT_1,
25 | DEPTH_LAYER_COUNT_2,
26 | DEPTH_LAYER_COUNT_COUNT,
27 | };
28 | #endif
29 |
30 | };
31 |
32 | struct LinearizeDepth_PS
33 | {
34 | void Create(DevicePointer Device);
35 | void Release(DevicePointer Device);
36 | PixelShader& Get(ShaderPermutations::RESOLVE_DEPTH A, ShaderPermutations::DEPTH_LAYER_COUNT B)
37 | {
38 | return m_Shader[A][B];
39 | }
40 |
41 | private:
42 | PixelShader m_Shader[ShaderPermutations::RESOLVE_DEPTH_COUNT][ShaderPermutations::DEPTH_LAYER_COUNT_COUNT];
43 | #if _WIN32
44 | static_assert(ShaderPermutations::RESOLVE_DEPTH_COUNT == 2, "");
45 | static_assert(ShaderPermutations::DEPTH_LAYER_COUNT_COUNT == 2, "");
46 | #endif
47 | };
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/ReconstructNormal_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | };
11 |
12 | struct ReconstructNormal_PS
13 | {
14 | void Create(DevicePointer Device);
15 | void Release(DevicePointer Device);
16 | PixelShader& Get()
17 | {
18 | return m_Shader;
19 | }
20 |
21 | private:
22 | PixelShader m_Shader;
23 | #if _WIN32
24 | #endif
25 | };
26 |
27 | };
28 |
--------------------------------------------------------------------------------
/src/shaders/out/D3D11/ReinterleaveAO_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef ENABLE_BLUR_DEFINED
11 | #define ENABLE_BLUR_DEFINED
12 | enum ENABLE_BLUR
13 | {
14 | ENABLE_BLUR_0,
15 | ENABLE_BLUR_1,
16 | ENABLE_BLUR_COUNT,
17 | };
18 | #endif
19 |
20 | #ifndef DEPTH_LAYER_COUNT_DEFINED
21 | #define DEPTH_LAYER_COUNT_DEFINED
22 | enum DEPTH_LAYER_COUNT
23 | {
24 | DEPTH_LAYER_COUNT_1,
25 | DEPTH_LAYER_COUNT_2,
26 | DEPTH_LAYER_COUNT_COUNT,
27 | };
28 | #endif
29 |
30 | };
31 |
32 | struct ReinterleaveAO_PS
33 | {
34 | void Create(DevicePointer Device);
35 | void Release(DevicePointer Device);
36 | PixelShader& Get(ShaderPermutations::ENABLE_BLUR A, ShaderPermutations::DEPTH_LAYER_COUNT B)
37 | {
38 | return m_Shader[A][B];
39 | }
40 |
41 | private:
42 | PixelShader m_Shader[ShaderPermutations::ENABLE_BLUR_COUNT][ShaderPermutations::DEPTH_LAYER_COUNT_COUNT];
43 | #if _WIN32
44 | static_assert(ShaderPermutations::ENABLE_BLUR_COUNT == 2, "");
45 | static_assert(ShaderPermutations::DEPTH_LAYER_COUNT_COUNT == 2, "");
46 | #endif
47 | };
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/src/shaders/out/GL/BlurX_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef ENABLE_SHARPNESS_PROFILE_DEFINED
11 | #define ENABLE_SHARPNESS_PROFILE_DEFINED
12 | enum ENABLE_SHARPNESS_PROFILE
13 | {
14 | ENABLE_SHARPNESS_PROFILE_0,
15 | ENABLE_SHARPNESS_PROFILE_1,
16 | ENABLE_SHARPNESS_PROFILE_COUNT,
17 | };
18 | #endif
19 |
20 | #ifndef KERNEL_RADIUS_DEFINED
21 | #define KERNEL_RADIUS_DEFINED
22 | enum KERNEL_RADIUS
23 | {
24 | KERNEL_RADIUS_2,
25 | KERNEL_RADIUS_4,
26 | KERNEL_RADIUS_COUNT,
27 | };
28 | #endif
29 |
30 | };
31 |
32 | struct BlurX_PS
33 | {
34 | void Create(DevicePointer Device);
35 | void Release(DevicePointer Device);
36 | GLSLPrograms::BlurX_PS& Get(ShaderPermutations::ENABLE_SHARPNESS_PROFILE A, ShaderPermutations::KERNEL_RADIUS B)
37 | {
38 | return m_Shader[A][B];
39 | }
40 |
41 | private:
42 | GLSLPrograms::BlurX_PS m_Shader[ShaderPermutations::ENABLE_SHARPNESS_PROFILE_COUNT][ShaderPermutations::KERNEL_RADIUS_COUNT];
43 | #if _WIN32
44 | static_assert(ShaderPermutations::ENABLE_SHARPNESS_PROFILE_COUNT == 2, "");
45 | static_assert(ShaderPermutations::KERNEL_RADIUS_COUNT == 2, "");
46 | #endif
47 | };
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/src/shaders/out/GL/BlurY_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef ENABLE_SHARPNESS_PROFILE_DEFINED
11 | #define ENABLE_SHARPNESS_PROFILE_DEFINED
12 | enum ENABLE_SHARPNESS_PROFILE
13 | {
14 | ENABLE_SHARPNESS_PROFILE_0,
15 | ENABLE_SHARPNESS_PROFILE_1,
16 | ENABLE_SHARPNESS_PROFILE_COUNT,
17 | };
18 | #endif
19 |
20 | #ifndef KERNEL_RADIUS_DEFINED
21 | #define KERNEL_RADIUS_DEFINED
22 | enum KERNEL_RADIUS
23 | {
24 | KERNEL_RADIUS_2,
25 | KERNEL_RADIUS_4,
26 | KERNEL_RADIUS_COUNT,
27 | };
28 | #endif
29 |
30 | };
31 |
32 | struct BlurY_PS
33 | {
34 | void Create(DevicePointer Device);
35 | void Release(DevicePointer Device);
36 | GLSLPrograms::BlurY_PS& Get(ShaderPermutations::ENABLE_SHARPNESS_PROFILE A, ShaderPermutations::KERNEL_RADIUS B)
37 | {
38 | return m_Shader[A][B];
39 | }
40 |
41 | private:
42 | GLSLPrograms::BlurY_PS m_Shader[ShaderPermutations::ENABLE_SHARPNESS_PROFILE_COUNT][ShaderPermutations::KERNEL_RADIUS_COUNT];
43 | #if _WIN32
44 | static_assert(ShaderPermutations::ENABLE_SHARPNESS_PROFILE_COUNT == 2, "");
45 | static_assert(ShaderPermutations::KERNEL_RADIUS_COUNT == 2, "");
46 | #endif
47 | };
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/src/shaders/out/GL/CoarseAO_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef ENABLE_FOREGROUND_AO_DEFINED
11 | #define ENABLE_FOREGROUND_AO_DEFINED
12 | enum ENABLE_FOREGROUND_AO
13 | {
14 | ENABLE_FOREGROUND_AO_0,
15 | ENABLE_FOREGROUND_AO_1,
16 | ENABLE_FOREGROUND_AO_COUNT,
17 | };
18 | #endif
19 |
20 | #ifndef ENABLE_BACKGROUND_AO_DEFINED
21 | #define ENABLE_BACKGROUND_AO_DEFINED
22 | enum ENABLE_BACKGROUND_AO
23 | {
24 | ENABLE_BACKGROUND_AO_0,
25 | ENABLE_BACKGROUND_AO_1,
26 | ENABLE_BACKGROUND_AO_COUNT,
27 | };
28 | #endif
29 |
30 | #ifndef ENABLE_DEPTH_THRESHOLD_DEFINED
31 | #define ENABLE_DEPTH_THRESHOLD_DEFINED
32 | enum ENABLE_DEPTH_THRESHOLD
33 | {
34 | ENABLE_DEPTH_THRESHOLD_0,
35 | ENABLE_DEPTH_THRESHOLD_1,
36 | ENABLE_DEPTH_THRESHOLD_COUNT,
37 | };
38 | #endif
39 |
40 | #ifndef FETCH_GBUFFER_NORMAL_DEFINED
41 | #define FETCH_GBUFFER_NORMAL_DEFINED
42 | enum FETCH_GBUFFER_NORMAL
43 | {
44 | FETCH_GBUFFER_NORMAL_0,
45 | FETCH_GBUFFER_NORMAL_1,
46 | FETCH_GBUFFER_NORMAL_2,
47 | FETCH_GBUFFER_NORMAL_COUNT,
48 | };
49 | #endif
50 |
51 | };
52 |
53 | struct CoarseAO_PS
54 | {
55 | void Create(DevicePointer Device);
56 | void Release(DevicePointer Device);
57 | GLSLPrograms::CoarseAO_PS& Get(ShaderPermutations::ENABLE_FOREGROUND_AO A, ShaderPermutations::ENABLE_BACKGROUND_AO B, ShaderPermutations::ENABLE_DEPTH_THRESHOLD C, ShaderPermutations::FETCH_GBUFFER_NORMAL D)
58 | {
59 | return m_Shader[A][B][C][D];
60 | }
61 |
62 | private:
63 | GLSLPrograms::CoarseAO_PS m_Shader[ShaderPermutations::ENABLE_FOREGROUND_AO_COUNT][ShaderPermutations::ENABLE_BACKGROUND_AO_COUNT][ShaderPermutations::ENABLE_DEPTH_THRESHOLD_COUNT][ShaderPermutations::FETCH_GBUFFER_NORMAL_COUNT];
64 | #if _WIN32
65 | static_assert(ShaderPermutations::ENABLE_FOREGROUND_AO_COUNT == 2, "");
66 | static_assert(ShaderPermutations::ENABLE_BACKGROUND_AO_COUNT == 2, "");
67 | static_assert(ShaderPermutations::ENABLE_DEPTH_THRESHOLD_COUNT == 2, "");
68 | static_assert(ShaderPermutations::FETCH_GBUFFER_NORMAL_COUNT == 3, "");
69 | #endif
70 | };
71 |
72 | };
73 |
--------------------------------------------------------------------------------
/src/shaders/out/GL/CopyDepth_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef RESOLVE_DEPTH_DEFINED
11 | #define RESOLVE_DEPTH_DEFINED
12 | enum RESOLVE_DEPTH
13 | {
14 | RESOLVE_DEPTH_0,
15 | RESOLVE_DEPTH_1,
16 | RESOLVE_DEPTH_COUNT,
17 | };
18 | #endif
19 |
20 | };
21 |
22 | struct CopyDepth_PS
23 | {
24 | void Create(DevicePointer Device);
25 | void Release(DevicePointer Device);
26 | GLSLPrograms::CopyDepth_PS& Get(ShaderPermutations::RESOLVE_DEPTH A)
27 | {
28 | return m_Shader[A];
29 | }
30 |
31 | private:
32 | GLSLPrograms::CopyDepth_PS m_Shader[ShaderPermutations::RESOLVE_DEPTH_COUNT];
33 | #if _WIN32
34 | static_assert(ShaderPermutations::RESOLVE_DEPTH_COUNT == 2, "");
35 | #endif
36 | };
37 |
38 | };
39 |
--------------------------------------------------------------------------------
/src/shaders/out/GL/DebugNormals_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef FETCH_GBUFFER_NORMAL_DEFINED
11 | #define FETCH_GBUFFER_NORMAL_DEFINED
12 | enum FETCH_GBUFFER_NORMAL
13 | {
14 | FETCH_GBUFFER_NORMAL_0,
15 | FETCH_GBUFFER_NORMAL_1,
16 | FETCH_GBUFFER_NORMAL_2,
17 | FETCH_GBUFFER_NORMAL_COUNT,
18 | };
19 | #endif
20 |
21 | };
22 |
23 | struct DebugNormals_PS
24 | {
25 | void Create(DevicePointer Device);
26 | void Release(DevicePointer Device);
27 | GLSLPrograms::DebugNormals_PS& Get(ShaderPermutations::FETCH_GBUFFER_NORMAL A)
28 | {
29 | return m_Shader[A];
30 | }
31 |
32 | private:
33 | GLSLPrograms::DebugNormals_PS m_Shader[ShaderPermutations::FETCH_GBUFFER_NORMAL_COUNT];
34 | #if _WIN32
35 | static_assert(ShaderPermutations::FETCH_GBUFFER_NORMAL_COUNT == 3, "");
36 | #endif
37 | };
38 |
39 | };
40 |
--------------------------------------------------------------------------------
/src/shaders/out/GL/DeinterleaveDepth_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | };
11 |
12 | struct DeinterleaveDepth_PS
13 | {
14 | void Create(DevicePointer Device);
15 | void Release(DevicePointer Device);
16 | GLSLPrograms::DeinterleaveDepth_PS& Get()
17 | {
18 | return m_Shader;
19 | }
20 |
21 | private:
22 | GLSLPrograms::DeinterleaveDepth_PS m_Shader;
23 | #if _WIN32
24 | #endif
25 | };
26 |
27 | };
28 |
--------------------------------------------------------------------------------
/src/shaders/out/GL/LinearizeDepth_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef RESOLVE_DEPTH_DEFINED
11 | #define RESOLVE_DEPTH_DEFINED
12 | enum RESOLVE_DEPTH
13 | {
14 | RESOLVE_DEPTH_0,
15 | RESOLVE_DEPTH_1,
16 | RESOLVE_DEPTH_COUNT,
17 | };
18 | #endif
19 |
20 | };
21 |
22 | struct LinearizeDepth_PS
23 | {
24 | void Create(DevicePointer Device);
25 | void Release(DevicePointer Device);
26 | GLSLPrograms::LinearizeDepth_PS& Get(ShaderPermutations::RESOLVE_DEPTH A)
27 | {
28 | return m_Shader[A];
29 | }
30 |
31 | private:
32 | GLSLPrograms::LinearizeDepth_PS m_Shader[ShaderPermutations::RESOLVE_DEPTH_COUNT];
33 | #if _WIN32
34 | static_assert(ShaderPermutations::RESOLVE_DEPTH_COUNT == 2, "");
35 | #endif
36 | };
37 |
38 | };
39 |
--------------------------------------------------------------------------------
/src/shaders/out/GL/ReconstructNormal_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | };
11 |
12 | struct ReconstructNormal_PS
13 | {
14 | void Create(DevicePointer Device);
15 | void Release(DevicePointer Device);
16 | GLSLPrograms::ReconstructNormal_PS& Get()
17 | {
18 | return m_Shader;
19 | }
20 |
21 | private:
22 | GLSLPrograms::ReconstructNormal_PS m_Shader;
23 | #if _WIN32
24 | #endif
25 | };
26 |
27 | };
28 |
--------------------------------------------------------------------------------
/src/shaders/out/GL/ReinterleaveAO_PS.h:
--------------------------------------------------------------------------------
1 | //! This file was auto-generated. Do not modify manually.
2 | #pragma once
3 |
4 | namespace Generated
5 | {
6 |
7 | namespace ShaderPermutations
8 | {
9 |
10 | #ifndef ENABLE_BLUR_DEFINED
11 | #define ENABLE_BLUR_DEFINED
12 | enum ENABLE_BLUR
13 | {
14 | ENABLE_BLUR_0,
15 | ENABLE_BLUR_1,
16 | ENABLE_BLUR_COUNT,
17 | };
18 | #endif
19 |
20 | };
21 |
22 | struct ReinterleaveAO_PS
23 | {
24 | void Create(DevicePointer Device);
25 | void Release(DevicePointer Device);
26 | GLSLPrograms::ReinterleaveAO_PS& Get(ShaderPermutations::ENABLE_BLUR A)
27 | {
28 | return m_Shader[A];
29 | }
30 |
31 | private:
32 | GLSLPrograms::ReinterleaveAO_PS m_Shader[ShaderPermutations::ENABLE_BLUR_COUNT];
33 | #if _WIN32
34 | static_assert(ShaderPermutations::ENABLE_BLUR_COUNT == 2, "");
35 | #endif
36 | };
37 |
38 | };
39 |
--------------------------------------------------------------------------------
/src/shaders/src/BlurX_PS.hlsl:
--------------------------------------------------------------------------------
1 | /*
2 | #permutation ENABLE_SHARPNESS_PROFILE 0 1
3 | #permutation KERNEL_RADIUS 2 4
4 | */
5 |
6 | // This code contains NVIDIA Confidential Information and is disclosed to you
7 | // under a form of NVIDIA software license agreement provided separately to you.
8 | //
9 | // Notice
10 | // NVIDIA Corporation and its licensors retain all intellectual property and
11 | // proprietary rights in and to this software and related documentation and
12 | // any modifications thereto. Any use, reproduction, disclosure, or
13 | // distribution of this software and related documentation without an express
14 | // license agreement from NVIDIA Corporation is strictly prohibited.
15 | //
16 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
17 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
18 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
19 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
20 | //
21 | // Information and code furnished is believed to be accurate and reliable.
22 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
23 | // information or for any infringement of patents or other rights of third parties that may
24 | // result from its use. No license is granted by implication or otherwise under any patent
25 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
26 | // This code supersedes and replaces all information previously supplied.
27 | // NVIDIA Corporation products are not authorized for use as critical
28 | // components in life support devices or systems without express written approval of
29 | // NVIDIA Corporation.
30 | //
31 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
32 |
33 | #include "ConstantBuffers.hlsl"
34 | #include "FullScreenTriangle_VS.hlsl"
35 | #include "Blur_Common.hlsl"
36 |
37 | //----------------------------------------------------------------------------------
38 | float2 BlurX_PS( PostProc_VSOut IN ) : SV_TARGET
39 | {
40 | float CenterDepth;
41 | float AO = ComputeBlur(IN, float2(g_f2InvFullResolution.x,0), CenterDepth);
42 |
43 | return float2(AO, CenterDepth);
44 | }
45 |
--------------------------------------------------------------------------------
/src/shaders/src/BlurY_PS.hlsl:
--------------------------------------------------------------------------------
1 | /*
2 | #permutation ENABLE_SHARPNESS_PROFILE 0 1
3 | #permutation KERNEL_RADIUS 2 4
4 | */
5 |
6 | // This code contains NVIDIA Confidential Information and is disclosed to you
7 | // under a form of NVIDIA software license agreement provided separately to you.
8 | //
9 | // Notice
10 | // NVIDIA Corporation and its licensors retain all intellectual property and
11 | // proprietary rights in and to this software and related documentation and
12 | // any modifications thereto. Any use, reproduction, disclosure, or
13 | // distribution of this software and related documentation without an express
14 | // license agreement from NVIDIA Corporation is strictly prohibited.
15 | //
16 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
17 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
18 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
19 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
20 | //
21 | // Information and code furnished is believed to be accurate and reliable.
22 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
23 | // information or for any infringement of patents or other rights of third parties that may
24 | // result from its use. No license is granted by implication or otherwise under any patent
25 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
26 | // This code supersedes and replaces all information previously supplied.
27 | // NVIDIA Corporation products are not authorized for use as critical
28 | // components in life support devices or systems without express written approval of
29 | // NVIDIA Corporation.
30 | //
31 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
32 |
33 | #include "ConstantBuffers.hlsl"
34 | #include "FullScreenTriangle_VS.hlsl"
35 | #include "Blur_Common.hlsl"
36 |
37 | //-------------------------------------------------------------------------
38 | float4 BlurY_PS( PostProc_VSOut IN ) : SV_TARGET
39 | {
40 | SubtractViewportOrigin(IN);
41 |
42 | float CenterDepth;
43 | float AO = ComputeBlur(IN, float2(0,g_f2InvFullResolution.y), CenterDepth);
44 |
45 | return pow(saturate(AO), g_fPowExponent);
46 | }
47 |
--------------------------------------------------------------------------------
/src/shaders/src/CoarseAO_GS.hlsl:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #include "ConstantBuffers.hlsl"
29 | #include "FullScreenTriangle_VS.hlsl"
30 |
31 | struct GSOut
32 | {
33 | float4 pos : SV_Position;
34 | float2 uv : TEXCOORD0;
35 | uint LayerIndex : SV_RenderTargetArrayIndex;
36 | };
37 |
38 | [maxvertexcount(3)]
39 | void CoarseAO_GS(triangle PostProc_VSOut input[3], inout TriangleStream OUT)
40 | {
41 | GSOut OutVertex;
42 |
43 | OutVertex.LayerIndex = g_PerPassConstants.uSliceIndex;
44 |
45 | [unroll]
46 | for (int VertexID = 0; VertexID < 3; VertexID++)
47 | {
48 | OutVertex.uv = input[VertexID].uv;
49 | OutVertex.pos = input[VertexID].pos;
50 | OUT.Append(OutVertex);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/shaders/src/CopyDepth_PS.hlsl:
--------------------------------------------------------------------------------
1 | /*
2 | #permutation RESOLVE_DEPTH 0 1
3 | #permutation DEPTH_LAYER_COUNT 1 2
4 | */
5 |
6 | // This code contains NVIDIA Confidential Information and is disclosed to you
7 | // under a form of NVIDIA software license agreement provided separately to you.
8 | //
9 | // Notice
10 | // NVIDIA Corporation and its licensors retain all intellectual property and
11 | // proprietary rights in and to this software and related documentation and
12 | // any modifications thereto. Any use, reproduction, disclosure, or
13 | // distribution of this software and related documentation without an express
14 | // license agreement from NVIDIA Corporation is strictly prohibited.
15 | //
16 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
17 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
18 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
19 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
20 | //
21 | // Information and code furnished is believed to be accurate and reliable.
22 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
23 | // information or for any infringement of patents or other rights of third parties that may
24 | // result from its use. No license is granted by implication or otherwise under any patent
25 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
26 | // This code supersedes and replaces all information previously supplied.
27 | // NVIDIA Corporation products are not authorized for use as critical
28 | // components in life support devices or systems without express written approval of
29 | // NVIDIA Corporation.
30 | //
31 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
32 |
33 | #include "FullScreenTriangle_VS.hlsl"
34 | #include "ConstantBuffers.hlsl"
35 |
36 | #if DEPTH_LAYER_COUNT==2
37 | #if RESOLVE_DEPTH
38 | Texture2DMS DepthTextureMS0 : register(t0);
39 | Texture2DMS DepthTextureMS1 : register(t1);
40 | #else
41 | Texture2D DepthTexture0 : register(t0);
42 | Texture2D DepthTexture1 : register(t1);
43 | #endif
44 | #else
45 | #if RESOLVE_DEPTH
46 | Texture2DMS DepthTextureMS : register(t0);
47 | #else
48 | Texture2D DepthTexture : register(t0);
49 | #endif
50 | #endif
51 |
52 | //----------------------------------------------------------------------------------
53 | #if DEPTH_LAYER_COUNT==2
54 | struct OutputDepths
55 | {
56 | float ViewDepth0 : SV_Target0;
57 | float ViewDepth1 : SV_Target1;
58 | };
59 | OutputDepths CopyDepth_PS(PostProc_VSOut IN)
60 | {
61 | AddViewportOrigin(IN);
62 |
63 | #if RESOLVE_DEPTH
64 | float ViewDepth0 = DepthTextureMS0.Load(int2(IN.pos.xy), g_iSampleIndex);
65 | float ViewDepth1 = DepthTextureMS1.Load(int2(IN.pos.xy), g_iSampleIndex);
66 | #else
67 | float ViewDepth0 = DepthTexture0.Load(int3(IN.pos.xy, 0));
68 | float ViewDepth1 = DepthTexture1.Load(int3(IN.pos.xy, 0));
69 | #endif
70 |
71 | OutputDepths Out;
72 | Out.ViewDepth0 = min(ViewDepth0, ViewDepth1);
73 | Out.ViewDepth1 = max(ViewDepth0, ViewDepth1);
74 | return Out;
75 | }
76 | #else
77 | //----------------------------------------------------------------------------------
78 | float CopyDepth_PS(PostProc_VSOut IN) : SV_TARGET
79 | {
80 | AddViewportOrigin(IN);
81 |
82 | #if RESOLVE_DEPTH
83 | float ViewDepth = DepthTextureMS.Load(int2(IN.pos.xy), g_iSampleIndex);
84 | #else
85 | float ViewDepth = DepthTexture.Load(int3(IN.pos.xy, 0));
86 | #endif
87 |
88 | return ViewDepth;
89 | }
90 | #endif
91 |
--------------------------------------------------------------------------------
/src/shaders/src/DebugNormals_PS.hlsl:
--------------------------------------------------------------------------------
1 | /*
2 | #permutation FETCH_GBUFFER_NORMAL 0 1 2
3 | */
4 |
5 | // This code contains NVIDIA Confidential Information and is disclosed to you
6 | // under a form of NVIDIA software license agreement provided separately to you.
7 | //
8 | // Notice
9 | // NVIDIA Corporation and its licensors retain all intellectual property and
10 | // proprietary rights in and to this software and related documentation and
11 | // any modifications thereto. Any use, reproduction, disclosure, or
12 | // distribution of this software and related documentation without an express
13 | // license agreement from NVIDIA Corporation is strictly prohibited.
14 | //
15 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
16 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
17 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
18 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
19 | //
20 | // Information and code furnished is believed to be accurate and reliable.
21 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
22 | // information or for any infringement of patents or other rights of third parties that may
23 | // result from its use. No license is granted by implication or otherwise under any patent
24 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
25 | // This code supersedes and replaces all information previously supplied.
26 | // NVIDIA Corporation products are not authorized for use as critical
27 | // components in life support devices or systems without express written approval of
28 | // NVIDIA Corporation.
29 | //
30 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
31 |
32 | #include "ReconstructNormal_Common.hlsl"
33 |
34 | //----------------------------------------------------------------------------------
35 | float3 FetchFullResViewNormal(PostProc_VSOut IN, float3 ViewPosition)
36 | {
37 | #if FETCH_GBUFFER_NORMAL
38 | return FetchFullResViewNormal_GBuffer(IN);
39 | #else
40 | return ReconstructNormal(IN.uv, ViewPosition);
41 | #endif
42 | }
43 |
44 | //----------------------------------------------------------------------------------
45 | float4 DebugNormals_PS(PostProc_VSOut IN) : SV_TARGET
46 | {
47 | SubtractViewportOrigin(IN);
48 |
49 | float3 ViewPosition = FetchFullResViewPos(IN.uv);
50 | float3 ViewNormal = -FetchFullResViewNormal(IN, ViewPosition);
51 |
52 | float3 OutColor =
53 | (g_iDebugNormalComponent == 0) ? ViewNormal.xxx :
54 | (g_iDebugNormalComponent == 1) ? ViewNormal.yyy :
55 | (g_iDebugNormalComponent == 2) ? ViewNormal.zzz :
56 | ViewNormal;
57 |
58 | return float4(OutColor, 0);
59 | }
60 |
--------------------------------------------------------------------------------
/src/shaders/src/FetchNormal_Common.hlsl:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #include "ConstantBuffers.hlsl"
29 |
30 | #if FETCH_GBUFFER_NORMAL == 2
31 | Texture2DMS FullResNormalTextureMS : register(t1);
32 | #else
33 | Texture2D FullResNormalTexture : register(t1);
34 | #endif
35 |
36 | //----------------------------------------------------------------------------------
37 | float3 FetchFullResWorldNormal_GBuffer(PostProc_VSOut IN)
38 | {
39 | AddViewportOrigin(IN);
40 |
41 | #if FETCH_GBUFFER_NORMAL == 2
42 | return FullResNormalTextureMS.Load(int2(IN.pos.xy), g_iSampleIndex).xyz;
43 | #else
44 | return FullResNormalTexture.Load(int3(IN.pos.xy, 0)).xyz;
45 | #endif
46 | }
47 |
48 | //----------------------------------------------------------------------------------
49 | float3 FetchFullResViewNormal_GBuffer(PostProc_VSOut IN)
50 | {
51 | float3 WorldNormal = FetchFullResWorldNormal_GBuffer(IN) * g_fNormalDecodeScale + g_fNormalDecodeBias;
52 | float3 ViewNormal = normalize(mul(WorldNormal, (float3x3)g_f44NormalMatrix));
53 | return ViewNormal;
54 | }
55 |
--------------------------------------------------------------------------------
/src/shaders/src/FullScreenTriangle_VS.hlsl:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #include "ConstantBuffers.hlsl"
29 |
30 | struct PostProc_VSOut
31 | {
32 | float4 pos : SV_Position;
33 | float2 uv : TEXCOORD0;
34 | };
35 |
36 | //----------------------------------------------------------------------------------
37 | // Vertex shader that generates a full-screen triangle with texcoords
38 | // Assuming a Draw(3,0) call.
39 | //----------------------------------------------------------------------------------
40 | PostProc_VSOut FullScreenTriangle_VS( uint VertexId : SV_VertexID )
41 | {
42 | PostProc_VSOut output = (PostProc_VSOut)0.0f;
43 | output.uv = float2( (VertexId << 1) & 2, VertexId & 2 );
44 | output.pos = float4( output.uv * float2( 2.0f, -2.0f ) + float2( -1.0f, 1.0f) , 0.0f, 1.0f );
45 | return output;
46 | }
47 |
48 | //----------------------------------------------------------------------------------
49 | void AddViewportOrigin(inout PostProc_VSOut IN)
50 | {
51 | IN.pos.xy += g_f2InputViewportTopLeft;
52 | IN.uv = IN.pos.xy * g_f2InvFullResolution;
53 | }
54 |
55 | //----------------------------------------------------------------------------------
56 | void SubtractViewportOrigin(inout PostProc_VSOut IN)
57 | {
58 | IN.pos.xy -= g_f2InputViewportTopLeft;
59 | IN.uv = IN.pos.xy * g_f2InvFullResolution;
60 | }
61 |
--------------------------------------------------------------------------------
/src/shaders/src/ReconstructNormal_Common.hlsl:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #include "ConstantBuffers.hlsl"
29 | #include "FullScreenTriangle_VS.hlsl"
30 | #include "FetchNormal_Common.hlsl"
31 |
32 | Texture2D FullResDepthTexture : register(t0);
33 | sampler PointClampSampler : register(s0);
34 |
35 | //----------------------------------------------------------------------------------
36 | float3 UVToView(float2 UV, float viewDepth)
37 | {
38 | UV = g_f2UVToViewA * UV + g_f2UVToViewB;
39 | return float3(UV * viewDepth, viewDepth);
40 | }
41 |
42 | //----------------------------------------------------------------------------------
43 | float3 FetchFullResViewPos(float2 UV)
44 | {
45 | float ViewDepth = FullResDepthTexture.SampleLevel(PointClampSampler, UV, 0);
46 | return UVToView(UV, ViewDepth);
47 | }
48 |
49 | //----------------------------------------------------------------------------------
50 | float3 MinDiff(float3 P, float3 Pr, float3 Pl)
51 | {
52 | float3 V1 = Pr - P;
53 | float3 V2 = P - Pl;
54 | return (dot(V1,V1) < dot(V2,V2)) ? V1 : V2;
55 | }
56 |
57 | //----------------------------------------------------------------------------------
58 | float3 ReconstructNormal(float2 UV, float3 P)
59 | {
60 | float3 Pr = FetchFullResViewPos(UV + float2(g_f2InvFullResolution.x, 0));
61 | float3 Pl = FetchFullResViewPos(UV + float2(-g_f2InvFullResolution.x, 0));
62 | float3 Pt = FetchFullResViewPos(UV + float2(0, g_f2InvFullResolution.y));
63 | float3 Pb = FetchFullResViewPos(UV + float2(0, -g_f2InvFullResolution.y));
64 | return normalize(cross(MinDiff(P, Pr, Pl), MinDiff(P, Pt, Pb)));
65 | }
66 |
--------------------------------------------------------------------------------
/src/shaders/src/ReconstructNormal_PS.hlsl:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | #include "ReconstructNormal_Common.hlsl"
29 |
30 | //----------------------------------------------------------------------------------
31 | float3 FetchFullResViewNormal(PostProc_VSOut IN, float3 ViewPosition)
32 | {
33 | return ReconstructNormal(IN.uv, ViewPosition);
34 | }
35 |
36 | //----------------------------------------------------------------------------------
37 | float4 ReconstructNormal_PS(PostProc_VSOut IN) : SV_TARGET
38 | {
39 | float3 ViewPosition = FetchFullResViewPos(IN.uv);
40 | float3 ViewNormal = FetchFullResViewNormal(IN, ViewPosition);
41 |
42 | return float4(ViewNormal * 0.5 + 0.5, 0);
43 | }
44 |
--------------------------------------------------------------------------------
/src/shaders/src/ReinterleaveAO_PS.hlsl:
--------------------------------------------------------------------------------
1 | /*
2 | #permutation ENABLE_BLUR 0 1
3 | #permutation DEPTH_LAYER_COUNT 1 2
4 | */
5 |
6 | // This code contains NVIDIA Confidential Information and is disclosed to you
7 | // under a form of NVIDIA software license agreement provided separately to you.
8 | //
9 | // Notice
10 | // NVIDIA Corporation and its licensors retain all intellectual property and
11 | // proprietary rights in and to this software and related documentation and
12 | // any modifications thereto. Any use, reproduction, disclosure, or
13 | // distribution of this software and related documentation without an express
14 | // license agreement from NVIDIA Corporation is strictly prohibited.
15 | //
16 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
17 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
18 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
19 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
20 | //
21 | // Information and code furnished is believed to be accurate and reliable.
22 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
23 | // information or for any infringement of patents or other rights of third parties that may
24 | // result from its use. No license is granted by implication or otherwise under any patent
25 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
26 | // This code supersedes and replaces all information previously supplied.
27 | // NVIDIA Corporation products are not authorized for use as critical
28 | // components in life support devices or systems without express written approval of
29 | // NVIDIA Corporation.
30 | //
31 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
32 |
33 | #include "ConstantBuffers.hlsl"
34 | #include "FullScreenTriangle_VS.hlsl"
35 |
36 | #define USE_INTEGER_MATH 1
37 |
38 | Texture2DArray AOTexture : register(t0);
39 | #if DEPTH_LAYER_COUNT==2
40 | Texture2D DepthTexture1 : register(t1);
41 | Texture2D DepthTexture2 : register(t2);
42 | #else
43 | Texture2D DepthTexture : register(t1);
44 | #endif
45 |
46 | sampler PointSampler : register(s0);
47 |
48 | //----------------------------------------------------------------------------------
49 | struct PSOut
50 | {
51 | #if ENABLE_BLUR
52 | float2 AOZ : SV_TARGET;
53 | #else
54 | float4 AO : SV_TARGET;
55 | #endif
56 | };
57 |
58 | //-------------------------------------------------------------------------
59 | PSOut ReinterleaveAO_PS(PostProc_VSOut IN)
60 | {
61 | PSOut OUT;
62 |
63 | #if !ENABLE_BLUR
64 | SubtractViewportOrigin(IN);
65 | #endif
66 |
67 | #if USE_INTEGER_MATH
68 | int2 FullResPos = int2(IN.pos.xy);
69 | int2 Offset = FullResPos & 3;
70 | int SliceId = Offset.y * 4 + Offset.x;
71 | int2 QuarterResPos = FullResPos >> 2;
72 | #else
73 | float2 FullResPos = floor(IN.pos.xy);
74 | float2 Offset = fmod(abs(FullResPos), float2(4,4));
75 | float SliceId = Offset.y * 4.0 + Offset.x;
76 | float2 QuarterResPos = FullResPos / 4.0;
77 | #endif
78 |
79 |
80 | float AO = AOTexture.Load(int4(QuarterResPos, SliceId, 0));
81 | #if ENABLE_BLUR
82 | #if DEPTH_LAYER_COUNT==2
83 | float ViewDepth1 = DepthTexture1.Sample(PointSampler, IN.uv);
84 | float ViewDepth2 = DepthTexture2.Sample(PointSampler, IN.uv);
85 | float ViewDepth = min(ViewDepth1, ViewDepth2);
86 | #else
87 | float ViewDepth = DepthTexture.Sample(PointSampler, IN.uv);
88 | #endif
89 | OUT.AOZ = float2(AO, ViewDepth);
90 | #else
91 | OUT.AO = pow(saturate(AO), g_fPowExponent);
92 | #endif
93 |
94 | return OUT;
95 | }
96 |
--------------------------------------------------------------------------------
/src/shaders/src/SharedDefines.h:
--------------------------------------------------------------------------------
1 | // This code contains NVIDIA Confidential Information and is disclosed to you
2 | // under a form of NVIDIA software license agreement provided separately to you.
3 | //
4 | // Notice
5 | // NVIDIA Corporation and its licensors retain all intellectual property and
6 | // proprietary rights in and to this software and related documentation and
7 | // any modifications thereto. Any use, reproduction, disclosure, or
8 | // distribution of this software and related documentation without an express
9 | // license agreement from NVIDIA Corporation is strictly prohibited.
10 | //
11 | // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 | // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 | // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 | // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 | //
16 | // Information and code furnished is believed to be accurate and reliable.
17 | // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 | // information or for any infringement of patents or other rights of third parties that may
19 | // result from its use. No license is granted by implication or otherwise under any patent
20 | // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 | // This code supersedes and replaces all information previously supplied.
22 | // NVIDIA Corporation products are not authorized for use as critical
23 | // components in life support devices or systems without express written approval of
24 | // NVIDIA Corporation.
25 | //
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 |
28 | // Number of sampled directions per pixel
29 | #ifndef NUM_DIRECTIONS
30 | #define NUM_DIRECTIONS 8
31 | #endif
32 |
33 | // To disable the per-pixel randomization
34 | #ifndef USE_RANDOM_TEXTURE
35 | #define USE_RANDOM_TEXTURE 1
36 | #endif
37 |
38 | // Width of the tiled random texture
39 | #ifndef RANDOM_TEXTURE_WIDTH
40 | #define RANDOM_TEXTURE_WIDTH 4
41 | #endif
42 |
43 | #ifndef GFSDK_PI
44 | #define GFSDK_PI 3.14159265f
45 | #endif
46 |
47 | #ifndef MAX_NUM_MRTS
48 | #define MAX_NUM_MRTS 8
49 | #endif
50 |
--------------------------------------------------------------------------------