OverviewFilesCommitsIssuesDocsReleasesPeers

nvidia-rtx-godot commits / 84fe630

Add NGX SDK headers and static library for Linux DLSS
Include NVIDIA NGX SDK headers (nvsdk_ngx*.h) and the static library (libnvsdk_ngx.a) needed for direct NGX DLSS integration on Linux. Runtime .so files are excluded (provided by the driver). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
84fe630d7d620a9f755a05c3fa17f8dbb9a4d60c
by plankatron <fleeky@gmail.com> · 2026-03-12T19:16:33.000Z

Changed files (17) +5941 -0

thirdparty/README.md +16 -0
……@@ -889,6 +889,22 @@ Patches:
889889- `0001-remove-unused-save-features.patch` ([GH-113965](https://github.com/godotengine/godot/issues/113965))
890890
891891
892## ngx
893
894- Upstream: https://github.com/NVIDIA/DLSS
895- Version: 310.5.3 (2025)
896- License: NVIDIA RTX SDK License
897
898Files extracted from upstream source:
899
900- Headers from `include/`: `nvsdk_ngx*.h`
901- Linux static library: `lib/Linux_x86_64/dev/libnvsdk_ngx.a`
902
903Used by the direct NGX DLSS backend on Linux (see `servers/rendering/renderer_rd/effects/dlss.cpp`
904under `NGX_DLSS_ENABLED`). The runtime `.so` files (`libnvidia-ngx-dlss*.so`) are provided
905separately at `lib/linux_x86_64/` and loaded at runtime.
906
907
892908## openxr
893909
894910- Upstream: https://github.com/KhronosGroup/OpenXR-SDK
thirdparty/ngx/include/nvsdk_ngx.h +724 -0
……@@ -0,0 +1,724 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2018-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13/*
14* HOW TO USE:
15*
16* IMPORTANT: FOR DLSS/DLISP PLEASE SEE THE PROGRAMMING GUIDE
17*
18* IMPORTANT: Methods in this library are NOT thread safe. It is up to the
19* client to ensure that thread safety is enforced as needed.
20*
21* 1) Call NVSDK_CONV NVSDK_NGX_D3D11/D3D12/CUDA_Init and pass your app Id
22* and other parameters. This will initialize SDK or return an error code
23* if SDK cannot run on target machine. Depending on error user might
24* need to update drivers. Please note that application Id is provided
25* by NVIDIA so if you do not have one please contact us.
26*
27* 2) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetCapabilityParameters to obtain pointer to
28* interface used to pass parameters to SDK. Interface instance is
29* allocated and released by SDK so there is no need to do any memory
30* management on client side.
31*
32* 3) Set key parameters for the feature you want to use. For example,
33* width and height are required for all features and they can be
34* set like this:
35* Params->Set(NVSDK_NGX_Parameter_Width,MY_WIDTH);
36* Params->Set(NVSDK_NGX_Parameter_Height,MY_HEIGHT);
37*
38* You can also provide hints like NVSDK_NGX_Parameter_Hint_HDR to tell
39* SDK that it should expect HDR color space is needed. Please refer to
40* samples since different features need different parameters and hints.
41*
42* 4) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetScratchBufferSize to obtain size of
43* the scratch buffer needed by specific feature. This D3D or CUDA buffer
44* should be allocated by client and passed as:
45* Params->Set(NVSDK_NGX_Parameter_Scratch,MY_SCRATCH_POINTER)
46* Params->Set(NVSDK_NGX_Parameter_Scratch_SizeInBytes,MY_SCRATCH_SIZE_IN_BYTES)
47* NOTE: Returned size can be 0 if feature does not use any scratch buffer.
48* It is OK to use bigger buffer or reuse buffers across features as long
49* as minimum size requirement is met.
50*
51* 5) Call NVSDK_NGX_D3D11/D3D12/CUDA_CreateFeature to create feature you need.
52* On success SDK will return a handle which must be used in any successive
53* calls to SDK which require feature handle. SDK will use all parameters
54* and hints provided by client to generate feature. If feature with the same
55* parameters already exists and error code will be returned.
56*
57* 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_EvaluateFeature to invoke execution of
58* specific feature. Before feature can be evaluated input parameters must
59* be specified (like for example color/albedo buffer, motion vectors etc)
60*
61* 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_ReleaseFeature when feature is no longer
62* needed. After this call feature handle becomes invalid and cannot be used.
63*
64* 7) Call NVSDK_NGX_D3D11/D3D12/CUDA_Shutdown when SDK is no longer needed to
65* release all resources.
66
67* Contact: ngxsupport@nvidia.com
68*/
69
70
71#ifndef NVSDK_NGX_H
72#define NVSDK_NGX_H
73
74#include <stddef.h> // For size_t
75
76#include "nvsdk_ngx_defs.h"
77#include "nvsdk_ngx_params.h"
78#ifndef __cplusplus
79#include <stdbool.h>
80#include <wchar.h>
81#endif
82
83#ifdef __cplusplus
84extern "C"
85{
86#endif
87
88typedef struct IUnknown IUnknown;
89
90typedef struct IDXGIAdapter IDXGIAdapter;
91typedef struct ID3D11Device ID3D11Device;
92typedef struct ID3D11Resource ID3D11Resource;
93typedef struct ID3D11DeviceContext ID3D11DeviceContext;
94typedef struct D3D11_TEXTURE2D_DESC D3D11_TEXTURE2D_DESC;
95typedef struct D3D11_BUFFER_DESC D3D11_BUFFER_DESC;
96typedef struct ID3D11Buffer ID3D11Buffer;
97typedef struct ID3D11Texture2D ID3D11Texture2D;
98
99typedef struct ID3D12Device ID3D12Device;
100typedef struct ID3D12Resource ID3D12Resource;
101typedef struct ID3D12GraphicsCommandList ID3D12GraphicsCommandList;
102typedef struct D3D12_RESOURCE_DESC D3D12_RESOURCE_DESC;
103typedef struct CD3DX12_HEAP_PROPERTIES CD3DX12_HEAP_PROPERTIES;
104
105typedef struct NVSDK_NGX_CUDADevice NVSDK_NGX_CUDADevice;
106
107typedef void (NVSDK_CONV *PFN_NVSDK_NGX_D3D12_ResourceAllocCallback)(D3D12_RESOURCE_DESC *InDesc, int InState, CD3DX12_HEAP_PROPERTIES *InHeap, ID3D12Resource **OutResource);
108typedef void (NVSDK_CONV *PFN_NVSDK_NGX_D3D11_BufferAllocCallback)(D3D11_BUFFER_DESC *InDesc, ID3D11Buffer **OutResource);
109typedef void (NVSDK_CONV *PFN_NVSDK_NGX_D3D11_Tex2DAllocCallback)(D3D11_TEXTURE2D_DESC *InDesc, ID3D11Texture2D **OutResource);
110typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ResourceReleaseCallback)(IUnknown *InResource);
111
112typedef unsigned long long CUtexObject;
113
114// NOTE: Functions under the same name and different function signatures exist
115// between the NGX SDK, NGX Core (driver), and NGX Snippets. To discern the
116// different signatures here we check if NGX_SNIPPET_BUILD is defined. When that
117// is the case we know that the function signature in-use should be that of
118// between NGX Core and the Snippet. Otherwise the signature should be between
119// NGX SDK and NGX Core.
120//
121////////////////////////////////////////////////////////////////////////////////
122// NVSDK_NGX_Init
123// -----------------------------------------------------------------------------
124// Initializes a new SDK instance.
125//
126// DESCRIPTION:
127// Initializes a new SDK instance. Most NGX SDK functions require the NGX
128// SDK to be initialized for the corresponding graphics API and device to
129// function properly.
130//
131// NVSDK_NGX_Init requires an application ID provided by NVIDIA. If an
132// application ID is not available, use NVSDK_NGX_Init_with_ProjectID to
133// supply your own identifier.
134//
135// Be sure to call NVSDK_NGX_Shutdown to shut down the SDK when it is no
136// longer needed.
137//
138// PARAMETERS:
139// InApplicationId:
140// Unique ID provided by NVIDIA.
141//
142// InApplicationDataPath:
143// Directory to store logs and other temporary files. Write access is
144// required. Typically, this would be next to the application executable,
145// or in a location like Documents or ProgramData.
146//
147// InDevice (D3D11/12 only):
148// DirectX device to use.
149//
150// InFeatureInfo:
151// Contains information common to all features, including a list of paths
152// where feature DLLs can be located, other than the default path (application directory).
153//
154// InSDKVersion:
155// Version of the SDK currently in use. Typically, this should be left as
156// the default value, NVSDK_NGX_Version_API.
157//
158// RETURNS:
159// NVSDK_NGX_Result indicating success or failure. Common values include:
160// - NVSDK_NGX_Result_Success if the function executed successfully
161// - NVSDK_NGX_Result_FAIL_FeatureNotSupported if the NGX SDK is not
162// supported on the current system
163// Check the NGX logs for additional information about any failures.
164//
165#if defined(NGX_SNIPPET_BUILD)
166#ifdef __cplusplus
167NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
168NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init_Ext(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API, const NVSDK_NGX_Parameter* InParameters = nullptr);
169NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
170NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init_Ext(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API, const NVSDK_NGX_Parameter* InParameters = nullptr);
171NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
172NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init_Ext(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API, const NVSDK_NGX_Parameter* InParameters = nullptr);
173NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init_Ext1(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, NVSDK_NGX_CUDADevice *InDevice, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API, const NVSDK_NGX_Parameter* InParameters = nullptr);
174#else
175NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, NVSDK_NGX_Version InSDKVersion);
176NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init_Ext(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_Parameter* InParameters);
177NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, NVSDK_NGX_Version InSDKVersion);
178NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init_Ext(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_Parameter* InParameters);
179NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, NVSDK_NGX_Version InSDKVersion);
180NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init_Ext(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_Parameter* InParameters);
181NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init_Ext1(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, NVSDK_NGX_CUDADevice *InDevice, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_Parameter* InParameters);
182#endif
183#else
184#ifdef __cplusplus
185NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
186NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
187NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
188NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init1(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, NVSDK_NGX_CUDADevice *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
189#else
190NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
191NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
192NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
193NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init1(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, NVSDK_NGX_CUDADevice *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
194#endif
195#endif // defined(NGX_SNIPPET_BUILD)
196
197////////////////////////////////////////////////////////////////////////////////
198// NVSDK_NGX_Init_with_ProjectID
199// -----------------------------------------------------------------------------
200// Initializes a new SDK instance using a project ID.
201//
202// DESCRIPTION:
203// Initializes a new SDK instance. Most NGX SDK functions require the NGX
204// SDK to be initialized for the corresponding graphics API and device to
205// function properly.
206//
207// Applications must provide a unique identifier to initialize the NGX SDK.
208// If an identifier was provided by NVIDIA, use NVSDK_NGX_Init instead.
209//
210// For projects using third-party engines such as Unreal Engine or
211// Omniverse, the integration for those engines should handle providing the
212// correct Project ID to NGX. Ensure that the project ID is set in the
213// engine's editor.
214//
215// For other engines, use NVSDK_NGX_EngineType CUSTOM. The driver will
216// validate that the Project ID is GUID-like, for example,
217// "a0f57b54-1daf-4934-90ae-c4035c19df04". Ensure your project ID matches
218// this format.
219//
220// Be sure to call NVSDK_NGX_Shutdown to shut down the SDK when it is no
221// longer needed.
222//
223// PARAMETERS:
224// InProjectId:
225// Unique ID provided by the rendering engine used. Must be a GUID-like
226// string.
227//
228// InEngineType:
229// Rendering engine used by the application/plugin. Use NVSDK_NGX_EngineType
230// CUSTOM if the specific engine type is not explicitly supported.
231//
232// InEngineVersion:
233// Version number of the rendering engine used by the application/plugin.
234//
235// InApplicationDataPath:
236// Directory to store logs and other temporary files (write access required).
237//
238// InDevice (D3D11/12 only):
239// DirectX device to use.
240//
241// InFeatureInfo:
242// Contains information common to all features, including a list of paths
243// where feature DLLs can be located in addition to the default path
244// (the application directory).
245//
246// InSDKVersion:
247// Version of the SDK currently in use. Typically, this should be left as
248// the default value, NVSDK_NGX_Version_API.
249//
250// RETURNS:
251// NVSDK_NGX_Result indicating success or failure. Common values include:
252// - NVSDK_NGX_Result_Success if the function executed successfully
253// - NVSDK_NGX_Result_InvalidParameter if the provided project ID is in
254// an invalid format
255// - NVSDK_NGX_Result_FAIL_FeatureNotSupported if the NGX SDK is not
256// supported on the current system
257// Check the NGX logs for additional information about any failures.
258//
259#if defined(NGX_SNIPPET_BUILD)
260// No NGX Core <---> Snippet interfaces
261#else
262#ifdef __cplusplus
263NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
264NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
265NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
266#else
267NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, ID3D11Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
268NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
269NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
270#endif
271#endif // defined(NGX_SNIPPET_BUILD)
272
273////////////////////////////////////////////////////////////////////////////////
274// NVSDK_NGX_Shutdown
275// -----------------------------------------------------------------------------
276// Shuts down the current SDK instance and releases all resources.
277//
278// DESCRIPTION:
279// Shuts down the current SDK instance and releases all resources. If a
280// device is provided, NVSDK_NGX_Shutdown1 shuts down the instance
281// corresponding to the specified device. If nullptr is provided, all
282// instances are shut down.
283//
284// Deprecation Notice: The use of Shutdown() is deprecated. Please use
285// Shutdown1(nullptr) instead.
286//
287// PARAMETERS:
288// InDevice:
289// Device to shut down. If nullptr, the SDK is shut down for all devices.
290//
291// RETURNS:
292// NVSDK_NGX_Result indicating success or failure.
293//
294#ifdef NGX_ENABLE_DEPRECATED_SHUTDOWN
295NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Shutdown(void);
296NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Shutdown(void);
297#endif
298NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Shutdown1(ID3D11Device *InDevice);
299NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Shutdown1(ID3D12Device *InDevice);
300NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Shutdown(void);
301NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Shutdown1(NVSDK_NGX_CUDADevice *InDevice);
302
303#ifdef NGX_ENABLE_DEPRECATED_GET_PARAMETERS
304////////////////////////////////////////////////////////////////////////////////
305// NVSDK_NGX_GetParameters
306// -----------------------------------------------------------------------------
307// Retrieves a parameter map used to set parameters needed by the SDK.
308//
309// DEPRECATED: Use NVSDK_NGX_AllocateParameters or
310// NVSDK_NGX_GetCapabilityParameters instead.
311//
312// DESCRIPTION:
313// Retrieves the common NVSDK_NGX_Parameter map for providing parameters to
314// the SDK. The NVSDK_NGX_Parameter interface allows simple parameter setup
315// using named fields. For example, set the width by calling
316// Parameters->Set(NVSDK_NGX_Parameter_Width, 100) or provide a resource
317// pointer by calling Parameters->Set(NVSDK_NGX_Parameter_Color, resource).
318// For more details, see the sample code.
319//
320// Parameter maps returned by NVSDK_NGX_GetParameters are pre-populated
321// with NGX capabilities and available features. Unlike
322// NVSDK_NGX_AllocateParameters, parameter maps returned by
323// NVSDK_NGX_GetParameters have their lifetimes managed by NGX and must not
324// be destroyed by the application using NVSDK_NGX_DestroyParameters.
325//
326// This function may only be called after a successful call to
327// NVSDK_NGX_Init.
328//
329// Note: Allocated memory will be freed by NGX, so do not use the
330// free/delete operator.
331//
332// Deprecation Notice: NVSDK_NGX_GetParameters is deprecated. Applications
333// should use NVSDK_NGX_AllocateParameters and
334// NVSDK_NGX_GetCapabilityParameters when possible. However, if there is a
335// possibility that the user may be using an older driver version (driver
336// version 445 or older), NVSDK_NGX_GetParameters may still be used as a
337// fallback if NVSDK_NGX_AllocateParameters or
338// NVSDK_NGX_GetCapabilityParameters return
339// NVSDK_NGX_Result_FAIL_OutOfDate.
340//
341// PARAMETERS:
342// OutParameters:
343// Output pointer that will be populated with an NVSDK_NGX_Parameter
344// interface.
345//
346// RETURNS:
347// NVSDK_NGX_Result indicating success or failure.
348//
349NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_GetParameters(NVSDK_NGX_Parameter **OutParameters);
350NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_GetParameters(NVSDK_NGX_Parameter **OutParameters);
351NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_GetParameters(NVSDK_NGX_Parameter **OutParameters);
352#endif // NGX_ENABLE_DEPRECATED_GET_PARAMETERS
353
354////////////////////////////////////////////////////////////////////////////////
355// NVSDK_NGX_AllocateParameters
356// -----------------------------------------------------------------------------
357// Allocates a parameter map used to set parameters needed by the SDK.
358//
359// DESCRIPTION:
360// Allocates a new NVSDK_NGX_Parameter map for providing parameters to the
361// SDK. The lifetime of this parameter map must be managed by the
362// application. The NVSDK_NGX_Parameter interface allows simple parameter
363// setup using named fields. For example, set the width by calling
364// Parameters->Set(NVSDK_NGX_Parameter_Width, 100) or provide a resource
365// pointer by calling Parameters->Set(NVSDK_NGX_Parameter_Color, resource).
366// For more details, see the sample code.
367//
368// Use NVSDK_NGX_DestroyParameters to free a parameter map created by
369// NVSDK_NGX_AllocateParameters. Parameter maps created by
370// NVSDK_NGX_AllocateParameters must NOT be freed using the free/delete
371// operator.
372//
373// Parameter maps created by NVSDK_NGX_AllocateParameters do not come
374// pre-populated with NGX capabilities and available features. To create a
375// new parameter map pre-populated with such information, use
376// NVSDK_NGX_GetCapabilityParameters instead.
377//
378// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if using an
379// older driver that does not support this API call. In such a case,
380// NVSDK_NGX_GetParameters may be used as a fallback.
381//
382// This function may only be called after a successful call to
383// NVSDK_NGX_Init.
384//
385// PARAMETERS:
386// OutParameters:
387// Output pointer that will be populated with the newly-allocated
388// NVSDK_NGX_Parameter interface.
389//
390// RETURNS:
391// NVSDK_NGX_Result indicating success or failure. Common values include:
392// - NVSDK_NGX_Result_Success if the function executed successfully
393// - NVSDK_NGX_Result_FAIL_OutOfDate if this function is not supported by
394// the current display driver
395// Check the NGX logs for additional information about any failures.
396//
397NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
398NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
399NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
400
401////////////////////////////////////////////////////////////////////////////////
402// NVSDK_NGX_GetCapabilityParameters
403// -----------------------------------------------------------------------------
404// Allocates a parameter map populated with NGX and feature capabilities.
405//
406// DESCRIPTION:
407// Allocates a new NVSDK_NGX_Parameter map pre-populated with NGX
408// capabilities and information about available features. The output
409// parameter map can also be used in the same ways as a parameter map
410// allocated with NVSDK_NGX_AllocateParameters. However, it is not
411// recommended to use NVSDK_NGX_GetCapabilityParameters unless querying NGX
412// capabilities due to the overhead associated with pre-populating the
413// parameter map.
414//
415// Use NVSDK_NGX_DestroyParameters to free a parameter map created by
416// NVSDK_NGX_GetCapabilityParameters. Parameter maps created by
417// NVSDK_NGX_GetCapabilityParameters must NOT be freed using the
418// free/delete operator.
419//
420// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if using an
421// older driver that does not support this API call. In such a case,
422// NVSDK_NGX_GetParameters may be used as a fallback.
423//
424// This function may only be called after a successful call to
425// NVSDK_NGX_Init.
426//
427// PARAMETERS:
428// OutParameters:
429// Output pointer that will be populated with the newly-allocated
430// NVSDK_NGX_Parameter interface.
431//
432// RETURNS:
433// NVSDK_NGX_Result indicating success or failure. Common values include:
434// - NVSDK_NGX_Result_Success if the function executed successfully
435// - NVSDK_NGX_Result_FAIL_OutOfDate if this function is not supported by
436// the current display driver
437// Check the NGX logs for additional information about any failures.
438//
439NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
440NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
441NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
442
443////////////////////////////////////////////////////////////////////////////////
444// NVSDK_NGX_DestroyParameters
445// -----------------------------------------------------------------------------
446// Destroys the specified parameter map.
447//
448// DESCRIPTION:
449// Destroys the input parameter map. Once NVSDK_NGX_DestroyParameters is
450// called on a parameter map, it must not be used again.
451//
452// NVSDK_NGX_DestroyParameters must not be called on any parameter map
453// returned by NVSDK_NGX_GetParameters; NGX will manage the lifetime of
454// those parameter maps.
455//
456// This function may only be called after a successful call to
457// NVSDK_NGX_Init.
458//
459// PARAMETERS:
460// InParameters:
461// The parameter map to be destroyed.
462//
463// RETURNS:
464// NVSDK_NGX_Result indicating success or failure.
465//
466NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
467NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
468NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
469
470////////////////////////////////////////////////////////////////////////////////
471// NVSDK_NGX_GetScratchBufferSize
472// -----------------------------------------------------------------------------
473// Retrieves the size of the scratch buffer needed for the specified feature.
474//
475// DESCRIPTION:
476// The SDK requires a buffer of a certain size provided by the client to
477// initialize some NGX features. Once the feature is no longer needed, the
478// buffer can be released. It is safe to reuse the same scratch buffer for
479// different features as long as the minimum size requirement is met for
480// all features. Some features might not need a scratch buffer, so a return
481// size of 0 is completely valid.
482//
483// Note: Most current NGX features do not use scratch buffers. Please check
484// the documentation for the particular feature in use to determine whether
485// a scratch buffer needs to be created.
486//
487// PARAMETERS:
488// InFeatureId:
489// Identifier of the feature to query.
490//
491// InParameters:
492// Parameters used by the feature to determine scratch buffer size.
493//
494// OutSizeInBytes:
495// Number of bytes needed for the scratch buffer for the specified feature.
496//
497// RETURNS:
498// NVSDK_NGX_Result indicating success or failure.
499//
500NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
501NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
502NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
503
504////////////////////////////////////////////////////////////////////////////////
505// NVSDK_NGX_CreateFeature
506// -----------------------------------------------------------------------------
507// Creates and initializes an instance of the specified NGX feature.
508//
509// DESCRIPTION:
510// Each feature needs to be created before it can be used. The parameters
511// required to create the feature vary. Refer to the feature's
512// documentation and/or sample code to find out which input parameters are
513// needed to create a specific feature.
514//
515// NVSDK_NGX_CreateFeature creates an NVSDK_NGX_Handle to the feature, which
516// is needed to reference the feature in later calls to
517// NVSDK_NGX_EvaluateFeature. Multiple instances of the same feature may be
518// created, and evaluating one instance of a feature should not change the
519// state of other instances.
520//
521// When a feature instance is no longer needed, it should be freed using
522// NVSDK_NGX_ReleaseFeature.
523//
524// PARAMETERS:
525// InCmdList (D3D12 only):
526// Command list to use to execute GPU commands. Must:
527// - Be open and recording
528// - Have a node mask that includes the device provided in
529// NVSDK_NGX_D3D12_Init
530// - Be executed on a non-copy command queue
531//
532// InDevCtx (D3D11 only):
533// Device context to use to execute GPU commands. Must be an immediate
534// context. Passing a deferred context is not supported and will cause the
535// API to return an error.
536//
537// InFeatureID:
538// Identifier of the feature to initialize.
539//
540// InParameters:
541// Parameters used to create the feature.
542//
543// OutHandle:
544// Handle which uniquely identifies the feature.
545//
546// RETURNS:
547// NVSDK_NGX_Result indicating success or failure. Common values include:
548// - NVSDK_NGX_Result_Success if the function executed successfully
549// - NVSDK_NGX_Result_FAIL_UnableToInitializeFeature if the feature
550// cannot be created, for example, because the feature is not supported
551// on the current hardware, or because the DLL could not be found
552// - NVSDK_NGX_Result_FAIL_InvalidParameter if any of the input
553// parameters are invalid
554// - NVSDK_NGX_Result_FAIL_FeatureAlreadyExists if a feature instance
555// with the same parameters has already been created, and the feature
556// doesn't allow multiple instances to be created with the same
557// parameters.
558// Check the NGX logs for additional information about any failures.
559//
560#if defined(NGX_SNIPPET_BUILD)
561NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_CreateFeature(ID3D11DeviceContext *InDevCtx, NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
562NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsCommandList *InCmdList, NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
563NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_CreateFeature(NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
564NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_CreateFeature1(NVSDK_NGX_CUDADevice *InDevice, NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
565#else
566NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_CreateFeature(ID3D11DeviceContext *InDevCtx, NVSDK_NGX_Feature InFeatureID, NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
567NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_CreateFeature(ID3D12GraphicsCommandList *InCmdList, NVSDK_NGX_Feature InFeatureID, NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
568NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_CreateFeature(NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
569NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_CreateFeature1(NVSDK_NGX_CUDADevice *InDevice, NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
570
571#endif // defined(NGX_SNIPPET_BUILD)
572
573////////////////////////////////////////////////////////////////////////////////
574// NVSDK_NGX_ReleaseFeature
575// -----------------------------------------------------------------------------
576// Releases the specified NGX feature.
577//
578// DESCRIPTION:
579// Releases the feature associated with the given handle and frees its
580// memory. Handles are not reference counted, so after this call, it is
581// invalid to use the provided handle.
582//
583// PARAMETERS:
584// InHandle:
585// Handle to the feature to be released.
586//
587// RETURNS:
588// NVSDK_NGX_Result indicating success or failure.
589//
590NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
591NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
592NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
593
594////////////////////////////////////////////////////////////////////////////////
595// NVSDK_NGX_GetFeatureRequirements
596// -----------------------------------------------------------------------------
597// Identifies system requirements to support a given NGX feature.
598//
599// DESCRIPTION:
600// Utility function used to identify system requirements to support a given
601// NGX feature on a system, given its display device subsystem adapter
602// information that will be subsequently used for creating the graphics
603// device. The output parameter OutSupported will be populated with
604// requirements and is valid if and only if the function returns
605// NVSDK_NGX_Result_Success. The result includes:
606// - FeatureSupported: Bitfield of reasons why the feature is
607// unsupported, as specified in NVSDK_NGX_Feature_Support_Result. 0 if
608// the feature is supported
609// - MinHWArchitecture: The hardware architecture version corresponding
610// to an NV_GPU_ARCHITECTURE_ID value defined in the NvAPI GPU
611// Framework
612// - MinOSVersion: The minimum OS version required for the provided
613// feature
614//
615// NVSDK_NGX_Init does NOT need to be called before calling this function.
616// Applications may wish to use this function to determine whether a
617// desired feature is supported before initializing the complete SDK.
618//
619// PARAMETERS:
620// Adapter (D3D11/12 only):
621// Physical adapter which will be used to create the graphics device.
622//
623// FeatureDiscoveryInfo:
624// Struct containing information about the feature to query and how it is
625// expected to be initialized, including the feature ID and information
626// that would be provided to NVSDK_NGX_Init.
627//
628// OutSupported:
629// Populated with the requirements for the specified feature.
630//
631// RETURNS:
632// NVSDK_NGX_Result indicating success or failure.
633//
634NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_GetFeatureRequirements(IDXGIAdapter *Adapter,
635 const NVSDK_NGX_FeatureDiscoveryInfo *FeatureDiscoveryInfo,
636 NVSDK_NGX_FeatureRequirement *OutSupported);
637
638NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_GetFeatureRequirements(IDXGIAdapter *Adapter,
639 const NVSDK_NGX_FeatureDiscoveryInfo *FeatureDiscoveryInfo,
640 NVSDK_NGX_FeatureRequirement *OutSupported);
641
642NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_GetFeatureRequirements(int CudaDevice,
643 const NVSDK_NGX_FeatureDiscoveryInfo *FeatureDiscoveryInfo,
644 NVSDK_NGX_FeatureRequirement *OutSupported);
645
646////////////////////////////////////////////////////////////////////////////////
647// NVSDK_NGX_EvaluateFeature
648// -----------------------------------------------------------------------------
649// Evaluates the specified NGX feature using the provided parameters.
650//
651// DESCRIPTION:
652// Evaluates the given feature using the provided parameters. The
653// parameters required to evaluate a feature vary. Refer to the feature's
654// documentation and sample code to determine which input parameters are
655// needed.
656//
657// To evaluate a feature, an NVSDK_NGX_Handle to an instance of that
658// feature, created with NVSDK_NGX_CreateFeature, must be provided.
659//
660// For most features, it is beneficial to pass as many input buffers and
661// parameters as possible (e.g., provide all render targets like color,
662// albedo, normals, depth, etc.). This will ensure maximum future
663// compatibility with new updates.
664//
665// PARAMETERS:
666// InCmdList (D3D12 only):
667// Command list to use to execute GPU commands. Must be:
668// - Open and recording
669// - With a node mask including the device provided in NVSDK_NGX_D3D12_Init
670// - Executed on a non-copy command queue
671//
672// InDevCtx (D3D11 only):
673// Device context to use to execute GPU commands. Must be an immediate
674// context. Passing a deferred context is not supported and will cause the
675// API to return an error.
676//
677// InFeatureHandle:
678// Handle representing the feature to be evaluated.
679//
680// InParameters:
681// List of parameters required to evaluate the feature.
682//
683// InCallback:
684// Optional callback for features that might take longer to execute. If
685// specified, the SDK will call it with progress values in the range 0.0f -
686// 1.0f. Not all features support progress callbacks. Refer to the
687// documentation for the specific feature to determine whether or not
688// progress callbacks are supported.
689//
690// RETURNS:
691// NVSDK_NGX_Result indicating success or failure. Common values include:
692// - NVSDK_NGX_Result_Success if the function executed successfully.
693// - NVSDK_NGX_Result_FAIL_InvalidParameter if any of the input
694// parameters are missing or invalid.
695// - NVSDK_NGX_Result_FAIL_FeatureNotFound if a feature with the provided
696// handle could not be found.
697// Check the NGX logs for additional information about any failures.
698//
699#ifdef __cplusplus
700typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback)(float InCurrentProgress, bool &OutShouldCancel);
701NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_EvaluateFeature(ID3D11DeviceContext *InDevCtx, const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback InCallback = NULL);
702NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_EvaluateFeature(ID3D12GraphicsCommandList *InCmdList, const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback InCallback = NULL);
703NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_EvaluateFeature(const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback InCallback = NULL);
704#endif
705
706typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback_C)(float InCurrentProgress, bool *OutShouldCancel);
707NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_EvaluateFeature_C(ID3D11DeviceContext *InDevCtx, const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback_C InCallback);
708NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_EvaluateFeature_C(ID3D12GraphicsCommandList *InCmdList, const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback_C InCallback);
709NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_EvaluateFeature_C(const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback_C InCallback);
710
711#if defined(NGX_SNIPPET_BUILD)
712// No NGX Core <---> Snippet interfaces
713#else
714NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_UpdateFeature(const NVSDK_NGX_Application_Identifier *ApplicationId, const NVSDK_NGX_Feature FeatureID);
715#endif // defined(NGX_SNIPPET_BUILD)
716
717// NGX return-code conversion-to-string utility only as a helper for debugging/logging - not for official use.
718const wchar_t* NVSDK_CONV GetNGXResultAsString(NVSDK_NGX_Result InNGXResult);
719
720#ifdef __cplusplus
721} // extern "C"
722#endif
723
724#endif // #define NVSDK_NGX_H
thirdparty/ngx/include/nvsdk_ngx_defs.h +817 -0
……@@ -0,0 +1,817 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2018-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13#ifndef NVSDK_NGX_DEFS_H
14#define NVSDK_NGX_DEFS_H
15#pragma once
16
17#ifndef __cplusplus
18#include <stddef.h> // For size_t
19#include <stdbool.h>
20#include <wchar.h>
21#endif
22
23#ifdef __cplusplus
24extern "C"
25{
26#endif
27
28#ifdef __cplusplus
29#if defined(NGX_CORE_BUILD) && defined(_WIN32)
30#define NVSDK_NGX_API extern "C" __declspec(dllexport)
31#else
32#define NVSDK_NGX_API extern "C"
33#endif
34#else
35#if defined(NGX_CORE_BUILD) && defined(_WIN32)
36#define NVSDK_NGX_API __declspec(dllexport)
37#else
38#define NVSDK_NGX_API
39#endif
40#endif
41
42#ifdef __GNUC__
43#define NVSDK_CONV
44#else
45#define NVSDK_CONV __cdecl
46#endif
47
48#define NVSDK_NGX_ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0]))
49
50// Version Notes:
51// Version 0x0000014:
52// * Added a logging callback that the app may pass in on init
53// * Added ability for the app to override the logging level
54// Version 0x0000015:
55// * Support multiple GPUs (bug 3270533)
56#define NVSDK_NGX_VERSION_API_MACRO 0x0000015 // NGX_VERSION_DOT 1.5.0
57
58#ifdef __cplusplus
59#if __cplusplus >= 201402L
60#define SR_DEPRECATED_SHARPENING [[deprecated("Sharpness is not supported")]]
61#else
62#define SR_DEPRECATED_SHARPENING
63#endif
64#else
65#define SR_DEPRECATED_SHARPENING
66#endif
67
68typedef unsigned long long AppId;
69
70typedef enum NVSDK_NGX_DLSS_Hint_Render_Preset
71{
72 NVSDK_NGX_DLSS_Hint_Render_Preset_Default = 0, // default behavior, may or may not change after OTA
73 // NVSDK_NGX_DLSS_Hint_Render_Preset_A removed, use preset J or K
74 // NVSDK_NGX_DLSS_Hint_Render_Preset_B removed, use preset J or K
75 // NVSDK_NGX_DLSS_Hint_Render_Preset_C removed, use preset J or K
76 // NVSDK_NGX_DLSS_Hint_Render_Preset_D removed, use preset J or K
77 // NVSDK_NGX_DLSS_Hint_Render_Preset_E removed, use preset J or K
78 NVSDK_NGX_DLSS_Hint_Render_Preset_F = 6, // Deprecated
79 NVSDK_NGX_DLSS_Hint_Render_Preset_G = 7, // Do not use, reverts to default behavior
80 NVSDK_NGX_DLSS_Hint_Render_Preset_H_Reserved = 8, // Do not use, reverts to default behavior
81 NVSDK_NGX_DLSS_Hint_Render_Preset_I_Reserved = 9, // Do not use, reverts to default behavior
82 NVSDK_NGX_DLSS_Hint_Render_Preset_J = 10, // Similar to preset K. Preset J might exhibit slightly less ghosting at the cost of extra flickering. Preset K is generally recommended over preset J
83 NVSDK_NGX_DLSS_Hint_Render_Preset_K = 11, // Default preset for DLAA/Balanced/Quality modes that is transformer based. Best image quality preset at a higher performance cost
84 NVSDK_NGX_DLSS_Hint_Render_Preset_L = 12, // Default for Ultra Perf mode
85 NVSDK_NGX_DLSS_Hint_Render_Preset_M = 13, // Default for Perf mode
86 NVSDK_NGX_DLSS_Hint_Render_Preset_N = 14, // Do not use, reverts to default behavior
87 NVSDK_NGX_DLSS_Hint_Render_Preset_O = 15, // Do not use, reverts to default behavior
88} NVSDK_NGX_DLSS_Hint_Render_Preset;
89
90typedef struct NVSDK_NGX_FeatureCommonInfo_Internal NVSDK_NGX_FeatureCommonInfo_Internal;
91
92typedef enum NVSDK_NGX_Version { NVSDK_NGX_Version_API = NVSDK_NGX_VERSION_API_MACRO } NVSDK_NGX_Version;
93
94typedef enum NVSDK_NGX_Result
95{
96 // The operation completed successfully.
97 NVSDK_NGX_Result_Success = 0x1,
98
99 // Generic failure. Check the NGX logs for detailed information.
100 NVSDK_NGX_Result_Fail = 0xBAD00000,
101
102 // The NGX SDK or a specific feature is not supported by the current system,
103 // hardware, and/or graphics API.
104 NVSDK_NGX_Result_FAIL_FeatureNotSupported = NVSDK_NGX_Result_Fail | 1,
105
106 // An error occurred within the underlying platform, which includes the
107 // graphics API in use, the operating system, or other system libraries and
108 // dependencies that are not part of the NGX SDK, such as NvAPI. Consult the
109 // NGX logs and the graphics API's validation layers for detailed
110 // information.
111 NVSDK_NGX_Result_FAIL_PlatformError = NVSDK_NGX_Result_Fail | 2,
112
113 // The NGX feature could not be created because a feature with identical
114 // parameters already exists, and the feature does not support multiple
115 // identical instances.
116 NVSDK_NGX_Result_FAIL_FeatureAlreadyExists = NVSDK_NGX_Result_Fail | 3,
117
118 // A feature associated with the provided handle could not be found.
119 NVSDK_NGX_Result_FAIL_FeatureNotFound = NVSDK_NGX_Result_Fail | 4,
120
121 // One or more provided parameters had an incorrect value or type, or a
122 // required parameter was not provided.
123 NVSDK_NGX_Result_FAIL_InvalidParameter = NVSDK_NGX_Result_Fail | 5,
124
125 // The feature requires a scratch buffer, but none was provided or the
126 // provided buffer is too small. Use NVSDK_NGX_GetScratchBufferSize to
127 // determine the necessary size.
128 NVSDK_NGX_Result_FAIL_ScratchBufferTooSmall = NVSDK_NGX_Result_Fail | 6,
129
130 // A function that requires the NGX SDK to be initialized was called before
131 // the SDK was properly initialized.
132 NVSDK_NGX_Result_FAIL_NotInitialized = NVSDK_NGX_Result_Fail | 7,
133
134 // One or more input buffers supplied to the feature had an unsupported
135 // format.
136 NVSDK_NGX_Result_FAIL_UnsupportedInputFormat = NVSDK_NGX_Result_Fail | 8,
137
138 // The feature requires read/write access to output buffers, but one or more
139 // provided buffers did not have the correct access flags (UAV in
140 // D3D11/D3D12).
141 NVSDK_NGX_Result_FAIL_RWFlagMissing = NVSDK_NGX_Result_Fail | 9,
142
143 // A required input parameter was not provided.
144 NVSDK_NGX_Result_FAIL_MissingInput = NVSDK_NGX_Result_Fail | 10,
145
146 // The requested feature could not be initialized, likely because the
147 // library for that feature could not be found.
148 NVSDK_NGX_Result_FAIL_UnableToInitializeFeature = NVSDK_NGX_Result_Fail | 11,
149
150 // A function was used which requires a newer version of the NVIDIA Display
151 // Driver or feature library than is currently installed.
152 NVSDK_NGX_Result_FAIL_OutOfDate = NVSDK_NGX_Result_Fail | 12,
153
154 // An operation could not be completed because the system lacked sufficient
155 // GPU memory.
156 NVSDK_NGX_Result_FAIL_OutOfGPUMemory = NVSDK_NGX_Result_Fail | 13,
157
158 // One or more buffers provided to the feature had an unsupported format.
159 NVSDK_NGX_Result_FAIL_UnsupportedFormat = NVSDK_NGX_Result_Fail | 14,
160
161 // The SDK does not have the necessary write permissions for the path
162 // specified in InApplicationDataPath.
163 NVSDK_NGX_Result_FAIL_UnableToWriteToAppDataPath = NVSDK_NGX_Result_Fail | 15,
164
165 // A parameter supplied to the feature is either unsupported by the current
166 // version or has an unsupported value.
167 NVSDK_NGX_Result_FAIL_UnsupportedParameter = NVSDK_NGX_Result_Fail | 16,
168
169 // NVIDIA has restricted the use of this feature in the current application.
170 // Contact NVIDIA for further information.
171 NVSDK_NGX_Result_FAIL_Denied = NVSDK_NGX_Result_Fail | 17,
172
173 // The requested feature or functionality has not been implemented in the
174 // current version of the NGX SDK, display driver, or feature library.
175 NVSDK_NGX_Result_FAIL_NotImplemented = NVSDK_NGX_Result_Fail | 18,
176} NVSDK_NGX_Result;
177
178#define NVSDK_NGX_SUCCEED(value) (((value) & 0xFFF00000) != NVSDK_NGX_Result_Fail)
179#define NVSDK_NGX_FAILED(value) (((value) & 0xFFF00000) == NVSDK_NGX_Result_Fail)
180
181typedef enum NVSDK_NGX_Feature
182{
183 NVSDK_NGX_Feature_Reserved0 = 0,
184
185 NVSDK_NGX_Feature_SuperSampling = 1,
186
187 NVSDK_NGX_Feature_InPainting = 2,
188
189 NVSDK_NGX_Feature_ImageSuperResolution = 3,
190
191 NVSDK_NGX_Feature_SlowMotion = 4,
192
193 NVSDK_NGX_Feature_VideoSuperResolution = 5,
194
195 NVSDK_NGX_Feature_Reserved1 = 6,
196
197 NVSDK_NGX_Feature_Reserved2 = 7,
198
199 NVSDK_NGX_Feature_Reserved3 = 8,
200
201 NVSDK_NGX_Feature_ImageSignalProcessing = 9,
202
203 NVSDK_NGX_Feature_DeepResolve = 10,
204
205 NVSDK_NGX_Feature_FrameGeneration = 11,
206
207 NVSDK_NGX_Feature_DeepDVC = 12,
208
209 NVSDK_NGX_Feature_RayReconstruction = 13,
210
211 NVSDK_NGX_Feature_Reserved14 = 14,
212
213 NVSDK_NGX_Feature_Reserved15 = 15,
214
215 NVSDK_NGX_Feature_Reserved16 = 16,
216
217 // New features go here
218 NVSDK_NGX_Feature_Count,
219
220 // These members are not strictly NGX features, but are
221 // components of the NGX system, and it may sometimes
222 // be useful to identify them using the same enum
223 NVSDK_NGX_Feature_Reserved_SDK = 32764,
224
225 NVSDK_NGX_Feature_Reserved_Core = 32765,
226
227 NVSDK_NGX_Feature_Reserved_Unknown = 32766
228} NVSDK_NGX_Feature;
229
230//TODO create grayscale format (R32F?)
231typedef enum NVSDK_NGX_Buffer_Format
232{
233 NVSDK_NGX_Buffer_Format_Unknown,
234 NVSDK_NGX_Buffer_Format_RGB8UI,
235 NVSDK_NGX_Buffer_Format_RGB16F,
236 NVSDK_NGX_Buffer_Format_RGB32F,
237 NVSDK_NGX_Buffer_Format_RGBA8UI,
238 NVSDK_NGX_Buffer_Format_RGBA16F,
239 NVSDK_NGX_Buffer_Format_RGBA32F,
240} NVSDK_NGX_Buffer_Format;
241
242typedef enum NVSDK_NGX_PerfQuality_Value
243{
244 NVSDK_NGX_PerfQuality_Value_MaxPerf,
245 NVSDK_NGX_PerfQuality_Value_Balanced,
246 NVSDK_NGX_PerfQuality_Value_MaxQuality,
247 // Extended PerfQuality modes
248 NVSDK_NGX_PerfQuality_Value_UltraPerformance,
249 NVSDK_NGX_PerfQuality_Value_UltraQuality,
250 NVSDK_NGX_PerfQuality_Value_DLAA,
251} NVSDK_NGX_PerfQuality_Value;
252
253typedef enum NVSDK_NGX_RTX_Value
254{
255 NVSDK_NGX_RTX_Value_Off,
256 NVSDK_NGX_RTX_Value_On,
257} NVSDK_NGX_RTX_Value;
258
259// For each unique instance, a pointer to NVSDK_NGX_CUDADevice is passed in to
260// NVSDK_NGX_CUDA_Init1, NVSDK_NGX_CUDA_CreateFeature1 and NVSDK_NGX_CUDA_Shutdown1.
261// This is needed in the case of running multiple threads in a single process.
262// Depending on the app usage of CUDA, one or both of cudaContext and cudaStream can be set.
263struct NVSDK_NGX_CUDADevice
264{
265 void* cudaContext; // CUcontext returned from cuCtxCreate
266 void* cudaStream; // CUstream returned from cuStreamCreate
267};
268
269typedef enum NVSDK_NGX_DLSS_Mode
270{
271 NVSDK_NGX_DLSS_Mode_Off, // use existing in-engine AA + upscale solution
272 NVSDK_NGX_DLSS_Mode_DLSS_DLISP,
273 NVSDK_NGX_DLSS_Mode_DLISP_Only, // use existing in-engine AA solution
274 NVSDK_NGX_DLSS_Mode_DLSS, // DLSS will apply AA and upsample at the same time
275} NVSDK_NGX_DLSS_Mode;
276
277typedef struct NVSDK_NGX_Handle { unsigned int Id; } NVSDK_NGX_Handle;
278
279typedef enum NVSDK_NGX_DLSS_Feature_Flags
280{
281 NVSDK_NGX_DLSS_Feature_Flags_IsInvalid = 1 << 31,
282
283 NVSDK_NGX_DLSS_Feature_Flags_None = 0,
284 NVSDK_NGX_DLSS_Feature_Flags_IsHDR = 1 << 0,
285 NVSDK_NGX_DLSS_Feature_Flags_MVLowRes = 1 << 1,
286 NVSDK_NGX_DLSS_Feature_Flags_MVJittered = 1 << 2,
287 NVSDK_NGX_DLSS_Feature_Flags_DepthInverted = 1 << 3,
288 NVSDK_NGX_DLSS_Feature_Flags_Reserved_0 = 1 << 4,
289 NVSDK_NGX_DLSS_Feature_Flags_DoSharpening SR_DEPRECATED_SHARPENING = 1 << 5, // Sharpness is not supported
290 NVSDK_NGX_DLSS_Feature_Flags_AutoExposure = 1 << 6,
291 NVSDK_NGX_DLSS_Feature_Flags_AlphaUpscaling = 1 << 7,
292} NVSDK_NGX_DLSS_Feature_Flags;
293
294typedef enum NVSDK_NGX_ToneMapperType
295{
296 NVSDK_NGX_TONEMAPPER_STRING = 0,
297 NVSDK_NGX_TONEMAPPER_REINHARD,
298 NVSDK_NGX_TONEMAPPER_ONEOVERLUMA,
299 NVSDK_NGX_TONEMAPPER_ACES,
300 NVSDK_NGX_TONEMAPPERTYPE_NUM
301} NVSDK_NGX_ToneMapperType;
302
303typedef enum NVSDK_NGX_GBufferType
304{
305 NVSDK_NGX_GBUFFER_ALBEDO = 0,
306 NVSDK_NGX_GBUFFER_ROUGHNESS,
307 NVSDK_NGX_GBUFFER_METALLIC,
308 NVSDK_NGX_GBUFFER_SPECULAR,
309 NVSDK_NGX_GBUFFER_SUBSURFACE,
310 NVSDK_NGX_GBUFFER_NORMALS,
311 NVSDK_NGX_GBUFFER_SHADINGMODELID, /* unique identifier for drawn object or how the object is drawn */
312 NVSDK_NGX_GBUFFER_MATERIALID, /* unique identifier for material */
313 NVSDK_NGX_GBUFFER_SPECULAR_ALBEDO,
314 NVSDK_NGX_GBUFFER_INDIRECT_ALBEDO,
315 NVSDK_NGX_GBUFFER_SPECULAR_MVEC,
316 NVSDK_NGX_GBUFFER_DISOCCL_MASK,
317 NVSDK_NGX_GBUFFER_EMISSIVE,
318 NVSDK_NGX_GBUFFERTYPE_NUM = 16
319} NVSDK_NGX_GBufferType;
320
321typedef struct NVSDK_NGX_Coordinates
322{
323 unsigned int X;
324 unsigned int Y;
325} NVSDK_NGX_Coordinates;
326
327typedef struct NVSDK_NGX_Dimensions
328{
329 unsigned int Width;
330 unsigned int Height;
331} NVSDK_NGX_Dimensions;
332
333typedef struct NVSDK_NGX_PrecisionInfo
334{
335 // 1 if and only if the associated resource buffer is considered low-precision
336 unsigned int IsLowPrecision;
337
338 // Bias and Scale values, such that `hi = lo * Scale + Bias`
339 float Bias;
340 float Scale;
341} NVSDK_NGX_PrecisionInfo;
342
343typedef struct NVSDK_NGX_PathListInfo
344{
345 // Pointer to a const string
346 wchar_t const* const* Path;
347 // Path-list length
348 unsigned int Length;
349} NVSDK_NGX_PathListInfo;
350
351typedef enum NVSDK_NGX_Logging_Level
352{
353 NVSDK_NGX_LOGGING_LEVEL_OFF = 0,
354 NVSDK_NGX_LOGGING_LEVEL_ON,
355 NVSDK_NGX_LOGGING_LEVEL_VERBOSE,
356 NVSDK_NGX_LOGGING_LEVEL_NUM
357} NVSDK_NGX_Logging_Level;
358
359// A logging callback provided by the app to allow piping log lines back to the app.
360// Please take careful note of the signature and calling convention.
361// The callback must be able to be called from any thread.
362// It must also be fully thread-safe and any number of threads may call into it concurrently.
363// It must fully process message by the time it returns, and there is no guarantee that
364// message will still be valid or allocated after it returns.
365// message will be a null-terminated string and may contain multibyte characters.
366#if defined(__GNUC__) || defined(__clang__)
367typedef void NVSDK_CONV(*NVSDK_NGX_AppLogCallback)(const char* message, NVSDK_NGX_Logging_Level loggingLevel, NVSDK_NGX_Feature sourceComponent);
368#else
369typedef void(NVSDK_CONV* NVSDK_NGX_AppLogCallback)(const char* message, NVSDK_NGX_Logging_Level loggingLevel, NVSDK_NGX_Feature sourceComponent);
370#endif
371
372typedef struct NVSDK_NGX_LoggingInfo
373{
374 // Fields below were introduced in SDK version 0x0000014
375
376 // App-provided logging callback
377 NVSDK_NGX_AppLogCallback LoggingCallback;
378
379 // The minimum logging level to use. If this is higher
380 // than the logging level otherwise configured, this will override
381 // that logging level. Otherwise, that logging level will be used.
382 NVSDK_NGX_Logging_Level MinimumLoggingLevel;
383
384 // Whether or not to disable writing log lines to sinks other than the app log callback. This
385 // may be useful if the app provides a logging callback. LoggingCallback must be non-null and point
386 // to a valid logging callback if this is set to true.
387 bool DisableOtherLoggingSinks;
388
389} NVSDK_NGX_LoggingInfo;
390
391typedef struct NVSDK_NGX_FeatureCommonInfo
392{
393 // List of all paths in descending order of search sequence to locate a feature dll in, other than the default path - application folder.
394 NVSDK_NGX_PathListInfo PathListInfo;
395 // Used internally by NGX
396 NVSDK_NGX_FeatureCommonInfo_Internal* InternalData; // Introduced in SDK version 0x0000013
397
398 // Fields below were introduced in SDK version 0x0000014
399 NVSDK_NGX_LoggingInfo LoggingInfo;
400} NVSDK_NGX_FeatureCommonInfo;
401
402typedef enum NVSDK_NGX_Resource_VK_Type
403{
404 NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW,
405 NVSDK_NGX_RESOURCE_VK_TYPE_VK_BUFFER
406} NVSDK_NGX_Resource_VK_Type;
407
408typedef enum NVSDK_NGX_Opt_Level
409{
410 NVSDK_NGX_OPT_LEVEL_UNDEFINED = 0,
411 NVSDK_NGX_OPT_LEVEL_DEBUG = 20,
412 NVSDK_NGX_OPT_LEVEL_DEVELOP = 30,
413 NVSDK_NGX_OPT_LEVEL_RELEASE = 40
414} NVSDK_NGX_Opt_Level;
415
416typedef enum NVSDK_NGX_EngineType
417{
418 NVSDK_NGX_ENGINE_TYPE_CUSTOM = 0,
419 NVSDK_NGX_ENGINE_TYPE_UNREAL,
420 NVSDK_NGX_ENGINE_TYPE_UNITY,
421 NVSDK_NGX_ENGINE_TYPE_OMNIVERSE,
422 NVSDK_NGX_ENGINE_COUNT
423} NVSDK_NGX_EngineType;
424
425typedef enum NVSDK_NGX_Feature_Support_Result
426{
427 NVSDK_NGX_FeatureSupportResult_Supported = 0,
428 NVSDK_NGX_FeatureSupportResult_CheckNotPresent = 1,
429 NVSDK_NGX_FeatureSupportResult_DriverVersionUnsupported = 2,
430 NVSDK_NGX_FeatureSupportResult_AdapterUnsupported = 4,
431 NVSDK_NGX_FeatureSupportResult_OSVersionBelowMinimumSupported = 8,
432 NVSDK_NGX_FeatureSupportResult_NotImplemented = 16
433} NVSDK_NGX_Feature_Support_Result;
434
435typedef enum NVSDK_NGX_Application_Identifier_Type
436{
437 NVSDK_NGX_Application_Identifier_Type_Application_Id = 0,
438 NVSDK_NGX_Application_Identifier_Type_Project_Id = 1,
439} NVSDK_NGX_Application_Identifier_Type;
440
441/////////////////////////////////////////////////////////////////////////////////////////////////////////////
442// NVSDK_NGX_ProjectIdDescription
443// -------------------------------------
444// Contains information to identify an application built using a common rendering engine (list of supported rendering engines is defined in NVSDK_NGX_EngineType).
445// Should only be used by plugins for the supported rendering engines, unless using NVSDK_NGX_ENGINE_TYPE_CUSTOM as the engine type.
446//
447// ProjectId
448// Unique Id provided by the rendering engine used
449//
450// EngineType
451// Rendering engine used by the application / plugin.
452// Use NVSDK_NGX_ENGINE_TYPE_CUSTOM if the specific engine type is not supported explicitly
453//
454// EngineVersion
455// Version number of the rendering engine used by the application / plugin.
456//
457// DESCRIPTION:
458// Contains information to identify an application built using a common rendering engine (list of supported rendering engines is defined in NVSDK_NGX_EngineType).
459// Should only be used by plugins for the supported rendering engines, unless using NVSDK_NGX_ENGINE_TYPE_CUSTOM as the engine type.
460//
461typedef struct NVSDK_NGX_ProjectIdDescription
462{
463 const char* ProjectId;
464 NVSDK_NGX_EngineType EngineType;
465 const char* EngineVersion;
466} NVSDK_NGX_ProjectIdDescription;
467
468/////////////////////////////////////////////////////////////////////////////////////////////////////////////
469// NVSDK_NGX_Application_Identifier
470// -------------------------------------
471// Identifier for each application. Required for over the air updates (both optional and mandatory)
472// as well as for app-specific customizations for features like DLSS-SR
473//
474// IdentifierType:
475// Whether using a NVSDK_NGX_ProjectIdDescription or an Unique Application Identifier
476//
477// ProjectDesc:
478// If using NVSDK_NGX_ProjectIdDescription, this contains the project ID and engine info required to identify this app
479//
480// ApplicationIdentifier:
481// If not using NVSDK_NGX_ProjectIdDescription, this contains an ID provided by NVIDIA for this app
482// If your NVIDIA contact did not provide you an ID for this purpose, use ProjectDesc with NVSDK_NGX_ENGINE_TYPE_CUSTOM as the engine type
483//
484typedef struct NVSDK_NGX_Application_Identifier
485{
486 NVSDK_NGX_Application_Identifier_Type IdentifierType;
487 union v {
488 NVSDK_NGX_ProjectIdDescription ProjectDesc;
489 unsigned long long ApplicationId;
490 } v;
491} NVSDK_NGX_Application_Identifier;
492
493/////////////////////////////////////////////////////////////////////////////////////////////////////////////
494// NVSDK_NGX_FeatureDiscoveryInfo
495// -------------------------------------
496// Contains information common to all features, used by NGX in determining requested Feature availability
497//
498// InSDKVersion:
499// API Struct version number
500//
501// FeatureID
502// Valid NVSDK_NGX_Feature enum corresponding to DLSS v3 Feature which is being queried for availability
503//
504// ApplicationId
505// Unique Id provided by NVIDIA corresponding to a particular Application or alternatively custom Id set by Engine
506//
507// InApplicationDataPath:
508// Folder to store logs and other temporary files (write access required),
509// Normally this would be a location in Documents or ProgramData.
510//
511// FeatureInfo:
512// Contains information common to all features, presently only a list of all paths
513// feature dlls can be located in, other than the default path - application directory.
514//
515typedef struct NVSDK_NGX_FeatureDiscoveryInfo
516{
517 NVSDK_NGX_Version SDKVersion;
518 NVSDK_NGX_Feature FeatureID;
519 NVSDK_NGX_Application_Identifier Identifier;
520 const wchar_t* ApplicationDataPath;
521 const NVSDK_NGX_FeatureCommonInfo* FeatureInfo;
522} NVSDK_NGX_FeatureDiscoveryInfo;
523
524typedef struct NVSDK_NGX_FeatureRequirement
525{
526 // Bitfield of bit shifted values specified in NVSDK_NGX_Feature_Support_Result. 0 if Feature is Supported.
527 NVSDK_NGX_Feature_Support_Result FeatureSupported;
528
529 // Returned HW Architecture value corresponding to NV_GPU_ARCHITECTURE_ID values defined in NvAPI GPU Framework.
530 unsigned int MinHWArchitecture;
531
532 // Value corresponding to minimum OS version required for NGX Feature Support
533 char MinOSVersion[255];
534} NVSDK_NGX_FeatureRequirement;
535
536// Read-only parameters provided by NGX
537#define NVSDK_NGX_EParameter_Reserved00 "#\x00"
538#define NVSDK_NGX_EParameter_SuperSampling_Available "#\x01"
539#define NVSDK_NGX_EParameter_InPainting_Available "#\x02"
540#define NVSDK_NGX_EParameter_ImageSuperResolution_Available "#\x03"
541#define NVSDK_NGX_EParameter_SlowMotion_Available "#\x04"
542#define NVSDK_NGX_EParameter_VideoSuperResolution_Available "#\x05"
543#define NVSDK_NGX_EParameter_Reserved06 "#\x06"
544#define NVSDK_NGX_EParameter_Reserved07 "#\x07"
545#define NVSDK_NGX_EParameter_Reserved08 "#\x08"
546#define NVSDK_NGX_EParameter_ImageSignalProcessing_Available "#\x09"
547#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_2_1 "#\x0a"
548#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_3_1 "#\x0b"
549#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_3_2 "#\x0c"
550#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_4_3 "#\x0d"
551#define NVSDK_NGX_EParameter_NumFrames "#\x0e"
552#define NVSDK_NGX_EParameter_Scale "#\x0f"
553#define NVSDK_NGX_EParameter_Width "#\x10"
554#define NVSDK_NGX_EParameter_Height "#\x11"
555#define NVSDK_NGX_EParameter_OutWidth "#\x12"
556#define NVSDK_NGX_EParameter_OutHeight "#\x13"
557#define NVSDK_NGX_EParameter_Sharpness "#\x14"
558#define NVSDK_NGX_EParameter_Scratch "#\x15"
559#define NVSDK_NGX_EParameter_Scratch_SizeInBytes "#\x16"
560#define NVSDK_NGX_EParameter_EvaluationNode "#\x17" // valid since API 0x13 (replaced a deprecated param)
561#define NVSDK_NGX_EParameter_Input1 "#\x18"
562#define NVSDK_NGX_EParameter_Input1_Format "#\x19"
563#define NVSDK_NGX_EParameter_Input1_SizeInBytes "#\x1a"
564#define NVSDK_NGX_EParameter_Input2 "#\x1b"
565#define NVSDK_NGX_EParameter_Input2_Format "#\x1c"
566#define NVSDK_NGX_EParameter_Input2_SizeInBytes "#\x1d"
567#define NVSDK_NGX_EParameter_Color "#\x1e"
568#define NVSDK_NGX_EParameter_Color_Format "#\x1f"
569#define NVSDK_NGX_EParameter_Color_SizeInBytes "#\x20"
570#define NVSDK_NGX_EParameter_Albedo "#\x21"
571#define NVSDK_NGX_EParameter_Output "#\x22"
572#define NVSDK_NGX_EParameter_Output_Format "#\x23"
573#define NVSDK_NGX_EParameter_Output_SizeInBytes "#\x24"
574#define NVSDK_NGX_EParameter_Reset "#\x25"
575#define NVSDK_NGX_EParameter_BlendFactor "#\x26"
576#define NVSDK_NGX_EParameter_MotionVectors "#\x27"
577#define NVSDK_NGX_EParameter_Rect_X "#\x28"
578#define NVSDK_NGX_EParameter_Rect_Y "#\x29"
579#define NVSDK_NGX_EParameter_Rect_W "#\x2a"
580#define NVSDK_NGX_EParameter_Rect_H "#\x2b"
581#define NVSDK_NGX_EParameter_MV_Scale_X "#\x2c"
582#define NVSDK_NGX_EParameter_MV_Scale_Y "#\x2d"
583#define NVSDK_NGX_EParameter_Model "#\x2e"
584#define NVSDK_NGX_EParameter_Format "#\x2f"
585#define NVSDK_NGX_EParameter_SizeInBytes "#\x30"
586#define NVSDK_NGX_EParameter_ResourceAllocCallback "#\x31"
587#define NVSDK_NGX_EParameter_BufferAllocCallback "#\x32"
588#define NVSDK_NGX_EParameter_Tex2DAllocCallback "#\x33"
589#define NVSDK_NGX_EParameter_ResourceReleaseCallback "#\x34"
590#define NVSDK_NGX_EParameter_CreationNodeMask "#\x35"
591#define NVSDK_NGX_EParameter_VisibilityNodeMask "#\x36"
592#define NVSDK_NGX_EParameter_PreviousOutput "#\x37"
593#define NVSDK_NGX_EParameter_MV_Offset_X "#\x38"
594#define NVSDK_NGX_EParameter_MV_Offset_Y "#\x39"
595#define NVSDK_NGX_EParameter_Hint_UseFireflySwatter "#\x3a"
596#define NVSDK_NGX_EParameter_Resource_Width "#\x3b"
597#define NVSDK_NGX_EParameter_Resource_Height "#\x3c"
598#define NVSDK_NGX_EParameter_Depth "#\x3d"
599#define NVSDK_NGX_EParameter_DLSSOptimalSettingsCallback "#\x3e"
600#define NVSDK_NGX_EParameter_PerfQualityValue "#\x3f"
601#define NVSDK_NGX_EParameter_RTXValue "#\x40"
602#define NVSDK_NGX_EParameter_DLSSMode "#\x41"
603#define NVSDK_NGX_EParameter_DeepResolve_Available "#\x42"
604#define NVSDK_NGX_EParameter_Deprecated_43 "#\x43"
605#define NVSDK_NGX_EParameter_OptLevel "#\x44"
606#define NVSDK_NGX_EParameter_IsDevSnippetBranch "#\x45"
607#define NVSDK_NGX_EParameter_DeepDVC_Available "#\x46"
608#define NVSDK_NGX_EParameter_Graphics_API "#\x47"
609#define NVSDK_NGX_EParameter_Reserved_48 "#\x48"
610#define NVSDK_NGX_EParameter_Reserved_49 "#\x49"
611
612#define NVSDK_NGX_Parameter_OptLevel "Snippet.OptLevel"
613#define NVSDK_NGX_Parameter_IsDevSnippetBranch "Snippet.IsDevBranch"
614#define NVSDK_NGX_Parameter_SuperSampling_ScaleFactor "SuperSampling.ScaleFactor"
615#define NVSDK_NGX_Parameter_ImageSignalProcessing_ScaleFactor "ImageSignalProcessing.ScaleFactor"
616#define NVSDK_NGX_Parameter_SuperSampling_Available "SuperSampling.Available"
617#define NVSDK_NGX_Parameter_InPainting_Available "InPainting.Available"
618#define NVSDK_NGX_Parameter_ImageSuperResolution_Available "ImageSuperResolution.Available"
619#define NVSDK_NGX_Parameter_SlowMotion_Available "SlowMotion.Available"
620#define NVSDK_NGX_Parameter_VideoSuperResolution_Available "VideoSuperResolution.Available"
621#define NVSDK_NGX_Parameter_ImageSignalProcessing_Available "ImageSignalProcessing.Available"
622#define NVSDK_NGX_Parameter_DeepResolve_Available "DeepResolve.Available"
623#define NVSDK_NGX_Parameter_SuperSampling_NeedsUpdatedDriver "SuperSampling.NeedsUpdatedDriver"
624#define NVSDK_NGX_Parameter_InPainting_NeedsUpdatedDriver "InPainting.NeedsUpdatedDriver"
625#define NVSDK_NGX_Parameter_ImageSuperResolution_NeedsUpdatedDriver "ImageSuperResolution.NeedsUpdatedDriver"
626#define NVSDK_NGX_Parameter_SlowMotion_NeedsUpdatedDriver "SlowMotion.NeedsUpdatedDriver"
627#define NVSDK_NGX_Parameter_VideoSuperResolution_NeedsUpdatedDriver "VideoSuperResolution.NeedsUpdatedDriver"
628#define NVSDK_NGX_Parameter_ImageSignalProcessing_NeedsUpdatedDriver "ImageSignalProcessing.NeedsUpdatedDriver"
629#define NVSDK_NGX_Parameter_DeepResolve_NeedsUpdatedDriver "DeepResolve.NeedsUpdatedDriver"
630#define NVSDK_NGX_Parameter_FrameInterpolation_NeedsUpdatedDriver "FrameInterpolation.NeedsUpdatedDriver"
631#define NVSDK_NGX_Parameter_SuperSampling_MinDriverVersionMajor "SuperSampling.MinDriverVersionMajor"
632#define NVSDK_NGX_Parameter_InPainting_MinDriverVersionMajor "InPainting.MinDriverVersionMajor"
633#define NVSDK_NGX_Parameter_ImageSuperResolution_MinDriverVersionMajor "ImageSuperResolution.MinDriverVersionMajor"
634#define NVSDK_NGX_Parameter_SlowMotion_MinDriverVersionMajor "SlowMotion.MinDriverVersionMajor"
635#define NVSDK_NGX_Parameter_VideoSuperResolution_MinDriverVersionMajor "VideoSuperResolution.MinDriverVersionMajor"
636#define NVSDK_NGX_Parameter_ImageSignalProcessing_MinDriverVersionMajor "ImageSignalProcessing.MinDriverVersionMajor"
637#define NVSDK_NGX_Parameter_DeepResolve_MinDriverVersionMajor "DeepResolve.MinDriverVersionMajor"
638#define NVSDK_NGX_Parameter_FrameInterpolation_MinDriverVersionMajor "FrameInterpolation.MinDriverVersionMajor"
639#define NVSDK_NGX_Parameter_SuperSampling_MinDriverVersionMinor "SuperSampling.MinDriverVersionMinor"
640#define NVSDK_NGX_Parameter_InPainting_MinDriverVersionMinor "InPainting.MinDriverVersionMinor"
641#define NVSDK_NGX_Parameter_ImageSuperResolution_MinDriverVersionMinor "ImageSuperResolution.MinDriverVersionMinor"
642#define NVSDK_NGX_Parameter_SlowMotion_MinDriverVersionMinor "SlowMotion.MinDriverVersionMinor"
643#define NVSDK_NGX_Parameter_VideoSuperResolution_MinDriverVersionMinor "VideoSuperResolution.MinDriverVersionMinor"
644#define NVSDK_NGX_Parameter_ImageSignalProcessing_MinDriverVersionMinor "ImageSignalProcessing.MinDriverVersionMinor"
645#define NVSDK_NGX_Parameter_DeepResolve_MinDriverVersionMinor "DeepResolve.MinDriverVersionMinor"
646#define NVSDK_NGX_Parameter_SuperSampling_FeatureInitResult "SuperSampling.FeatureInitResult"
647#define NVSDK_NGX_Parameter_InPainting_FeatureInitResult "InPainting.FeatureInitResult"
648#define NVSDK_NGX_Parameter_ImageSuperResolution_FeatureInitResult "ImageSuperResolution.FeatureInitResult"
649#define NVSDK_NGX_Parameter_SlowMotion_FeatureInitResult "SlowMotion.FeatureInitResult"
650#define NVSDK_NGX_Parameter_VideoSuperResolution_FeatureInitResult "VideoSuperResolution.FeatureInitResult"
651#define NVSDK_NGX_Parameter_ImageSignalProcessing_FeatureInitResult "ImageSignalProcessing.FeatureInitResult"
652#define NVSDK_NGX_Parameter_DeepResolve_FeatureInitResult "DeepResolve.FeatureInitResult"
653#define NVSDK_NGX_Parameter_FrameInterpolation_FeatureInitResult "FrameInterpolation.FeatureInitResult"
654#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_2_1 "ImageSuperResolution.ScaleFactor.2.1"
655#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_3_1 "ImageSuperResolution.ScaleFactor.3.1"
656#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_3_2 "ImageSuperResolution.ScaleFactor.3.2"
657#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_4_3 "ImageSuperResolution.ScaleFactor.4.3"
658#define NVSDK_NGX_Parameter_NumFrames "NumFrames"
659#define NVSDK_NGX_Parameter_Scale "Scale"
660#define NVSDK_NGX_Parameter_Width "Width"
661#define NVSDK_NGX_Parameter_Height "Height"
662#define NVSDK_NGX_Parameter_OutWidth "OutWidth"
663#define NVSDK_NGX_Parameter_OutHeight "OutHeight"
664#define NVSDK_NGX_Parameter_Sharpness "Sharpness"
665#define NVSDK_NGX_Parameter_Scratch "Scratch"
666#define NVSDK_NGX_Parameter_Scratch_SizeInBytes "Scratch.SizeInBytes"
667#define NVSDK_NGX_Parameter_Input1 "Input1"
668#define NVSDK_NGX_Parameter_Input1_Format "Input1.Format"
669#define NVSDK_NGX_Parameter_Input1_SizeInBytes "Input1.SizeInBytes"
670#define NVSDK_NGX_Parameter_Input2 "Input2"
671#define NVSDK_NGX_Parameter_Input2_Format "Input2.Format"
672#define NVSDK_NGX_Parameter_Input2_SizeInBytes "Input2.SizeInBytes"
673#define NVSDK_NGX_Parameter_Color "Color"
674#define NVSDK_NGX_Parameter_Color_Format "Color.Format"
675#define NVSDK_NGX_Parameter_Color_SizeInBytes "Color.SizeInBytes"
676#define NVSDK_NGX_Parameter_FI_Color1 "Color1"
677#define NVSDK_NGX_Parameter_FI_Color2 "Color2"
678#define NVSDK_NGX_Parameter_Albedo "Albedo"
679#define NVSDK_NGX_Parameter_Output "Output"
680#define NVSDK_NGX_Parameter_Output_Format "Output.Format"
681#define NVSDK_NGX_Parameter_Output_SizeInBytes "Output.SizeInBytes"
682#define NVSDK_NGX_Parameter_FI_Output1 "Output1"
683#define NVSDK_NGX_Parameter_FI_Output2 "Output2"
684#define NVSDK_NGX_Parameter_FI_Output3 "Output3"
685#define NVSDK_NGX_Parameter_Reset "Reset"
686#define NVSDK_NGX_Parameter_BlendFactor "BlendFactor"
687#define NVSDK_NGX_Parameter_MotionVectors "MotionVectors"
688#define NVSDK_NGX_Parameter_FI_MotionVectors1 "MotionVectors1"
689#define NVSDK_NGX_Parameter_FI_MotionVectors2 "MotionVectors2"
690#define NVSDK_NGX_Parameter_Rect_X "Rect.X"
691#define NVSDK_NGX_Parameter_Rect_Y "Rect.Y"
692#define NVSDK_NGX_Parameter_Rect_W "Rect.W"
693#define NVSDK_NGX_Parameter_Rect_H "Rect.H"
694#define NVSDK_NGX_Parameter_OutRect_X "OutRect.X"
695#define NVSDK_NGX_Parameter_OutRect_Y "OutRect.Y"
696#define NVSDK_NGX_Parameter_OutRect_W "OutRect.W"
697#define NVSDK_NGX_Parameter_OutRect_H "OutRect.H"
698#define NVSDK_NGX_Parameter_MV_Scale_X "MV.Scale.X"
699#define NVSDK_NGX_Parameter_MV_Scale_Y "MV.Scale.Y"
700#define NVSDK_NGX_Parameter_Model "Model"
701#define NVSDK_NGX_Parameter_Format "Format"
702#define NVSDK_NGX_Parameter_SizeInBytes "SizeInBytes"
703#define NVSDK_NGX_Parameter_ResourceAllocCallback "ResourceAllocCallback"
704#define NVSDK_NGX_Parameter_BufferAllocCallback "BufferAllocCallback"
705#define NVSDK_NGX_Parameter_Tex2DAllocCallback "Tex2DAllocCallback"
706#define NVSDK_NGX_Parameter_ResourceReleaseCallback "ResourceReleaseCallback"
707#define NVSDK_NGX_Parameter_CreationNodeMask "CreationNodeMask"
708#define NVSDK_NGX_Parameter_VisibilityNodeMask "VisibilityNodeMask"
709#define NVSDK_NGX_Parameter_MV_Offset_X "MV.Offset.X"
710#define NVSDK_NGX_Parameter_MV_Offset_Y "MV.Offset.Y"
711#define NVSDK_NGX_Parameter_Hint_UseFireflySwatter "Hint.UseFireflySwatter"
712#define NVSDK_NGX_Parameter_Resource_Width "ResourceWidth"
713#define NVSDK_NGX_Parameter_Resource_Height "ResourceHeight"
714#define NVSDK_NGX_Parameter_Resource_OutWidth "ResourceOutWidth"
715#define NVSDK_NGX_Parameter_Resource_OutHeight "ResourceOutHeight"
716#define NVSDK_NGX_Parameter_Depth "Depth"
717#define NVSDK_NGX_Parameter_FI_Depth1 "Depth1"
718#define NVSDK_NGX_Parameter_FI_Depth2 "Depth2"
719#define NVSDK_NGX_Parameter_DLSSOptimalSettingsCallback "DLSSOptimalSettingsCallback"
720#define NVSDK_NGX_Parameter_DLSSGetStatsCallback "DLSSGetStatsCallback"
721#define NVSDK_NGX_Parameter_PerfQualityValue "PerfQualityValue"
722#define NVSDK_NGX_Parameter_RTXValue "RTXValue"
723#define NVSDK_NGX_Parameter_DLSSMode "DLSSMode"
724#define NVSDK_NGX_Parameter_FI_Mode "FIMode"
725#define NVSDK_NGX_Parameter_FI_OF_Preset "FIOFPreset"
726#define NVSDK_NGX_Parameter_FI_OF_GridSize "FIOFGridSize"
727#define NVSDK_NGX_Parameter_Jitter_Offset_X "Jitter.Offset.X"
728#define NVSDK_NGX_Parameter_Jitter_Offset_Y "Jitter.Offset.Y"
729#define NVSDK_NGX_Parameter_Denoise "Denoise"
730#define NVSDK_NGX_Parameter_TransparencyMask "TransparencyMask"
731#define NVSDK_NGX_Parameter_ExposureTexture "ExposureTexture" // a 1x1 texture containing the final exposure scale
732#define NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags "DLSS.Feature.Create.Flags"
733#define NVSDK_NGX_Parameter_DLSS_Checkerboard_Jitter_Hack "DLSS.Checkerboard.Jitter.Hack"
734#define NVSDK_NGX_Parameter_GBuffer_Normals "GBuffer.Normals"
735#define NVSDK_NGX_Parameter_GBuffer_Albedo "GBuffer.Albedo"
736#define NVSDK_NGX_Parameter_GBuffer_Roughness "GBuffer.Roughness"
737#define NVSDK_NGX_Parameter_GBuffer_DiffuseAlbedo "GBuffer.DiffuseAlbedo"
738#define NVSDK_NGX_Parameter_GBuffer_SpecularAlbedo "GBuffer.SpecularAlbedo"
739#define NVSDK_NGX_Parameter_GBuffer_IndirectAlbedo "GBuffer.IndirectAlbedo"
740#define NVSDK_NGX_Parameter_GBuffer_SpecularMvec "GBuffer.SpecularMvec"
741#define NVSDK_NGX_Parameter_GBuffer_DisocclusionMask "GBuffer.DisocclusionMask"
742#define NVSDK_NGX_Parameter_GBuffer_Metallic "GBuffer.Metallic"
743#define NVSDK_NGX_Parameter_GBuffer_Specular "GBuffer.Specular"
744#define NVSDK_NGX_Parameter_GBuffer_Subsurface "GBuffer.Subsurface"
745#define NVSDK_NGX_Parameter_GBuffer_ShadingModelId "GBuffer.ShadingModelId"
746#define NVSDK_NGX_Parameter_GBuffer_MaterialId "GBuffer.MaterialId"
747#define NVSDK_NGX_Parameter_GBuffer_Atrrib_8 "GBuffer.Attrib.8"
748#define NVSDK_NGX_Parameter_GBuffer_Atrrib_9 "GBuffer.Attrib.9"
749#define NVSDK_NGX_Parameter_GBuffer_Atrrib_10 "GBuffer.Attrib.10"
750#define NVSDK_NGX_Parameter_GBuffer_Atrrib_11 "GBuffer.Attrib.11"
751#define NVSDK_NGX_Parameter_GBuffer_Atrrib_12 "GBuffer.Attrib.12"
752#define NVSDK_NGX_Parameter_GBuffer_Atrrib_13 "GBuffer.Attrib.13"
753#define NVSDK_NGX_Parameter_GBuffer_Atrrib_14 "GBuffer.Attrib.14"
754#define NVSDK_NGX_Parameter_GBuffer_Atrrib_15 "GBuffer.Attrib.15"
755#define NVSDK_NGX_Parameter_TonemapperType "TonemapperType"
756#define NVSDK_NGX_Parameter_FreeMemOnReleaseFeature "FreeMemOnReleaseFeature"
757#define NVSDK_NGX_Parameter_MotionVectors3D "MotionVectors3D"
758#define NVSDK_NGX_Parameter_IsParticleMask "IsParticleMask"
759#define NVSDK_NGX_Parameter_AnimatedTextureMask "AnimatedTextureMask"
760#define NVSDK_NGX_Parameter_DepthHighRes "DepthHighRes"
761#define NVSDK_NGX_Parameter_Position_ViewSpace "Position.ViewSpace"
762#define NVSDK_NGX_Parameter_FrameTimeDeltaInMsec "FrameTimeDeltaInMsec"
763#define NVSDK_NGX_Parameter_RayTracingHitDistance "RayTracingHitDistance"
764#define NVSDK_NGX_Parameter_MotionVectorsReflection "MotionVectorsReflection"
765#define NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects "DLSS.Enable.Output.Subrects"
766#define NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X "DLSS.Input.Color.Subrect.Base.X"
767#define NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y "DLSS.Input.Color.Subrect.Base.Y"
768#define NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X "DLSS.Input.Depth.Subrect.Base.X"
769#define NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y "DLSS.Input.Depth.Subrect.Base.Y"
770#define NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X "DLSS.Input.MV.Subrect.Base.X"
771#define NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y "DLSS.Input.MV.Subrect.Base.Y"
772#define NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X "DLSS.Input.Translucency.Subrect.Base.X"
773#define NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y "DLSS.Input.Translucency.Subrect.Base.Y"
774#define NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X "DLSS.Output.Subrect.Base.X"
775#define NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y "DLSS.Output.Subrect.Base.Y"
776#define NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width "DLSS.Render.Subrect.Dimensions.Width"
777#define NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height "DLSS.Render.Subrect.Dimensions.Height"
778#define NVSDK_NGX_Parameter_DLSS_Pre_Exposure "DLSS.Pre.Exposure"
779#define NVSDK_NGX_Parameter_DLSS_Exposure_Scale "DLSS.Exposure.Scale"
780#define NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask "DLSS.Input.Bias.Current.Color.Mask"
781#define NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X "DLSS.Input.Bias.Current.Color.Subrect.Base.X"
782#define NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y "DLSS.Input.Bias.Current.Color.Subrect.Base.Y"
783#define NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis "DLSS.Indicator.Invert.Y.Axis"
784#define NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis "DLSS.Indicator.Invert.X.Axis"
785#define NVSDK_NGX_Parameter_DLSS_INV_VIEW_PROJECTION_MATRIX "InvViewProjectionMatrix"
786#define NVSDK_NGX_Parameter_DLSS_CLIP_TO_PREV_CLIP_MATRIX "ClipToPrevClipMatrix"
787
788#define NVSDK_NGX_Parameter_DLSS_TransparencyLayer "DLSS.TransparencyLayer"
789#define NVSDK_NGX_Parameter_DLSS_TransparencyLayer_Subrect_Base_X "DLSS.TransparencyLayer.Subrect.Base.X"
790#define NVSDK_NGX_Parameter_DLSS_TransparencyLayer_Subrect_Base_Y "DLSS.TransparencyLayer.Subrect.Base.Y"
791#define NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity "DLSS.TransparencyLayerOpacity"
792#define NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity_Subrect_Base_X "DLSS.TransparencyLayerOpacity.Subrect.Base.X"
793#define NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity_Subrect_Base_Y "DLSS.TransparencyLayerOpacity.Subrect.Base.Y"
794#define NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs "DLSS.TransparencyLayerMvecs"
795#define NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs_Subrect_Base_X "DLSS.TransparencyLayerMvecs.Subrect.Base.X"
796#define NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs_Subrect_Base_Y "DLSS.TransparencyLayerMvecs.Subrect.Base.Y"
797#define NVSDK_NGX_Parameter_DLSS_DisocclusionMask "DLSS.DisocclusionMask"
798#define NVSDK_NGX_Parameter_DLSS_DisocclusionMask_Subrect_Base_X "DLSS.DisocclusionMask.Subrect.Base.X"
799#define NVSDK_NGX_Parameter_DLSS_DisocclusionMask_Subrect_Base_Y "DLSS.DisocclusionMask.Subrect.Base.Y"
800
801#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Width "DLSS.Get.Dynamic.Max.Render.Width"
802#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Height "DLSS.Get.Dynamic.Max.Render.Height"
803#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Width "DLSS.Get.Dynamic.Min.Render.Width"
804#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Height "DLSS.Get.Dynamic.Min.Render.Height"
805
806#define NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_DLAA "DLSS.Hint.Render.Preset.DLAA"
807#define NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Quality "DLSS.Hint.Render.Preset.Quality"
808#define NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Balanced "DLSS.Hint.Render.Preset.Balanced"
809#define NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Performance "DLSS.Hint.Render.Preset.Performance"
810#define NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraPerformance "DLSS.Hint.Render.Preset.UltraPerformance"
811#define NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraQuality "DLSS.Hint.Render.Preset.UltraQuality"
812
813#ifdef __cplusplus
814} // extern "C"
815#endif
816
817#endif
thirdparty/ngx/include/nvsdk_ngx_defs_dlssd.h +163 -0
……@@ -0,0 +1,163 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13#ifndef NVSDK_NGX_DEFS_DLSSD_H
14#define NVSDK_NGX_DEFS_DLSSD_H
15#pragma once
16
17typedef enum NVSDK_NGX_DLSS_Denoise_Mode
18{
19 NVSDK_NGX_DLSS_Denoise_Mode_Off = 0,
20 NVSDK_NGX_DLSS_Denoise_Mode_DLUnified = 1, // DL based unified upscaler
21} NVSDK_NGX_DLSS_Denoise_Mode;
22
23typedef enum NVSDK_NGX_DLSS_Roughness_Mode
24{
25 NVSDK_NGX_DLSS_Roughness_Mode_Unpacked = 0, // Read roughness separately
26 NVSDK_NGX_DLSS_Roughness_Mode_Packed = 1, // Read roughness from normals.w
27} NVSDK_NGX_DLSS_Roughness_Mode;
28
29typedef enum NVSDK_NGX_DLSS_Depth_Type
30{
31 NVSDK_NGX_DLSS_Depth_Type_Linear = 0, // Linear Depth
32 NVSDK_NGX_DLSS_Depth_Type_HW = 1, // HW Depth
33} NVSDK_NGX_DLSS_Depth_Type;
34
35
36typedef enum NVSDK_NGX_RayReconstruction_Hint_Render_Preset
37{
38 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_Default = 0, // default behavior, may or may not change after OTA
39 // NVSDK_NGX_RayReconstruction_Hint_Render_Preset_A removed, use preset D or E
40 // NVSDK_NGX_RayReconstruction_Hint_Render_Preset_B removed, use preset D or E
41 // NVSDK_NGX_RayReconstruction_Hint_Render_Preset_C removed, use preset D or E
42 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_D = 4, // Default model (transformer)
43 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_E = 5, // Latest transformer model (must use if DoF guide is needed)
44 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_F = 6, // Do not use, reverts to default behavior
45 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_G = 7, // Do not use, reverts to default behavior
46 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_H = 8, // Do not use, reverts to default behavior
47 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_I = 9, // Do not use, reverts to default behavior
48 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_J = 10, // Do not use, reverts to default behavior
49 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_K = 11, // Do not use, reverts to default behavior
50 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_L = 12, // Do not use, reverts to default behavior
51 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_M = 13, // Do not use, reverts to default behavior
52 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_N = 14, // Do not use, reverts to default behavior
53 NVSDK_NGX_RayReconstruction_Hint_Render_Preset_O = 15, // Do not use, reverts to default behavior
54} NVSDK_NGX_RayReconstruction_Hint_Render_Preset;
55
56#define NVSDK_NGX_Parameter_DLSS_Denoise_Mode "DLSS.Denoise.Mode"
57#define NVSDK_NGX_Parameter_DLSS_Roughness_Mode "DLSS.Roughness.Mode"
58#define NVSDK_NGX_Parameter_DiffuseAlbedo "DLSS.Input.DiffuseAlbedo"
59#define NVSDK_NGX_Parameter_SpecularAlbedo "DLSS.Input.SpecularAlbedo"
60#define NVSDK_NGX_Parameter_DLSS_Input_DiffuseAlbedo_Subrect_Base_X "DLSS.Input.DiffuseAlbedo.Subrect.Base.X"
61#define NVSDK_NGX_Parameter_DLSS_Input_DiffuseAlbedo_Subrect_Base_Y "DLSS.Input.DiffuseAlbedo.Subrect.Base.Y"
62#define NVSDK_NGX_Parameter_DLSS_Input_SpecularAlbedo_Subrect_Base_X "DLSS.Input.SpecularAlbedo.Subrect.Base.X"
63#define NVSDK_NGX_Parameter_DLSS_Input_SpecularAlbedo_Subrect_Base_Y "DLSS.Input.SpecularAlbedo.Subrect.Base.Y"
64#define NVSDK_NGX_Parameter_DLSS_Input_Normals_Subrect_Base_X "DLSS.Input.Normals.Subrect.Base.X"
65#define NVSDK_NGX_Parameter_DLSS_Input_Normals_Subrect_Base_Y "DLSS.Input.Normals.Subrect.Base.Y"
66#define NVSDK_NGX_Parameter_DLSS_Input_Roughness_Subrect_Base_X "DLSS.Input.Roughness.Subrect.Base.X"
67#define NVSDK_NGX_Parameter_DLSS_Input_Roughness_Subrect_Base_Y "DLSS.Input.Roughness.Subrect.Base.Y"
68#define NVSDK_NGX_Parameter_ViewToClipMatrix "ViewToClipMatrix"
69#define NVSDK_NGX_Parameter_GBuffer_Emissive "GBuffer.Emissive"
70#define NVSDK_NGX_Parameter_Use_Folded_Network "DLSS.Use.Folded.Network"
71#define NVSDK_NGX_Parameter_Diffuse_Ray_Direction "Diffuse.Ray.Direction"
72#define NVSDK_NGX_Parameter_DLSS_WORLD_TO_VIEW_MATRIX "WorldToViewMatrix"
73#define NVSDK_NGX_Parameter_DLSS_VIEW_TO_CLIP_MATRIX "ViewToClipMatrix"
74#define NVSDK_NGX_Parameter_Use_HW_Depth "DLSS.Use.HW.Depth"
75#define NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo "DLSSD.ReflectedAlbedo"
76#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles "DLSSD.ColorBeforeParticles"
77#define NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles "DLSSD.ColorAfterParticles"
78#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency "DLSSD.ColorBeforeTransparency"
79#define NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency "DLSSD.ColorAfterTransparency"
80#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog "DLSSD.ColorBeforeFog"
81#define NVSDK_NGX_Parameter_DLSSD_ColorAfterFog "DLSSD.ColorAfterFog"
82#define NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide "DLSSD.ScreenSpaceSubsurfaceScatteringGuide"
83#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering "DLSSD.ColorBeforeScreenSpaceSubsurfaceScattering"
84#define NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering "DLSSD.ColorAfterScreenSpaceSubsurfaceScattering"
85#define NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide "DLSSD.ScreenSpaceRefractionGuide"
86#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction "DLSSD.ColorBeforeScreenSpaceRefraction"
87#define NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction "DLSSD.ColorAfterScreenSpaceRefraction"
88#define NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide "DLSSD.DepthOfFieldGuide"
89#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField "DLSSD.ColorBeforeDepthOfField"
90#define NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField "DLSSD.ColorAfterDepthOfField"
91#define NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance "DLSSD.DiffuseHitDistance"
92#define NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance "DLSSD.SpecularHitDistance"
93#define NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection "DLSSD.DiffuseRayDirection"
94#define NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection "DLSSD.SpecularRayDirection"
95#define NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance "DLSSD.DiffuseRayDirectionHitDistance"
96#define NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance "DLSSD.SpecularRayDirectionHitDistance"
97#define NVSDK_NGX_Parameter_DLSSD_Alpha "DLSSD.Alpha"
98#define NVSDK_NGX_Parameter_DLSSD_OutputAlpha "DLSSD.OutputAlpha"
99#define NVSDK_NGX_Parameter_DLSSD_Alpha_Subrect_Base_X "DLSSD.Alpha.Subrect.Base.X"
100#define NVSDK_NGX_Parameter_DLSSD_Alpha_Subrect_Base_Y "DLSSD.Alpha.Subrect.Base.Y"
101#define NVSDK_NGX_Parameter_DLSSD_OutputAlpha_Subrect_Base_X "DLSSD.OutputAlpha.Subrect.Base.X"
102#define NVSDK_NGX_Parameter_DLSSD_OutputAlpha_Subrect_Base_Y "DLSSD.OutputAlpha.Subrect.Base.Y"
103#define NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo_Subrect_Base_X "DLSSD.ReflectedAlbedo.Subrect.Base.X"
104#define NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo_Subrect_Base_Y "DLSSD.ReflectedAlbedo.Subrect.Base.Y"
105#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles_Subrect_Base_X "DLSSD.ColorBeforeParticles.Subrect.Base.X"
106#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles_Subrect_Base_Y "DLSSD.ColorBeforeParticles.Subrect.Base.Y"
107#define NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles_Subrect_Base_X "DLSSD.ColorAfterParticles.Subrect.Base.X"
108#define NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles_Subrect_Base_Y "DLSSD.ColorAfterParticles.Subrect.Base.Y"
109#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency_Subrect_Base_X "DLSSD.ColorBeforeTransparency.Subrect.Base.X"
110#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency_Subrect_Base_Y "DLSSD.ColorBeforeTransparency.Subrect.Base.Y"
111#define NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency_Subrect_Base_X "DLSSD.ColorAfterTransparency.Subrect.Base.X"
112#define NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency_Subrect_Base_Y "DLSSD.ColorAfterTransparency.Subrect.Base.Y"
113#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog_Subrect_Base_X "DLSSD.ColorBeforeFog.Subrect.Base.X"
114#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog_Subrect_Base_Y "DLSSD.ColorBeforeFog.Subrect.Base.Y"
115#define NVSDK_NGX_Parameter_DLSSD_ColorAfterFog_Subrect_Base_X "DLSSD.ColorAfterFog.Subrect.Base.X"
116#define NVSDK_NGX_Parameter_DLSSD_ColorAfterFog_Subrect_Base_Y "DLSSD.ColorAfterFog.Subrect.Base.Y"
117#define NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide_Subrect_Base_X "DLSSD.ScreenSpaceSubsurfaceScatteringGuide.Subrect.Base.X"
118#define NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide_Subrect_Base_Y "DLSSD.ScreenSpaceSubsurfaceScatteringGuide.Subrect.Base.Y"
119#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering_Subrect_Base_X "DLSSD.ColorBeforeScreenSpaceSubsurfaceScattering.Subrect.Base.X"
120#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering_Subrect_Base_Y "DLSSD.ColorBeforeScreenSpaceSubsurfaceScattering.Subrect.Base.Y"
121#define NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering_Subrect_Base_X "DLSSD.ColorAfterScreenSpaceSubsurfaceScattering.Subrect.Base.X"
122#define NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering_Subrect_Base_Y "DLSSD.ColorAfterScreenSpaceSubsurfaceScattering.Subrect.Base.Y"
123#define NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide_Subrect_Base_X "DLSSD.ScreenSpaceRefractionGuide.Subrect.Base.X"
124#define NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide_Subrect_Base_Y "DLSSD.ScreenSpaceRefractionGuide.Subrect.Base.Y"
125#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction_Subrect_Base_X "DLSSD.ColorBeforeScreenSpaceRefraction.Subrect.Base.X"
126#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction_Subrect_Base_Y "DLSSD.ColorBeforeScreenSpaceRefraction.Subrect.Base.Y"
127#define NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction_Subrect_Base_X "DLSSD.ColorAfterScreenSpaceRefraction.Subrect.Base.X"
128#define NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction_Subrect_Base_Y "DLSSD.ColorAfterScreenSpaceRefraction.Subrect.Base.Y"
129#define NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide_Subrect_Base_X "DLSSD.DepthOfFieldGuide.Subrect.Base.X"
130#define NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide_Subrect_Base_Y "DLSSD.DepthOfFieldGuide.Subrect.Base.Y"
131#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField_Subrect_Base_X "DLSSD.ColorBeforeDepthOfField.Subrect.Base.X"
132#define NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField_Subrect_Base_Y "DLSSD.ColorBeforeDepthOfField.Subrect.Base.Y"
133#define NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField_Subrect_Base_X "DLSSD.ColorAfterDepthOfField.Subrect.Base.X"
134#define NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField_Subrect_Base_Y "DLSSD.ColorAfterDepthOfField.Subrect.Base.Y"
135#define NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance_Subrect_Base_X "DLSSD.DiffuseHitDistance.Subrect.Base.X"
136#define NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance_Subrect_Base_Y "DLSSD.DiffuseHitDistance.Subrect.Base.Y"
137#define NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance_Subrect_Base_X "DLSSD.SpecularHitDistance.Subrect.Base.X"
138#define NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance_Subrect_Base_Y "DLSSD.SpecularHitDistance.Subrect.Base.Y"
139#define NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection_Subrect_Base_X "DLSSD.DiffuseRayDirection.Subrect.Base.X"
140#define NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection_Subrect_Base_Y "DLSSD.DiffuseRayDirection.Subrect.Base.Y"
141#define NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection_Subrect_Base_X "DLSSD.SpecularRayDirection.Subrect.Base.X"
142#define NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection_Subrect_Base_Y "DLSSD.SpecularRayDirection.Subrect.Base.Y"
143#define NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance_Subrect_Base_X "DLSSD.DiffuseRayDirectionHitDistance.Subrect.Base.X"
144#define NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance_Subrect_Base_Y "DLSSD.DiffuseRayDirectionHitDistance.Subrect.Base.Y"
145#define NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance_Subrect_Base_X "DLSSD.SpecularRayDirectionHitDistance.Subrect.Base.X"
146#define NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance_Subrect_Base_Y "DLSSD.SpecularRayDirectionHitDistance.Subrect.Base.Y"
147
148#define NVSDK_NGX_Parameter_SuperSamplingDenoising_Available "SuperSamplingDenoising.Available"
149#define NVSDK_NGX_Parameter_SuperSamplingDenoising_NeedsUpdatedDriver "SuperSamplingDenoising.NeedsUpdatedDriver"
150#define NVSDK_NGX_Parameter_SuperSamplingDenoising_MinDriverVersionMajor "SuperSamplingDenoising.MinDriverVersionMajor"
151#define NVSDK_NGX_Parameter_SuperSamplingDenoising_MinDriverVersionMinor "SuperSamplingDenoising.MinDriverVersionMinor"
152#define NVSDK_NGX_Parameter_SuperSamplingDenoising_FeatureInitResult "SuperSamplingDenoising.FeatureInitResult"
153#define NVSDK_NGX_Parameter_DLSSDOptimalSettingsCallback "DLSSDOptimalSettingsCallback"
154#define NVSDK_NGX_Parameter_DLSSDGetStatsCallback "DLSSDGetStatsCallback"
155
156#define NVSDK_NGX_Parameter_RayReconstruction_Hint_Render_Preset_DLAA "RayReconstruction.Hint.Render.Preset.DLAA"
157#define NVSDK_NGX_Parameter_RayReconstruction_Hint_Render_Preset_Quality "RayReconstruction.Hint.Render.Preset.Quality"
158#define NVSDK_NGX_Parameter_RayReconstruction_Hint_Render_Preset_Balanced "RayReconstruction.Hint.Render.Preset.Balanced"
159#define NVSDK_NGX_Parameter_RayReconstruction_Hint_Render_Preset_Performance "RayReconstruction.Hint.Render.Preset.Performance"
160#define NVSDK_NGX_Parameter_RayReconstruction_Hint_Render_Preset_UltraPerformance "RayReconstruction.Hint.Render.Preset.UltraPerformance"
161#define NVSDK_NGX_Parameter_RayReconstruction_Hint_Render_Preset_UltraQuality "RayReconstruction.Hint.Render.Preset.UltraQuality"
162
163#endif // NVSDK_NGX_DEFS_DLSSD_H
thirdparty/ngx/include/nvsdk_ngx_defs_dlssg.h +279 -0
……@@ -0,0 +1,279 @@
1#pragma once
2/*
3* Copyright (c) 2021-2024 NVIDIA CORPORATION. All rights reserved.
4*
5* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
6* rights in and to this software, related documentation and any modifications thereto.
7* Any use, reproduction, disclosure or distribution of this software and related
8* documentation without an express license agreement from NVIDIA Corporation is strictly
9* prohibited.
10*
11* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
12* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
13* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
15* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
16* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
17* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
18* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
19* SUCH DAMAGES.
20*/
21
22
23#ifndef NVSDK_NGX_DEFS_DLSSG_H
24#define NVSDK_NGX_DEFS_DLSSG_H
25
26#include <stddef.h> // for size_t
27#include <stdint.h> // for uint64_t
28
29#include "nvsdk_ngx_defs.h"
30#include "nvsdk_ngx_params.h"
31
32#define NVSDK_NGX_Parameter_FrameGeneration_Available "FrameGeneration.Available"
33#define NVSDK_NGX_Parameter_FrameGeneration_FeatureInitResult "FrameGeneration.FeatureInitResult"
34#define NVSDK_NGX_Parameter_FrameGeneration_MinDriverVersionMajor "FrameGeneration.MinDriverVersionMajor"
35#define NVSDK_NGX_Parameter_FrameGeneration_MinDriverVersionMinor "FrameGeneration.MinDriverVersionMinor"
36#define NVSDK_NGX_Parameter_FrameGeneration_NeedsUpdatedDriver "FrameGeneration.NeedsUpdatedDriver"
37
38#define NVSDK_NGX_Parameter_FrameInterpolation_Available "FrameInterpolation.Available"
39#define NVSDK_NGX_Parameter_FrameInterpolation_FeatureInitResult "FrameInterpolation.FeatureInitResult"
40#define NVSDK_NGX_Parameter_FrameInterpolation_MinDriverVersionMajor "FrameInterpolation.MinDriverVersionMajor"
41#define NVSDK_NGX_Parameter_FrameInterpolation_MinDriverVersionMinor "FrameInterpolation.MinDriverVersionMinor"
42#define NVSDK_NGX_Parameter_FrameInterpolation_NeedsUpdatedDriver "FrameInterpolation.NeedsUpdatedDriver"
43
44#define NVSDK_NGX_DLSSG_Parameter_BackbufferFormat "DLSSG.BackbufferFormat"
45
46#define NVSDK_NGX_DLSSG_Parameter_Backbuffer "DLSSG.Backbuffer"
47#define NVSDK_NGX_DLSSG_Parameter_MVecs "DLSSG.MVecs"
48#define NVSDK_NGX_DLSSG_Parameter_Depth "DLSSG.Depth"
49#define NVSDK_NGX_DLSSG_Parameter_HUDLess "DLSSG.HUDLess"
50#define NVSDK_NGX_DLSSG_Parameter_UI "DLSSG.UI"
51#define NVSDK_NGX_DLSSG_Parameter_NoPostProcessingColor "DLSSG.NoPostProcessingColor"
52#define NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField "DLSSG.BidirectionalDistortionField"
53#define NVSDK_NGX_Parameter_OutputInterpolated "DLSSG.OutputInterpolated"
54#define NVSDK_NGX_Parameter_OutputReal "DLSSG.OutputReal"
55
56// DLFG-specific width/height parameters, to avoid name conflicts with other
57// features. If set in CreateFeature, these parameters will be used instead of
58// the generic NVSDK_NGX_Parameter{Width,Height}
59#define NVSDK_NGX_DLSSG_Parameter_Width "DLSSG.Width"
60#define NVSDK_NGX_DLSSG_Parameter_Height "DLSSG.Height"
61
62// Output resource which allows the snippet to hint to the host application that
63// the interpolated frame(s) should not be shown this frame. This resource must
64// be created by the application with a minimum size of 4 bytes, and will be filled
65// by the snippet: if interpolation should be disabled for this frame, boolean true
66// will be written to the first byte of the buffer.
67#define NVSDK_NGX_DLSSG_Parameter_OutputDisableInterpolation "DLSSG.OutputDisableInterpolation"
68
69//! IMPORTANT: All matrices should NOT contain temporal AA jitter offset
70//! Specifies matrix transformation from the camera view to the clip space.
71//! Float4x4 as void*
72#define NVSDK_NGX_DLSSG_Parameter_CameraViewToClip "DLSSG.CameraViewToClip"
73//! Float4x4 as void*
74#define NVSDK_NGX_DLSSG_Parameter_ClipToCameraView "DLSSG.ClipToCameraView"
75//! Float4x4 as void*
76#define NVSDK_NGX_DLSSG_Parameter_ClipToLensClip "DLSSG.ClipToLensClip"
77//! Float4x4 as void*
78#define NVSDK_NGX_DLSSG_Parameter_ClipToPrevClip "DLSSG.ClipToPrevClip"
79//! Float4x4 as void*
80#define NVSDK_NGX_DLSSG_Parameter_PrevClipToClip "DLSSG.PrevClipToClip"
81
82//! Specifies clip space jitter offset
83#define NVSDK_NGX_DLSSG_Parameter_JitterOffsetX "DLSSG.JitterOffsetX"
84#define NVSDK_NGX_DLSSG_Parameter_JitterOffsetY "DLSSG.JitterOffsetY"
85
86//! Specifies scale factors used to normalize motion vectors (so the values are in [-1,1] range)
87#define NVSDK_NGX_DLSSG_Parameter_MvecScaleX "DLSSG.MvecScaleX"
88#define NVSDK_NGX_DLSSG_Parameter_MvecScaleY "DLSSG.MvecScaleY"
89
90//! Specifies camera pinhole offset.
91#define NVSDK_NGX_DLSSG_Parameter_CameraPinholeOffsetX "DLSSG.CameraPinholeOffsetX"
92#define NVSDK_NGX_DLSSG_Parameter_CameraPinholeOffsetY "DLSSG.CameraPinholeOffsetY"
93
94//! Specifies camera position in world space.
95#define NVSDK_NGX_DLSSG_Parameter_CameraPosX "DLSSG.CameraPosX"
96#define NVSDK_NGX_DLSSG_Parameter_CameraPosY "DLSSG.CameraPosY"
97#define NVSDK_NGX_DLSSG_Parameter_CameraPosZ "DLSSG.CameraPosZ"
98
99//! Specifies camera up vector in world space.
100#define NVSDK_NGX_DLSSG_Parameter_CameraUpX "DLSSG.CameraUpX"
101#define NVSDK_NGX_DLSSG_Parameter_CameraUpY "DLSSG.CameraUpY"
102#define NVSDK_NGX_DLSSG_Parameter_CameraUpZ "DLSSG.CameraUpZ"
103
104//! Specifies camera right vector in world space.
105#define NVSDK_NGX_DLSSG_Parameter_CameraRightX "DLSSG.CameraRightX"
106#define NVSDK_NGX_DLSSG_Parameter_CameraRightY "DLSSG.CameraRightY"
107#define NVSDK_NGX_DLSSG_Parameter_CameraRightZ "DLSSG.CameraRightZ"
108
109//! Specifies camera forward vector in world space.
110#define NVSDK_NGX_DLSSG_Parameter_CameraFwdX "DLSSG.CameraFwdX"
111#define NVSDK_NGX_DLSSG_Parameter_CameraFwdY "DLSSG.CameraFwdY"
112#define NVSDK_NGX_DLSSG_Parameter_CameraFwdZ "DLSSG.CameraFwdZ"
113
114//! Specifies camera near view plane distance.
115#define NVSDK_NGX_DLSSG_Parameter_CameraNear "DLSSG.CameraNear"
116
117//! Specifies camera far view plane distance.
118#define NVSDK_NGX_DLSSG_Parameter_CameraFar "DLSSG.CameraFar"
119
120//! Specifies camera field of view in radians.
121#define NVSDK_NGX_DLSSG_Parameter_CameraFOV "DLSSG.CameraFOV"
122
123//! Specifies camera aspect ratio defined as view space width divided by height.
124#define NVSDK_NGX_DLSSG_Parameter_CameraAspectRatio "DLSSG.CameraAspectRatio"
125
126//! Specifies if tagged color buffers are full HDR (rendering to an HDR monitor) or not
127#define NVSDK_NGX_DLSSG_Parameter_ColorBuffersHDR "DLSSG.ColorBuffersHDR"
128
129//! Specifies if depth values are inverted (value closer to the camera is higher) or not.
130#define NVSDK_NGX_DLSSG_Parameter_DepthInverted "DLSSG.DepthInverted"
131
132//! Specifies if camera motion is included in the MVec buffer.
133#define NVSDK_NGX_DLSSG_Parameter_CameraMotionIncluded "DLSSG.CameraMotionIncluded"
134
135//! Specifies if motion vectors include jitter data.
136
137//! Specifies if previous frame has no connection to the current one (motion vectors are invalid)
138#define NVSDK_NGX_DLSSG_Parameter_Reset "DLSSG.Reset"
139
140//! Specifies if Automode overrode the input Reset flag to true.
141#define NVSDK_NGX_DLSSG_Parameter_AutomodeOverrideReset "DLSSG.AutomodeOverrideReset"
142
143//! Specifies if application is not currently rendering game frames (paused in menu, playing video cut-scenes)
144#define NVSDK_NGX_DLSSG_Parameter_NotRenderingGameFrames "DLSSG.NotRenderingGameFrames"
145
146//! Specifies if orthographic projection is used or not.
147#define NVSDK_NGX_DLSSG_Parameter_OrthoProjection "DLSSG.OrthoProjection"
148
149#define NVSDK_NGX_Parameter_DLSSGGetCurrentSettingsCallback "DLSSG.GetCurrentSettingsCallback"
150#define NVSDK_NGX_Parameter_DLSSGEstimateVRAMCallback "DLSSG.EstimateVRAMCallback"
151
152#define NVSDK_NGX_Parameter_DLSSGMustCallEval "DLSSG.MustCallEval"
153#define NVSDK_NGX_Parameter_DLSSGBurstCaptureRunning "DLSSG.BurstCaptureRunning"
154
155#define NVSDK_NGX_Parameter_DLSSGInvertXAxis "DLSSG.InvertXAxis"
156#define NVSDK_NGX_Parameter_DLSSGInvertYAxis "DLSSG.InvertYAxis"
157
158#define NVSDK_NGX_DLSSG_Parameter_UserDebugText "DLSSG.UserDebugText"
159
160#define NVSDK_NGX_DLSSG_Parameter_MvecInvalidValue "DLSSG.MvecInvalidValue"
161#define NVSDK_NGX_DLSSG_Parameter_MvecDilated "DLSSG.MvecDilated"
162#define NVSDK_NGX_DLSSG_Parameter_MvecJittered "DLSSG.MvecJittered"
163
164#define NVSDK_NGX_DLSSG_Parameter_MenuDetectionEnabled "DLSSG.MenuDetectionEnabled"
165
166//! If true, allow the snippet to create internal resources on a separate thread, to avoid hitches during feature creation (default false)
167#define NVSDK_NGX_DLSSG_Parameter_AsyncCreateEnabled "DLSSG.AsyncCreateEnabled"
168
169//! The DLSS Frame Generation algorithm processes all depth in a "linearized" depth space using the below formulation.
170//!
171//! if NVSDK_NGX_DLSSG_Parameter_DepthInverted is false: `lin_depth = 1 / (1 - depth)`
172//! if NVSDK_NGX_DLSSG_Parameter_DepthInverted is true: `lin_depth = 1 / depth`
173//!
174//! This enables the algorithm to reliably threshold and characterize depth interactions.
175//!
176//! The Frame Generation algorithm is tuned such that most game integrations do not need to modify these values.
177//! However, the below parameters provide mechanisms to control the shape of the internal depth processing space.
178//! Typically useful when input raw depth units are compressed into a small dynamic range. The scale modifier
179//! NVSDK_NGX_DLSSG_Parameter_LinearizedDepth_Scale is a good place to start that won't require more changes.
180//!
181//! Note: the input depth texture must be consistent with the input camera transformation matrices, e.g. clip2prevclip.
182
183//! Optional scalar on the linearized depth before algorithm processing.
184//!
185//! Defaults to 1.0f. A value of 0.1f can help with a compressed input depth range.
186#define NVSDK_NGX_DLSSG_Parameter_LinearizedDepth_Scale "DLSSG.LinearizedDepth_Scale"
187
188//! Optional heuristic that defines the z-distance to the depth plane that artificially partitions near from far objects.
189//! DLSS Frame Generation uses this plane to restrict far plane object motion from scattering into near plane objects.
190//!
191//! Defaults to 600.0f. A value of 4000.0f can help with a compressed input depth range.
192#define NVSDK_NGX_DLSSG_Parameter_LinearizedDepth_NearFarPartition "DLSSG.LinearizedDepth_NearFarPartition"
193
194//! Optional heuristic that specifies the minimum linearized depth difference between two objects in screen-space.
195//! DLSS Frame Generation uses this heuristic to understand contiguous depth surfaces.
196//!
197//! Defaults to 40.0f.
198#define NVSDK_NGX_DLSSG_Parameter_MinRelativeLinearDepthObjectSeparation "DLSSG.MinRelativeLinearDepthObjectSeparation"
199
200//! Texture Subrect Definitions
201
202#define NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectBaseX "DLSSG.BackbufferSubrectBaseX"
203#define NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectBaseY "DLSSG.BackbufferSubrectBaseY"
204#define NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectWidth "DLSSG.BackbufferSubrectWidth"
205#define NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectHeight "DLSSG.BackbufferSubrectHeight"
206
207#define NVSDK_NGX_DLSSG_Parameter_MVecsSubrectBaseX "DLSSG.MVecsSubrectBaseX"
208#define NVSDK_NGX_DLSSG_Parameter_MVecsSubrectBaseY "DLSSG.MVecsSubrectBaseY"
209#define NVSDK_NGX_DLSSG_Parameter_MVecsSubrectWidth "DLSSG.MVecsSubrectWidth"
210#define NVSDK_NGX_DLSSG_Parameter_MVecsSubrectHeight "DLSSG.MVecsSubrectHeight"
211
212#define NVSDK_NGX_DLSSG_Parameter_DepthSubrectBaseX "DLSSG.DepthSubrectBaseX"
213#define NVSDK_NGX_DLSSG_Parameter_DepthSubrectBaseY "DLSSG.DepthSubrectBaseY"
214#define NVSDK_NGX_DLSSG_Parameter_DepthSubrectWidth "DLSSG.DepthSubrectWidth"
215#define NVSDK_NGX_DLSSG_Parameter_DepthSubrectHeight "DLSSG.DepthSubrectHeight"
216
217#define NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectBaseX "DLSSG.HUDLessSubrectBaseX"
218#define NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectBaseY "DLSSG.HUDLessSubrectBaseY"
219#define NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectWidth "DLSSG.HUDLessSubrectWidth"
220#define NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectHeight "DLSSG.HUDLessSubrectHeight"
221
222#define NVSDK_NGX_DLSSG_Parameter_UISubrectBaseX "DLSSG.UISubrectBaseX"
223#define NVSDK_NGX_DLSSG_Parameter_UISubrectBaseY "DLSSG.UISubrectBaseY"
224#define NVSDK_NGX_DLSSG_Parameter_UISubrectWidth "DLSSG.UISubrectWidth"
225#define NVSDK_NGX_DLSSG_Parameter_UISubrectHeight "DLSSG.UISubrectHeight"
226
227#define NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectBaseX "DLSSG.BidirectionalDistortionFieldSubrectBaseX"
228#define NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectBaseY "DLSSG.BidirectionalDistortionFieldSubrectBaseY"
229#define NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectWidth "DLSSG.BidirectionalDistortionFieldSubrectWidth"
230#define NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectHeight "DLSSG.BidirectionalDistortionFieldSubrectHeight"
231#define NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField_LowPrecision_IsLowPrecision "DLSSG.BidirectionalDistortionFieldLowPrecision.IsLowPrecision"
232#define NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField_LowPrecision_Bias "DLSSG.BidirectionalDistortionFieldLowPrecision.Bias"
233#define NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField_LowPrecision_Scale "DLSSG.BidirectionalDistortionFieldLowPrecision.Scale"
234
235//! Specifies the internal resolution to be used (mainly for dynamic resolution)
236#define NVSDK_NGX_DLSSG_Parameter_InternalWidth "DLSSG.InternalWidth"
237#define NVSDK_NGX_DLSSG_Parameter_InternalHeight "DLSSG.InternalHeight"
238
239//! If nonzero, we expect to use dynamic resolution (MVec and Depth res will change, possibly per frame)
240#define NVSDK_NGX_DLSSG_Parameter_DynamicResolution "DLSSG.DynamicResolution"
241
242typedef enum NVSDK_NGX_DLSSG_EvalFlags
243{
244 // The default behaviour for evaluate is to write the interpolated pixels inside of the
245 // backbuffer extent and uninterpolated pixels - outside of the extent. If this flag is
246 // set, then only the inside of the backbuffer extent is updated, the outside of the extent
247 // stays untouched.
248 NVSDK_NGX_DLSSG_EvalFlags_UpdateOnlyInsideExtents = (1 << 0)
249} NVSDK_NGX_DLSSG_EvalFlags;
250#define NVSDK_NGX_DLSSG_Parameter_EvalFlags "DLSSG.EvalFlags"
251
252// Callback function types
253typedef NVSDK_NGX_Result(NVSDK_CONV* PFN_NVSDK_NGX_DLSSG_GetCurrentSettingsCallback)(const NVSDK_NGX_Handle* InHandle, NVSDK_NGX_Parameter* InParams);
254typedef NVSDK_NGX_Result(NVSDK_CONV* PFN_NVSDK_NGX_DLSSG_EstimateVRAMCallback)(uint32_t mvecDepthWidth, uint32_t mvecDepthHeight,
255 uint32_t colorWidth, uint32_t colorHeight,
256 uint32_t colorBufferFormat,
257 uint32_t mvecBufferFormat, uint32_t depthBufferFormat,
258 uint32_t hudLessBufferFormat, uint32_t uiBufferFormat, size_t* estimatedVRAMInBytes);
259
260// DLSS 4
261
262// Output Capability Parameters (access via GetDeviceCapabilityParameters)
263// The maximum number of generated frames supported by the feature (e.g. 3 for 4x)
264// If 1 or not set, multiframe is not supported
265#define NVSDK_NGX_DLSSG_Parameter_MultiFrameCountMax "DLSSG.MultiFrameCountMax"
266
267// InParameters
268// uint32_t, Total of Number Frames expected to Interpolate for given Real-Frame Pair. For 4x, this is 3. For 2x, this is 1.
269#define NVSDK_NGX_DLSSG_Parameter_MultiFrameCount "DLSSG.MultiFrameCount"
270// uint32_t, Current inner frame index. For 4x, this is 1, 2, and 3. For 2x, this is 1.
271#define NVSDK_NGX_DLSSG_Parameter_MultiFrameIndex "DLSSG.MultiFrameIndex"
272
273//! Optional: uint64_t that increments by one for each fully rendered backbuffer frame such that
274//! Current Backbuffer ID == (Previous Backbuffer ID + 1). The number should increment even
275//! if FG is off, for example, when rendering a menu with FG temporarily disabled.
276#define NVSDK_NGX_DLSSG_Parameter_BackbufferFrameID "DLSSG.BackbufferFrameID"
277
278
279#endif // NVSDK_NGX_DEFS_DLSSG_H
thirdparty/ngx/include/nvsdk_ngx_helpers.h +627 -0
……@@ -0,0 +1,627 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13#ifndef NVSDK_NGX_HELPERS_H
14#define NVSDK_NGX_HELPERS_H
15#pragma once
16
17#include "nvsdk_ngx.h"
18#include "nvsdk_ngx_defs.h"
19
20typedef NVSDK_NGX_Result(NVSDK_CONV *PFN_NVSDK_NGX_DLSS_GetStatsCallback)(NVSDK_NGX_Parameter *InParams);
21
22static inline NVSDK_NGX_Result NGX_DLSS_GET_STATS_2(
23 NVSDK_NGX_Parameter *pInParams,
24 unsigned long long *pVRAMAllocatedBytes,
25 unsigned int *pOptLevel, unsigned int *IsDevSnippetBranch)
26{
27 void *Callback = NULL;
28 NVSDK_NGX_Parameter_GetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSGetStatsCallback, &Callback);
29 if (!Callback)
30 {
31 // Possible reasons for this:
32 // - Installed DLSS is out of date and does not support the feature we need
33 // - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
34 return NVSDK_NGX_Result_FAIL_OutOfDate;
35 }
36
37 NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
38 PFN_NVSDK_NGX_DLSS_GetStatsCallback PFNCallback = (PFN_NVSDK_NGX_DLSS_GetStatsCallback)Callback;
39 Res = PFNCallback(pInParams);
40 if (NVSDK_NGX_FAILED(Res))
41 {
42 return Res;
43 }
44 NVSDK_NGX_Parameter_GetULL(pInParams, NVSDK_NGX_Parameter_SizeInBytes, pVRAMAllocatedBytes);
45 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_EParameter_OptLevel, pOptLevel);
46 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_EParameter_IsDevSnippetBranch, IsDevSnippetBranch);
47 return Res;
48}
49
50static inline NVSDK_NGX_Result NGX_DLSS_GET_STATS_1(
51 NVSDK_NGX_Parameter *pInParams,
52 unsigned long long *pVRAMAllocatedBytes,
53 unsigned int *pOptLevel)
54{
55 unsigned int dummy = 0;
56 return NGX_DLSS_GET_STATS_2(pInParams, pVRAMAllocatedBytes, pOptLevel, &dummy);
57}
58
59static inline NVSDK_NGX_Result NGX_DLSS_GET_STATS(
60 NVSDK_NGX_Parameter *pInParams,
61 unsigned long long *pVRAMAllocatedBytes)
62{
63 unsigned int dummy = 0;
64 return NGX_DLSS_GET_STATS_2(pInParams, pVRAMAllocatedBytes, &dummy, &dummy);
65}
66
67typedef NVSDK_NGX_Result(NVSDK_CONV *PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback)(NVSDK_NGX_Parameter *InParams);
68
69static inline NVSDK_NGX_Result NGX_DLSS_GET_OPTIMAL_SETTINGS(
70 NVSDK_NGX_Parameter *pInParams,
71 unsigned int InUserSelectedWidth,
72 unsigned int InUserSelectedHeight,
73 NVSDK_NGX_PerfQuality_Value InPerfQualityValue,
74 unsigned int *pOutRenderOptimalWidth,
75 unsigned int *pOutRenderOptimalHeight,
76 unsigned int *pOutRenderMaxWidth,
77 unsigned int *pOutRenderMaxHeight,
78 unsigned int *pOutRenderMinWidth,
79 unsigned int *pOutRenderMinHeight,
80 float *pOutSharpness)
81{
82 void *Callback = NULL;
83 NVSDK_NGX_Parameter_GetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSOptimalSettingsCallback, &Callback);
84 if (!Callback)
85 {
86 // Possible reasons for this:
87 // - Installed DLSS is out of date and does not support the feature we need
88 // - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
89 return NVSDK_NGX_Result_FAIL_OutOfDate;
90 }
91
92 // These are selections made by user in UI
93 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, InUserSelectedWidth);
94 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, InUserSelectedHeight);
95 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, InPerfQualityValue);
96 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_RTXValue, false); // Some older DLSS dlls still expect this value to be set
97
98 NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
99 PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback PFNCallback = (PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback)Callback;
100 Res = PFNCallback(pInParams);
101 if (NVSDK_NGX_FAILED(Res))
102 {
103 return Res;
104 }
105 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pOutRenderOptimalWidth);
106 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pOutRenderOptimalHeight);
107 // If we have an older DLSS Dll those might need to be set to the optimal dimensions instead
108 *pOutRenderMaxWidth = *pOutRenderOptimalWidth;
109 *pOutRenderMaxHeight = *pOutRenderOptimalHeight;
110 *pOutRenderMinWidth = *pOutRenderOptimalWidth;
111 *pOutRenderMinHeight = *pOutRenderOptimalHeight;
112 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Width, pOutRenderMaxWidth);
113 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Height, pOutRenderMaxHeight);
114 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Width, pOutRenderMinWidth);
115 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Height, pOutRenderMinHeight);
116 NVSDK_NGX_Parameter_GetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pOutSharpness);
117 return Res;
118}
119
120/*** D3D11 ***/
121typedef struct NVSDK_NGX_D3D11_Feature_Eval_Params
122{
123 ID3D11Resource* pInColor;
124 ID3D11Resource* pInOutput;
125 /*** OPTIONAL for DLSS ***/
126 float InSharpness;
127} NVSDK_NGX_D3D11_Feature_Eval_Params;
128
129typedef struct NVSDK_NGX_CUDA_Feature_Eval_Params
130{
131 CUtexObject* pInColor;
132 CUtexObject* pInOutput;
133 /*** OPTIONAL for DLSS ***/
134 float InSharpness;
135} NVSDK_NGX_CUDA_Feature_Eval_Params;
136
137typedef struct NVSDK_NGX_D3D11_GBuffer
138{
139 ID3D11Resource* pInAttrib[NVSDK_NGX_GBUFFERTYPE_NUM];
140} NVSDK_NGX_D3D11_GBuffer;
141
142typedef struct NVSDK_NGX_D3D11_DLSS_Eval_Params
143{
144 NVSDK_NGX_D3D11_Feature_Eval_Params Feature;
145 ID3D11Resource* pInDepth;
146 ID3D11Resource* pInMotionVectors;
147 float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
148 float InJitterOffsetY;
149 NVSDK_NGX_Dimensions InRenderSubrectDimensions;
150 /*** OPTIONAL - leave to 0/0.0f if unused ***/
151 int InReset; /* Set to 1 when scene changes completely (new level etc) */
152 float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
153 float InMVScaleY;
154 ID3D11Resource* pInTransparencyMask; /* Unused/Reserved for future use */
155 ID3D11Resource* pInExposureTexture;
156 ID3D11Resource* pInBiasCurrentColorMask;
157 NVSDK_NGX_Coordinates InColorSubrectBase;
158 NVSDK_NGX_Coordinates InDepthSubrectBase;
159 NVSDK_NGX_Coordinates InMVSubrectBase;
160 NVSDK_NGX_Coordinates InTranslucencySubrectBase;
161 NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
162 NVSDK_NGX_Coordinates InOutputSubrectBase;
163 float InPreExposure;
164 float InExposureScale;
165 int InIndicatorInvertXAxis;
166 int InIndicatorInvertYAxis;
167 /*** OPTIONAL - only for research purposes ***/
168 NVSDK_NGX_D3D11_GBuffer GBufferSurface;
169 NVSDK_NGX_ToneMapperType InToneMapperType;
170 ID3D11Resource* pInMotionVectors3D;
171 ID3D11Resource* pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
172 ID3D11Resource* pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
173 ID3D11Resource* pInDepthHighRes;
174 ID3D11Resource* pInPositionViewSpace;
175 float InFrameTimeDeltaInMsec; /* helps in determining the amount to denoise or anti-alias based on the speed of the object from motion vector magnitudes and fps as determined by this delta */
176 ID3D11Resource* pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
177 ID3D11Resource* pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
178} NVSDK_NGX_D3D11_DLSS_Eval_Params;
179
180typedef struct NVSDK_NGX_D3D11_DLISP_Eval_Params
181{
182 NVSDK_NGX_D3D11_Feature_Eval_Params Feature;
183 /*** OPTIONAL - leave to 0/0.0f if unused ***/
184 unsigned int InRectX;
185 unsigned int InRectY;
186 unsigned int InRectW;
187 unsigned int InRectH;
188 float InDenoise;
189} NVSDK_NGX_D3D11_DLISP_Eval_Params;
190
191typedef struct NVSDK_NGX_CUDA_DLISP_Eval_Params
192{
193 NVSDK_NGX_CUDA_Feature_Eval_Params Feature;
194 /*** OPTIONAL - leave to 0/0.0f if unused ***/
195 unsigned int InRectX;
196 unsigned int InRectY;
197 unsigned int InRectW;
198 unsigned int InRectH;
199 float InDenoise;
200} NVSDK_NGX_CUDA_DLISP_Eval_Params;
201
202
203static inline NVSDK_NGX_Result NGX_D3D11_CREATE_DLSS_EXT(
204 ID3D11DeviceContext *pInCtx,
205 NVSDK_NGX_Handle **ppOutHandle,
206 NVSDK_NGX_Parameter *pInParams,
207 NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
208{
209 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssCreateParams->Feature.InWidth);
210 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssCreateParams->Feature.InHeight);
211 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssCreateParams->Feature.InTargetWidth);
212 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssCreateParams->Feature.InTargetHeight);
213 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssCreateParams->Feature.InPerfQualityValue);
214 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssCreateParams->InFeatureCreateFlags);
215 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssCreateParams->InEnableOutputSubrects ? 1 : 0);
216
217 return NVSDK_NGX_D3D11_CreateFeature(pInCtx, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
218}
219
220
221static inline NVSDK_NGX_Result NGX_D3D11_EVALUATE_DLSS_EXT(
222 ID3D11DeviceContext *pInCtx,
223 NVSDK_NGX_Handle *pInHandle,
224 NVSDK_NGX_Parameter *pInParams,
225 NVSDK_NGX_D3D11_DLSS_Eval_Params *pInDlssEvalParams)
226{
227 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Color, pInDlssEvalParams->Feature.pInColor);
228 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Output, pInDlssEvalParams->Feature.pInOutput);
229 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssEvalParams->pInDepth);
230 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssEvalParams->pInMotionVectors);
231 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssEvalParams->InJitterOffsetX);
232 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssEvalParams->InJitterOffsetY);
233 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlssEvalParams->Feature.InSharpness);
234 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssEvalParams->InReset);
235 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleX);
236 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleY);
237 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssEvalParams->pInTransparencyMask);
238 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssEvalParams->pInExposureTexture);
239 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssEvalParams->pInBiasCurrentColorMask);
240 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
241 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
242 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
243 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
244 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
245 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
246 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
247 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
248 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssEvalParams->GBufferSurface.pInAttrib[8]);
249 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssEvalParams->GBufferSurface.pInAttrib[9]);
250 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_10, pInDlssEvalParams->GBufferSurface.pInAttrib[10]);
251 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssEvalParams->GBufferSurface.pInAttrib[11]);
252 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssEvalParams->GBufferSurface.pInAttrib[12]);
253 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssEvalParams->GBufferSurface.pInAttrib[13]);
254 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssEvalParams->GBufferSurface.pInAttrib[14]);
255 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssEvalParams->GBufferSurface.pInAttrib[15]);
256 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssEvalParams->InToneMapperType);
257 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssEvalParams->pInMotionVectors3D);
258 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssEvalParams->pInIsParticleMask);
259 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssEvalParams->pInAnimatedTextureMask);
260 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssEvalParams->pInDepthHighRes);
261 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssEvalParams->pInPositionViewSpace);
262 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssEvalParams->InFrameTimeDeltaInMsec);
263 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssEvalParams->pInRayTracingHitDistance);
264 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectorsReflection, pInDlssEvalParams->pInMotionVectorsReflections);
265 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssEvalParams->InColorSubrectBase.X);
266 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssEvalParams->InColorSubrectBase.Y);
267 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssEvalParams->InDepthSubrectBase.X);
268 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssEvalParams->InDepthSubrectBase.Y);
269 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssEvalParams->InMVSubrectBase.X);
270 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssEvalParams->InMVSubrectBase.Y);
271 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssEvalParams->InTranslucencySubrectBase.X);
272 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssEvalParams->InTranslucencySubrectBase.Y);
273 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssEvalParams->InBiasCurrentColorSubrectBase.X);
274 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssEvalParams->InBiasCurrentColorSubrectBase.Y);
275 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssEvalParams->InOutputSubrectBase.X);
276 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssEvalParams->InOutputSubrectBase.Y);
277 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssEvalParams->InRenderSubrectDimensions.Width);
278 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssEvalParams->InRenderSubrectDimensions.Height);
279 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssEvalParams->InPreExposure);
280 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Exposure_Scale, pInDlssEvalParams->InExposureScale == 0.0f ? 1.0f : pInDlssEvalParams->InExposureScale);
281 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssEvalParams->InIndicatorInvertXAxis);
282 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssEvalParams->InIndicatorInvertYAxis);
283
284 return NVSDK_NGX_D3D11_EvaluateFeature_C(pInCtx, pInHandle, pInParams, NULL);
285}
286
287static inline NVSDK_NGX_Result NGX_D3D11_CREATE_DLISP_EXT(
288 ID3D11DeviceContext *pInCtx,
289 NVSDK_NGX_Handle **ppOutHandle,
290 NVSDK_NGX_Parameter *pInParams,
291 NVSDK_NGX_Feature_Create_Params *pDlispCreateParams)
292{
293 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlispCreateParams->InWidth);
294 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlispCreateParams->InHeight);
295 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlispCreateParams->InTargetWidth);
296 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlispCreateParams->InTargetHeight);
297
298 return NVSDK_NGX_D3D11_CreateFeature(pInCtx, NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
299}
300
301static inline NVSDK_NGX_Result NGX_CUDA_CREATE_DLISP_EXT(
302 NVSDK_NGX_Handle** ppOutHandle,
303 NVSDK_NGX_Parameter* pInParams,
304 NVSDK_NGX_Feature_Create_Params* pDlispCreateParams)
305{
306 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlispCreateParams->InWidth);
307 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlispCreateParams->InHeight);
308 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlispCreateParams->InTargetWidth);
309 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlispCreateParams->InTargetHeight);
310
311 return NVSDK_NGX_CUDA_CreateFeature(NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
312}
313
314static inline NVSDK_NGX_Result NGX_D3D11_EVALUATE_DLISP_EXT(
315 ID3D11DeviceContext *pInCtx,
316 NVSDK_NGX_Handle *pInHandle,
317 NVSDK_NGX_Parameter *pInParams,
318 NVSDK_NGX_D3D11_DLISP_Eval_Params *pDlispEvalParams)
319{
320 if (pDlispEvalParams->Feature.InSharpness < 0.0f || pDlispEvalParams->Feature.InSharpness > 1.0f || pDlispEvalParams->InDenoise < 0.0f || pDlispEvalParams->InDenoise > 1.0f)
321 {
322 return NVSDK_NGX_Result_FAIL_InvalidParameter;
323 }
324 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlispEvalParams->Feature.pInColor);
325 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlispEvalParams->Feature.pInOutput);
326 // Both sharpness and denoise in range [0.0f,1.0f]
327 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlispEvalParams->Feature.InSharpness);
328 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pDlispEvalParams->InDenoise);
329 // If input is atlas - use RECT to upscale only the required area
330 if (pDlispEvalParams->InRectW)
331 {
332 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pDlispEvalParams->InRectX);
333 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pDlispEvalParams->InRectY);
334 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pDlispEvalParams->InRectW);
335 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pDlispEvalParams->InRectH);
336 }
337
338 return NVSDK_NGX_D3D11_EvaluateFeature_C(pInCtx, pInHandle, pInParams, NULL);
339}
340
341static inline NVSDK_NGX_Result NGX_CUDA_EVALUATE_DLISP_EXT(
342 NVSDK_NGX_Handle *pInHandle,
343 NVSDK_NGX_Parameter *pInParams,
344 NVSDK_NGX_CUDA_DLISP_Eval_Params *pDlispEvalParams)
345{
346 if (pDlispEvalParams->Feature.InSharpness < 0.0f || pDlispEvalParams->Feature.InSharpness > 1.0f || pDlispEvalParams->InDenoise < 0.0f || pDlispEvalParams->InDenoise > 1.0f)
347 {
348 return NVSDK_NGX_Result_FAIL_InvalidParameter;
349 }
350 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pDlispEvalParams->Feature.pInColor);
351 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pDlispEvalParams->Feature.pInOutput);
352 // Both sharpness and denoise in range [0.0f,1.0f]
353 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlispEvalParams->Feature.InSharpness);
354 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pDlispEvalParams->InDenoise);
355 // If input is atlas - use RECT to upscale only the required area
356 if (pDlispEvalParams->InRectW)
357 {
358 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pDlispEvalParams->InRectX);
359 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pDlispEvalParams->InRectY);
360 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pDlispEvalParams->InRectW);
361 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pDlispEvalParams->InRectH);
362 }
363
364 return NVSDK_NGX_CUDA_EvaluateFeature_C(pInHandle, pInParams, NULL);
365}
366
367static inline NVSDK_NGX_Result NGX_D3D11_CREATE_DLRESOLVE_EXT(
368 ID3D11DeviceContext *pInCtx,
369 NVSDK_NGX_Handle **ppOutHandle,
370 NVSDK_NGX_Parameter *pInParams,
371 NVSDK_NGX_Feature_Create_Params *pDlresolveCreateParams)
372{
373 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlresolveCreateParams->InWidth);
374 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlresolveCreateParams->InHeight);
375 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlresolveCreateParams->InTargetWidth);
376 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlresolveCreateParams->InTargetHeight);
377
378 return NVSDK_NGX_D3D11_CreateFeature(pInCtx, NVSDK_NGX_Feature_DeepResolve, pInParams, ppOutHandle);
379}
380
381static inline NVSDK_NGX_Result NGX_D3D11_EVALUATE_DLRESOLVE_EXT(
382 ID3D11DeviceContext *pInCtx,
383 NVSDK_NGX_Handle *InHandle,
384 NVSDK_NGX_Parameter *pInParams,
385 NVSDK_NGX_D3D11_Feature_Eval_Params *pDlresolveEvalParams)
386{
387 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlresolveEvalParams->pInColor);
388 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlresolveEvalParams->pInOutput);
389 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlresolveEvalParams->InSharpness);
390
391 return NVSDK_NGX_D3D11_EvaluateFeature_C(pInCtx, InHandle, pInParams, NULL);
392}
393
394/*** D3D12 ***/
395typedef struct NVSDK_NGX_D3D12_Feature_Eval_Params
396{
397 ID3D12Resource* pInColor;
398 ID3D12Resource* pInOutput;
399 /*** OPTIONAL for DLSS ***/
400 float InSharpness;
401} NVSDK_NGX_D3D12_Feature_Eval_Params;
402
403typedef struct NVSDK_NGX_D3D12_GBuffer
404{
405 ID3D12Resource* pInAttrib[NVSDK_NGX_GBUFFERTYPE_NUM];
406} NVSDK_NGX_D3D12_GBuffer;
407
408typedef struct NVSDK_NGX_D3D12_DLSS_Eval_Params
409{
410 NVSDK_NGX_D3D12_Feature_Eval_Params Feature;
411 ID3D12Resource* pInDepth;
412 ID3D12Resource* pInMotionVectors;
413 float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
414 float InJitterOffsetY;
415 NVSDK_NGX_Dimensions InRenderSubrectDimensions;
416 /*** OPTIONAL - leave to 0/0.0f if unused ***/
417 int InReset; /* Set to 1 when scene changes completely (new level etc) */
418 float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
419 float InMVScaleY;
420 ID3D12Resource* pInTransparencyMask; /* Unused/Reserved for future use */
421 ID3D12Resource* pInExposureTexture;
422 ID3D12Resource* pInBiasCurrentColorMask;
423 NVSDK_NGX_Coordinates InColorSubrectBase;
424 NVSDK_NGX_Coordinates InDepthSubrectBase;
425 NVSDK_NGX_Coordinates InMVSubrectBase;
426 NVSDK_NGX_Coordinates InTranslucencySubrectBase;
427 NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
428 NVSDK_NGX_Coordinates InOutputSubrectBase;
429 float InPreExposure;
430 float InExposureScale;
431 int InIndicatorInvertXAxis;
432 int InIndicatorInvertYAxis;
433 /*** OPTIONAL - only for research purposes ***/
434 NVSDK_NGX_D3D12_GBuffer GBufferSurface;
435 NVSDK_NGX_ToneMapperType InToneMapperType;
436 ID3D12Resource* pInMotionVectors3D;
437 ID3D12Resource* pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
438 ID3D12Resource* pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
439 ID3D12Resource* pInDepthHighRes;
440 ID3D12Resource* pInPositionViewSpace;
441 float InFrameTimeDeltaInMsec; /* helps in determining the amount to denoise or anti-alias based on the speed of the object from motion vector magnitudes and fps as determined by this delta */
442 ID3D12Resource* pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
443 ID3D12Resource* pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
444} NVSDK_NGX_D3D12_DLSS_Eval_Params;
445
446typedef struct NVSDK_NGX_D3D12_DLISP_Eval_Params
447{
448 NVSDK_NGX_D3D12_Feature_Eval_Params Feature;
449 /*** OPTIONAL ***/
450 unsigned int InRectX;
451 unsigned int InRectY;
452 unsigned int InRectW;
453 unsigned int InRectH;
454 float InDenoise;
455} NVSDK_NGX_D3D12_DLISP_Eval_Params;
456
457
458static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLSS_EXT(
459 ID3D12GraphicsCommandList *pInCmdList,
460 unsigned int InCreationNodeMask,
461 unsigned int InVisibilityNodeMask,
462 NVSDK_NGX_Handle **ppOutHandle,
463 NVSDK_NGX_Parameter *pInParams,
464 NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
465{
466 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
467 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
468 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssCreateParams->Feature.InWidth);
469 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssCreateParams->Feature.InHeight);
470 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssCreateParams->Feature.InTargetWidth);
471 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssCreateParams->Feature.InTargetHeight);
472 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssCreateParams->Feature.InPerfQualityValue);
473 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssCreateParams->InFeatureCreateFlags);
474 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssCreateParams->InEnableOutputSubrects ? 1 : 0);
475
476 return NVSDK_NGX_D3D12_CreateFeature(pInCmdList, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
477}
478
479
480static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLSS_EXT(
481 ID3D12GraphicsCommandList *pInCmdList,
482 NVSDK_NGX_Handle *pInHandle,
483 NVSDK_NGX_Parameter *pInParams,
484 NVSDK_NGX_D3D12_DLSS_Eval_Params *pInDlssEvalParams)
485{
486 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Color, pInDlssEvalParams->Feature.pInColor);
487 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Output, pInDlssEvalParams->Feature.pInOutput);
488 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssEvalParams->pInDepth);
489 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssEvalParams->pInMotionVectors);
490 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssEvalParams->InJitterOffsetX);
491 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssEvalParams->InJitterOffsetY);
492 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlssEvalParams->Feature.InSharpness);
493 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssEvalParams->InReset);
494 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleX);
495 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleY);
496 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssEvalParams->pInTransparencyMask);
497 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssEvalParams->pInExposureTexture);
498 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssEvalParams->pInBiasCurrentColorMask);
499 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
500 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
501 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
502 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
503 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
504 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
505 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
506 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
507 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssEvalParams->GBufferSurface.pInAttrib[8]);
508 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssEvalParams->GBufferSurface.pInAttrib[9]);
509 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_10, pInDlssEvalParams->GBufferSurface.pInAttrib[10]);
510 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssEvalParams->GBufferSurface.pInAttrib[11]);
511 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssEvalParams->GBufferSurface.pInAttrib[12]);
512 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssEvalParams->GBufferSurface.pInAttrib[13]);
513 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssEvalParams->GBufferSurface.pInAttrib[14]);
514 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssEvalParams->GBufferSurface.pInAttrib[15]);
515 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssEvalParams->InToneMapperType);
516 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssEvalParams->pInMotionVectors3D);
517 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssEvalParams->pInIsParticleMask);
518 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssEvalParams->pInAnimatedTextureMask);
519 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssEvalParams->pInDepthHighRes);
520 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssEvalParams->pInPositionViewSpace);
521 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssEvalParams->InFrameTimeDeltaInMsec);
522 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssEvalParams->pInRayTracingHitDistance);
523 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectorsReflection, pInDlssEvalParams->pInMotionVectorsReflections);
524 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssEvalParams->InColorSubrectBase.X);
525 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssEvalParams->InColorSubrectBase.Y);
526 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssEvalParams->InDepthSubrectBase.X);
527 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssEvalParams->InDepthSubrectBase.Y);
528 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssEvalParams->InMVSubrectBase.X);
529 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssEvalParams->InMVSubrectBase.Y);
530 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssEvalParams->InTranslucencySubrectBase.X);
531 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssEvalParams->InTranslucencySubrectBase.Y);
532 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssEvalParams->InBiasCurrentColorSubrectBase.X);
533 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssEvalParams->InBiasCurrentColorSubrectBase.Y);
534 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssEvalParams->InOutputSubrectBase.X);
535 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssEvalParams->InOutputSubrectBase.Y);
536 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssEvalParams->InRenderSubrectDimensions.Width);
537 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssEvalParams->InRenderSubrectDimensions.Height);
538 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssEvalParams->InPreExposure);
539 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Exposure_Scale, pInDlssEvalParams->InExposureScale == 0.0f ? 1.0f : pInDlssEvalParams->InExposureScale);
540 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssEvalParams->InIndicatorInvertXAxis);
541 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssEvalParams->InIndicatorInvertYAxis);
542
543 return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
544}
545
546static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLISP_EXT(
547 ID3D12GraphicsCommandList *InCmdList,
548 unsigned int InCreationNodeMask,
549 unsigned int InVisibilityNodeMask,
550 NVSDK_NGX_Handle **ppOutHandle,
551 NVSDK_NGX_Parameter *pInParams,
552 NVSDK_NGX_Feature_Create_Params *pDlispCreateParams)
553{
554 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
555 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
556 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlispCreateParams->InWidth);
557 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlispCreateParams->InHeight);
558 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlispCreateParams->InTargetWidth);
559 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlispCreateParams->InTargetHeight);
560 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pDlispCreateParams->InPerfQualityValue);
561
562 return NVSDK_NGX_D3D12_CreateFeature(InCmdList, NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
563}
564
565static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLISP_EXT(
566 ID3D12GraphicsCommandList *pInCmdList,
567 NVSDK_NGX_Handle *pInHandle,
568 NVSDK_NGX_Parameter *pInParams,
569 NVSDK_NGX_D3D12_DLISP_Eval_Params *pDlispEvalParams)
570{
571 if (pDlispEvalParams->Feature.InSharpness < 0.0f || pDlispEvalParams->Feature.InSharpness > 1.0f || pDlispEvalParams->InDenoise < 0.0f || pDlispEvalParams->InDenoise > 1.0f)
572 {
573 return NVSDK_NGX_Result_FAIL_InvalidParameter;
574 }
575 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlispEvalParams->Feature.pInColor);
576 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlispEvalParams->Feature.pInOutput);
577 // Both sharpness and denoise in range [0.0f,1.0f]
578 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlispEvalParams->Feature.InSharpness);
579 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pDlispEvalParams->InDenoise);
580 // If input is atlas - use RECT to upscale only the required area
581 if (pDlispEvalParams->InRectW)
582 {
583 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pDlispEvalParams->InRectX);
584 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pDlispEvalParams->InRectY);
585 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pDlispEvalParams->InRectW);
586 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pDlispEvalParams->InRectH);
587 }
588 return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
589}
590
591
592static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLRESOLVE_EXT(
593 ID3D12GraphicsCommandList *pInCmdList,
594 unsigned int InCreationNodeMask,
595 unsigned int InVisibilityNodeMask,
596 NVSDK_NGX_Handle **ppOutHandle,
597 NVSDK_NGX_Parameter *pInParams,
598 NVSDK_NGX_Feature_Create_Params *pDlresolveCreateParams)
599{
600 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
601 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
602 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlresolveCreateParams->InWidth);
603 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlresolveCreateParams->InHeight);
604 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlresolveCreateParams->InTargetWidth);
605 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlresolveCreateParams->InTargetHeight);
606
607 return NVSDK_NGX_D3D12_CreateFeature(pInCmdList, NVSDK_NGX_Feature_DeepResolve, pInParams, ppOutHandle);
608}
609
610static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLRESOLVE_EXT(
611 ID3D12GraphicsCommandList *pInCmdList,
612 NVSDK_NGX_Handle *pInHandle,
613 NVSDK_NGX_Parameter *pInParams,
614 NVSDK_NGX_D3D12_Feature_Eval_Params *pDlresolveEvalParams)
615{
616 // This call to NVSDK_NGX_Parameter_SetXXX() is equivalent to the Params->Set below functionally
617 // but to work around the lack of virtual functions and polymorphism in a C only project
618 // we introduced this new way to set params.
619 // The test should enforce that both paths work.
620 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlresolveEvalParams->pInColor);
621 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlresolveEvalParams->pInOutput);
622 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlresolveEvalParams->InSharpness);
623
624 return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
625}
626
627#endif
thirdparty/ngx/include/nvsdk_ngx_helpers_dlssd.h +715 -0
……@@ -0,0 +1,715 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13#ifndef NVSDK_NGX_HELPERS_DLSSD_H
14#define NVSDK_NGX_HELPERS_DLSSD_H
15#pragma once
16
17#include "nvsdk_ngx_helpers.h"
18#include "nvsdk_ngx_defs_dlssd.h"
19#include "nvsdk_ngx_params_dlssd.h"
20
21typedef NVSDK_NGX_Result(NVSDK_CONV* PFN_NVSDK_NGX_DLSS_GetStatsCallback)(NVSDK_NGX_Parameter* InParams);
22
23static inline NVSDK_NGX_Result NGX_DLSSD_GET_STATS_2(
24 NVSDK_NGX_Parameter* pInParams,
25 unsigned long long* pVRAMAllocatedBytes,
26 unsigned int* pOptLevel, unsigned int* IsDevSnippetBranch)
27{
28 void* Callback = NULL;
29 NVSDK_NGX_Parameter_GetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSDGetStatsCallback, &Callback);
30 if (!Callback)
31 {
32 // Possible reasons for this:
33 // - Installed DLSS is out of date and does not support the feature we need
34 // - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
35 return NVSDK_NGX_Result_FAIL_OutOfDate;
36 }
37
38 NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
39 PFN_NVSDK_NGX_DLSS_GetStatsCallback PFNCallback = (PFN_NVSDK_NGX_DLSS_GetStatsCallback)Callback;
40 Res = PFNCallback(pInParams);
41 if (NVSDK_NGX_FAILED(Res))
42 {
43 return Res;
44 }
45 NVSDK_NGX_Parameter_GetULL(pInParams, NVSDK_NGX_Parameter_SizeInBytes, pVRAMAllocatedBytes);
46 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_EParameter_OptLevel, pOptLevel);
47 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_EParameter_IsDevSnippetBranch, IsDevSnippetBranch);
48 return Res;
49}
50
51static inline NVSDK_NGX_Result NGX_DLSSD_GET_STATS_1(
52 NVSDK_NGX_Parameter* pInParams,
53 unsigned long long* pVRAMAllocatedBytes,
54 unsigned int* pOptLevel)
55{
56 unsigned int dummy = 0;
57 return NGX_DLSSD_GET_STATS_2(pInParams, pVRAMAllocatedBytes, pOptLevel, &dummy);
58}
59
60static inline NVSDK_NGX_Result NGX_DLSSD_GET_STATS(
61 NVSDK_NGX_Parameter* pInParams,
62 unsigned long long* pVRAMAllocatedBytes)
63{
64 unsigned int dummy = 0;
65 return NGX_DLSSD_GET_STATS_2(pInParams, pVRAMAllocatedBytes, &dummy, &dummy);
66}
67
68typedef NVSDK_NGX_Result(NVSDK_CONV* PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback)(NVSDK_NGX_Parameter* InParams);
69
70static inline NVSDK_NGX_Result NGX_DLSSD_GET_OPTIMAL_SETTINGS(
71 NVSDK_NGX_Parameter* pInParams,
72 unsigned int InUserSelectedWidth,
73 unsigned int InUserSelectedHeight,
74 NVSDK_NGX_PerfQuality_Value InPerfQualityValue,
75 unsigned int* pOutRenderOptimalWidth,
76 unsigned int* pOutRenderOptimalHeight,
77 unsigned int* pOutRenderMaxWidth,
78 unsigned int* pOutRenderMaxHeight,
79 unsigned int* pOutRenderMinWidth,
80 unsigned int* pOutRenderMinHeight,
81 float* pOutSharpness)
82{
83 void* Callback = NULL;
84 NVSDK_NGX_Parameter_GetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSDOptimalSettingsCallback, &Callback);
85 if (!Callback)
86 {
87 // Possible reasons for this:
88 // - Installed DLSS is out of date and does not support the feature we need
89 // - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
90 return NVSDK_NGX_Result_FAIL_OutOfDate;
91 }
92
93 // These are selections made by user in UI
94 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, InUserSelectedWidth);
95 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, InUserSelectedHeight);
96 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, InPerfQualityValue);
97 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_RTXValue, false); // Some older DLSS dlls still expect this value to be set
98
99 NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
100 PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback PFNCallback = (PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback)Callback;
101 Res = PFNCallback(pInParams);
102 if (NVSDK_NGX_FAILED(Res))
103 {
104 return Res;
105 }
106 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pOutRenderOptimalWidth);
107 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pOutRenderOptimalHeight);
108 // If we have an older DLSS Dll those might need to be set to the optimal dimensions instead
109 *pOutRenderMaxWidth = *pOutRenderOptimalWidth;
110 *pOutRenderMaxHeight = *pOutRenderOptimalHeight;
111 *pOutRenderMinWidth = *pOutRenderOptimalWidth;
112 *pOutRenderMinHeight = *pOutRenderOptimalHeight;
113 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Width, pOutRenderMaxWidth);
114 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Height, pOutRenderMaxHeight);
115 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Width, pOutRenderMinWidth);
116 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Height, pOutRenderMinHeight);
117 NVSDK_NGX_Parameter_GetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pOutSharpness);
118 return Res;
119}
120
121typedef struct NVSDK_NGX_D3D11_DLSSD_Eval_Params
122{
123 ID3D11Resource* pInDiffuseAlbedo;
124 ID3D11Resource* pInSpecularAlbedo;
125 ID3D11Resource* pInNormals;
126 ID3D11Resource* pInRoughness;
127
128 ID3D11Resource* pInColor;
129 ID3D11Resource* pInAlpha;
130 ID3D11Resource* pInOutput;
131 ID3D11Resource* pInOutputAlpha;
132 ID3D11Resource* pInDepth;
133 ID3D11Resource* pInMotionVectors;
134 float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
135 float InJitterOffsetY;
136 NVSDK_NGX_Dimensions InRenderSubrectDimensions;
137 /*** OPTIONAL - leave to 0/0.0f if unused ***/
138 int InReset; /* Set to 1 when scene changes completely (new level etc) */
139 float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
140 float InMVScaleY;
141 ID3D11Resource* pInTransparencyMask; /* Unused/Reserved for future use */
142 ID3D11Resource* pInExposureTexture;
143 ID3D11Resource* pInBiasCurrentColorMask;
144 NVSDK_NGX_Coordinates InAlphaSubrectBase;
145 NVSDK_NGX_Coordinates InOutputAlphaSubrectBase;
146 NVSDK_NGX_Coordinates InDiffuseAlbedoSubrectBase;
147 NVSDK_NGX_Coordinates InSpecularAlbedoSubrectBase;
148 NVSDK_NGX_Coordinates InNormalsSubrectBase;
149 NVSDK_NGX_Coordinates InRoughnessSubrectBase;
150 NVSDK_NGX_Coordinates InColorSubrectBase;
151 NVSDK_NGX_Coordinates InDepthSubrectBase;
152 NVSDK_NGX_Coordinates InMVSubrectBase;
153 NVSDK_NGX_Coordinates InTranslucencySubrectBase;
154 NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
155 NVSDK_NGX_Coordinates InOutputSubrectBase;
156
157 ID3D11Resource* pInReflectedAlbedo;
158 ID3D11Resource* pInColorBeforeParticles;
159 ID3D11Resource* pInColorAfterParticles;
160 ID3D11Resource* pInColorBeforeTransparency;
161 ID3D11Resource* pInColorAfterTransparency;
162 ID3D11Resource* pInColorBeforeFog;
163 ID3D11Resource* pInColorAfterFog;
164 ID3D11Resource* pInScreenSpaceSubsurfaceScatteringGuide;
165 ID3D11Resource* pInColorBeforeScreenSpaceSubsurfaceScattering;
166 ID3D11Resource* pInColorAfterScreenSpaceSubsurfaceScattering;
167 ID3D11Resource* pInScreenSpaceRefractionGuide;
168 ID3D11Resource* pInColorBeforeScreenSpaceRefraction;
169 ID3D11Resource* pInColorAfterScreenSpaceRefraction;
170 ID3D11Resource* pInDepthOfFieldGuide;
171 ID3D11Resource* pInColorBeforeDepthOfField;
172 ID3D11Resource* pInColorAfterDepthOfField;
173 ID3D11Resource* pInDiffuseHitDistance;
174 ID3D11Resource* pInSpecularHitDistance;
175 ID3D11Resource* pInDiffuseRayDirection;
176 ID3D11Resource* pInSpecularRayDirection;
177 ID3D11Resource* pInDiffuseRayDirectionHitDistance;
178 ID3D11Resource* pInSpecularRayDirectionHitDistance;
179 NVSDK_NGX_Coordinates InReflectedAlbedoSubrectBase;
180 NVSDK_NGX_Coordinates InColorBeforeParticlesSubrectBase;
181 NVSDK_NGX_Coordinates InColorAfterParticlesSubrectBase;
182 NVSDK_NGX_Coordinates InColorBeforeTransparencySubrectBase;
183 NVSDK_NGX_Coordinates InColorAfterTransparencySubrectBase;
184 NVSDK_NGX_Coordinates InColorBeforeFogSubrectBase;
185 NVSDK_NGX_Coordinates InColorAfterFogSubrectBase;
186 NVSDK_NGX_Coordinates InScreenSpaceSubsurfaceScatteringGuideSubrectBase;
187 NVSDK_NGX_Coordinates InScreenSpaceRefractionGuideSubrectBase;
188 NVSDK_NGX_Coordinates InDepthOfFieldGuideSubrectBase;
189 NVSDK_NGX_Coordinates InDiffuseHitDistanceSubrectBase;
190 NVSDK_NGX_Coordinates InSpecularHitDistanceSubrectBase;
191 NVSDK_NGX_Coordinates InDiffuseRayDirectionSubrectBase;
192 NVSDK_NGX_Coordinates InSpecularRayDirectionSubrectBase;
193 NVSDK_NGX_Coordinates InDiffuseRayDirectionHitDistanceSubrectBase;
194 NVSDK_NGX_Coordinates InSpecularRayDirectionHitDistanceSubrectBase;
195 NVSDK_NGX_Coordinates InColorBeforeScreenSpaceSubsurfaceScatteringSubrectBase;
196 NVSDK_NGX_Coordinates InColorAfterScreenSpaceSubsurfaceScatteringSubrectBase;
197 NVSDK_NGX_Coordinates InColorBeforeScreenSpaceRefractionSubrectBase;
198 NVSDK_NGX_Coordinates InColorAfterScreenSpaceRefractionSubrectBase;
199 NVSDK_NGX_Coordinates InColorBeforeDepthOfFieldSubrectBase;
200 NVSDK_NGX_Coordinates InColorAfterDepthOfFieldSubtectBase;
201 float* pInWorldToViewMatrix;
202 float* pInViewToClipMatrix;
203
204 float InPreExposure;
205 float InExposureScale;
206 int InIndicatorInvertXAxis;
207 int InIndicatorInvertYAxis;
208 /*** OPTIONAL - only for research purposes ***/
209 NVSDK_NGX_D3D11_GBuffer GBufferSurface;
210 NVSDK_NGX_ToneMapperType InToneMapperType;
211 ID3D11Resource* pInMotionVectors3D;
212 ID3D11Resource* pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
213 ID3D11Resource* pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
214 ID3D11Resource* pInDepthHighRes;
215 ID3D11Resource* pInPositionViewSpace;
216 float InFrameTimeDeltaInMsec; /* helps in determining the amount to denoise or anti-alias based on the speed of the object from motion vector magnitudes and fps as determined by this delta */
217 ID3D11Resource* pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
218 ID3D11Resource* pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
219 ID3D11Resource* pInTransparencyLayer; /* optional input res particle layer */
220 NVSDK_NGX_Coordinates InTransparencyLayerSubrectBase;
221 ID3D11Resource* pInTransparencyLayerOpacity; /* optional input res particle opacity layer */
222 NVSDK_NGX_Coordinates InTransparencyLayerOpacitySubrectBase;
223 ID3D11Resource* pInTransparencyLayerMvecs; /* optional input res transparency layer mvecs */
224 NVSDK_NGX_Coordinates InTransparencyLayerMvecsSubrectBase;
225 ID3D11Resource* pInDisocclusionMask; /* optional input res disocclusion mask */
226 NVSDK_NGX_Coordinates InDisocclusionMaskSubrectBase;
227} NVSDK_NGX_D3D11_DLSSD_Eval_Params;
228
229static inline NVSDK_NGX_Result NGX_D3D11_CREATE_DLSSD_EXT(
230 ID3D11DeviceContext *pInCtx,
231 NVSDK_NGX_Handle **ppOutHandle,
232 NVSDK_NGX_Parameter *pInParams,
233 NVSDK_NGX_DLSSD_Create_Params *pInDlssDCreateParams)
234{
235 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssDCreateParams->InWidth);
236 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssDCreateParams->InHeight);
237 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssDCreateParams->InTargetWidth);
238 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssDCreateParams->InTargetHeight);
239 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssDCreateParams->InPerfQualityValue);
240 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssDCreateParams->InFeatureCreateFlags);
241 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssDCreateParams->InEnableOutputSubrects ? 1 : 0);
242 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Denoise_Mode, NVSDK_NGX_DLSS_Denoise_Mode_DLUnified);
243 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Roughness_Mode, pInDlssDCreateParams->InRoughnessMode);
244 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Use_HW_Depth, pInDlssDCreateParams->InUseHWDepth);
245
246 return NVSDK_NGX_D3D11_CreateFeature(pInCtx, NVSDK_NGX_Feature_RayReconstruction, pInParams, ppOutHandle);
247}
248
249static inline NVSDK_NGX_Result NGX_D3D11_EVALUATE_DLSSD_EXT(
250 ID3D11DeviceContext *pInCtx,
251 NVSDK_NGX_Handle *pInHandle,
252 NVSDK_NGX_Parameter *pInParams,
253 NVSDK_NGX_D3D11_DLSSD_Eval_Params *pInDlssDEvalParams)
254{
255 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Color, pInDlssDEvalParams->pInColor);
256 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Output, pInDlssDEvalParams->pInOutput);
257 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssDEvalParams->pInDepth);
258 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssDEvalParams->pInMotionVectors);
259 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssDEvalParams->InJitterOffsetX);
260 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssDEvalParams->InJitterOffsetY);
261 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssDEvalParams->InReset);
262 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssDEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssDEvalParams->InMVScaleX);
263 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssDEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssDEvalParams->InMVScaleY);
264 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssDEvalParams->pInTransparencyMask);
265 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssDEvalParams->pInExposureTexture);
266 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssDEvalParams->pInBiasCurrentColorMask);
267 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
268 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
269 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
270 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
271 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
272 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
273 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
274 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
275 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssDEvalParams->GBufferSurface.pInAttrib[8]);
276 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssDEvalParams->GBufferSurface.pInAttrib[9]);
277 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_SpecularMvec, pInDlssDEvalParams->pInMotionVectorsReflections);
278 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssDEvalParams->GBufferSurface.pInAttrib[11]);
279 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssDEvalParams->GBufferSurface.pInAttrib[12]);
280 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssDEvalParams->GBufferSurface.pInAttrib[13]);
281 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssDEvalParams->GBufferSurface.pInAttrib[14]);
282 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssDEvalParams->GBufferSurface.pInAttrib[15]);
283 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssDEvalParams->InToneMapperType);
284 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssDEvalParams->pInMotionVectors3D);
285 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssDEvalParams->pInIsParticleMask);
286 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssDEvalParams->pInAnimatedTextureMask);
287 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssDEvalParams->pInDepthHighRes);
288 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssDEvalParams->pInPositionViewSpace);
289 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssDEvalParams->InFrameTimeDeltaInMsec);
290 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssDEvalParams->pInRayTracingHitDistance);
291 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssDEvalParams->InColorSubrectBase.X);
292 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssDEvalParams->InColorSubrectBase.Y);
293 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssDEvalParams->InDepthSubrectBase.X);
294 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssDEvalParams->InDepthSubrectBase.Y);
295 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssDEvalParams->InMVSubrectBase.X);
296 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssDEvalParams->InMVSubrectBase.Y);
297 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssDEvalParams->InTranslucencySubrectBase.X);
298 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssDEvalParams->InTranslucencySubrectBase.Y);
299 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssDEvalParams->InBiasCurrentColorSubrectBase.X);
300 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssDEvalParams->InBiasCurrentColorSubrectBase.Y);
301 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssDEvalParams->InOutputSubrectBase.X);
302 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssDEvalParams->InOutputSubrectBase.Y);
303 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssDEvalParams->InRenderSubrectDimensions.Width);
304 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssDEvalParams->InRenderSubrectDimensions.Height);
305 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssDEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssDEvalParams->InPreExposure);
306 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Exposure_Scale, pInDlssDEvalParams->InExposureScale == 0.0f ? 1.0f : pInDlssDEvalParams->InExposureScale);
307 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssDEvalParams->InIndicatorInvertXAxis);
308 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssDEvalParams->InIndicatorInvertYAxis);
309
310 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DiffuseAlbedo, pInDlssDEvalParams->pInDiffuseAlbedo);
311 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_SpecularAlbedo, pInDlssDEvalParams->pInSpecularAlbedo);
312 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_DiffuseAlbedo_Subrect_Base_X, pInDlssDEvalParams->InDiffuseAlbedoSubrectBase.X);
313 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_DiffuseAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseAlbedoSubrectBase.Y);
314 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_SpecularAlbedo_Subrect_Base_X, pInDlssDEvalParams->InSpecularAlbedoSubrectBase.X);
315 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_SpecularAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InSpecularAlbedoSubrectBase.Y);
316 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Normals_Subrect_Base_X, pInDlssDEvalParams->InNormalsSubrectBase.X);
317 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Normals_Subrect_Base_Y, pInDlssDEvalParams->InNormalsSubrectBase.Y);
318 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Roughness_Subrect_Base_X, pInDlssDEvalParams->InRoughnessSubrectBase.X);
319 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Roughness_Subrect_Base_Y, pInDlssDEvalParams->InRoughnessSubrectBase.Y);
320 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Emissive, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_EMISSIVE]);
321
322 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_Alpha, pInDlssDEvalParams->pInAlpha);
323 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_OutputAlpha, pInDlssDEvalParams->pInOutputAlpha);
324 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo, pInDlssDEvalParams->pInReflectedAlbedo);
325 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles, pInDlssDEvalParams->pInColorBeforeParticles);
326 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles, pInDlssDEvalParams->pInColorAfterParticles);
327 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency, pInDlssDEvalParams->pInColorBeforeTransparency);
328 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency, pInDlssDEvalParams->pInColorAfterTransparency);
329 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog, pInDlssDEvalParams->pInColorBeforeFog);
330 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterFog, pInDlssDEvalParams->pInColorAfterFog);
331 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide, pInDlssDEvalParams->pInScreenSpaceSubsurfaceScatteringGuide);
332 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering, pInDlssDEvalParams->pInColorBeforeScreenSpaceSubsurfaceScattering);
333 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering, pInDlssDEvalParams->pInColorAfterScreenSpaceSubsurfaceScattering);
334 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide, pInDlssDEvalParams->pInScreenSpaceRefractionGuide);
335 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction, pInDlssDEvalParams->pInColorBeforeScreenSpaceRefraction);
336 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction, pInDlssDEvalParams->pInColorAfterScreenSpaceRefraction);
337 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide, pInDlssDEvalParams->pInDepthOfFieldGuide);
338 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField, pInDlssDEvalParams->pInColorBeforeDepthOfField);
339 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField, pInDlssDEvalParams->pInColorAfterDepthOfField);
340 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance, pInDlssDEvalParams->pInDiffuseHitDistance);
341 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance, pInDlssDEvalParams->pInSpecularHitDistance);
342 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection, pInDlssDEvalParams->pInDiffuseRayDirection);
343 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection, pInDlssDEvalParams->pInSpecularRayDirection);
344 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance, pInDlssDEvalParams->pInDiffuseRayDirectionHitDistance);
345 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance, pInDlssDEvalParams->pInSpecularRayDirectionHitDistance);
346 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_Alpha_Subrect_Base_X, pInDlssDEvalParams->InAlphaSubrectBase.X);
347 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_Alpha_Subrect_Base_Y, pInDlssDEvalParams->InAlphaSubrectBase.Y);
348 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_OutputAlpha_Subrect_Base_X, pInDlssDEvalParams->InOutputAlphaSubrectBase.X);
349 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_OutputAlpha_Subrect_Base_Y, pInDlssDEvalParams->InOutputAlphaSubrectBase.Y);
350 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo_Subrect_Base_X, pInDlssDEvalParams->InReflectedAlbedoSubrectBase.X);
351 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InReflectedAlbedoSubrectBase.Y);
352 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles_Subrect_Base_X, pInDlssDEvalParams->InColorAfterParticlesSubrectBase.X);
353 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterParticlesSubrectBase.Y);
354 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeParticlesSubrectBase.X);
355 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeParticlesSubrectBase.Y);
356 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeTransparencySubrectBase.X);
357 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeTransparencySubrectBase.Y);
358 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency_Subrect_Base_X, pInDlssDEvalParams->InColorAfterTransparencySubrectBase.X);
359 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterTransparencySubrectBase.Y);
360 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeFogSubrectBase.X);
361 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeFogSubrectBase.Y);
362 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterFog_Subrect_Base_X, pInDlssDEvalParams->InColorAfterFogSubrectBase.X);
363 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterFog_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterFogSubrectBase.Y);
364 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide_Subrect_Base_X, pInDlssDEvalParams->InScreenSpaceSubsurfaceScatteringGuideSubrectBase.X);
365 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide_Subrect_Base_Y, pInDlssDEvalParams->InScreenSpaceSubsurfaceScatteringGuideSubrectBase.Y);
366 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeScreenSpaceSubsurfaceScatteringSubrectBase.X);
367 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeScreenSpaceSubsurfaceScatteringSubrectBase.Y);
368 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering_Subrect_Base_X, pInDlssDEvalParams->InColorAfterScreenSpaceSubsurfaceScatteringSubrectBase.X);
369 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterScreenSpaceSubsurfaceScatteringSubrectBase.Y);
370 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide_Subrect_Base_X, pInDlssDEvalParams->InScreenSpaceRefractionGuideSubrectBase.X);
371 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide_Subrect_Base_Y, pInDlssDEvalParams->InScreenSpaceRefractionGuideSubrectBase.Y);
372 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeScreenSpaceRefractionSubrectBase.X);
373 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeScreenSpaceRefractionSubrectBase.Y);
374 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction_Subrect_Base_X, pInDlssDEvalParams->InColorAfterScreenSpaceRefractionSubrectBase.X);
375 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterScreenSpaceRefractionSubrectBase.Y);
376 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide_Subrect_Base_X, pInDlssDEvalParams->InDepthOfFieldGuideSubrectBase.X);
377 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide_Subrect_Base_Y, pInDlssDEvalParams->InDepthOfFieldGuideSubrectBase.Y);
378 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeDepthOfFieldSubrectBase.X);
379 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeDepthOfFieldSubrectBase.Y);
380 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField_Subrect_Base_X, pInDlssDEvalParams->InColorAfterDepthOfFieldSubtectBase.X);
381 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterDepthOfFieldSubtectBase.Y);
382 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance_Subrect_Base_X, pInDlssDEvalParams->InDiffuseHitDistanceSubrectBase.X);
383 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseHitDistanceSubrectBase.Y);
384 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance_Subrect_Base_X, pInDlssDEvalParams->InSpecularHitDistanceSubrectBase.X);
385 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InSpecularHitDistanceSubrectBase.Y);
386 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection_Subrect_Base_X, pInDlssDEvalParams->InDiffuseRayDirectionSubrectBase.X);
387 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseRayDirectionSubrectBase.Y);
388 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection_Subrect_Base_X, pInDlssDEvalParams->InSpecularRayDirectionSubrectBase.X);
389 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection_Subrect_Base_Y, pInDlssDEvalParams->InSpecularRayDirectionSubrectBase.Y);
390 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance_Subrect_Base_X, pInDlssDEvalParams->InDiffuseRayDirectionHitDistanceSubrectBase.X);
391 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseRayDirectionHitDistanceSubrectBase.Y);
392 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance_Subrect_Base_X, pInDlssDEvalParams->InSpecularRayDirectionHitDistanceSubrectBase.X);
393 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InSpecularRayDirectionHitDistanceSubrectBase.Y);
394
395 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_WORLD_TO_VIEW_MATRIX, pInDlssDEvalParams->pInWorldToViewMatrix);
396 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_VIEW_TO_CLIP_MATRIX, pInDlssDEvalParams->pInViewToClipMatrix);
397
398 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssDEvalParams->pInNormals);
399 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssDEvalParams->pInRoughness);
400 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer, pInDlssDEvalParams->pInTransparencyLayer);
401 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity, pInDlssDEvalParams->pInTransparencyLayerOpacity);
402 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs, pInDlssDEvalParams->pInTransparencyLayerMvecs);
403 NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSS_DisocclusionMask, pInDlssDEvalParams->pInDisocclusionMask);
404 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerSubrectBase.X);
405 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerSubrectBase.Y);
406 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerOpacitySubrectBase.X);
407 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerOpacitySubrectBase.Y);
408 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerMvecsSubrectBase.X);
409 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerMvecsSubrectBase.Y);
410 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_DisocclusionMask_Subrect_Base_X, pInDlssDEvalParams->InDisocclusionMaskSubrectBase.X);
411 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_DisocclusionMask_Subrect_Base_Y, pInDlssDEvalParams->InDisocclusionMaskSubrectBase.Y);
412
413
414 return NVSDK_NGX_D3D11_EvaluateFeature_C(pInCtx, pInHandle, pInParams, NULL);
415}
416
417typedef struct NVSDK_NGX_D3D12_DLSSD_Eval_Params
418{
419 ID3D12Resource* pInDiffuseAlbedo;
420 ID3D12Resource* pInSpecularAlbedo;
421 ID3D12Resource* pInNormals;
422 ID3D12Resource* pInRoughness;
423
424 ID3D12Resource* pInColor;
425 ID3D12Resource* pInAlpha;
426 ID3D12Resource* pInOutput;
427 ID3D12Resource* pInOutputAlpha;
428 ID3D12Resource* pInDepth;
429 ID3D12Resource* pInMotionVectors;
430 float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
431 float InJitterOffsetY;
432 NVSDK_NGX_Dimensions InRenderSubrectDimensions;
433 /*** OPTIONAL - leave to 0/0.0f if unused ***/
434 int InReset; /* Set to 1 when scene changes completely (new level etc) */
435 float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
436 float InMVScaleY;
437 ID3D12Resource* pInTransparencyMask; /* Unused/Reserved for future use */
438 ID3D12Resource* pInExposureTexture;
439 ID3D12Resource* pInBiasCurrentColorMask;
440 NVSDK_NGX_Coordinates InAlphaSubrectBase;
441 NVSDK_NGX_Coordinates InOutputAlphaSubrectBase;
442 NVSDK_NGX_Coordinates InDiffuseAlbedoSubrectBase;
443 NVSDK_NGX_Coordinates InSpecularAlbedoSubrectBase;
444 NVSDK_NGX_Coordinates InNormalsSubrectBase;
445 NVSDK_NGX_Coordinates InRoughnessSubrectBase;
446 NVSDK_NGX_Coordinates InColorSubrectBase;
447 NVSDK_NGX_Coordinates InDepthSubrectBase;
448 NVSDK_NGX_Coordinates InMVSubrectBase;
449 NVSDK_NGX_Coordinates InTranslucencySubrectBase;
450 NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
451 NVSDK_NGX_Coordinates InOutputSubrectBase;
452
453 ID3D12Resource* pInReflectedAlbedo;
454 ID3D12Resource* pInColorBeforeParticles;
455 ID3D12Resource* pInColorAfterParticles;
456 ID3D12Resource* pInColorBeforeTransparency;
457 ID3D12Resource* pInColorAfterTransparency;
458 ID3D12Resource* pInColorBeforeFog;
459 ID3D12Resource* pInColorAfterFog;
460 ID3D12Resource* pInScreenSpaceSubsurfaceScatteringGuide;
461 ID3D12Resource* pInColorBeforeScreenSpaceSubsurfaceScattering;
462 ID3D12Resource* pInColorAfterScreenSpaceSubsurfaceScattering;
463 ID3D12Resource* pInScreenSpaceRefractionGuide;
464 ID3D12Resource* pInColorBeforeScreenSpaceRefraction;
465 ID3D12Resource* pInColorAfterScreenSpaceRefraction;
466 ID3D12Resource* pInDepthOfFieldGuide;
467 ID3D12Resource* pInColorBeforeDepthOfField;
468 ID3D12Resource* pInColorAfterDepthOfField;
469 ID3D12Resource* pInDiffuseHitDistance;
470 ID3D12Resource* pInSpecularHitDistance;
471 ID3D12Resource* pInDiffuseRayDirection;
472 ID3D12Resource* pInSpecularRayDirection;
473 ID3D12Resource* pInDiffuseRayDirectionHitDistance;
474 ID3D12Resource* pInSpecularRayDirectionHitDistance;
475 NVSDK_NGX_Coordinates InReflectedAlbedoSubrectBase;
476 NVSDK_NGX_Coordinates InColorBeforeParticlesSubrectBase;
477 NVSDK_NGX_Coordinates InColorAfterParticlesSubrectBase;
478 NVSDK_NGX_Coordinates InColorBeforeTransparencySubrectBase;
479 NVSDK_NGX_Coordinates InColorAfterTransparencySubrectBase;
480 NVSDK_NGX_Coordinates InColorBeforeFogSubrectBase;
481 NVSDK_NGX_Coordinates InColorAfterFogSubrectBase;
482 NVSDK_NGX_Coordinates InScreenSpaceSubsurfaceScatteringGuideSubrectBase;
483 NVSDK_NGX_Coordinates InScreenSpaceRefractionGuideSubrectBase;
484 NVSDK_NGX_Coordinates InDepthOfFieldGuideSubrectBase;
485 NVSDK_NGX_Coordinates InDiffuseHitDistanceSubrectBase;
486 NVSDK_NGX_Coordinates InSpecularHitDistanceSubrectBase;
487 NVSDK_NGX_Coordinates InDiffuseRayDirectionSubrectBase;
488 NVSDK_NGX_Coordinates InSpecularRayDirectionSubrectBase;
489 NVSDK_NGX_Coordinates InDiffuseRayDirectionHitDistanceSubrectBase;
490 NVSDK_NGX_Coordinates InSpecularRayDirectionHitDistanceSubrectBase;
491 NVSDK_NGX_Coordinates InColorBeforeScreenSpaceSubsurfaceScatteringSubrectBase;
492 NVSDK_NGX_Coordinates InColorAfterScreenSpaceSubsurfaceScatteringSubrectBase;
493 NVSDK_NGX_Coordinates InColorBeforeScreenSpaceRefractionSubrectBase;
494 NVSDK_NGX_Coordinates InColorAfterScreenSpaceRefractionSubrectBase;
495 NVSDK_NGX_Coordinates InColorBeforeDepthOfFieldSubrectBase;
496 NVSDK_NGX_Coordinates InColorAfterDepthOfFieldSubtectBase;
497 float* pInWorldToViewMatrix;
498 float* pInViewToClipMatrix;
499
500 float InPreExposure;
501 float InExposureScale;
502 int InIndicatorInvertXAxis;
503 int InIndicatorInvertYAxis;
504 /*** OPTIONAL - only for research purposes ***/
505 NVSDK_NGX_D3D12_GBuffer GBufferSurface;
506 NVSDK_NGX_ToneMapperType InToneMapperType;
507 ID3D12Resource* pInMotionVectors3D;
508 ID3D12Resource* pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
509 ID3D12Resource* pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
510 ID3D12Resource* pInDepthHighRes;
511 ID3D12Resource* pInPositionViewSpace;
512 float InFrameTimeDeltaInMsec; /* helps in determining the amount to denoise or anti-alias based on the speed of the object from motion vector magnitudes and fps as determined by this delta */
513 ID3D12Resource* pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
514 ID3D12Resource* pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
515 ID3D12Resource* pInTransparencyLayer; /* optional input res particle layer */
516 NVSDK_NGX_Coordinates InTransparencyLayerSubrectBase;
517 ID3D12Resource* pInTransparencyLayerOpacity; /* optional input res particle opacity layer */
518 NVSDK_NGX_Coordinates InTransparencyLayerOpacitySubrectBase;
519 ID3D12Resource* pInTransparencyLayerMvecs; /* optional input res transparency layer mvecs */
520 NVSDK_NGX_Coordinates InTransparencyLayerMvecsSubrectBase;
521 ID3D12Resource* pInDisocclusionMask; /* optional input res disocclusion mask */
522 NVSDK_NGX_Coordinates InDisocclusionMaskSubrectBase;
523
524} NVSDK_NGX_D3D12_DLSSD_Eval_Params;
525
526static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLSSD_EXT(
527 ID3D12GraphicsCommandList *pInCmdList,
528 unsigned int InCreationNodeMask,
529 unsigned int InVisibilityNodeMask,
530 NVSDK_NGX_Handle **ppOutHandle,
531 NVSDK_NGX_Parameter *pInParams,
532 NVSDK_NGX_DLSSD_Create_Params *pInDlssDCreateParams)
533{
534 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
535 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
536 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssDCreateParams->InWidth);
537 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssDCreateParams->InHeight);
538 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssDCreateParams->InTargetWidth);
539 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssDCreateParams->InTargetHeight);
540 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssDCreateParams->InPerfQualityValue);
541 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssDCreateParams->InFeatureCreateFlags);
542 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssDCreateParams->InEnableOutputSubrects ? 1 : 0);
543 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Denoise_Mode, NVSDK_NGX_DLSS_Denoise_Mode_DLUnified);
544 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Roughness_Mode, pInDlssDCreateParams->InRoughnessMode);
545 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Use_HW_Depth, pInDlssDCreateParams->InUseHWDepth);
546 return NVSDK_NGX_D3D12_CreateFeature(pInCmdList, NVSDK_NGX_Feature_RayReconstruction, pInParams, ppOutHandle);
547}
548
549static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLSSD_EXT(
550 ID3D12GraphicsCommandList *pInCmdList,
551 NVSDK_NGX_Handle *pInHandle,
552 NVSDK_NGX_Parameter *pInParams,
553 NVSDK_NGX_D3D12_DLSSD_Eval_Params *pInDlssDEvalParams)
554{
555 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Color, pInDlssDEvalParams->pInColor);
556 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Output, pInDlssDEvalParams->pInOutput);
557 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssDEvalParams->pInDepth);
558 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssDEvalParams->pInMotionVectors);
559 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssDEvalParams->InJitterOffsetX);
560 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssDEvalParams->InJitterOffsetY);
561 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssDEvalParams->InReset);
562 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssDEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssDEvalParams->InMVScaleX);
563 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssDEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssDEvalParams->InMVScaleY);
564 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssDEvalParams->pInTransparencyMask);
565 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssDEvalParams->pInExposureTexture);
566 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssDEvalParams->pInBiasCurrentColorMask);
567 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
568 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
569 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
570 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
571 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
572 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
573 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
574 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
575 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssDEvalParams->GBufferSurface.pInAttrib[8]);
576 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssDEvalParams->GBufferSurface.pInAttrib[9]);
577 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssDEvalParams->GBufferSurface.pInAttrib[11]);
578 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssDEvalParams->GBufferSurface.pInAttrib[12]);
579 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssDEvalParams->GBufferSurface.pInAttrib[13]);
580 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssDEvalParams->GBufferSurface.pInAttrib[14]);
581 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssDEvalParams->GBufferSurface.pInAttrib[15]);
582 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssDEvalParams->InToneMapperType);
583 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssDEvalParams->pInMotionVectors3D);
584 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssDEvalParams->pInIsParticleMask);
585 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssDEvalParams->pInAnimatedTextureMask);
586 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssDEvalParams->pInDepthHighRes);
587 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssDEvalParams->pInPositionViewSpace);
588 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssDEvalParams->InFrameTimeDeltaInMsec);
589 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssDEvalParams->pInRayTracingHitDistance);
590 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_SpecularMvec, pInDlssDEvalParams->pInMotionVectorsReflections);
591 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssDEvalParams->InColorSubrectBase.X);
592 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssDEvalParams->InColorSubrectBase.Y);
593 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssDEvalParams->InDepthSubrectBase.X);
594 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssDEvalParams->InDepthSubrectBase.Y);
595 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssDEvalParams->InMVSubrectBase.X);
596 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssDEvalParams->InMVSubrectBase.Y);
597 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssDEvalParams->InTranslucencySubrectBase.X);
598 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssDEvalParams->InTranslucencySubrectBase.Y);
599 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssDEvalParams->InBiasCurrentColorSubrectBase.X);
600 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssDEvalParams->InBiasCurrentColorSubrectBase.Y);
601 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssDEvalParams->InOutputSubrectBase.X);
602 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssDEvalParams->InOutputSubrectBase.Y);
603 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssDEvalParams->InRenderSubrectDimensions.Width);
604 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssDEvalParams->InRenderSubrectDimensions.Height);
605 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssDEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssDEvalParams->InPreExposure);
606 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Exposure_Scale, pInDlssDEvalParams->InExposureScale == 0.0f ? 1.0f : pInDlssDEvalParams->InExposureScale);
607 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssDEvalParams->InIndicatorInvertXAxis);
608 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssDEvalParams->InIndicatorInvertYAxis);
609
610 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Emissive, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_EMISSIVE]);
611
612 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DiffuseAlbedo, pInDlssDEvalParams->pInDiffuseAlbedo);
613 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_SpecularAlbedo, pInDlssDEvalParams->pInSpecularAlbedo);
614 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_DiffuseAlbedo_Subrect_Base_X, pInDlssDEvalParams->InDiffuseAlbedoSubrectBase.X);
615 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_DiffuseAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseAlbedoSubrectBase.Y);
616 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_SpecularAlbedo_Subrect_Base_X, pInDlssDEvalParams->InSpecularAlbedoSubrectBase.X);
617 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_SpecularAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InSpecularAlbedoSubrectBase.Y);
618 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Normals_Subrect_Base_X, pInDlssDEvalParams->InNormalsSubrectBase.X);
619 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Normals_Subrect_Base_Y, pInDlssDEvalParams->InNormalsSubrectBase.Y);
620 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Roughness_Subrect_Base_X, pInDlssDEvalParams->InRoughnessSubrectBase.X);
621 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Roughness_Subrect_Base_Y, pInDlssDEvalParams->InRoughnessSubrectBase.Y);
622 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssDEvalParams->pInNormals);
623 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssDEvalParams->pInRoughness);
624
625 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_Alpha, pInDlssDEvalParams->pInAlpha);
626 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_OutputAlpha, pInDlssDEvalParams->pInOutputAlpha);
627 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo, pInDlssDEvalParams->pInReflectedAlbedo);
628 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles, pInDlssDEvalParams->pInColorBeforeParticles);
629 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles, pInDlssDEvalParams->pInColorAfterParticles);
630 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency, pInDlssDEvalParams->pInColorBeforeTransparency);
631 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency, pInDlssDEvalParams->pInColorAfterTransparency);
632 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog, pInDlssDEvalParams->pInColorBeforeFog);
633 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterFog, pInDlssDEvalParams->pInColorAfterFog);
634 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide, pInDlssDEvalParams->pInScreenSpaceSubsurfaceScatteringGuide);
635 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering, pInDlssDEvalParams->pInColorBeforeScreenSpaceSubsurfaceScattering);
636 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering, pInDlssDEvalParams->pInColorAfterScreenSpaceSubsurfaceScattering);
637 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide, pInDlssDEvalParams->pInScreenSpaceRefractionGuide);
638 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction, pInDlssDEvalParams->pInColorBeforeScreenSpaceRefraction);
639 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction, pInDlssDEvalParams->pInColorAfterScreenSpaceRefraction);
640 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide, pInDlssDEvalParams->pInDepthOfFieldGuide);
641 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField, pInDlssDEvalParams->pInColorBeforeDepthOfField);
642 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField, pInDlssDEvalParams->pInColorAfterDepthOfField);
643 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance, pInDlssDEvalParams->pInDiffuseHitDistance);
644 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance, pInDlssDEvalParams->pInSpecularHitDistance);
645 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection, pInDlssDEvalParams->pInDiffuseRayDirection);
646 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection, pInDlssDEvalParams->pInSpecularRayDirection);
647 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance, pInDlssDEvalParams->pInDiffuseRayDirectionHitDistance);
648 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance, pInDlssDEvalParams->pInSpecularRayDirectionHitDistance);
649 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_Alpha_Subrect_Base_X, pInDlssDEvalParams->InAlphaSubrectBase.X);
650 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_Alpha_Subrect_Base_Y, pInDlssDEvalParams->InAlphaSubrectBase.Y);
651 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_OutputAlpha_Subrect_Base_X, pInDlssDEvalParams->InOutputAlphaSubrectBase.X);
652 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_OutputAlpha_Subrect_Base_Y, pInDlssDEvalParams->InOutputAlphaSubrectBase.Y);
653 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo_Subrect_Base_X, pInDlssDEvalParams->InReflectedAlbedoSubrectBase.X);
654 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InReflectedAlbedoSubrectBase.Y);
655 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles_Subrect_Base_X, pInDlssDEvalParams->InColorAfterParticlesSubrectBase.X);
656 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterParticlesSubrectBase.Y);
657 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeParticlesSubrectBase.X);
658 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeParticlesSubrectBase.Y);
659 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeTransparencySubrectBase.X);
660 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeTransparencySubrectBase.Y);
661 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency_Subrect_Base_X, pInDlssDEvalParams->InColorAfterTransparencySubrectBase.X);
662 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterTransparencySubrectBase.Y);
663 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterFog_Subrect_Base_X, pInDlssDEvalParams->InColorAfterFogSubrectBase.X);
664 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterFog_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterFogSubrectBase.Y);
665 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeFogSubrectBase.X);
666 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeFogSubrectBase.Y);
667 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide_Subrect_Base_X, pInDlssDEvalParams->InScreenSpaceSubsurfaceScatteringGuideSubrectBase.X);
668 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide_Subrect_Base_Y, pInDlssDEvalParams->InScreenSpaceSubsurfaceScatteringGuideSubrectBase.Y);
669 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeScreenSpaceSubsurfaceScatteringSubrectBase.X);
670 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeScreenSpaceSubsurfaceScatteringSubrectBase.Y);
671 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering_Subrect_Base_X, pInDlssDEvalParams->InColorAfterScreenSpaceSubsurfaceScatteringSubrectBase.X);
672 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterScreenSpaceSubsurfaceScatteringSubrectBase.Y);
673 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide_Subrect_Base_X, pInDlssDEvalParams->InScreenSpaceRefractionGuideSubrectBase.X);
674 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide_Subrect_Base_Y, pInDlssDEvalParams->InScreenSpaceRefractionGuideSubrectBase.Y);
675 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeScreenSpaceRefractionSubrectBase.X);
676 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeScreenSpaceRefractionSubrectBase.Y);
677 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction_Subrect_Base_X, pInDlssDEvalParams->InColorAfterScreenSpaceRefractionSubrectBase.X);
678 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterScreenSpaceRefractionSubrectBase.Y);
679 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide_Subrect_Base_X, pInDlssDEvalParams->InDepthOfFieldGuideSubrectBase.X);
680 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide_Subrect_Base_Y, pInDlssDEvalParams->InDepthOfFieldGuideSubrectBase.Y);
681 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeDepthOfFieldSubrectBase.X);
682 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeDepthOfFieldSubrectBase.Y);
683 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField_Subrect_Base_X, pInDlssDEvalParams->InColorAfterDepthOfFieldSubtectBase.X);
684 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterDepthOfFieldSubtectBase.Y);
685 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance_Subrect_Base_X, pInDlssDEvalParams->InDiffuseHitDistanceSubrectBase.X);
686 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseHitDistanceSubrectBase.Y);
687 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance_Subrect_Base_X, pInDlssDEvalParams->InSpecularHitDistanceSubrectBase.X);
688 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InSpecularHitDistanceSubrectBase.Y);
689 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection_Subrect_Base_X, pInDlssDEvalParams->InDiffuseRayDirectionSubrectBase.X);
690 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseRayDirectionSubrectBase.Y);
691 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection_Subrect_Base_X, pInDlssDEvalParams->InSpecularRayDirectionSubrectBase.X);
692 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection_Subrect_Base_Y, pInDlssDEvalParams->InSpecularRayDirectionSubrectBase.Y);
693 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance_Subrect_Base_X, pInDlssDEvalParams->InDiffuseRayDirectionHitDistanceSubrectBase.X);
694 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseRayDirectionHitDistanceSubrectBase.Y);
695 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance_Subrect_Base_X, pInDlssDEvalParams->InSpecularRayDirectionHitDistanceSubrectBase.X);
696 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InSpecularRayDirectionHitDistanceSubrectBase.Y);
697 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_WORLD_TO_VIEW_MATRIX, pInDlssDEvalParams->pInWorldToViewMatrix);
698 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_VIEW_TO_CLIP_MATRIX, pInDlssDEvalParams->pInViewToClipMatrix);
699 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer, pInDlssDEvalParams->pInTransparencyLayer);
700 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity, pInDlssDEvalParams->pInTransparencyLayerOpacity);
701 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs, pInDlssDEvalParams->pInTransparencyLayerMvecs);
702 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSS_DisocclusionMask, pInDlssDEvalParams->pInDisocclusionMask);
703 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerSubrectBase.X);
704 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerSubrectBase.Y);
705 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerOpacitySubrectBase.X);
706 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerOpacitySubrectBase.Y);
707 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerMvecsSubrectBase.X);
708 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerMvecsSubrectBase.Y);
709 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_DisocclusionMask_Subrect_Base_X, pInDlssDEvalParams->InDisocclusionMaskSubrectBase.X);
710 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_DisocclusionMask_Subrect_Base_Y, pInDlssDEvalParams->InDisocclusionMaskSubrectBase.Y);
711
712 return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
713}
714
715#endif // NVSDK_NGX_HELPERS_DLSSD_H
thirdparty/ngx/include/nvsdk_ngx_helpers_dlssd_cuda.h +368 -0
……@@ -0,0 +1,368 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13#ifndef NVSDK_NGX_HELPERS_DLSSD_CUDA_H
14#define NVSDK_NGX_HELPERS_DLSSD_CUDA_H
15#pragma once
16
17#include "nvsdk_ngx_helpers.h"
18#include "nvsdk_ngx_defs_dlssd.h"
19#include "nvsdk_ngx_params_dlssd.h"
20#if 1
21typedef NVSDK_NGX_Result(NVSDK_CONV* PFN_NVSDK_NGX_DLSS_GetStatsCallback)(NVSDK_NGX_Parameter* InParams);
22
23static inline NVSDK_NGX_Result NGX_DLSSD_GET_STATS_2(
24 NVSDK_NGX_Parameter* pInParams,
25 unsigned long long* pVRAMAllocatedBytes,
26 unsigned int* pOptLevel, unsigned int* IsDevSnippetBranch)
27{
28 void* Callback = NULL;
29 NVSDK_NGX_Parameter_GetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSDGetStatsCallback, &Callback);
30 if (!Callback)
31 {
32 // Possible reasons for this:
33 // - Installed DLSS is out of date and does not support the feature we need
34 // - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
35 return NVSDK_NGX_Result_FAIL_OutOfDate;
36 }
37
38 NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
39 PFN_NVSDK_NGX_DLSS_GetStatsCallback PFNCallback = (PFN_NVSDK_NGX_DLSS_GetStatsCallback)Callback;
40 Res = PFNCallback(pInParams);
41 if (NVSDK_NGX_FAILED(Res))
42 {
43 return Res;
44 }
45 NVSDK_NGX_Parameter_GetULL(pInParams, NVSDK_NGX_Parameter_SizeInBytes, pVRAMAllocatedBytes);
46 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_EParameter_OptLevel, pOptLevel);
47 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_EParameter_IsDevSnippetBranch, IsDevSnippetBranch);
48 return Res;
49}
50
51static inline NVSDK_NGX_Result NGX_DLSSD_GET_STATS_1(
52 NVSDK_NGX_Parameter* pInParams,
53 unsigned long long* pVRAMAllocatedBytes,
54 unsigned int* pOptLevel)
55{
56 unsigned int dummy = 0;
57 return NGX_DLSSD_GET_STATS_2(pInParams, pVRAMAllocatedBytes, pOptLevel, &dummy);
58}
59
60static inline NVSDK_NGX_Result NGX_DLSSD_GET_STATS(
61 NVSDK_NGX_Parameter* pInParams,
62 unsigned long long* pVRAMAllocatedBytes)
63{
64 unsigned int dummy = 0;
65 return NGX_DLSSD_GET_STATS_2(pInParams, pVRAMAllocatedBytes, &dummy, &dummy);
66}
67#endif
68
69typedef NVSDK_NGX_Result(NVSDK_CONV* PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback)(NVSDK_NGX_Parameter* InParams);
70
71static inline NVSDK_NGX_Result NGX_DLSSD_GET_OPTIMAL_SETTINGS(
72 NVSDK_NGX_Parameter* pInParams,
73 unsigned int InUserSelectedWidth,
74 unsigned int InUserSelectedHeight,
75 NVSDK_NGX_PerfQuality_Value InPerfQualityValue,
76 unsigned int* pOutRenderOptimalWidth,
77 unsigned int* pOutRenderOptimalHeight,
78 unsigned int* pOutRenderMaxWidth,
79 unsigned int* pOutRenderMaxHeight,
80 unsigned int* pOutRenderMinWidth,
81 unsigned int* pOutRenderMinHeight,
82 float* pOutSharpness)
83{
84 void* Callback = NULL;
85 NVSDK_NGX_Parameter_GetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSDOptimalSettingsCallback, &Callback);
86 if (!Callback)
87 {
88 // Possible reasons for this:
89 // - Installed DLSS is out of date and does not support the feature we need
90 // - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
91 return NVSDK_NGX_Result_FAIL_OutOfDate;
92 }
93
94 // These are selections made by user in UI
95 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, InUserSelectedWidth);
96 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, InUserSelectedHeight);
97 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, InPerfQualityValue);
98 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_RTXValue, false); // Some older DLSS dlls still expect this value to be set
99
100 NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
101 PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback PFNCallback = (PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback)Callback;
102 Res = PFNCallback(pInParams);
103 if (NVSDK_NGX_FAILED(Res))
104 {
105 return Res;
106 }
107 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pOutRenderOptimalWidth);
108 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pOutRenderOptimalHeight);
109 // If we have an older DLSS Dll those might need to be set to the optimal dimensions instead
110 *pOutRenderMaxWidth = *pOutRenderOptimalWidth;
111 *pOutRenderMaxHeight = *pOutRenderOptimalHeight;
112 *pOutRenderMinWidth = *pOutRenderOptimalWidth;
113 *pOutRenderMinHeight = *pOutRenderOptimalHeight;
114 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Width, pOutRenderMaxWidth);
115 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Height, pOutRenderMaxHeight);
116 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Width, pOutRenderMinWidth);
117 NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Height, pOutRenderMinHeight);
118 NVSDK_NGX_Parameter_GetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pOutSharpness);
119 return Res;
120}
121
122typedef struct NVSDK_NGX_CUDA_GBuffer
123{
124 CUtexObject* pInAttrib[NVSDK_NGX_GBUFFERTYPE_NUM];
125} NVSDK_NGX_CUDA_GBuffer;
126
127typedef struct NVSDK_NGX_CUDA_DLSSD_Create_Params
128{
129 NVSDK_NGX_DLSSD_Create_Params Feature;
130 void* InCUContext;
131 void* InCUStream;
132} NVSDK_NGX_CUDA_DLSSD_Create_Params;
133
134static inline NVSDK_NGX_Result NGX_CUDA_CREATE_DLSSD_EXT(
135 NVSDK_NGX_Handle** ppOutHandle,
136 NVSDK_NGX_Parameter* pInParams,
137 NVSDK_NGX_CUDA_DLSSD_Create_Params* pInDlssDCreateParams)
138{
139 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Input1, pInDlssDCreateParams->InCUContext);
140 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Input2, pInDlssDCreateParams->InCUStream);
141 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssDCreateParams->Feature.InWidth);
142 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssDCreateParams->Feature.InHeight);
143 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssDCreateParams->Feature.InTargetWidth);
144 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssDCreateParams->Feature.InTargetHeight);
145 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssDCreateParams->Feature.InPerfQualityValue);
146 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssDCreateParams->Feature.InFeatureCreateFlags);
147 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssDCreateParams->Feature.InEnableOutputSubrects ? 1 : 0);
148 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Denoise_Mode, NVSDK_NGX_DLSS_Denoise_Mode_DLUnified);
149 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Roughness_Mode, pInDlssDCreateParams->Feature.InRoughnessMode);
150 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Use_HW_Depth, pInDlssDCreateParams->Feature.InUseHWDepth);
151 return NVSDK_NGX_CUDA_CreateFeature(NVSDK_NGX_Feature_RayReconstruction, pInParams, ppOutHandle);
152}
153
154static inline NVSDK_NGX_Result NGX_CUDA_CREATE_DLSSD_EXT1(
155 NVSDK_NGX_CUDADevice *InDevice,
156 NVSDK_NGX_Handle** ppOutHandle,
157 NVSDK_NGX_Parameter* pInParams,
158 NVSDK_NGX_CUDA_DLSSD_Create_Params* pInDlssDCreateParams)
159{
160 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Input1, pInDlssDCreateParams->InCUContext);
161 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Input2, pInDlssDCreateParams->InCUStream);
162 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssDCreateParams->Feature.InWidth);
163 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssDCreateParams->Feature.InHeight);
164 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssDCreateParams->Feature.InTargetWidth);
165 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssDCreateParams->Feature.InTargetHeight);
166 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssDCreateParams->Feature.InPerfQualityValue);
167 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssDCreateParams->Feature.InFeatureCreateFlags);
168 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssDCreateParams->Feature.InEnableOutputSubrects ? 1 : 0);
169 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Denoise_Mode, NVSDK_NGX_DLSS_Denoise_Mode_DLUnified);
170 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Roughness_Mode, pInDlssDCreateParams->Feature.InRoughnessMode);
171 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Use_HW_Depth, pInDlssDCreateParams->Feature.InUseHWDepth);
172 return NVSDK_NGX_CUDA_CreateFeature1(InDevice, NVSDK_NGX_Feature_RayReconstruction, pInParams, ppOutHandle);
173}
174
175typedef struct NVSDK_NGX_CUDA_DLSSD_Eval_Params
176{
177 void* pInDiffuseAlbedo;
178 void* pInSpecularAlbedo;
179 void* pInNormals;
180 void* pInRoughness;
181
182 void* pInColor;
183 void* pInOutput;
184 void* pInDepth;
185 void* pInMotionVectors;
186 float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
187 float InJitterOffsetY;
188 NVSDK_NGX_Dimensions InRenderSubrectDimensions;
189 /*** OPTIONAL - leave to 0/0.0f if unused ***/
190 int InReset; /* Set to 1 when scene changes completely (new level etc) */
191 float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
192 float InMVScaleY;
193 void* pInTransparencyMask; /* Unused/Reserved for future use */
194 void* pInExposureTexture;
195 void* pInBiasCurrentColorMask;
196 NVSDK_NGX_Coordinates InDiffuseAlbedoSubrectBase;
197 NVSDK_NGX_Coordinates InSpecularAlbedoSubrectBase;
198 NVSDK_NGX_Coordinates InNormalsSubrectBase;
199 NVSDK_NGX_Coordinates InRoughnessSubrectBase;
200 NVSDK_NGX_Coordinates InColorSubrectBase;
201 NVSDK_NGX_Coordinates InDepthSubrectBase;
202 NVSDK_NGX_Coordinates InMVSubrectBase;
203 NVSDK_NGX_Coordinates InTranslucencySubrectBase;
204 NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
205 NVSDK_NGX_Coordinates InOutputSubrectBase;
206
207 void* pInReflectedAlbedo;
208 void* pInColorBeforeParticles;
209 void* pInColorBeforeTransparency;
210 void* pInColorBeforeFog;
211 void* pInDiffuseHitDistance;
212 void* pInSpecularHitDistance;
213 void* pInDiffuseRayDirection;
214 void* pInSpecularRayDirection;
215 void* pInDiffuseRayDirectionHitDistance;
216 void* pInSpecularRayDirectionHitDistance;
217 NVSDK_NGX_Coordinates InReflectedAlbedoSubrectBase;
218 NVSDK_NGX_Coordinates InColorBeforeParticlesSubrectBase;
219 NVSDK_NGX_Coordinates InColorBeforeTransparencySubrectBase;
220 NVSDK_NGX_Coordinates InColorBeforeFogSubrectBase;
221 NVSDK_NGX_Coordinates InDiffuseHitDistanceSubrectBase;
222 NVSDK_NGX_Coordinates InSpecularHitDistanceSubrectBase;
223 NVSDK_NGX_Coordinates InDiffuseRayDirectionSubrectBase;
224 NVSDK_NGX_Coordinates InSpecularRayDirectionSubrectBase;
225 NVSDK_NGX_Coordinates InDiffuseRayDirectionHitDistanceSubrectBase;
226 NVSDK_NGX_Coordinates InSpecularRayDirectionHitDistanceSubrectBase;
227 float* pInWorldToViewMatrix;
228 float* pInViewToClipMatrix;
229
230 float InPreExposure;
231 float InExposureScale;
232 int InIndicatorInvertXAxis;
233 int InIndicatorInvertYAxis;
234 /*** OPTIONAL - only for research purposes ***/
235 NVSDK_NGX_CUDA_GBuffer GBufferSurface;
236 NVSDK_NGX_ToneMapperType InToneMapperType;
237 void* pInMotionVectors3D;
238 void* pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
239 void* pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
240 void* pInDepthHighRes;
241 void* pInPositionViewSpace;
242 float InFrameTimeDeltaInMsec; /* helps in determining the amount to denoise or anti-alias based on the speed of the object from motion vector magnitudes and fps as determined by this delta */
243 void* pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
244 void* pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
245 void* pInTransparencyLayer; /* optional input res particle layer */
246 NVSDK_NGX_Coordinates InTransparencyLayerSubrectBase;
247 void* pInTransparencyLayerOpacity; /* optional input res particle opacity layer */
248 NVSDK_NGX_Coordinates InTransparencyLayerOpacitySubrectBase;
249} NVSDK_NGX_CUDA_DLSSD_Eval_Params;
250
251static inline NVSDK_NGX_Result NGX_CUDA_EVALUATE_DLSSD_EXT(
252 NVSDK_NGX_Handle* pInHandle,
253 NVSDK_NGX_Parameter* pInParams,
254 NVSDK_NGX_CUDA_DLSSD_Eval_Params* pInDlssDEvalParams)
255{
256 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlssDEvalParams->pInColor);
257 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlssDEvalParams->pInOutput);
258 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssDEvalParams->pInDepth);
259 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssDEvalParams->pInMotionVectors);
260 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssDEvalParams->InJitterOffsetX);
261 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssDEvalParams->InJitterOffsetY);
262 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssDEvalParams->InReset);
263 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssDEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssDEvalParams->InMVScaleX);
264 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssDEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssDEvalParams->InMVScaleY);
265 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssDEvalParams->pInTransparencyMask);
266 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssDEvalParams->pInExposureTexture);
267 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssDEvalParams->pInBiasCurrentColorMask);
268 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
269 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
270 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
271 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
272 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
273 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
274 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
275 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
276 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssDEvalParams->GBufferSurface.pInAttrib[8]);
277 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssDEvalParams->GBufferSurface.pInAttrib[9]);
278 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssDEvalParams->GBufferSurface.pInAttrib[11]);
279 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssDEvalParams->GBufferSurface.pInAttrib[12]);
280 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssDEvalParams->GBufferSurface.pInAttrib[13]);
281 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssDEvalParams->GBufferSurface.pInAttrib[14]);
282 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssDEvalParams->GBufferSurface.pInAttrib[15]);
283 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssDEvalParams->InToneMapperType);
284 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssDEvalParams->pInMotionVectors3D);
285 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssDEvalParams->pInIsParticleMask);
286 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssDEvalParams->pInAnimatedTextureMask);
287 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssDEvalParams->pInDepthHighRes);
288 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssDEvalParams->pInPositionViewSpace);
289 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssDEvalParams->InFrameTimeDeltaInMsec);
290 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssDEvalParams->pInRayTracingHitDistance);
291 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_SpecularMvec, pInDlssDEvalParams->pInMotionVectorsReflections);
292 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssDEvalParams->InColorSubrectBase.X);
293 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssDEvalParams->InColorSubrectBase.Y);
294 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssDEvalParams->InDepthSubrectBase.X);
295 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssDEvalParams->InDepthSubrectBase.Y);
296 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssDEvalParams->InMVSubrectBase.X);
297 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssDEvalParams->InMVSubrectBase.Y);
298 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssDEvalParams->InTranslucencySubrectBase.X);
299 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssDEvalParams->InTranslucencySubrectBase.Y);
300 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssDEvalParams->InBiasCurrentColorSubrectBase.X);
301 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssDEvalParams->InBiasCurrentColorSubrectBase.Y);
302 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssDEvalParams->InOutputSubrectBase.X);
303 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssDEvalParams->InOutputSubrectBase.Y);
304 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width, pInDlssDEvalParams->InRenderSubrectDimensions.Width);
305 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssDEvalParams->InRenderSubrectDimensions.Height);
306 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssDEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssDEvalParams->InPreExposure);
307 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Exposure_Scale, pInDlssDEvalParams->InExposureScale == 0.0f ? 1.0f : pInDlssDEvalParams->InExposureScale);
308 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssDEvalParams->InIndicatorInvertXAxis);
309 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssDEvalParams->InIndicatorInvertYAxis);
310
311 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Emissive, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_EMISSIVE]);
312
313 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DiffuseAlbedo, pInDlssDEvalParams->pInDiffuseAlbedo);
314 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_SpecularAlbedo, pInDlssDEvalParams->pInSpecularAlbedo);
315 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_DiffuseAlbedo_Subrect_Base_X, pInDlssDEvalParams->InDiffuseAlbedoSubrectBase.X);
316 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_DiffuseAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseAlbedoSubrectBase.Y);
317 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_SpecularAlbedo_Subrect_Base_X, pInDlssDEvalParams->InSpecularAlbedoSubrectBase.X);
318 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_SpecularAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InSpecularAlbedoSubrectBase.Y);
319 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Normals_Subrect_Base_X, pInDlssDEvalParams->InNormalsSubrectBase.X);
320 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Normals_Subrect_Base_Y, pInDlssDEvalParams->InNormalsSubrectBase.Y);
321 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Roughness_Subrect_Base_X, pInDlssDEvalParams->InRoughnessSubrectBase.X);
322 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Roughness_Subrect_Base_Y, pInDlssDEvalParams->InRoughnessSubrectBase.Y);
323 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssDEvalParams->pInNormals);
324 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssDEvalParams->pInRoughness);
325
326 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo, pInDlssDEvalParams->pInReflectedAlbedo);
327 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles, pInDlssDEvalParams->pInColorBeforeParticles);
328 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency, pInDlssDEvalParams->pInColorBeforeTransparency);
329 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog, pInDlssDEvalParams->pInColorBeforeFog);
330 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance, pInDlssDEvalParams->pInDiffuseHitDistance);
331 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance, pInDlssDEvalParams->pInSpecularHitDistance);
332 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection, pInDlssDEvalParams->pInDiffuseRayDirection);
333 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection, pInDlssDEvalParams->pInSpecularRayDirection);
334 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance, pInDlssDEvalParams->pInDiffuseRayDirectionHitDistance);
335 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance, pInDlssDEvalParams->pInSpecularRayDirectionHitDistance);
336 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo_Subrect_Base_X, pInDlssDEvalParams->InReflectedAlbedoSubrectBase.X);
337 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InReflectedAlbedoSubrectBase.Y);
338 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeParticlesSubrectBase.X);
339 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeParticlesSubrectBase.Y);
340 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeTransparencySubrectBase.X);
341 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeTransparencySubrectBase.Y);
342 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeFogSubrectBase.X);
343 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeFogSubrectBase.Y);
344 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance_Subrect_Base_X, pInDlssDEvalParams->InDiffuseHitDistanceSubrectBase.X);
345 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseHitDistanceSubrectBase.Y);
346 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance_Subrect_Base_X, pInDlssDEvalParams->InSpecularHitDistanceSubrectBase.X);
347 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InSpecularHitDistanceSubrectBase.Y);
348 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection_Subrect_Base_X, pInDlssDEvalParams->InDiffuseRayDirectionSubrectBase.X);
349 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseRayDirectionSubrectBase.Y);
350 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection_Subrect_Base_X, pInDlssDEvalParams->InSpecularRayDirectionSubrectBase.X);
351 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection_Subrect_Base_Y, pInDlssDEvalParams->InSpecularRayDirectionSubrectBase.Y);
352 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance_Subrect_Base_X, pInDlssDEvalParams->InDiffuseRayDirectionHitDistanceSubrectBase.X);
353 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseRayDirectionHitDistanceSubrectBase.Y);
354 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance_Subrect_Base_X, pInDlssDEvalParams->InSpecularRayDirectionHitDistanceSubrectBase.X);
355 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InSpecularRayDirectionHitDistanceSubrectBase.Y);
356 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_WORLD_TO_VIEW_MATRIX, pInDlssDEvalParams->pInWorldToViewMatrix);
357 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_VIEW_TO_CLIP_MATRIX, pInDlssDEvalParams->pInViewToClipMatrix);
358 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer, pInDlssDEvalParams->pInTransparencyLayer);
359 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity, pInDlssDEvalParams->pInTransparencyLayerOpacity);
360 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerSubrectBase.X);
361 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerSubrectBase.Y);
362 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerOpacitySubrectBase.X);
363 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerOpacitySubrectBase.Y);
364
365 return NVSDK_NGX_CUDA_EvaluateFeature_C(pInHandle, pInParams, NULL);
366}
367
368#endif // NVSDK_NGX_HELPERS_DLSSD_CUDA_H
thirdparty/ngx/include/nvsdk_ngx_helpers_dlssd_vk.h +373 -0
……@@ -0,0 +1,373 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13#ifndef NVSDK_NGX_HELPERS_DLSSD_VK_H
14#define NVSDK_NGX_HELPERS_DLSSD_VK_H
15#pragma once
16
17#include "nvsdk_ngx_vk.h"
18#include "nvsdk_ngx_defs_dlssd.h"
19#include "nvsdk_ngx_params_dlssd.h"
20
21typedef struct NVSDK_NGX_VK_DLSSD_Eval_Params
22{
23 NVSDK_NGX_Resource_VK* pInDiffuseAlbedo;
24 NVSDK_NGX_Resource_VK* pInSpecularAlbedo;
25 NVSDK_NGX_Resource_VK* pInNormals;
26 NVSDK_NGX_Resource_VK* pInRoughness;
27
28 NVSDK_NGX_Resource_VK* pInColor;
29 NVSDK_NGX_Resource_VK* pInAlpha;
30 NVSDK_NGX_Resource_VK* pInOutput;
31 NVSDK_NGX_Resource_VK* pInOutputAlpha;
32 NVSDK_NGX_Resource_VK * pInDepth;
33 NVSDK_NGX_Resource_VK * pInMotionVectors;
34 float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
35 float InJitterOffsetY;
36 NVSDK_NGX_Dimensions InRenderSubrectDimensions;
37 /*** OPTIONAL - leave to 0/0.0f if unused ***/
38 int InReset; /* Set to 1 when scene changes completely (new level etc) */
39 float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
40 float InMVScaleY;
41 NVSDK_NGX_Resource_VK * pInTransparencyMask; /* Unused/Reserved for future use */
42 NVSDK_NGX_Resource_VK * pInExposureTexture;
43 NVSDK_NGX_Resource_VK * pInBiasCurrentColorMask;
44 NVSDK_NGX_Coordinates InAlphaSubrectBase;
45 NVSDK_NGX_Coordinates InOutputAlphaSubrectBase;
46 NVSDK_NGX_Coordinates InDiffuseAlbedoSubrectBase;
47 NVSDK_NGX_Coordinates InSpecularAlbedoSubrectBase;
48 NVSDK_NGX_Coordinates InNormalsSubrectBase;
49 NVSDK_NGX_Coordinates InRoughnessSubrectBase;
50 NVSDK_NGX_Coordinates InColorSubrectBase;
51 NVSDK_NGX_Coordinates InDepthSubrectBase;
52 NVSDK_NGX_Coordinates InMVSubrectBase;
53 NVSDK_NGX_Coordinates InTranslucencySubrectBase;
54 NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
55 NVSDK_NGX_Coordinates InOutputSubrectBase;
56 float InPreExposure;
57 float InExposureScale;
58 int InIndicatorInvertXAxis;
59 int InIndicatorInvertYAxis;
60 /*** OPTIONAL - only for research purposes ***/
61
62 NVSDK_NGX_Resource_VK* pInReflectedAlbedo;
63 NVSDK_NGX_Resource_VK* pInColorBeforeParticles;
64 NVSDK_NGX_Resource_VK* pInColorAfterParticles;
65 NVSDK_NGX_Resource_VK* pInColorBeforeTransparency;
66 NVSDK_NGX_Resource_VK* pInColorAfterTransparency;
67 NVSDK_NGX_Resource_VK* pInColorBeforeFog;
68 NVSDK_NGX_Resource_VK* pInColorAfterFog;
69 NVSDK_NGX_Resource_VK* pInScreenSpaceSubsurfaceScatteringGuide;
70 NVSDK_NGX_Resource_VK* pInColorBeforeScreenSpaceSubsurfaceScattering;
71 NVSDK_NGX_Resource_VK* pInColorAfterScreenSpaceSubsurfaceScattering;
72 NVSDK_NGX_Resource_VK* pInScreenSpaceRefractionGuide;
73 NVSDK_NGX_Resource_VK* pInColorBeforeScreenSpaceRefraction;
74 NVSDK_NGX_Resource_VK* pInColorAfterScreenSpaceRefraction;
75 NVSDK_NGX_Resource_VK* pInDepthOfFieldGuide;
76 NVSDK_NGX_Resource_VK* pInColorBeforeDepthOfField;
77 NVSDK_NGX_Resource_VK* pInColorAfterDepthOfField;
78 NVSDK_NGX_Resource_VK* pInDiffuseHitDistance;
79 NVSDK_NGX_Resource_VK* pInSpecularHitDistance;
80 NVSDK_NGX_Resource_VK* pInDiffuseRayDirection;
81 NVSDK_NGX_Resource_VK* pInSpecularRayDirection;
82 NVSDK_NGX_Resource_VK* pInDiffuseRayDirectionHitDistance;
83 NVSDK_NGX_Resource_VK* pInSpecularRayDirectionHitDistance;
84 NVSDK_NGX_Coordinates InReflectedAlbedoSubrectBase;
85 NVSDK_NGX_Coordinates InColorBeforeParticlesSubrectBase;
86 NVSDK_NGX_Coordinates InColorAfterParticlesSubrectBase;
87 NVSDK_NGX_Coordinates InColorBeforeTransparencySubrectBase;
88 NVSDK_NGX_Coordinates InColorAfterTransparencySubrectBase;
89 NVSDK_NGX_Coordinates InColorBeforeFogSubrectBase;
90 NVSDK_NGX_Coordinates InColorAfterFogSubrectBase;
91 NVSDK_NGX_Coordinates InScreenSpaceSubsurfaceScatteringGuideSubrectBase;
92 NVSDK_NGX_Coordinates InColorBeforeScreenSpaceSubsurfaceScatteringSubrectBase;
93 NVSDK_NGX_Coordinates InColorAfterScreenSpaceSubsurfaceScatteringSubrectBase;
94 NVSDK_NGX_Coordinates InScreenSpaceRefractionGuideSubrectBase;
95 NVSDK_NGX_Coordinates InColorBeforeScreenSpaceRefractionSubrectBase;
96 NVSDK_NGX_Coordinates InColorAfterScreenSpaceRefractionSubrectBase;
97 NVSDK_NGX_Coordinates InDepthOfFieldGuideSubrectBase;
98 NVSDK_NGX_Coordinates InColorBeforeDepthOfFieldSubrectBase;
99 NVSDK_NGX_Coordinates InColorAfterDepthOfFieldSubrectBase;
100 NVSDK_NGX_Coordinates InDiffuseHitDistanceSubrectBase;
101 NVSDK_NGX_Coordinates InSpecularHitDistanceSubrectBase;
102 NVSDK_NGX_Coordinates InDiffuseRayDirectionSubrectBase;
103 NVSDK_NGX_Coordinates InSpecularRayDirectionSubrectBase;
104 NVSDK_NGX_Coordinates InDiffuseRayDirectionHitDistanceSubrectBase;
105 NVSDK_NGX_Coordinates InSpecularRayDirectionHitDistanceSubrectBase;
106 float* pInWorldToViewMatrix;
107 float* pInViewToClipMatrix;
108
109 NVSDK_NGX_VK_GBuffer GBufferSurface;
110 NVSDK_NGX_ToneMapperType InToneMapperType;
111 NVSDK_NGX_Resource_VK * pInMotionVectors3D;
112 NVSDK_NGX_Resource_VK * pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
113 NVSDK_NGX_Resource_VK * pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
114 NVSDK_NGX_Resource_VK * pInDepthHighRes;
115 NVSDK_NGX_Resource_VK * pInPositionViewSpace;
116 float InFrameTimeDeltaInMsec; /* helps in determining the amount to denoise or anti-alias based on the speed of the object from motion vector magnitudes and fps as determined by this delta */
117 NVSDK_NGX_Resource_VK * pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
118 NVSDK_NGX_Resource_VK * pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
119 NVSDK_NGX_Resource_VK* pInTransparencyLayer; /* optional input res particle layer */
120 NVSDK_NGX_Coordinates InTransparencyLayerSubrectBase;
121 NVSDK_NGX_Resource_VK* pInTransparencyLayerOpacity; /* optional input res particle opacity layer */
122 NVSDK_NGX_Coordinates InTransparencyLayerOpacitySubrectBase;
123 NVSDK_NGX_Resource_VK* pInTransparencyLayerMvecs; /* optional input res transparency layer mvecs */
124 NVSDK_NGX_Coordinates InTransparencyLayerMvecsSubrectBase;
125 NVSDK_NGX_Resource_VK* pInDisocclusionMask; /* optional input res disocclusion mask */
126 NVSDK_NGX_Coordinates InDisocclusionMaskSubrectBase;
127} NVSDK_NGX_VK_DLSSD_Eval_Params;
128
129static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLSSD_EXT1(
130 VkDevice InDevice,
131 VkCommandBuffer InCmdList,
132 unsigned int InCreationNodeMask,
133 unsigned int InVisibilityNodeMask,
134 NVSDK_NGX_Handle **ppOutHandle,
135 NVSDK_NGX_Parameter *pInParams,
136 NVSDK_NGX_DLSSD_Create_Params *pInDlssDCreateParams)
137{
138 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
139 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
140 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssDCreateParams->InWidth);
141 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssDCreateParams->InHeight);
142 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssDCreateParams->InTargetWidth);
143 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssDCreateParams->InTargetHeight);
144 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssDCreateParams->InPerfQualityValue);
145 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssDCreateParams->InFeatureCreateFlags);
146 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssDCreateParams->InEnableOutputSubrects ? 1 : 0);
147 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Denoise_Mode, NVSDK_NGX_DLSS_Denoise_Mode_DLUnified);
148 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Roughness_Mode, pInDlssDCreateParams->InRoughnessMode);
149 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Use_HW_Depth, pInDlssDCreateParams->InUseHWDepth);
150
151 if (InDevice) return NVSDK_NGX_VULKAN_CreateFeature1(InDevice, InCmdList, NVSDK_NGX_Feature_RayReconstruction, pInParams, ppOutHandle);
152 else return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_RayReconstruction, pInParams, ppOutHandle);
153}
154
155static inline NVSDK_NGX_Result NGX_VULKAN_EVALUATE_DLSSD_EXT(
156 VkCommandBuffer InCmdList,
157 NVSDK_NGX_Handle *pInHandle,
158 NVSDK_NGX_Parameter *pInParams,
159 NVSDK_NGX_VK_DLSSD_Eval_Params *pInDlssDEvalParams)
160{
161 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColor);
162 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInAlpha);
163 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInMotionVectors);
164 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInOutput);
165 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInOutputAlpha);
166 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInDepth);
167 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInDiffuseAlbedo);
168 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInSpecularAlbedo);
169 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInTransparencyMask);
170 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInExposureTexture);
171 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInBiasCurrentColorMask);
172 for (size_t i = 0; i <= 15; i++)
173 {
174 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->GBufferSurface.pInAttrib[i]);
175 }
176 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInMotionVectors3D);
177 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInIsParticleMask);
178 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInAnimatedTextureMask);
179 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInDepthHighRes);
180 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInPositionViewSpace);
181 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInRayTracingHitDistance);
182 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInMotionVectorsReflections);
183 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInReflectedAlbedo);
184 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorBeforeParticles);
185 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorAfterParticles);
186 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorBeforeTransparency);
187 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorAfterTransparency);
188 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorBeforeFog);
189 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorAfterFog);
190 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInScreenSpaceSubsurfaceScatteringGuide);
191 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorBeforeScreenSpaceSubsurfaceScattering);
192 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorAfterScreenSpaceSubsurfaceScattering);
193 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInScreenSpaceRefractionGuide);
194 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorBeforeScreenSpaceRefraction);
195 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorAfterScreenSpaceRefraction);
196 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInDepthOfFieldGuide);
197 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorBeforeDepthOfField);
198 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInColorAfterDepthOfField);
199 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInDiffuseHitDistance);
200 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInSpecularHitDistance);
201 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInDiffuseRayDirection);
202 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInSpecularRayDirection);
203 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInDiffuseRayDirectionHitDistance);
204 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInSpecularRayDirectionHitDistance);
205 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInTransparencyLayer);
206 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInTransparencyLayerOpacity);
207 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInTransparencyLayerMvecs);
208 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssDEvalParams->pInDisocclusionMask);
209
210 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlssDEvalParams->pInColor);
211 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlssDEvalParams->pInOutput);
212 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssDEvalParams->pInDepth);
213 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssDEvalParams->pInMotionVectors);
214 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssDEvalParams->InJitterOffsetX);
215 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssDEvalParams->InJitterOffsetY);
216 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssDEvalParams->InReset);
217 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssDEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssDEvalParams->InMVScaleX);
218 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssDEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssDEvalParams->InMVScaleY);
219 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssDEvalParams->pInTransparencyMask);
220 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssDEvalParams->pInExposureTexture);
221 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssDEvalParams->pInBiasCurrentColorMask);
222 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
223 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
224 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
225 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
226 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
227 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
228 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
229 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
230 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssDEvalParams->GBufferSurface.pInAttrib[8]);
231 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssDEvalParams->GBufferSurface.pInAttrib[9]);
232 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_SpecularMvec, pInDlssDEvalParams->pInMotionVectorsReflections);
233 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssDEvalParams->GBufferSurface.pInAttrib[11]);
234 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssDEvalParams->GBufferSurface.pInAttrib[12]);
235 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssDEvalParams->GBufferSurface.pInAttrib[13]);
236 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssDEvalParams->GBufferSurface.pInAttrib[14]);
237 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssDEvalParams->GBufferSurface.pInAttrib[15]);
238 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssDEvalParams->InToneMapperType);
239 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssDEvalParams->pInMotionVectors3D);
240 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssDEvalParams->pInIsParticleMask);
241 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssDEvalParams->pInAnimatedTextureMask);
242 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssDEvalParams->pInDepthHighRes);
243 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssDEvalParams->pInPositionViewSpace);
244 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssDEvalParams->InFrameTimeDeltaInMsec);
245 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssDEvalParams->pInRayTracingHitDistance);
246 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssDEvalParams->InColorSubrectBase.X);
247 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssDEvalParams->InColorSubrectBase.Y);
248 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssDEvalParams->InDepthSubrectBase.X);
249 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssDEvalParams->InDepthSubrectBase.Y);
250 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssDEvalParams->InMVSubrectBase.X);
251 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssDEvalParams->InMVSubrectBase.Y);
252 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssDEvalParams->InTranslucencySubrectBase.X);
253 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssDEvalParams->InTranslucencySubrectBase.Y);
254 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssDEvalParams->InBiasCurrentColorSubrectBase.X);
255 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssDEvalParams->InBiasCurrentColorSubrectBase.Y);
256 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssDEvalParams->InOutputSubrectBase.X);
257 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssDEvalParams->InOutputSubrectBase.Y);
258 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssDEvalParams->InRenderSubrectDimensions.Width);
259 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssDEvalParams->InRenderSubrectDimensions.Height);
260 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssDEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssDEvalParams->InPreExposure);
261 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Exposure_Scale, pInDlssDEvalParams->InExposureScale == 0.0f ? 1.0f : pInDlssDEvalParams->InExposureScale);
262 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssDEvalParams->InIndicatorInvertXAxis);
263 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssDEvalParams->InIndicatorInvertYAxis);
264
265 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Emissive, pInDlssDEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_EMISSIVE]);
266
267 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DiffuseAlbedo, pInDlssDEvalParams->pInDiffuseAlbedo);
268 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_SpecularAlbedo, pInDlssDEvalParams->pInSpecularAlbedo);
269 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssDEvalParams->pInNormals);
270 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssDEvalParams->pInRoughness);
271 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_DiffuseAlbedo_Subrect_Base_X, pInDlssDEvalParams->InDiffuseAlbedoSubrectBase.X);
272 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_DiffuseAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseAlbedoSubrectBase.Y);
273 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_SpecularAlbedo_Subrect_Base_X, pInDlssDEvalParams->InSpecularAlbedoSubrectBase.X);
274 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_SpecularAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InSpecularAlbedoSubrectBase.Y);
275 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Normals_Subrect_Base_X, pInDlssDEvalParams->InNormalsSubrectBase.X);
276 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Normals_Subrect_Base_Y, pInDlssDEvalParams->InNormalsSubrectBase.Y);
277 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Roughness_Subrect_Base_X, pInDlssDEvalParams->InRoughnessSubrectBase.X);
278 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Roughness_Subrect_Base_Y, pInDlssDEvalParams->InRoughnessSubrectBase.Y);
279
280 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_Alpha, pInDlssDEvalParams->pInAlpha);
281 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_OutputAlpha, pInDlssDEvalParams->pInOutputAlpha);
282 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo, pInDlssDEvalParams->pInReflectedAlbedo);
283 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles, pInDlssDEvalParams->pInColorBeforeParticles);
284 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles, pInDlssDEvalParams->pInColorAfterParticles);
285 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency, pInDlssDEvalParams->pInColorBeforeTransparency);
286 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency, pInDlssDEvalParams->pInColorAfterTransparency);
287 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog, pInDlssDEvalParams->pInColorBeforeFog);
288 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterFog, pInDlssDEvalParams->pInColorAfterFog);
289
290 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide, pInDlssDEvalParams->pInScreenSpaceSubsurfaceScatteringGuide);
291 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering, pInDlssDEvalParams->pInColorBeforeScreenSpaceSubsurfaceScattering);
292 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering, pInDlssDEvalParams->pInColorAfterScreenSpaceSubsurfaceScattering);
293 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide, pInDlssDEvalParams->pInScreenSpaceRefractionGuide);
294 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction, pInDlssDEvalParams->pInColorBeforeScreenSpaceRefraction);
295 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction, pInDlssDEvalParams->pInColorAfterScreenSpaceRefraction);
296 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide, pInDlssDEvalParams->pInDepthOfFieldGuide);
297 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField, pInDlssDEvalParams->pInColorBeforeDepthOfField);
298 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField, pInDlssDEvalParams->pInColorAfterDepthOfField);
299 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance, pInDlssDEvalParams->pInDiffuseHitDistance);
300 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance, pInDlssDEvalParams->pInSpecularHitDistance);
301 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection, pInDlssDEvalParams->pInDiffuseRayDirection);
302 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection, pInDlssDEvalParams->pInSpecularRayDirection);
303 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance, pInDlssDEvalParams->pInDiffuseRayDirectionHitDistance);
304 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance, pInDlssDEvalParams->pInSpecularRayDirectionHitDistance);
305 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_Alpha_Subrect_Base_X, pInDlssDEvalParams->InAlphaSubrectBase.X);
306 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_Alpha_Subrect_Base_Y, pInDlssDEvalParams->InAlphaSubrectBase.Y);
307 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_OutputAlpha_Subrect_Base_X, pInDlssDEvalParams->InOutputAlphaSubrectBase.X);
308 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_OutputAlpha_Subrect_Base_Y, pInDlssDEvalParams->InOutputAlphaSubrectBase.Y);
309 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo_Subrect_Base_X, pInDlssDEvalParams->InReflectedAlbedoSubrectBase.X);
310 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ReflectedAlbedo_Subrect_Base_Y, pInDlssDEvalParams->InReflectedAlbedoSubrectBase.Y);
311 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeParticlesSubrectBase.X);
312 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeParticles_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeParticlesSubrectBase.Y);
313 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles_Subrect_Base_X, pInDlssDEvalParams->InColorAfterParticlesSubrectBase.X);
314 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterParticles_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterParticlesSubrectBase.Y);
315 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeTransparencySubrectBase.X);
316 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeTransparency_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeTransparencySubrectBase.Y);
317 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency_Subrect_Base_X, pInDlssDEvalParams->InColorAfterTransparencySubrectBase.X);
318 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterTransparency_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterTransparencySubrectBase.Y);
319 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeFogSubrectBase.X);
320 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeFog_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeFogSubrectBase.Y);
321 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterFog_Subrect_Base_X, pInDlssDEvalParams->InColorAfterFogSubrectBase.X);
322 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterFog_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterFogSubrectBase.Y);
323 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide_Subrect_Base_X, pInDlssDEvalParams->InScreenSpaceSubsurfaceScatteringGuideSubrectBase.X);
324 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceSubsurfaceScatteringGuide_Subrect_Base_Y, pInDlssDEvalParams->InScreenSpaceSubsurfaceScatteringGuideSubrectBase.Y);
325 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeScreenSpaceSubsurfaceScatteringSubrectBase.X);
326 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceSubsurfaceScattering_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeScreenSpaceSubsurfaceScatteringSubrectBase.Y);
327 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering_Subrect_Base_X, pInDlssDEvalParams->InColorAfterScreenSpaceSubsurfaceScatteringSubrectBase.X);
328 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceSubsurfaceScattering_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterScreenSpaceSubsurfaceScatteringSubrectBase.Y);
329 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide_Subrect_Base_X, pInDlssDEvalParams->InScreenSpaceRefractionGuideSubrectBase.X);
330 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ScreenSpaceRefractionGuide_Subrect_Base_Y, pInDlssDEvalParams->InScreenSpaceRefractionGuideSubrectBase.Y);
331 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeScreenSpaceRefractionSubrectBase.X);
332 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeScreenSpaceRefraction_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeScreenSpaceRefractionSubrectBase.Y);
333 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction_Subrect_Base_X, pInDlssDEvalParams->InColorAfterScreenSpaceRefractionSubrectBase.X);
334 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterScreenSpaceRefraction_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterScreenSpaceRefractionSubrectBase.Y);
335 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide_Subrect_Base_X, pInDlssDEvalParams->InDepthOfFieldGuideSubrectBase.X);
336 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DepthOfFieldGuide_Subrect_Base_Y, pInDlssDEvalParams->InDepthOfFieldGuideSubrectBase.Y);
337 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField_Subrect_Base_X, pInDlssDEvalParams->InColorBeforeDepthOfFieldSubrectBase.X);
338 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorBeforeDepthOfField_Subrect_Base_Y, pInDlssDEvalParams->InColorBeforeDepthOfFieldSubrectBase.Y);
339 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField_Subrect_Base_X, pInDlssDEvalParams->InColorAfterDepthOfFieldSubrectBase.X);
340 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_ColorAfterDepthOfField_Subrect_Base_Y, pInDlssDEvalParams->InColorAfterDepthOfFieldSubrectBase.Y);
341 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance_Subrect_Base_X, pInDlssDEvalParams->InDiffuseHitDistanceSubrectBase.X);
342 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseHitDistanceSubrectBase.Y);
343 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance_Subrect_Base_X, pInDlssDEvalParams->InSpecularHitDistanceSubrectBase.X);
344 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InSpecularHitDistanceSubrectBase.Y);
345 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection_Subrect_Base_X, pInDlssDEvalParams->InDiffuseRayDirectionSubrectBase.X);
346 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirection_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseRayDirectionSubrectBase.Y);
347 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection_Subrect_Base_X, pInDlssDEvalParams->InSpecularRayDirectionSubrectBase.X);
348 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirection_Subrect_Base_Y, pInDlssDEvalParams->InSpecularRayDirectionSubrectBase.Y);
349 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance_Subrect_Base_X, pInDlssDEvalParams->InDiffuseRayDirectionHitDistanceSubrectBase.X);
350 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_DiffuseRayDirectionHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InDiffuseRayDirectionHitDistanceSubrectBase.Y);
351 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance_Subrect_Base_X, pInDlssDEvalParams->InSpecularRayDirectionHitDistanceSubrectBase.X);
352 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSSD_SpecularRayDirectionHitDistance_Subrect_Base_Y, pInDlssDEvalParams->InSpecularRayDirectionHitDistanceSubrectBase.Y);
353
354 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_WORLD_TO_VIEW_MATRIX, pInDlssDEvalParams->pInWorldToViewMatrix);
355 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_VIEW_TO_CLIP_MATRIX, pInDlssDEvalParams->pInViewToClipMatrix);
356 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer, pInDlssDEvalParams->pInTransparencyLayer);
357 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity, pInDlssDEvalParams->pInTransparencyLayerOpacity);
358 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs, pInDlssDEvalParams->pInTransparencyLayerMvecs);
359 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_DisocclusionMask, pInDlssDEvalParams->pInDisocclusionMask);
360 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerSubrectBase.X);
361 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayer_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerSubrectBase.Y);
362 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerOpacitySubrectBase.X);
363 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerOpacity_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerOpacitySubrectBase.Y);
364 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs_Subrect_Base_X, pInDlssDEvalParams->InTransparencyLayerMvecsSubrectBase.X);
365 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_TransparencyLayerMvecs_Subrect_Base_Y, pInDlssDEvalParams->InTransparencyLayerMvecsSubrectBase.Y);
366 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_DisocclusionMask_Subrect_Base_X, pInDlssDEvalParams->InDisocclusionMaskSubrectBase.X);
367 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_DisocclusionMask_Subrect_Base_Y, pInDlssDEvalParams->InDisocclusionMaskSubrectBase.Y);
368
369
370 return NVSDK_NGX_VULKAN_EvaluateFeature_C(InCmdList, pInHandle, pInParams, NULL);
371}
372
373#endif // NVSDK_NGX_HELPERS_DLSSD_VK_H
thirdparty/ngx/include/nvsdk_ngx_helpers_dlssg.h +214 -0
……@@ -0,0 +1,214 @@
1/*
2* Copyright (c) 2021-2025 NVIDIA CORPORATION. All rights reserved.
3*
4* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
5* rights in and to this software, related documentation and any modifications thereto.
6* Any use, reproduction, disclosure or distribution of this software and related
7* documentation without an express license agreement from NVIDIA Corporation is strictly
8* prohibited.
9*
10* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
11* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
12* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
13* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
14* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
15* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
16* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
17* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
18* SUCH DAMAGES.
19*/
20
21#pragma once
22
23#ifndef NVSDK_NGX_HELPERS_DLSSG_H
24#define NVSDK_NGX_HELPERS_DLSSG_H
25
26#include <stdint.h> // for uint64_t
27
28#include "nvsdk_ngx.h" // DX11/12 here
29#include "nvsdk_ngx_defs_dlssg.h"
30#include "nvsdk_ngx_params_dlssg.h"
31
32typedef struct NVSDK_NGX_D3D12_DLSSG_Eval_Params
33{
34 ID3D12Resource* pBackbuffer;
35 ID3D12Resource* pDepth;
36 ID3D12Resource* pMVecs;
37 ID3D12Resource* pHudless; // Optional
38 ID3D12Resource* pUI; // Optional
39 ID3D12Resource* pNoPostProcessingColor; // Optional
40 ID3D12Resource* pBidirectionalDistortionField; // Optional
41 ID3D12Resource* pOutputInterpFrame;
42 ID3D12Resource* pOutputRealFrame; // Optional. In some cases, the feature may modify this frame (e.g. debugging)
43 ID3D12Resource* pOutputDisableInterpolation; // Optional
44} NVSDK_NGX_D3D12_DLSSG_Eval_Params;
45
46static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLSSG(
47 ID3D12GraphicsCommandList* pInCmdList,
48 unsigned int InCreationNodeMask,
49 unsigned int InVisibilityNodeMask,
50 NVSDK_NGX_Handle** ppOutHandle,
51 NVSDK_NGX_Parameter* pInParams,
52 NVSDK_NGX_DLSSG_Create_Params* pInDlssgCreateParams)
53{
54 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
55 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
56 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssgCreateParams->Width);
57 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssgCreateParams->Height);
58 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BackbufferFormat, pInDlssgCreateParams->NativeBackbufferFormat);
59 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_InternalWidth, pInDlssgCreateParams->RenderWidth);
60 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_InternalHeight, pInDlssgCreateParams->RenderHeight);
61 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DynamicResolution, pInDlssgCreateParams->DynamicResolutionScaling);
62
63 return NVSDK_NGX_D3D12_CreateFeature(pInCmdList, NVSDK_NGX_Feature_FrameGeneration, pInParams, ppOutHandle);
64}
65
66static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLSSG(
67 ID3D12GraphicsCommandList* pInCmdList,
68 NVSDK_NGX_Handle* pInHandle,
69 NVSDK_NGX_Parameter* pInParams,
70 NVSDK_NGX_D3D12_DLSSG_Eval_Params* pInDlssgEvalParams,
71 NVSDK_NGX_DLSSG_Opt_Eval_Params* pInDlssgOptEvalParams)
72{
73 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_DLSSG_Parameter_Backbuffer, pInDlssgEvalParams->pBackbuffer);
74 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_DLSSG_Parameter_MVecs, pInDlssgEvalParams->pMVecs);
75 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_DLSSG_Parameter_Depth, pInDlssgEvalParams->pDepth);
76 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_DLSSG_Parameter_HUDLess, pInDlssgEvalParams->pHudless);
77 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_DLSSG_Parameter_UI, pInDlssgEvalParams->pUI);
78 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_DLSSG_Parameter_NoPostProcessingColor, pInDlssgEvalParams->pNoPostProcessingColor);
79 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField, pInDlssgEvalParams->pBidirectionalDistortionField);
80 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_OutputInterpolated, pInDlssgEvalParams->pOutputInterpFrame);
81 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_OutputReal, pInDlssgEvalParams->pOutputRealFrame);
82 NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_DLSSG_Parameter_OutputDisableInterpolation, pInDlssgEvalParams->pOutputDisableInterpolation);
83
84 if (pInDlssgOptEvalParams)
85 {
86 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MultiFrameCount, pInDlssgOptEvalParams->multiFrameCount);
87 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MultiFrameIndex, pInDlssgOptEvalParams->multiFrameIndex);
88
89 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraViewToClip, pInDlssgOptEvalParams->cameraViewToClip);
90 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_ClipToCameraView, pInDlssgOptEvalParams->clipToCameraView);
91 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_ClipToLensClip, pInDlssgOptEvalParams->clipToLensClip);
92 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_ClipToPrevClip, pInDlssgOptEvalParams->clipToPrevClip);
93 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_PrevClipToClip, pInDlssgOptEvalParams->prevClipToClip);
94
95 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_JitterOffsetX, pInDlssgOptEvalParams->jitterOffset[0]);
96 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_JitterOffsetY, pInDlssgOptEvalParams->jitterOffset[1]);
97
98 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_MvecScaleX, pInDlssgOptEvalParams->mvecScale[0]);
99 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_MvecScaleY, pInDlssgOptEvalParams->mvecScale[1]);
100
101 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraPinholeOffsetX, pInDlssgOptEvalParams->cameraPinholeOffset[0]);
102 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraPinholeOffsetY, pInDlssgOptEvalParams->cameraPinholeOffset[1]);
103
104 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraPosX, pInDlssgOptEvalParams->cameraPos[0]);
105 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraPosY, pInDlssgOptEvalParams->cameraPos[1]);
106 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraPosZ, pInDlssgOptEvalParams->cameraPos[2]);
107
108 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraUpX, pInDlssgOptEvalParams->cameraUp[0]);
109 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraUpY, pInDlssgOptEvalParams->cameraUp[1]);
110 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraUpZ, pInDlssgOptEvalParams->cameraUp[2]);
111
112 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraRightX, pInDlssgOptEvalParams->cameraRight[0]);
113 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraRightY, pInDlssgOptEvalParams->cameraRight[1]);
114 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraRightZ, pInDlssgOptEvalParams->cameraRight[2]);
115
116 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraFwdX, pInDlssgOptEvalParams->cameraFwd[0]);
117 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraFwdY, pInDlssgOptEvalParams->cameraFwd[1]);
118 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraFwdZ, pInDlssgOptEvalParams->cameraFwd[2]);
119
120 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraNear, pInDlssgOptEvalParams->cameraNear);
121 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraFar, pInDlssgOptEvalParams->cameraFar);
122 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraFOV, pInDlssgOptEvalParams->cameraFOV);
123 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraAspectRatio, pInDlssgOptEvalParams->cameraAspectRatio);
124
125 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_ColorBuffersHDR, pInDlssgOptEvalParams->colorBuffersHDR);
126
127 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DepthInverted, pInDlssgOptEvalParams->depthInverted);
128
129 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraMotionIncluded, pInDlssgOptEvalParams->cameraMotionIncluded);
130
131 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_Reset, pInDlssgOptEvalParams->reset);
132 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_AutomodeOverrideReset, pInDlssgOptEvalParams->automodeOverrideReset);
133
134 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_NotRenderingGameFrames, pInDlssgOptEvalParams->notRenderingGameFrames);
135
136 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_OrthoProjection, pInDlssgOptEvalParams->orthoProjection);
137
138 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_MvecInvalidValue, pInDlssgOptEvalParams->motionVectorsInvalidValue);
139 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MvecDilated, pInDlssgOptEvalParams->motionVectorsDilated);
140
141 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MenuDetectionEnabled, pInDlssgOptEvalParams->menuDetectionEnabled);
142
143 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MVecsSubrectBaseX, pInDlssgOptEvalParams->mvecsSubrectBase.X);
144 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MVecsSubrectBaseY, pInDlssgOptEvalParams->mvecsSubrectBase.Y);
145 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MVecsSubrectWidth, pInDlssgOptEvalParams->mvecsSubrectSize.Width);
146 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MVecsSubrectHeight, pInDlssgOptEvalParams->mvecsSubrectSize.Height);
147
148 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DepthSubrectBaseX, pInDlssgOptEvalParams->depthSubrectBase.X);
149 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DepthSubrectBaseY, pInDlssgOptEvalParams->depthSubrectBase.Y);
150 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DepthSubrectWidth, pInDlssgOptEvalParams->depthSubrectSize.Width);
151 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DepthSubrectHeight, pInDlssgOptEvalParams->depthSubrectSize.Height);
152
153 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectBaseX, pInDlssgOptEvalParams->hudLessSubrectBase.X);
154 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectBaseY, pInDlssgOptEvalParams->hudLessSubrectBase.Y);
155 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectWidth, pInDlssgOptEvalParams->hudLessSubrectSize.Width);
156 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectHeight, pInDlssgOptEvalParams->hudLessSubrectSize.Height);
157
158 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_UISubrectBaseX, pInDlssgOptEvalParams->uiSubrectBase.X);
159 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_UISubrectBaseY, pInDlssgOptEvalParams->uiSubrectBase.Y);
160 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_UISubrectWidth, pInDlssgOptEvalParams->uiSubrectSize.Width);
161 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_UISubrectHeight, pInDlssgOptEvalParams->uiSubrectSize.Height);
162
163 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectBaseX, pInDlssgOptEvalParams->bidirectionalDistFieldSubrectBase.X);
164 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectBaseY, pInDlssgOptEvalParams->bidirectionalDistFieldSubrectBase.Y);
165 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectWidth, pInDlssgOptEvalParams->bidirectionalDistFieldSubrectSize.Width);
166 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectHeight, pInDlssgOptEvalParams->bidirectionalDistFieldSubrectSize.Height);
167 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField_LowPrecision_IsLowPrecision, pInDlssgOptEvalParams->bidirectionalDistFieldPrecisionInfo.IsLowPrecision);
168 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField_LowPrecision_Bias, pInDlssgOptEvalParams->bidirectionalDistFieldPrecisionInfo.Bias);
169 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField_LowPrecision_Scale, pInDlssgOptEvalParams->bidirectionalDistFieldPrecisionInfo.Scale);
170
171 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_MinRelativeLinearDepthObjectSeparation, pInDlssgOptEvalParams->minRelativeLinearDepthObjectSeparation);
172
173 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectBaseX, pInDlssgOptEvalParams->backbufferSubrectBase.X);
174 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectBaseY, pInDlssgOptEvalParams->backbufferSubrectBase.Y);
175 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectWidth, pInDlssgOptEvalParams->backbufferSubrectSize.Width);
176 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectHeight, pInDlssgOptEvalParams->backbufferSubrectSize.Height);
177 }
178
179 return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
180}
181
182static inline NVSDK_NGX_Result NGX_D3D12_ESTIMATE_VRAM_DLSSG(
183 NVSDK_NGX_Parameter* InParams,
184 uint32_t mvecDepthWidth, uint32_t mvecDepthHeight,
185 uint32_t colorWidth, uint32_t colorHeight,
186 uint32_t colorBufferFormat,
187 uint32_t mvecBufferFormat, uint32_t depthBufferFormat,
188 uint32_t hudLessBufferFormat, uint32_t uiBufferFormat,
189 size_t* estimatedVRAMInBytes
190)
191{
192 void* Callback = NULL;
193 NVSDK_NGX_Parameter_GetVoidPointer(InParams, NVSDK_NGX_Parameter_DLSSGEstimateVRAMCallback, &Callback);
194 if (!Callback)
195 {
196 // Possible reasons for this:
197 // - Installed feature is out of date and does not support the feature we need
198 // - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
199 return NVSDK_NGX_Result_FAIL_OutOfDate;
200 }
201
202 NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
203 PFN_NVSDK_NGX_DLSSG_EstimateVRAMCallback PFNCallback = (PFN_NVSDK_NGX_DLSSG_EstimateVRAMCallback)Callback;
204 Res = PFNCallback(mvecDepthWidth, mvecDepthHeight, colorWidth, colorHeight,
205 colorBufferFormat, mvecBufferFormat, depthBufferFormat, hudLessBufferFormat, uiBufferFormat, estimatedVRAMInBytes);
206 if (NVSDK_NGX_FAILED(Res))
207 {
208 return Res;
209 }
210
211 return NVSDK_NGX_Result_Success;
212}
213
214#endif // NVSDK_NGX_HELPERS_DLSSG_H
thirdparty/ngx/include/nvsdk_ngx_helpers_dlssg_vk.h +212 -0
……@@ -0,0 +1,212 @@
1#pragma once
2/*
3* Copyright (c) 2021-2024 NVIDIA CORPORATION. All rights reserved.
4*
5* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
6* rights in and to this software, related documentation and any modifications thereto.
7* Any use, reproduction, disclosure or distribution of this software and related
8* documentation without an express license agreement from NVIDIA Corporation is strictly
9* prohibited.
10*
11* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
12* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
13* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
15* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
16* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
17* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
18* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
19* SUCH DAMAGES.
20*/
21
22
23#ifndef NVSDK_NGX_HELPERS_DLSSG_VK_H
24#define NVSDK_NGX_HELPERS_DLSSG_VK_H
25
26#include <vulkan/vulkan.h>
27#include "nvsdk_ngx_defs_dlssg.h"
28#include "nvsdk_ngx_params_dlssg.h"
29#include "nvsdk_ngx_vk.h" // VK here
30
31typedef struct NVSDK_NGX_VK_DLSSG_Eval_Params
32{
33 NVSDK_NGX_Resource_VK* pBackbuffer;
34 NVSDK_NGX_Resource_VK* pDepth;
35 NVSDK_NGX_Resource_VK* pMVecs;
36 NVSDK_NGX_Resource_VK* pHudless; // Optional
37 NVSDK_NGX_Resource_VK* pUI; // Optional
38 NVSDK_NGX_Resource_VK* pNoPostProcessingColor; // Optional
39 NVSDK_NGX_Resource_VK* pBidirectionalDistortionField; // Optional
40 NVSDK_NGX_Resource_VK* pOutputInterpFrame;
41 NVSDK_NGX_Resource_VK* pOutputRealFrame; // Optional. In some cases, the feature may modify this frame (e.g. debugging)
42 NVSDK_NGX_Resource_VK* pOutputDisableInterpolation; // Optional
43} NVSDK_NGX_VK_DLSSG_Eval_Params;
44
45static inline NVSDK_NGX_Result NGX_VK_CREATE_DLSSG(
46 VkCommandBuffer pInCmdBuf,
47 unsigned int InCreationNodeMask,
48 unsigned int InVisibilityNodeMask,
49 NVSDK_NGX_Handle** ppOutHandle,
50 NVSDK_NGX_Parameter* pInParams,
51 NVSDK_NGX_DLSSG_Create_Params* pInDlssgCreateParams)
52{
53 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
54 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
55 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssgCreateParams->Width);
56 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssgCreateParams->Height);
57 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BackbufferFormat, pInDlssgCreateParams->NativeBackbufferFormat);
58
59 return NVSDK_NGX_VULKAN_CreateFeature(pInCmdBuf, NVSDK_NGX_Feature_FrameGeneration, pInParams, ppOutHandle);
60}
61
62static inline NVSDK_NGX_Result NGX_VK_EVALUATE_DLSSG(
63 VkCommandBuffer pInCmdBuf,
64 NVSDK_NGX_Handle* pInHandle,
65 NVSDK_NGX_Parameter* pInParams,
66 NVSDK_NGX_VK_DLSSG_Eval_Params* pInDlssgEvalParams,
67 NVSDK_NGX_DLSSG_Opt_Eval_Params* pInDlssgOptEvalParams)
68{
69 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_Backbuffer, pInDlssgEvalParams->pBackbuffer);
70 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_MVecs, pInDlssgEvalParams->pMVecs);
71 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_Depth, pInDlssgEvalParams->pDepth);
72 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_HUDLess, pInDlssgEvalParams->pHudless);
73 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_UI, pInDlssgEvalParams->pUI);
74 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_NoPostProcessingColor, pInDlssgEvalParams->pNoPostProcessingColor);
75 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField, pInDlssgEvalParams->pBidirectionalDistortionField);
76 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_OutputInterpolated, pInDlssgEvalParams->pOutputInterpFrame);
77 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_OutputReal, pInDlssgEvalParams->pOutputRealFrame);
78 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_OutputDisableInterpolation, pInDlssgEvalParams->pOutputDisableInterpolation);
79
80 if (pInDlssgOptEvalParams)
81 {
82 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MultiFrameCount, pInDlssgOptEvalParams->multiFrameCount);
83 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MultiFrameIndex, pInDlssgOptEvalParams->multiFrameIndex);
84
85 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraViewToClip, pInDlssgOptEvalParams->cameraViewToClip);
86 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_ClipToCameraView, pInDlssgOptEvalParams->clipToCameraView);
87 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_ClipToLensClip, pInDlssgOptEvalParams->clipToLensClip);
88 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_ClipToPrevClip, pInDlssgOptEvalParams->clipToPrevClip);
89 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_DLSSG_Parameter_PrevClipToClip, pInDlssgOptEvalParams->prevClipToClip);
90
91 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_JitterOffsetX, pInDlssgOptEvalParams->jitterOffset[0]);
92 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_JitterOffsetY, pInDlssgOptEvalParams->jitterOffset[1]);
93
94 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_MvecScaleX, pInDlssgOptEvalParams->mvecScale[0]);
95 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_MvecScaleY, pInDlssgOptEvalParams->mvecScale[1]);
96
97 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraPinholeOffsetX, pInDlssgOptEvalParams->cameraPinholeOffset[0]);
98 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraPinholeOffsetY, pInDlssgOptEvalParams->cameraPinholeOffset[1]);
99
100 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraPosX, pInDlssgOptEvalParams->cameraPos[0]);
101 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraPosY, pInDlssgOptEvalParams->cameraPos[1]);
102 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraPosZ, pInDlssgOptEvalParams->cameraPos[2]);
103
104 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraUpX, pInDlssgOptEvalParams->cameraUp[0]);
105 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraUpY, pInDlssgOptEvalParams->cameraUp[1]);
106 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraUpZ, pInDlssgOptEvalParams->cameraUp[2]);
107
108 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraRightX, pInDlssgOptEvalParams->cameraRight[0]);
109 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraRightY, pInDlssgOptEvalParams->cameraRight[1]);
110 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraRightZ, pInDlssgOptEvalParams->cameraRight[2]);
111
112 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraFwdX, pInDlssgOptEvalParams->cameraFwd[0]);
113 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraFwdY, pInDlssgOptEvalParams->cameraFwd[1]);
114 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraFwdZ, pInDlssgOptEvalParams->cameraFwd[2]);
115
116 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraNear, pInDlssgOptEvalParams->cameraNear);
117 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraFar, pInDlssgOptEvalParams->cameraFar);
118 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraFOV, pInDlssgOptEvalParams->cameraFOV);
119 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraAspectRatio, pInDlssgOptEvalParams->cameraAspectRatio);
120
121 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_ColorBuffersHDR, pInDlssgOptEvalParams->colorBuffersHDR);
122
123 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DepthInverted, pInDlssgOptEvalParams->depthInverted);
124
125 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_CameraMotionIncluded, pInDlssgOptEvalParams->cameraMotionIncluded);
126
127 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_Reset, pInDlssgOptEvalParams->reset);
128 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_AutomodeOverrideReset, pInDlssgOptEvalParams->automodeOverrideReset);
129
130 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_NotRenderingGameFrames, pInDlssgOptEvalParams->notRenderingGameFrames);
131
132 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_OrthoProjection, pInDlssgOptEvalParams->orthoProjection);
133
134 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_MvecInvalidValue, pInDlssgOptEvalParams->motionVectorsInvalidValue);
135 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MvecDilated, pInDlssgOptEvalParams->motionVectorsDilated);
136
137 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MenuDetectionEnabled, pInDlssgOptEvalParams->menuDetectionEnabled);
138
139 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MVecsSubrectBaseX, pInDlssgOptEvalParams->mvecsSubrectBase.X);
140 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MVecsSubrectBaseY, pInDlssgOptEvalParams->mvecsSubrectBase.Y);
141 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MVecsSubrectWidth, pInDlssgOptEvalParams->mvecsSubrectSize.Width);
142 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_MVecsSubrectHeight, pInDlssgOptEvalParams->mvecsSubrectSize.Height);
143
144 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DepthSubrectBaseX, pInDlssgOptEvalParams->depthSubrectBase.X);
145 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DepthSubrectBaseY, pInDlssgOptEvalParams->depthSubrectBase.Y);
146 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DepthSubrectWidth, pInDlssgOptEvalParams->depthSubrectSize.Width);
147 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_DepthSubrectHeight, pInDlssgOptEvalParams->depthSubrectSize.Height);
148
149 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectBaseX, pInDlssgOptEvalParams->hudLessSubrectBase.X);
150 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectBaseY, pInDlssgOptEvalParams->hudLessSubrectBase.Y);
151 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectWidth, pInDlssgOptEvalParams->hudLessSubrectSize.Width);
152 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_HUDLessSubrectHeight, pInDlssgOptEvalParams->hudLessSubrectSize.Height);
153
154 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_UISubrectBaseX, pInDlssgOptEvalParams->uiSubrectBase.X);
155 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_UISubrectBaseY, pInDlssgOptEvalParams->uiSubrectBase.Y);
156 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_UISubrectWidth, pInDlssgOptEvalParams->uiSubrectSize.Width);
157 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_UISubrectHeight, pInDlssgOptEvalParams->uiSubrectSize.Height);
158
159 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectBaseX, pInDlssgOptEvalParams->bidirectionalDistFieldSubrectBase.X);
160 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectBaseY, pInDlssgOptEvalParams->bidirectionalDistFieldSubrectBase.Y);
161 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectWidth, pInDlssgOptEvalParams->bidirectionalDistFieldSubrectSize.Width);
162 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionFieldSubrectHeight, pInDlssgOptEvalParams->bidirectionalDistFieldSubrectSize.Height);
163
164 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField_LowPrecision_IsLowPrecision, pInDlssgOptEvalParams->bidirectionalDistFieldPrecisionInfo.IsLowPrecision);
165 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField_LowPrecision_Bias, pInDlssgOptEvalParams->bidirectionalDistFieldPrecisionInfo.Bias);
166 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_BidirectionalDistortionField_LowPrecision_Scale, pInDlssgOptEvalParams->bidirectionalDistFieldPrecisionInfo.Scale);
167
168 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_DLSSG_Parameter_MinRelativeLinearDepthObjectSeparation, pInDlssgOptEvalParams->minRelativeLinearDepthObjectSeparation);
169
170 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectBaseX, pInDlssgOptEvalParams->backbufferSubrectBase.X);
171 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectBaseY, pInDlssgOptEvalParams->backbufferSubrectBase.Y);
172 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectWidth, pInDlssgOptEvalParams->backbufferSubrectSize.Width);
173 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_DLSSG_Parameter_BackbufferSubrectHeight, pInDlssgOptEvalParams->backbufferSubrectSize.Height);
174 }
175
176 // C version or cpp?
177 return NVSDK_NGX_VULKAN_EvaluateFeature_C(pInCmdBuf, pInHandle, pInParams, NULL);
178}
179
180static inline NVSDK_NGX_Result NGX_VK_ESTIMATE_VRAM_DLSSG(
181 NVSDK_NGX_Parameter* InParams,
182 uint32_t mvecDepthWidth, uint32_t mvecDepthHeight,
183 uint32_t colorWidth, uint32_t colorHeight,
184 uint32_t colorBufferFormat,
185 uint32_t mvecBufferFormat, uint32_t depthBufferFormat,
186 uint32_t hudLessBufferFormat, uint32_t uiBufferFormat,
187 size_t* estimatedVRAMInBytes
188)
189{
190 void* Callback = NULL;
191 NVSDK_NGX_Parameter_GetVoidPointer(InParams, NVSDK_NGX_Parameter_DLSSGEstimateVRAMCallback, &Callback);
192 if (!Callback)
193 {
194 // Possible reasons for this:
195 // - Installed feature is out of date and does not support the feature we need
196 // - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
197 return NVSDK_NGX_Result_FAIL_OutOfDate;
198 }
199
200 NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
201 PFN_NVSDK_NGX_DLSSG_EstimateVRAMCallback PFNCallback = (PFN_NVSDK_NGX_DLSSG_EstimateVRAMCallback)Callback;
202 Res = PFNCallback(mvecDepthWidth, mvecDepthHeight, colorWidth, colorHeight,
203 colorBufferFormat, mvecBufferFormat, depthBufferFormat, hudLessBufferFormat, uiBufferFormat, estimatedVRAMInBytes);
204 if (NVSDK_NGX_FAILED(Res))
205 {
206 return Res;
207 }
208
209 return NVSDK_NGX_Result_Success;
210}
211
212#endif
thirdparty/ngx/include/nvsdk_ngx_helpers_vk.h +310 -0
……@@ -0,0 +1,310 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13#ifndef NVSDK_NGX_HELPERS_VK_H
14#define NVSDK_NGX_HELPERS_VK_H
15#pragma once
16
17#include "nvsdk_ngx_vk.h"
18
19#define NVSDK_NGX_ENSURE_VK_IMAGEVIEW(InResource) if ((InResource) && (InResource)->Type != NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW) { return NVSDK_NGX_Result_FAIL_InvalidParameter; }
20
21static inline NVSDK_NGX_Resource_VK NVSDK_NGX_Create_ImageView_Resource_VK(VkImageView imageView, VkImage image, VkImageSubresourceRange subresourceRange, VkFormat format, unsigned int width, unsigned int height, bool readWrite)
22{
23 NVSDK_NGX_Resource_VK resourceVK = {0};
24 resourceVK.Type = NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW;
25 resourceVK.Resource.ImageViewInfo.ImageView = imageView;
26 resourceVK.Resource.ImageViewInfo.Image = image;
27 resourceVK.Resource.ImageViewInfo.SubresourceRange = subresourceRange;
28 resourceVK.Resource.ImageViewInfo.Height = height;
29 resourceVK.Resource.ImageViewInfo.Width = width;
30 resourceVK.Resource.ImageViewInfo.Format = format;
31 resourceVK.ReadWrite = readWrite;
32 return resourceVK;
33}
34
35static inline NVSDK_NGX_Resource_VK NVSDK_NGX_Create_Buffer_Resource_VK(VkBuffer buffer, unsigned int sizeInBytes, bool readWrite)
36{
37 NVSDK_NGX_Resource_VK resourceVK = {0};
38 resourceVK.Type = NVSDK_NGX_RESOURCE_VK_TYPE_VK_BUFFER;
39 resourceVK.Resource.BufferInfo.Buffer = buffer;
40 resourceVK.Resource.BufferInfo.SizeInBytes = sizeInBytes;
41 resourceVK.ReadWrite = readWrite;
42 return resourceVK;
43}
44
45typedef struct NVSDK_NGX_VK_Feature_Eval_Params
46{
47 NVSDK_NGX_Resource_VK *pInColor;
48 NVSDK_NGX_Resource_VK *pInOutput;
49 /*** OPTIONAL for DLSS ***/
50 float InSharpness;
51} NVSDK_NGX_VK_Feature_Eval_Params;
52
53typedef struct NVSDK_NGX_VK_GBuffer
54{
55 NVSDK_NGX_Resource_VK *pInAttrib[NVSDK_NGX_GBUFFERTYPE_NUM];
56} NVSDK_NGX_VK_GBuffer;
57
58typedef struct NVSDK_NGX_Coordinates_VK
59{
60 unsigned int X;
61 unsigned int Y;
62} NVSDK_NGX_Coordinates_VK;
63
64typedef struct NVSDK_NGX_VK_DLSS_Eval_Params
65{
66 NVSDK_NGX_VK_Feature_Eval_Params Feature;
67 NVSDK_NGX_Resource_VK * pInDepth;
68 NVSDK_NGX_Resource_VK * pInMotionVectors;
69 float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
70 float InJitterOffsetY;
71 NVSDK_NGX_Dimensions InRenderSubrectDimensions;
72 /*** OPTIONAL - leave to 0/0.0f if unused ***/
73 int InReset; /* Set to 1 when scene changes completely (new level etc) */
74 float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
75 float InMVScaleY;
76 NVSDK_NGX_Resource_VK * pInTransparencyMask; /* Unused/Reserved for future use */
77 NVSDK_NGX_Resource_VK * pInExposureTexture;
78 NVSDK_NGX_Resource_VK * pInBiasCurrentColorMask;
79 NVSDK_NGX_Coordinates InColorSubrectBase;
80 NVSDK_NGX_Coordinates InDepthSubrectBase;
81 NVSDK_NGX_Coordinates InMVSubrectBase;
82 NVSDK_NGX_Coordinates InTranslucencySubrectBase;
83 NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
84 NVSDK_NGX_Coordinates InOutputSubrectBase;
85 float InPreExposure;
86 float InExposureScale;
87 int InIndicatorInvertXAxis;
88 int InIndicatorInvertYAxis;
89 /*** OPTIONAL - only for research purposes ***/
90 NVSDK_NGX_VK_GBuffer GBufferSurface;
91 NVSDK_NGX_ToneMapperType InToneMapperType;
92 NVSDK_NGX_Resource_VK * pInMotionVectors3D;
93 NVSDK_NGX_Resource_VK * pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
94 NVSDK_NGX_Resource_VK * pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
95 NVSDK_NGX_Resource_VK * pInDepthHighRes;
96 NVSDK_NGX_Resource_VK * pInPositionViewSpace;
97 float InFrameTimeDeltaInMsec; /* helps in determining the amount to denoise or anti-alias based on the speed of the object from motion vector magnitudes and fps as determined by this delta */
98 NVSDK_NGX_Resource_VK * pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
99 NVSDK_NGX_Resource_VK * pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
100} NVSDK_NGX_VK_DLSS_Eval_Params;
101
102typedef struct NVSDK_NGX_VK_DLISP_Eval_Params
103{
104 NVSDK_NGX_VK_Feature_Eval_Params Feature;
105 /*** OPTIONAL - leave to 0/0.0f if unused ***/
106 unsigned int InRectX;
107 unsigned int InRectY;
108 unsigned int InRectW;
109 unsigned int InRectH;
110 float InDenoise;
111} NVSDK_NGX_VK_DLISP_Eval_Params;
112
113static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLSS_EXT1(
114 VkDevice InDevice,
115 VkCommandBuffer InCmdList,
116 unsigned int InCreationNodeMask,
117 unsigned int InVisibilityNodeMask,
118 NVSDK_NGX_Handle **ppOutHandle,
119 NVSDK_NGX_Parameter *pInParams,
120 NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
121{
122 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
123 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
124 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssCreateParams->Feature.InWidth);
125 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssCreateParams->Feature.InHeight);
126 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssCreateParams->Feature.InTargetWidth);
127 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssCreateParams->Feature.InTargetHeight);
128 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssCreateParams->Feature.InPerfQualityValue);
129 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssCreateParams->InFeatureCreateFlags);
130 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssCreateParams->InEnableOutputSubrects ? 1 : 0);
131
132 if (InDevice) return NVSDK_NGX_VULKAN_CreateFeature1(InDevice, InCmdList, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
133 else return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
134}
135
136static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLSS_EXT(
137 VkCommandBuffer InCmdList,
138 unsigned int InCreationNodeMask,
139 unsigned int InVisibilityNodeMask,
140 NVSDK_NGX_Handle **ppOutHandle,
141 NVSDK_NGX_Parameter *pInParams,
142 NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
143{
144 return NGX_VULKAN_CREATE_DLSS_EXT1(NULL, InCmdList, InCreationNodeMask, InVisibilityNodeMask, ppOutHandle, pInParams, pInDlssCreateParams);
145}
146
147static inline NVSDK_NGX_Result NGX_VULKAN_EVALUATE_DLSS_EXT(
148 VkCommandBuffer InCmdList,
149 NVSDK_NGX_Handle *pInHandle,
150 NVSDK_NGX_Parameter *pInParams,
151 NVSDK_NGX_VK_DLSS_Eval_Params *pInDlssEvalParams)
152{
153 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->Feature.pInColor);
154 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInMotionVectors);
155 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->Feature.pInOutput);
156 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInDepth);
157 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInTransparencyMask);
158 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInExposureTexture);
159 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInBiasCurrentColorMask);
160 for (size_t i = 0; i <= 15; i++)
161 {
162 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->GBufferSurface.pInAttrib[i]);
163 }
164 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInMotionVectors3D);
165 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInIsParticleMask);
166 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInAnimatedTextureMask);
167 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInDepthHighRes);
168 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInPositionViewSpace);
169 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInRayTracingHitDistance);
170 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInMotionVectorsReflections);
171
172 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlssEvalParams->Feature.pInColor);
173 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlssEvalParams->Feature.pInOutput);
174 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssEvalParams->pInDepth);
175 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssEvalParams->pInMotionVectors);
176 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssEvalParams->InJitterOffsetX);
177 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssEvalParams->InJitterOffsetY);
178 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlssEvalParams->Feature.InSharpness);
179 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssEvalParams->InReset);
180 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleX);
181 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleY);
182 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssEvalParams->pInTransparencyMask);
183 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssEvalParams->pInExposureTexture);
184 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssEvalParams->pInBiasCurrentColorMask);
185 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
186 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
187 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
188 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
189 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
190 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
191 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
192 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
193 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssEvalParams->GBufferSurface.pInAttrib[8]);
194 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssEvalParams->GBufferSurface.pInAttrib[9]);
195 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_10, pInDlssEvalParams->GBufferSurface.pInAttrib[10]);
196 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssEvalParams->GBufferSurface.pInAttrib[11]);
197 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssEvalParams->GBufferSurface.pInAttrib[12]);
198 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssEvalParams->GBufferSurface.pInAttrib[13]);
199 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssEvalParams->GBufferSurface.pInAttrib[14]);
200 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssEvalParams->GBufferSurface.pInAttrib[15]);
201 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssEvalParams->InToneMapperType);
202 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssEvalParams->pInMotionVectors3D);
203 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssEvalParams->pInIsParticleMask);
204 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssEvalParams->pInAnimatedTextureMask);
205 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssEvalParams->pInDepthHighRes);
206 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssEvalParams->pInPositionViewSpace);
207 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssEvalParams->InFrameTimeDeltaInMsec);
208 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssEvalParams->pInRayTracingHitDistance);
209 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectorsReflection, pInDlssEvalParams->pInMotionVectorsReflections);
210 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssEvalParams->InColorSubrectBase.X);
211 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssEvalParams->InColorSubrectBase.Y);
212 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssEvalParams->InDepthSubrectBase.X);
213 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssEvalParams->InDepthSubrectBase.Y);
214 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssEvalParams->InMVSubrectBase.X);
215 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssEvalParams->InMVSubrectBase.Y);
216 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssEvalParams->InTranslucencySubrectBase.X);
217 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssEvalParams->InTranslucencySubrectBase.Y);
218 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssEvalParams->InBiasCurrentColorSubrectBase.X);
219 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssEvalParams->InBiasCurrentColorSubrectBase.Y);
220 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssEvalParams->InOutputSubrectBase.X);
221 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssEvalParams->InOutputSubrectBase.Y);
222 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssEvalParams->InRenderSubrectDimensions.Width);
223 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssEvalParams->InRenderSubrectDimensions.Height);
224 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssEvalParams->InPreExposure);
225 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Exposure_Scale, pInDlssEvalParams->InExposureScale == 0.0f ? 1.0f : pInDlssEvalParams->InExposureScale);
226 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssEvalParams->InIndicatorInvertXAxis);
227 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssEvalParams->InIndicatorInvertYAxis);
228
229 return NVSDK_NGX_VULKAN_EvaluateFeature_C(InCmdList, pInHandle, pInParams, NULL);
230}
231
232static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLISP_EXT(
233 VkCommandBuffer InCmdList,
234 unsigned int InCreationNodeMask,
235 unsigned int InVisibilityNodeMask,
236 NVSDK_NGX_Handle **ppOutHandle,
237 NVSDK_NGX_Parameter *pInParams,
238 NVSDK_NGX_Feature_Create_Params *pInDlispCreateParams)
239{
240 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
241 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
242 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlispCreateParams->InWidth);
243 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlispCreateParams->InHeight);
244 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlispCreateParams->InTargetWidth);
245 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlispCreateParams->InTargetHeight);
246 NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlispCreateParams->InPerfQualityValue);
247
248 return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
249}
250
251static inline NVSDK_NGX_Result NGX_VULKAN_EVALUATE_DLISP_EXT(
252 VkCommandBuffer InCmdList,
253 NVSDK_NGX_Handle *InHandle,
254 NVSDK_NGX_Parameter *pInParams,
255 NVSDK_NGX_VK_DLISP_Eval_Params *pInDlispEvalParams)
256{
257 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlispEvalParams->Feature.pInColor);
258 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlispEvalParams->Feature.pInOutput);
259
260 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlispEvalParams->Feature.pInColor);
261 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlispEvalParams->Feature.pInOutput);
262 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlispEvalParams->Feature.InSharpness);
263 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pInDlispEvalParams->InDenoise);
264 // If input is atlas - use RECT to upscale only the required area
265 if (pInDlispEvalParams->InRectW)
266 {
267 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pInDlispEvalParams->InRectX);
268 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pInDlispEvalParams->InRectY);
269 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pInDlispEvalParams->InRectW);
270 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pInDlispEvalParams->InRectH);
271 }
272
273 return NVSDK_NGX_VULKAN_EvaluateFeature_C(InCmdList, InHandle, pInParams, NULL);
274}
275
276static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLRESOLVE_EXT(
277 VkCommandBuffer InCmdList,
278 unsigned int InCreationNodeMask,
279 unsigned int InVisibilityNodeMask,
280 NVSDK_NGX_Handle **ppOutHandle,
281 NVSDK_NGX_Parameter *pInParams,
282 NVSDK_NGX_Feature_Create_Params *pInDlresolveCreateParams)
283{
284 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
285 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
286 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlresolveCreateParams->InWidth);
287 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlresolveCreateParams->InHeight);
288 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlresolveCreateParams->InTargetWidth);
289 NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlresolveCreateParams->InTargetHeight);
290
291 return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_DeepResolve, pInParams, ppOutHandle);
292}
293
294static inline NVSDK_NGX_Result NGX_VULKAN_EVALUATE_DLRESOLVE_EXT(
295 VkCommandBuffer InCmdList,
296 NVSDK_NGX_Handle *pInHandle,
297 NVSDK_NGX_Parameter *pInParams,
298 NVSDK_NGX_VK_Feature_Eval_Params *pInDlresolveEvalParams)
299{
300 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlresolveEvalParams->pInColor);
301 NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlresolveEvalParams->pInOutput);
302
303 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlresolveEvalParams->pInColor);
304 NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlresolveEvalParams->pInOutput);
305 NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlresolveEvalParams->InSharpness);
306
307 return NVSDK_NGX_VULKAN_EvaluateFeature_C(InCmdList, pInHandle, pInParams, NULL);
308}
309
310#endif // NVSDK_NGX_HELPERS_VK_H
thirdparty/ngx/include/nvsdk_ngx_params.h +116 -0
……@@ -0,0 +1,116 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13
14#ifndef NVSDK_NGX_PARAMS_H
15#define NVSDK_NGX_PARAMS_H
16
17#include "nvsdk_ngx_defs.h"
18
19#ifdef __cplusplus
20extern "C"
21{
22#endif
23
24typedef struct ID3D11Resource ID3D11Resource;
25typedef struct ID3D12Resource ID3D12Resource;
26
27typedef struct NVSDK_NGX_Feature_Create_Params
28{
29 unsigned int InWidth;
30 unsigned int InHeight;
31 unsigned int InTargetWidth;
32 unsigned int InTargetHeight;
33 /*** OPTIONAL ***/
34 NVSDK_NGX_PerfQuality_Value InPerfQualityValue;
35} NVSDK_NGX_Feature_Create_Params;
36
37typedef struct NVSDK_NGX_DLSS_Create_Params
38{
39 NVSDK_NGX_Feature_Create_Params Feature;
40 /*** OPTIONAL ***/
41 int InFeatureCreateFlags;
42 bool InEnableOutputSubrects;
43} NVSDK_NGX_DLSS_Create_Params;
44
45typedef struct NVSDK_NGX_DLDenoise_Create_Params
46{
47 NVSDK_NGX_Feature_Create_Params Feature;
48 /*** OPTIONAL ***/
49 int InFeatureCreateFlags;
50} NVSDK_NGX_DLDenoise_Create_Params;
51
52#ifdef __cplusplus
53typedef struct NVSDK_NGX_Parameter
54{
55 virtual void Set(const char * InName, unsigned long long InValue) = 0;
56 virtual void Set(const char * InName, float InValue) = 0;
57 virtual void Set(const char * InName, double InValue) = 0;
58 virtual void Set(const char * InName, unsigned int InValue) = 0;
59 virtual void Set(const char * InName, int InValue) = 0;
60 virtual void Set(const char * InName, ID3D11Resource *InValue) = 0;
61 virtual void Set(const char * InName, ID3D12Resource *InValue) = 0;
62 virtual void Set(const char * InName, void *InValue) = 0;
63
64 virtual NVSDK_NGX_Result Get(const char * InName, unsigned long long *OutValue) const = 0;
65 virtual NVSDK_NGX_Result Get(const char * InName, float *OutValue) const = 0;
66 virtual NVSDK_NGX_Result Get(const char * InName, double *OutValue) const = 0;
67 virtual NVSDK_NGX_Result Get(const char * InName, unsigned int *OutValue) const = 0;
68 virtual NVSDK_NGX_Result Get(const char * InName, int *OutValue) const = 0;
69 virtual NVSDK_NGX_Result Get(const char * InName, ID3D11Resource **OutValue) const = 0;
70 virtual NVSDK_NGX_Result Get(const char * InName, ID3D12Resource **OutValue) const = 0;
71 virtual NVSDK_NGX_Result Get(const char * InName, void **OutValue) const = 0;
72
73 virtual void Reset() = 0;
74} NVSDK_NGX_Parameter;
75#else
76typedef struct NVSDK_NGX_Parameter NVSDK_NGX_Parameter;
77#endif // _cplusplus
78
79typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetULL)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long InValue);
80NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetULL(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long InValue);
81typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetF)(NVSDK_NGX_Parameter *InParameter, const char * InName, float InValue);
82NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetF(NVSDK_NGX_Parameter *InParameter, const char * InName, float InValue);
83typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetD)(NVSDK_NGX_Parameter *InParameter, const char * InName, double InValue);
84NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetD(NVSDK_NGX_Parameter *InParameter, const char * InName, double InValue);
85typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetUI)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int InValue);
86NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetUI(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int InValue);
87typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetI)(NVSDK_NGX_Parameter *InParameter, const char * InName, int InValue);
88NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetI(NVSDK_NGX_Parameter *InParameter, const char * InName, int InValue);
89typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetD3d11Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource *InValue);
90NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetD3d11Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource *InValue);
91typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetD3d12Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource *InValue);
92NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetD3d12Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource *InValue);
93typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetVoidPointer)(NVSDK_NGX_Parameter *InParameter, const char * InName, void *InValue);
94NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetVoidPointer(NVSDK_NGX_Parameter *InParameter, const char * InName, void *InValue);
95typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetULL)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long *OutValue);
96NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetULL(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long *OutValue);
97typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetF)(NVSDK_NGX_Parameter *InParameter, const char * InName, float *OutValue);
98NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetF(NVSDK_NGX_Parameter *InParameter, const char * InName, float *OutValue);
99typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetD)(NVSDK_NGX_Parameter *InParameter, const char * InName, double *OutValue);
100NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetD(NVSDK_NGX_Parameter *InParameter, const char * InName, double *OutValue);
101typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetUI)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int *OutValue);
102NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetUI(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int *OutValue);
103typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetI)(NVSDK_NGX_Parameter *InParameter, const char * InName, int *OutValue);
104NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetI(NVSDK_NGX_Parameter *InParameter, const char * InName, int *OutValue);
105typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetD3d11Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource **OutValue);
106NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetD3d11Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource **OutValue);
107typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetD3d12Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource **OutValue);
108NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetD3d12Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource **OutValue);
109typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetVoidPointer)(NVSDK_NGX_Parameter *InParameter, const char * InName, void **OutValue);
110NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetVoidPointer(NVSDK_NGX_Parameter *InParameter, const char * InName, void **OutValue);
111
112#ifdef __cplusplus
113} // extern "C"
114#endif
115
116#endif // #define NVSDK_NGX_PARAMS_H
thirdparty/ngx/include/nvsdk_ngx_params_dlssd.h +36 -0
……@@ -0,0 +1,36 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13
14#ifndef NVSDK_NGX_PARAMS_DLSSD_H
15#define NVSDK_NGX_PARAMS_DLSSD_H
16
17#include "nvsdk_ngx_defs_dlssd.h"
18
19typedef struct NVSDK_NGX_DLSSD_Create_Params
20{
21 NVSDK_NGX_DLSS_Denoise_Mode InDenoiseMode;
22 NVSDK_NGX_DLSS_Roughness_Mode InRoughnessMode;
23 NVSDK_NGX_DLSS_Depth_Type InUseHWDepth;
24
25 unsigned int InWidth;
26 unsigned int InHeight;
27 unsigned int InTargetWidth;
28 unsigned int InTargetHeight;
29 /*** OPTIONAL ***/
30 NVSDK_NGX_PerfQuality_Value InPerfQualityValue;
31 int InFeatureCreateFlags;
32 bool InEnableOutputSubrects;
33} NVSDK_NGX_DLSSD_Create_Params;
34
35
36#endif // #define NVSDK_NGX_PARAMS_DLSSD_H
thirdparty/ngx/include/nvsdk_ngx_params_dlssg.h +131 -0
……@@ -0,0 +1,131 @@
1#pragma once
2/*
3* Copyright (c) 2021-2024 NVIDIA CORPORATION. All rights reserved.
4*
5* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
6* rights in and to this software, related documentation and any modifications thereto.
7* Any use, reproduction, disclosure or distribution of this software and related
8* documentation without an express license agreement from NVIDIA Corporation is strictly
9* prohibited.
10*
11* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
12* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
13* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
15* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
16* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
17* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
18* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
19* SUCH DAMAGES.
20*/
21
22
23#ifndef NVSDK_NGX_PARAMS_DLSSG_H
24#define NVSDK_NGX_PARAMS_DLSSG_H
25
26#include <stdint.h> // for uint64_t
27
28#include "nvsdk_ngx.h" // DX11/12 here
29#include "nvsdk_ngx_defs.h"
30
31typedef struct NVSDK_NGX_DLSSG_Create_Params
32{
33 unsigned int Width;
34 unsigned int Height;
35 unsigned int NativeBackbufferFormat;
36 unsigned int RenderWidth;
37 unsigned int RenderHeight;
38 bool DynamicResolutionScaling;
39} NVSDK_NGX_DLSSG_Create_Params;
40
41typedef struct NVSDK_NGX_DLSSG_Opt_Eval_Params
42{
43 //! Number of intermediate frames to generate between rendered frames
44 //! (1 = 2x, 2 = 3x, etc.)
45 unsigned int multiFrameCount = 1;
46 //! The index (starting at 1) of the intermediate frame being generated, up
47 //! to multiFrameCount (inclusive)
48 unsigned int multiFrameIndex = 1;
49
50 //! IMPORTANT: All matrices should NOT contain temporal AA jitter offset
51 //! Specifies matrix transformation from the camera view to the clip space.
52 float cameraViewToClip[4][4];
53 //! Specifies matrix transformation from the clip space to the camera view space.
54 float clipToCameraView[4][4];
55 //! Specifies matrix transformation describing lens distortion in clip space.
56 float clipToLensClip[4][4];
57 //! Specifies matrix transformation from the current clip to the previous clip space.
58 float clipToPrevClip[4][4];
59 //! Specifies matrix transformation from the previous clip to the current clip space.
60 float prevClipToClip[4][4];
61
62 //! Specifies clip space jitter offset
63 float jitterOffset[2];
64 //! Specifies scale factors used to normalize motion vectors (so the values are in [-1,1] range)
65 float mvecScale[2];
66 //! Specifies camera pinhole offset.
67 float cameraPinholeOffset[2];
68 //! Specifies camera position in world space.
69 float cameraPos[3];
70 //! Specifies camera up vector in world space.
71 float cameraUp[3];
72 //! Specifies camera right vector in world space.
73 float cameraRight[3];
74 //! Specifies camera forward vector in world space.
75 float cameraFwd[3];
76
77 //! Specifies camera near view plane distance.
78 float cameraNear;
79 //! Specifies camera far view plane distance.
80 float cameraFar;
81 //! Specifies camera field of view in radians.
82 float cameraFOV;
83 //! Specifies camera aspect ratio defined as view space width divided by height.
84 float cameraAspectRatio;
85
86 //! Specifies if tagged color buffers are full HDR (rendering to an HDR monitor) or not
87 bool colorBuffersHDR;
88 //! Specifies if depth values are inverted (value closer to the camera is higher) or not.
89 bool depthInverted;
90 //! Specifies if camera motion is included in the MVec buffer.
91 bool cameraMotionIncluded;
92 //! Specifies if previous frame has no connection to the current one (motion vectors are invalid)
93 bool reset;
94 //! Specifies if Automode overrode the input Reset flag to true.
95 bool automodeOverrideReset;
96 //! Specifies if application is not currently rendering game frames (paused in menu, playing video cut-scenes)
97 bool notRenderingGameFrames;
98 //! Specifies if orthographic projection is used or not.
99 bool orthoProjection;
100
101 //! Specifies which value represents an invalid (un-initialized) value in the motion vectors buffer
102 float motionVectorsInvalidValue;
103 //! Specifies if motion vectors are already dilated or not.
104 bool motionVectorsDilated;
105
106 //! Specifies whether or not fullscreen menu detection should be run
107 bool menuDetectionEnabled;
108
109 NVSDK_NGX_Coordinates mvecsSubrectBase = { 0, 0 };
110 NVSDK_NGX_Dimensions mvecsSubrectSize = { 0, 0 };
111 NVSDK_NGX_Coordinates depthSubrectBase = { 0, 0 };
112 NVSDK_NGX_Dimensions depthSubrectSize = { 0, 0 };
113
114 NVSDK_NGX_Coordinates hudLessSubrectBase = { 0, 0 };
115 NVSDK_NGX_Dimensions hudLessSubrectSize = { 0, 0 };
116 NVSDK_NGX_Coordinates uiSubrectBase = { 0, 0 };
117 NVSDK_NGX_Dimensions uiSubrectSize = { 0, 0 };
118
119 NVSDK_NGX_Coordinates bidirectionalDistFieldSubrectBase = { 0, 0 };
120 NVSDK_NGX_Dimensions bidirectionalDistFieldSubrectSize = { 0, 0 };
121 NVSDK_NGX_PrecisionInfo bidirectionalDistFieldPrecisionInfo = { 0, 0.0f, 0.0f };
122
123 //! Optional heuristic that specifies the minimum depth difference between two objects in screen-space.
124 //! See comment above NVSDK_NGX_DLSSG_Parameter_MinRelativeLinearDepthObjectSeparation for details.
125 float minRelativeLinearDepthObjectSeparation = 40.0f;
126
127 NVSDK_NGX_Coordinates backbufferSubrectBase = { 0, 0 };
128 NVSDK_NGX_Dimensions backbufferSubrectSize = { 0, 0 };
129} NVSDK_NGX_DLSSG_Opt_Eval_Params;
130
131#endif // NVSDK_NGX_PARAMS_DLSSG_H
thirdparty/ngx/include/nvsdk_ngx_vk.h +840 -0
……@@ -0,0 +1,840 @@
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12
13/*
14* HOW TO USE:
15*
16* IMPORTANT: Methods in this library are NOT thread safe. It is up to the
17* client to ensure that thread safety is enforced as needed.
18*
19* 1) Call NVSDK_CONV NVSDK_NGX_D3D11/D3D12/CUDA_Init and pass your app Id
20* and other parameters. This will initialize SDK or return an error code
21* if SDK cannot run on target machine. Depending on error user might
22* need to update drivers. Please note that application Id is provided
23* by NVIDIA so if you do not have one please contact us.
24*
25* 2) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetParameters to obtain pointer to
26* interface used to pass parameters to SDK. Interface instance is
27* allocated and released by SDK so there is no need to do any memory
28* management on client side.
29*
30* 3) Set key parameters for the feature you want to use. For example,
31* width and height are required for all features and they can be
32* set like this:
33* Params->Set(NVSDK_NGX_Parameter_Width,MY_WIDTH);
34* Params->Set(NVSDK_NGX_Parameter_Height,MY_HEIGHT);
35*
36* You can also provide hints like NVSDK_NGX_Parameter_Hint_HDR to tell
37* SDK that it should expect HDR color space is needed. Please refer to
38* samples since different features need different parameters and hints.
39*
40* 4) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetScratchBufferSize to obtain size of
41* the scratch buffer needed by specific feature. This D3D or CUDA buffer
42* should be allocated by client and passed as:
43* Params->Set(NVSDK_NGX_Parameter_Scratch,MY_SCRATCH_POINTER)
44* Params->Set(NVSDK_NGX_Parameter_Scratch_SizeInBytes,MY_SCRATCH_SIZE_IN_BYTES)
45* NOTE: Returned size can be 0 if feature does not use any scratch buffer.
46* It is OK to use bigger buffer or reuse buffers across features as long
47* as minimum size requirement is met.
48*
49* 5) Call NVSDK_NGX_D3D11/D3D12/CUDA_CreateFeature to create feature you need.
50* On success SDK will return a handle which must be used in any successive
51* calls to SDK which require feature handle. SDK will use all parameters
52* and hints provided by client to generate feature. If feature with the same
53* parameters already exists and error code will be returned.
54*
55* 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_EvaluateFeature to invoke execution of
56* specific feature. Before feature can be evaluated input parameters must
57* be specified (like for example color/albedo buffer, motion vectors etc)
58*
59* 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_ReleaseFeature when feature is no longer
60* needed. After this call feature handle becomes invalid and cannot be used.
61*
62* 7) Call NVSDK_NGX_D3D11/D3D12/CUDA_Shutdown when SDK is no longer needed to
63* release all resources.
64
65* Contact: ngxsupport@nvidia.com
66*/
67
68
69#ifndef NVSDK_NGX_VK_H
70#define NVSDK_NGX_VK_H
71
72#include "nvsdk_ngx_defs.h"
73#include "nvsdk_ngx_params.h"
74#ifndef __cplusplus
75#include <stdbool.h>
76#include <wchar.h>
77#endif
78
79#ifdef __cplusplus
80extern "C"
81{
82#endif
83
84////////////////////////////////////////////////////////////////////////////////
85// NVSDK_NGX_ImageViewInfo_VK [Vulkan only]
86// Contains ImageView-specific metadata.
87// ImageView:
88// The VkImageView resource.
89//
90// Image:
91// The VkImage associated to this VkImageView.
92//
93// SubresourceRange:
94// The VkImageSubresourceRange associated to this VkImageView.
95//
96// Format:
97// The format of the resource.
98//
99// Width:
100// The width of the resource.
101//
102// Height:
103// The height of the resource.
104//
105typedef struct NVSDK_NGX_ImageViewInfo_VK {
106 VkImageView ImageView;
107 VkImage Image;
108 VkImageSubresourceRange SubresourceRange;
109 VkFormat Format;
110 unsigned int Width;
111 unsigned int Height;
112} NVSDK_NGX_ImageViewInfo_VK;
113
114////////////////////////////////////////////////////////////////////////////////
115// NVSDK_NGX_BufferInfo_VK [Vulkan only]
116// Contains Buffer-specific metadata.
117// Buffer
118// The VkBuffer resource.
119//
120// SizeInBytes:
121// The size of the resource (in bytes).
122//
123typedef struct NVSDK_NGX_BufferInfo_VK {
124 VkBuffer Buffer;
125 unsigned int SizeInBytes;
126} NVSDK_NGX_BufferInfo_VK;
127
128////////////////////////////////////////////////////////////////////////////////
129// NVSDK_NGX_Resource_VK [Vulkan only]
130//
131// ImageViewInfo:
132// The VkImageView resource, and VkImageView-specific metadata. A NVSDK_NGX_Resource_VK can only have one of ImageViewInfo or BufferInfo.
133//
134// BufferInfo:
135// The VkBuffer Resource, and VkBuffer-specific metadata. A NVSDK_NGX_Resource_VK can only have one of ImageViewInfo or BufferInfo.
136//
137// Type:
138// Whether or this resource is a VkImageView or a VkBuffer.
139//
140// ReadWrite:
141// True if the resource is available for read and write access.
142// For VkBuffer resources: VkBufferUsageFlags includes VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT or VK_BUFFER_USAGE_STORAGE_BUFFER_BIT
143// For VkImage resources: VkImageUsageFlags for associated VkImage includes VK_IMAGE_USAGE_STORAGE_BIT
144//
145typedef struct NVSDK_NGX_Resource_VK {
146 union {
147 NVSDK_NGX_ImageViewInfo_VK ImageViewInfo;
148 NVSDK_NGX_BufferInfo_VK BufferInfo;
149 } Resource;
150 NVSDK_NGX_Resource_VK_Type Type;
151 bool ReadWrite;
152} NVSDK_NGX_Resource_VK;
153
154////////////////////////////////////////////////////////////////////////////////
155// NVSDK_NGX_VULKAN_RequiredExtensions [Vulkan only]
156// -------------------------------------
157// DEPRECATED: Use NVSDK_NGX_VULKAN_GetFeatureInstanceExtensionRequirements() and
158// NVSDK_NGX_VULKAN_GetFeatureRequirements() instead.
159//
160// Retrieves the instance and device extensions required by NGX.
161//
162// DESCRIPTION:
163// This function returns the instance and device extensions required by
164// NGX. It is deprecated and should be replaced with
165// NVSDK_NGX_VULKAN_GetFeatureInstanceExtensionRequirements() and
166// NVSDK_NGX_VULKAN_GetFeatureRequirements().
167//
168// PARAMETERS:
169// OutInstanceExtCount:
170// Returns the number of instance extensions NGX requires.
171//
172// OutInstanceExts:
173// Returns a pointer to *OutInstanceExtCount strings of instance extensions.
174//
175// OutDeviceExtCount:
176// Returns the number of device extensions NGX requires.
177//
178// OutDeviceExts:
179// Returns a pointer to *OutDeviceExtCount strings of device extensions.
180//
181// RETURNS:
182// NVSDK_NGX_Result indicating success or failure.
183//
184NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_RequiredExtensions(unsigned int *OutInstanceExtCount, const char ***OutInstanceExts, unsigned int *OutDeviceExtCount, const char ***OutDeviceExts);
185
186// NOTE: Functions under the same name and different function signatures exist
187// between the NGX SDK, NGX Core (driver), and NGX Snippets. To discern the
188// different signatures here we check if NGX_SNIPPET_BUILD is defined. When that
189// is the case we know that the function signature in-use should be that of
190// between NGX Core and the Snippet. Otherwise the signature should be between
191// NGX SDK and NGX Core.
192////////////////////////////////////////////////////////////////////////////////
193// NVSDK_NGX_Init
194// -----------------------------------------------------------------------------
195// Initializes a new SDK instance.
196//
197// DESCRIPTION:
198// Initializes a new SDK instance. Most NGX SDK functions require the NGX
199// SDK to be initialized for the corresponding graphics API and device to
200// function properly.
201//
202// NVSDK_NGX_Init requires an application ID provided by NVIDIA. If an
203// application ID is not available, use NVSDK_NGX_Init_with_ProjectID to
204// supply your own identifier.
205//
206// Be sure to call NVSDK_NGX_Shutdown to shut down the SDK when it is no
207// longer needed.
208//
209// PARAMETERS:
210// InApplicationId:
211// Unique ID provided by NVIDIA.
212//
213// InApplicationDataPath:
214// Directory to store logs and other temporary files. Write access is
215// required. Typically, this would be next to the application executable,
216// or in a location like Documents or ProgramData.
217//
218// InInstance/InPD/InDevice:
219// Vulkan Instance, PhysicalDevice, and Device to use.
220//
221// InGIPA/InGDPA:
222// Optional Vulkan function pointers to vkGetInstanceProcAddr and
223// vkGetDeviceProcAddr.
224//
225// InFeatureInfo:
226// Contains information common to all features, including a list of paths
227// where feature DLLs can be located, other than the default path (application directory).
228//
229// InSDKVersion:
230// Version of the SDK currently in use. Typically, this should be left as
231// the default value, NVSDK_NGX_Version_API.
232//
233// RETURNS:
234// NVSDK_NGX_Result indicating success or failure. Common values include:
235// - NVSDK_NGX_Result_Success if the function executed successfully
236// - NVSDK_NGX_Result_FAIL_FeatureNotSupported if the NGX SDK is not
237// supported on the current system
238// Check the NGX logs for additional information about any failures.
239//
240#if defined(NGX_SNIPPET_BUILD)
241#ifdef __cplusplus
242NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
243NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Init_Ext(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API, const NVSDK_NGX_Parameter *InParameters = nullptr);
244NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Init_Ext2(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, PFN_vkGetInstanceProcAddr InGIPA = nullptr, PFN_vkGetDeviceProcAddr InGDPA = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API, const NVSDK_NGX_Parameter *InParameters = nullptr);
245#else
246NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, NVSDK_NGX_Version InSDKVersion);
247NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Init_Ext(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_Parameter *InParameters);
248NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Init_Ext2(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, PFN_vkGetInstanceProcAddr InGIPA, PFN_vkGetDeviceProcAddr InGDPA, NVSDK_NGX_Version InSDKVersion, const NVSDK_NGX_Parameter *InParameters);
249#endif
250#else
251#ifdef __cplusplus
252NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, PFN_vkGetInstanceProcAddr InGIPA = nullptr, PFN_vkGetDeviceProcAddr InGDPA = nullptr, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
253#else
254NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, PFN_vkGetInstanceProcAddr InGIPA, PFN_vkGetDeviceProcAddr InGDPA, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
255#endif
256#endif // defined(NGX_SNIPPET_BUILD)
257
258////////////////////////////////////////////////////////////////////////////////
259// NVSDK_NGX_Init_with_ProjectID
260// -----------------------------------------------------------------------------
261// Initializes a new SDK instance using a project ID.
262//
263// DESCRIPTION:
264// Initializes a new SDK instance. Most NGX SDK functions require the NGX
265// SDK to be initialized for the corresponding graphics API and device to
266// function properly.
267//
268// Applications must provide a unique identifier to initialize the NGX SDK.
269// If an identifier was provided by NVIDIA, use NVSDK_NGX_Init instead.
270//
271// For projects using third-party engines such as Unreal Engine or
272// Omniverse, the integration for those engines should handle providing the
273// correct Project ID to NGX. Ensure that the project ID is set in the
274// engine's editor.
275//
276// For other engines, use NVSDK_NGX_EngineType CUSTOM. The driver will
277// validate that the Project ID is GUID-like, for example,
278// "a0f57b54-1daf-4934-90ae-c4035c19df04". Ensure your project ID matches
279// this format.
280//
281// Be sure to call NVSDK_NGX_Shutdown to shut down the SDK when it is no
282// longer needed.
283//
284// PARAMETERS:
285// InProjectId:
286// Unique ID provided by the rendering engine used. Must be a GUID-like
287// string.
288//
289// InEngineType:
290// Rendering engine used by the application/plugin. Use NVSDK_NGX_EngineType
291// CUSTOM if the specific engine type is not explicitly supported.
292//
293// InEngineVersion:
294// Version number of the rendering engine used by the application/plugin.
295//
296// InApplicationDataPath:
297// Directory to store logs and other temporary files (write access required).
298//
299// InInstance/InPD/InDevice:
300// Vulkan Instance, PhysicalDevice, and Device to use.
301//
302// InGIPA/InGDPA:
303// Optional Vulkan function pointers to vkGetInstanceProcAddr and
304// vkGetDeviceProcAddr.
305//
306// InFeatureInfo:
307// Contains information common to all features, including a list of paths
308// where feature DLLs can be located in addition to the default path
309// (the application directory).
310//
311// InSDKVersion:
312// Version of the SDK currently in use. Typically, this should be left as
313// the default value, NVSDK_NGX_Version_API.
314//
315// RETURNS:
316// NVSDK_NGX_Result indicating success or failure. Common values include:
317// - NVSDK_NGX_Result_Success if the function executed successfully
318// - NVSDK_NGX_Result_InvalidParameter if the provided project ID is in
319// an invalid format
320// - NVSDK_NGX_Result_FAIL_FeatureNotSupported if the NGX SDK is not
321// supported on the current system
322// Check the NGX logs for additional information about any failures.
323//
324#if defined(NGX_SNIPPET_BUILD)
325// No NGX Core <---> Snippet interfaces
326#else
327#ifdef __cplusplus
328NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, PFN_vkGetInstanceProcAddr InGIPA = nullptr, PFN_vkGetDeviceProcAddr InGDPA = nullptr, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
329#else
330NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Init_with_ProjectID(const char *InProjectId, NVSDK_NGX_EngineType InEngineType, const char *InEngineVersion, const wchar_t *InApplicationDataPath, VkInstance InInstance, VkPhysicalDevice InPD, VkDevice InDevice, PFN_vkGetInstanceProcAddr InGIPA, PFN_vkGetDeviceProcAddr InGDPA, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
331#endif
332#endif // defined(NGX_SNIPPET_BUILD)
333
334////////////////////////////////////////////////////////////////////////////////
335// NVSDK_NGX_Shutdown
336// -----------------------------------------------------------------------------
337// Shuts down the current SDK instance and releases all resources.
338//
339// DESCRIPTION:
340// Shuts down the current SDK instance and releases all resources. If a
341// device is provided, NVSDK_NGX_Shutdown1 shuts down the instance
342// corresponding to the specified device. If nullptr is provided, all
343// instances are shut down.
344//
345// Deprecation Notice: The use of Shutdown() is deprecated. Please use
346// Shutdown1(nullptr) instead.
347//
348// PARAMETERS:
349// InDevice:
350// Device to shut down. If nullptr, the SDK is shut down for all devices.
351//
352// RETURNS:
353// NVSDK_NGX_Result indicating success or failure.
354//
355#ifdef NGX_ENABLE_DEPRECATED_SHUTDOWN
356NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Shutdown(void);
357#endif
358NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Shutdown1(VkDevice InDevice);
359
360#ifdef NGX_ENABLE_DEPRECATED_GET_PARAMETERS
361////////////////////////////////////////////////////////////////////////////////
362// NVSDK_NGX_GetParameters
363// -----------------------------------------------------------------------------
364// Retrieves a parameter map used to set parameters needed by the SDK.
365//
366// DEPRECATED: Use NVSDK_NGX_AllocateParameters or
367// NVSDK_NGX_GetCapabilityParameters instead.
368//
369// DESCRIPTION:
370// Retrieves the common NVSDK_NGX_Parameter map for providing parameters to
371// the SDK. The NVSDK_NGX_Parameter interface allows simple parameter setup
372// using named fields. For example, set the width by calling
373// Parameters->Set(NVSDK_NGX_Parameter_Width, 100) or provide a resource
374// pointer by calling Parameters->Set(NVSDK_NGX_Parameter_Color, resource).
375// For more details, see the sample code.
376//
377// Parameter maps returned by NVSDK_NGX_GetParameters are pre-populated
378// with NGX capabilities and available features. Unlike
379// NVSDK_NGX_AllocateParameters, parameter maps returned by
380// NVSDK_NGX_GetParameters have their lifetimes managed by NGX and must not
381// be destroyed by the application using NVSDK_NGX_DestroyParameters.
382//
383// This function may only be called after a successful call to
384// NVSDK_NGX_Init.
385//
386// Note: Allocated memory will be freed by NGX, so do not use the
387// free/delete operator.
388//
389// Deprecation Notice: NVSDK_NGX_GetParameters is deprecated. Applications
390// should use NVSDK_NGX_AllocateParameters and
391// NVSDK_NGX_GetCapabilityParameters when possible. However, if there is a
392// possibility that the user may be using an older driver version (driver
393// version 445 or older), NVSDK_NGX_GetParameters may still be used as a
394// fallback if NVSDK_NGX_AllocateParameters or
395// NVSDK_NGX_GetCapabilityParameters return
396// NVSDK_NGX_Result_FAIL_OutOfDate.
397//
398// PARAMETERS:
399// OutParameters:
400// Output pointer that will be populated with an NVSDK_NGX_Parameter
401// interface.
402//
403// RETURNS:
404// NVSDK_NGX_Result indicating success or failure.
405//
406NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetParameters(NVSDK_NGX_Parameter **OutParameters);
407#endif // NGX_ENABLE_DEPRECATED_GET_PARAMETERS
408
409////////////////////////////////////////////////////////////////////////////////
410// NVSDK_NGX_AllocateParameters
411// -----------------------------------------------------------------------------
412// Allocates a parameter map used to set parameters needed by the SDK.
413//
414// DESCRIPTION:
415// Allocates a new NVSDK_NGX_Parameter map for providing parameters to the
416// SDK. The lifetime of this parameter map must be managed by the
417// application. The NVSDK_NGX_Parameter interface allows simple parameter
418// setup using named fields. For example, set the width by calling
419// Parameters->Set(NVSDK_NGX_Parameter_Width, 100) or provide a resource
420// pointer by calling Parameters->Set(NVSDK_NGX_Parameter_Color, resource).
421// For more details, see the sample code.
422//
423// Use NVSDK_NGX_DestroyParameters to free a parameter map created by
424// NVSDK_NGX_AllocateParameters. Parameter maps created by
425// NVSDK_NGX_AllocateParameters must NOT be freed using the free/delete
426// operator.
427//
428// Parameter maps created by NVSDK_NGX_AllocateParameters do not come
429// pre-populated with NGX capabilities and available features. To create a
430// new parameter map pre-populated with such information, use
431// NVSDK_NGX_GetCapabilityParameters instead.
432//
433// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if using an
434// older driver that does not support this API call. In such a case,
435// NVSDK_NGX_GetParameters may be used as a fallback.
436//
437// This function may only be called after a successful call to
438// NVSDK_NGX_Init.
439//
440// PARAMETERS:
441// OutParameters:
442// Output pointer that will be populated with the newly-allocated
443// NVSDK_NGX_Parameter interface.
444//
445// RETURNS:
446// NVSDK_NGX_Result indicating success or failure. Common values include:
447// - NVSDK_NGX_Result_Success if the function executed successfully
448// - NVSDK_NGX_Result_FAIL_OutOfDate if this function is not supported by
449// the current display driver
450// Check the NGX logs for additional information about any failures.
451//
452NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
453
454////////////////////////////////////////////////////////////////////////////////
455// NVSDK_NGX_GetCapabilityParameters
456// -----------------------------------------------------------------------------
457// Allocates a parameter map populated with NGX and feature capabilities.
458//
459// DESCRIPTION:
460// Allocates a new NVSDK_NGX_Parameter map pre-populated with NGX
461// capabilities and information about available features. The output
462// parameter map can also be used in the same ways as a parameter map
463// allocated with NVSDK_NGX_AllocateParameters. However, it is not
464// recommended to use NVSDK_NGX_GetCapabilityParameters unless querying NGX
465// capabilities due to the overhead associated with pre-populating the
466// parameter map.
467//
468// Use NVSDK_NGX_DestroyParameters to free a parameter map created by
469// NVSDK_NGX_GetCapabilityParameters. Parameter maps created by
470// NVSDK_NGX_GetCapabilityParameters must NOT be freed using the
471// free/delete operator.
472//
473// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if using an
474// older driver that does not support this API call. In such a case,
475// NVSDK_NGX_GetParameters may be used as a fallback.
476//
477// This function may only be called after a successful call to
478// NVSDK_NGX_Init.
479//
480// PARAMETERS:
481// OutParameters:
482// Output pointer that will be populated with the newly-allocated
483// NVSDK_NGX_Parameter interface.
484//
485// RETURNS:
486// NVSDK_NGX_Result indicating success or failure. Common values include:
487// - NVSDK_NGX_Result_Success if the function executed successfully
488// - NVSDK_NGX_Result_FAIL_OutOfDate if this function is not supported by
489// the current display driver
490// Check the NGX logs for additional information about any failures.
491//
492NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
493
494////////////////////////////////////////////////////////////////////////////////
495// NVSDK_NGX_DestroyParameters
496// -----------------------------------------------------------------------------
497// Destroys the specified parameter map.
498//
499// DESCRIPTION:
500// Destroys the input parameter map. Once NVSDK_NGX_DestroyParameters is
501// called on a parameter map, it must not be used again.
502//
503// NVSDK_NGX_DestroyParameters must not be called on any parameter map
504// returned by NVSDK_NGX_GetParameters; NGX will manage the lifetime of
505// those parameter maps.
506//
507// This function may only be called after a successful call to
508// NVSDK_NGX_Init.
509//
510// PARAMETERS:
511// InParameters:
512// The parameter map to be destroyed.
513//
514// RETURNS:
515// NVSDK_NGX_Result indicating success or failure.
516//
517NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
518
519////////////////////////////////////////////////////////////////////////////////
520// NVSDK_NGX_GetScratchBufferSize
521// -----------------------------------------------------------------------------
522// Retrieves the size of the scratch buffer needed for the specified feature.
523//
524// DESCRIPTION:
525// The SDK requires a buffer of a certain size provided by the client to
526// initialize some NGX features. Once the feature is no longer needed, the
527// buffer can be released. It is safe to reuse the same scratch buffer for
528// different features as long as the minimum size requirement is met for
529// all features. Some features might not need a scratch buffer, so a return
530// size of 0 is completely valid.
531//
532// Note: Most current NGX features do not use scratch buffers. Please check
533// the documentation for the particular feature in use to determine whether
534// a scratch buffer needs to be created.
535//
536// PARAMETERS:
537// InFeatureId:
538// Identifier of the feature to query.
539//
540// InParameters:
541// Parameters used by the feature to determine scratch buffer size.
542//
543// OutSizeInBytes:
544// Number of bytes needed for the scratch buffer for the specified feature.
545//
546// RETURNS:
547// NVSDK_NGX_Result indicating success or failure.
548//
549NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
550
551////////////////////////////////////////////////////////////////////////////////
552// NVSDK_NGX_CreateFeature
553// -----------------------------------------------------------------------------
554// Creates and initializes an instance of the specified NGX feature.
555//
556// DESCRIPTION:
557// Each feature needs to be created before it can be used. The parameters
558// required to create the feature vary. Refer to the feature's
559// documentation and/or sample code to find out which input parameters are
560// needed to create a specific feature.
561//
562// NVSDK_NGX_CreateFeature creates an NVSDK_NGX_Handle to the feature, which
563// is needed to reference the feature in later calls to
564// NVSDK_NGX_EvaluateFeature. Multiple instances of the same feature may be
565// created, and evaluating one instance of a feature should not change the
566// state of other instances.
567//
568// When a feature instance is no longer needed, it should be freed using
569// NVSDK_NGX_ReleaseFeature.
570//
571// If multiple devices are in use, the device to create the
572// feature on must be specified using CreateFeature1().
573//
574// PARAMETERS:
575// InCmdBuffer:
576// Command buffer to use to execute GPU commands. Must be open and
577// recording.
578//
579// InDevice:
580// Vulkan device on which to create the feature.
581//
582// InFeatureID:
583// Identifier of the feature to initialize.
584//
585// InParameters:
586// Parameters used to create the feature.
587//
588// OutHandle:
589// Handle which uniquely identifies the feature.
590//
591// RETURNS:
592// NVSDK_NGX_Result indicating success or failure. Common values include:
593// - NVSDK_NGX_Result_Success if the function executed successfully
594// - NVSDK_NGX_Result_FAIL_UnableToInitializeFeature if the feature
595// cannot be created, for example, because the feature is not supported
596// on the current hardware, or because the DLL could not be found
597// - NVSDK_NGX_Result_FAIL_InvalidParameter if any of the input
598// parameters are invalid
599// - NVSDK_NGX_Result_FAIL_FeatureAlreadyExists if a feature instance
600// with the same parameters has already been created, and the feature
601// doesn't allow multiple instances to be created with the same
602// parameters.
603// Check the NGX logs for additional information about any failures.
604//
605#if defined(NGX_SNIPPET_BUILD)
606NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_CreateFeature(VkCommandBuffer InCmdList, NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
607NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_CreateFeature1(VkDevice InDevice, VkCommandBuffer InCmdList, NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
608#else
609NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_CreateFeature(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Feature InFeatureID, NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
610NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_CreateFeature1(VkDevice InDevice, VkCommandBuffer InCmdList, NVSDK_NGX_Feature InFeatureID, NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
611#endif // defined(NGX_SNIPPET_BUILD)
612
613////////////////////////////////////////////////////////////////////////////////
614// NVSDK_NGX_ReleaseFeature
615// -----------------------------------------------------------------------------
616// Releases the specified NGX feature.
617//
618// DESCRIPTION:
619// Releases the feature associated with the given handle and frees its
620// memory. Handles are not reference counted, so after this call, it is
621// invalid to use the provided handle.
622//
623// PARAMETERS:
624// InHandle:
625// Handle to the feature to be released.
626//
627// RETURNS:
628// NVSDK_NGX_Result indicating success or failure.
629//
630NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
631
632////////////////////////////////////////////////////////////////////////////////
633// NVSDK_NGX_GetFeatureRequirements
634// -----------------------------------------------------------------------------
635// Identifies system requirements to support a given NGX feature.
636//
637// DESCRIPTION:
638// Utility function used to identify system requirements to support a given
639// NGX feature on a system, given its display device subsystem adapter
640// information that will be subsequently used for creating the graphics
641// device. The output parameter OutSupported will be populated with
642// requirements and is valid if and only if the function returns
643// NVSDK_NGX_Result_Success. The result includes:
644// - FeatureSupported: Bitfield of reasons why the feature is
645// unsupported, as specified in NVSDK_NGX_Feature_Support_Result. 0 if
646// the feature is supported
647// - MinHWArchitecture: The hardware architecture version corresponding
648// to an NV_GPU_ARCHITECTURE_ID value defined in the NvAPI GPU
649// Framework
650// - MinOSVersion: The minimum OS version required for the provided
651// feature
652//
653// NVSDK_NGX_Init does NOT need to be called before calling this function.
654// Applications may wish to use this function to determine whether a
655// desired feature is supported before initializing the complete SDK.
656//
657// PARAMETERS:
658// Instance:
659// VkInstance in use by the application.
660//
661// InPhysicalDevice:
662// VkPhysicalDevice in use by the application.
663//
664// FeatureDiscoveryInfo:
665// Struct containing information about the feature to query and how it is
666// expected to be initialized, including the feature ID and information
667// that would be provided to NVSDK_NGX_Init.
668//
669// OutSupported:
670// Populated with the requirements for the specified feature.
671//
672// RETURNS:
673// NVSDK_NGX_Result indicating success or failure.
674//
675NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetFeatureRequirements(const VkInstance Instance,
676 const VkPhysicalDevice PhysicalDevice,
677 const NVSDK_NGX_FeatureDiscoveryInfo *FeatureDiscoveryInfo,
678 NVSDK_NGX_FeatureRequirement *OutSupported);
679
680
681////////////////////////////////////////////////////////////////////////////////
682// NVSDK_NGX_VULKAN_GetFeatureInstanceExtensionRequirements
683// -----------------------------------------------------------------------------
684// Identifies Vulkan instance extensions required for NGX feature support.
685//
686// DESCRIPTION:
687// This utility function identifies the Vulkan instance extensions required
688// for a specific NGX feature, specified by its feature ID. The function
689// populates OutExtensionCount with the number of extensions required for
690// the NGX feature. It also populates OutExtensionProperties with a pointer
691// to an array of VkExtensionProperties structures, which contains details
692// about each required extension. The size of this array is equal to
693// OutExtensionCount.
694//
695// NVSDK_NGX_Init does NOT need to be called before calling this function.
696// This function should be called before the VkInstance for the application
697// is created so that the correct extensions can be enabled.
698//
699// PARAMETERS:
700// FeatureDiscoveryInfo:
701// Struct containing information about the feature to query and how it is
702// expected to be initialized, including the feature ID and information
703// that would be provided to NVSDK_NGX_Init.
704//
705// OutExtensionCount:
706// Output pointer that will be populated with the number of required
707// instance extensions.
708//
709// OutExtensionProperties:
710// Output pointer that will be populated with an array of
711// VkExtensionProperties structures required by the given feature.
712//
713// RETURNS:
714// NVSDK_NGX_Result indicating success or failure.
715//
716NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetFeatureInstanceExtensionRequirements(const NVSDK_NGX_FeatureDiscoveryInfo *FeatureDiscoveryInfo,
717 uint32_t *OutExtensionCount,
718 VkExtensionProperties **OutExtensionProperties);
719
720////////////////////////////////////////////////////////////////////////////////
721// NVSDK_NGX_VULKAN_GetFeatureDeviceExtensionRequirements
722// -----------------------------------------------------------------------------
723// Identifies Vulkan device extensions required for NGX feature support.
724//
725// DESCRIPTION:
726// This utility function identifies the Vulkan device extensions required
727// for a specific NGX feature, specified by its feature ID, and a given
728// VkInstance and VkPhysicalDevice. The function populates
729// OutExtensionCount with the number of extensions required for the NGX
730// feature. It also populates OutExtensionProperties with a pointer to an
731// array of VkExtensionProperties structures, which contains details about
732// each required extension. The size of this array is equal to
733// OutExtensionCount.
734//
735// NVSDK_NGX_Init does NOT need to be called before calling this function.
736// This function should be called before the VkDevice for the application
737// is created so that the correct extensions can be enabled.
738//
739// PARAMETERS:
740// Instance:
741// VkInstance in use by the application.
742//
743// InPhysicalDevice:
744// VkPhysicalDevice in use by the application.
745//
746// FeatureDiscoveryInfo:
747// Struct containing information about the feature to query and how it is
748// expected to be initialized, including the feature ID and information
749// that would be provided to NVSDK_NGX_Init.
750//
751// OutExtensionCount:
752// Output pointer that will be populated with the number of required
753// device extensions.
754//
755// OutExtensionProperties:
756// Output pointer that will be populated with an array of
757// VkExtensionProperties structures required by the given feature.
758//
759// RETURNS:
760// NVSDK_NGX_Result indicating success or failure.
761//
762#if defined(NGX_SNIPPET_BUILD)
763NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetFeatureDeviceExtensionRequirements(const VkInstance Instance,
764 const VkPhysicalDevice PhysicalDevice,
765 const NVSDK_NGX_FeatureDiscoveryInfo *FeatureDiscoveryInfo,
766 uint32_t *OutExtensionCount,
767 VkExtensionProperties **OutExtensionProperties);
768#else
769NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetFeatureDeviceExtensionRequirements(VkInstance Instance,
770 VkPhysicalDevice PhysicalDevice,
771 const NVSDK_NGX_FeatureDiscoveryInfo *FeatureDiscoveryInfo,
772 uint32_t *OutExtensionCount,
773 VkExtensionProperties **OutExtensionProperties);
774#endif // defined(NGX_SNIPPET_BUILD)
775
776////////////////////////////////////////////////////////////////////////////////
777// NVSDK_NGX_EvaluateFeature
778// -----------------------------------------------------------------------------
779// Evaluates the specified NGX feature using the provided parameters.
780//
781// DESCRIPTION:
782// Evaluates the given feature using the provided parameters. The
783// parameters required to evaluate a feature vary. Refer to the feature's
784// documentation and sample code to determine which input parameters are
785// needed.
786//
787// To evaluate a feature, an NVSDK_NGX_Handle to an instance of that
788// feature, created with NVSDK_NGX_CreateFeature, must be provided.
789//
790// For most features, it is beneficial to pass as many input buffers and
791// parameters as possible (e.g., provide all render targets like color,
792// albedo, normals, depth, etc.). This will ensure maximum future
793// compatibility with new updates.
794//
795// PARAMETERS:
796// InCmdBuffer:
797// Command buffer to use to execute GPU commands. Must be open and
798// recording.
799//
800// InFeatureHandle:
801// Handle representing the feature to be evaluated.
802//
803// InParameters:
804// List of parameters required to evaluate the feature.
805//
806// InCallback:
807// Optional callback for features that might take longer to execute. If
808// specified, the SDK will call it with progress values in the range 0.0f -
809// 1.0f. Not all features support progress callbacks. Refer to the
810// documentation for the specific feature to determine whether or not
811// progress callbacks are supported.
812//
813// RETURNS:
814// NVSDK_NGX_Result indicating success or failure. Common values include:
815// - NVSDK_NGX_Result_Success if the function executed successfully.
816// - NVSDK_NGX_Result_FAIL_InvalidParameter if any of the input
817// parameters are missing or invalid.
818// - NVSDK_NGX_Result_FAIL_FeatureNotFound if a feature with the provided
819// handle could not be found.
820// Check the NGX logs for additional information about any failures.
821//
822#ifdef __cplusplus
823typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback)(float InCurrentProgress, bool &OutShouldCancel);
824NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_EvaluateFeature(VkCommandBuffer InCmdList, const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback InCallback = NULL);
825#endif
826typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback_C)(float InCurrentProgress, bool *OutShouldCancel);
827NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_EvaluateFeature_C(VkCommandBuffer InCmdList, const NVSDK_NGX_Handle *InFeatureHandle, const NVSDK_NGX_Parameter *InParameters, PFN_NVSDK_NGX_ProgressCallback_C InCallback);
828
829#if defined(NGX_SNIPPET_BUILD)
830// No NGX Core <---> Snippet interfaces
831#else
832// NGX return-code conversion-to-string utility only as a helper for debugging/logging - not for official use.
833const wchar_t* NVSDK_CONV GetNGXResultAsString(NVSDK_NGX_Result InNGXResult);
834#endif
835
836#ifdef __cplusplus
837} // extern "C"
838#endif
839
840#endif // #define NVSDK_NGX_VK_H
thirdparty/ngx/lib/linux_x86_64/libnvsdk_ngx.a +0 -0
(no content changes — binary or rename)