Adds everything

This commit is contained in:
2022-09-18 00:48:56 +02:00
parent da7398c21e
commit 2f879fc333
4928 changed files with 25215 additions and 60 deletions

View File

@@ -0,0 +1,437 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
/*
* HOW TO USE:
*
* IMPORTANT: FOR DLSS/DLISP PLEASE SEE THE PROGRAMMING GUIDE
*
* IMPORTANT: Methods in this library are NOT thread safe. It is up to the
* client to ensure that thread safety is enforced as needed.
*
* 1) Call NVSDK_CONV NVSDK_NGX_D3D11/D3D12/CUDA_Init and pass your app Id
* and other parameters. This will initialize SDK or return an error code
* if SDK cannot run on target machine. Depending on error user might
* need to update drivers. Please note that application Id is provided
* by NVIDIA so if you do not have one please contact us.
*
* 2) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetParameters to obtain pointer to
* interface used to pass parameters to SDK. Interface instance is
* allocated and released by SDK so there is no need to do any memory
* management on client side.
*
* 3) Set key parameters for the feature you want to use. For example,
* width and height are required for all features and they can be
* set like this:
* Params->Set(NVSDK_NGX_Parameter_Width,MY_WIDTH);
* Params->Set(NVSDK_NGX_Parameter_Height,MY_HEIGHT);
*
* You can also provide hints like NVSDK_NGX_Parameter_Hint_HDR to tell
* SDK that it should expect HDR color space is needed. Please refer to
* samples since different features need different parameters and hints.
*
* 4) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetScratchBufferSize to obtain size of
* the scratch buffer needed by specific feature. This D3D or CUDA buffer
* should be allocated by client and passed as:
* Params->Set(NVSDK_NGX_Parameter_Scratch,MY_SCRATCH_POINTER)
* Params->Set(NVSDK_NGX_Parameter_Scratch_SizeInBytes,MY_SCRATCH_SIZE_IN_BYTES)
* NOTE: Returned size can be 0 if feature does not use any scratch buffer.
* It is OK to use bigger buffer or reuse buffers across features as long
* as minimum size requirement is met.
*
* 5) Call NVSDK_NGX_D3D11/D3D12/CUDA_CreateFeature to create feature you need.
* On success SDK will return a handle which must be used in any successive
* calls to SDK which require feature handle. SDK will use all parameters
* and hints provided by client to generate feature. If feature with the same
* parameters already exists and error code will be returned.
*
* 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_EvaluateFeature to invoke execution of
* specific feature. Before feature can be evaluated input parameters must
* be specified (like for example color/albedo buffer, motion vectors etc)
*
* 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_ReleaseFeature when feature is no longer
* needed. After this call feature handle becomes invalid and cannot be used.
*
* 7) Call NVSDK_NGX_D3D11/D3D12/CUDA_Shutdown when SDK is no longer needed to
* release all resources.
* Contact: ngxsupport@nvidia.com
*/
#ifndef NVSDK_NGX_H
#define NVSDK_NGX_H
#include <stddef.h> // For size_t
#include "nvsdk_ngx_defs.h"
#include "nvsdk_ngx_params.h"
#ifndef __cplusplus
#include <stdbool.h>
#include <wchar.h>
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct IUnknown IUnknown;
typedef struct ID3D11Device ID3D11Device;
typedef struct ID3D11Resource ID3D11Resource;
typedef struct ID3D11DeviceContext ID3D11DeviceContext;
typedef struct D3D11_TEXTURE2D_DESC D3D11_TEXTURE2D_DESC;
typedef struct D3D11_BUFFER_DESC D3D11_BUFFER_DESC;
typedef struct ID3D11Buffer ID3D11Buffer;
typedef struct ID3D11Texture2D ID3D11Texture2D;
typedef struct ID3D12Device ID3D12Device;
typedef struct ID3D12Resource ID3D12Resource;
typedef struct ID3D12GraphicsCommandList ID3D12GraphicsCommandList;
typedef struct D3D12_RESOURCE_DESC D3D12_RESOURCE_DESC;
typedef struct CD3DX12_HEAP_PROPERTIES CD3DX12_HEAP_PROPERTIES;
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_D3D12_ResourceAllocCallback)(D3D12_RESOURCE_DESC *InDesc, int InState, CD3DX12_HEAP_PROPERTIES *InHeap, ID3D12Resource **OutResource);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_D3D11_BufferAllocCallback)(D3D11_BUFFER_DESC *InDesc, ID3D11Buffer **OutResource);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_D3D11_Tex2DAllocCallback)(D3D11_TEXTURE2D_DESC *InDesc, ID3D11Texture2D **OutResource);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ResourceReleaseCallback)(IUnknown *InResource);
typedef unsigned long long CUtexObject;
///////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Init
// -------------------------------------
//
// InApplicationId:
// Unique Id provided by NVIDIA
//
// InApplicationDataPath:
// Folder to store logs and other temporary files (write access required),
// Normally this would be a location in Documents or ProgramData.
//
// InDevice: [d3d11/12 only]
// DirectX device to use
//
// InFeatureInfo:
// Contains information common to all features, presently only a list of all paths
// feature dlls can be located in, other than the default path - application directory.
//
// DESCRIPTION:
// Initializes new SDK instance.
//
#ifdef __cplusplus
NVSDK_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);
NVSDK_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);
NVSDK_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);
#else
NVSDK_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);
NVSDK_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);
NVSDK_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);
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Init_with_ProjectID
// -------------------------------------
//
// InProjectId:
// Unique Id provided by the rendering engine used
//
// InEngineType:
// Rendering engine used by the application / plugin.
// Use NVSDK_NGX_ENGINE_TYPE_CUSTOM if the specific engine type is not supported explicitly
//
// InEngineVersion:
// Version number of the rendering engine used by the application / plugin.
//
// InApplicationDataPath:
// Folder to store logs and other temporary files (write access required),
// Normally this would be a location in Documents or ProgramData.
//
// InDevice: [d3d11/12 only]
// DirectX device to use
//
// InFeatureInfo:
// Contains information common to all features, presently only a list of all paths
// feature dlls can be located in, other than the default path - application directory.
//
// DESCRIPTION:
// Initializes new SDK instance.
//
#ifdef __cplusplus
NVSDK_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);
NVSDK_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);
NVSDK_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);
#else
NVSDK_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);
NVSDK_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);
NVSDK_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);
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Shutdown
// -------------------------------------
//
// DESCRIPTION:
// Shuts down the current SDK instance and releases all resources.
// Shutdown1(Device) only affects specified device
// Shutdown1(nullptr) = Shutdown() and shuts down all devices
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Shutdown(void);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_Shutdown1(ID3D11Device *InDevice);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Shutdown(void);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_Shutdown1(ID3D12Device *InDevice);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_Shutdown(void);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_GetParameters
// ----------------------------------------------------------
//
// OutParameters:
// Parameters interface used to set any parameter needed by the SDK
//
// DESCRIPTION:
// This interface allows simple parameter setup using named fields.
// For example one can set width by calling Set(NVSDK_NGX_Parameter_Denoiser_Width,100) or
// provide CUDA buffer pointer by calling Set(NVSDK_NGX_Parameter_Denoiser_Color,cudaBuffer)
// For more details please see sample code. Please note that allocated memory
// will be freed by NGX so free/delete operator should NOT be called.
// Parameter maps output by NVSDK_NGX_GetParameters are also pre-populated
// with NGX capabilities and available features.
// Unlike with NVSDK_NGX_AllocateParameters, parameter maps output by NVSDK_NGX_GetParameters
// have their lifetimes managed by NGX, and must not
// be destroyed by the app using NVSDK_NGX_DestroyParameters.
// NVSDK_NGX_GetParameters is soon to be deprecated and apps should move to using
// NVSDK_NGX_AllocateParameters and NVSDK_NGX_GetCapabilityParameters when possible.
// Nevertheless, due to the possibility that the user will be using an older driver version,
// NVSDK_NGX_GetParameters should still be used as a fallback if NVSDK_NGX_AllocateParameters
// or NVSDK_NGX_GetCapabilityParameters return NVSDK_NGX_Result_FAIL_OutOfDate.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_GetParameters(NVSDK_NGX_Parameter **OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_GetParameters(NVSDK_NGX_Parameter **OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_GetParameters(NVSDK_NGX_Parameter **OutParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_AllocateParameters
// ----------------------------------------------------------
//
// OutParameters:
// Parameters interface used to set any parameter needed by the SDK
//
// DESCRIPTION:
// This interface allows allocating a simple parameter setup using named fields, whose
// lifetime the app must manage.
// For example one can set width by calling Set(NVSDK_NGX_Parameter_Denoiser_Width,100) or
// provide CUDA buffer pointer by calling Set(NVSDK_NGX_Parameter_Denoiser_Color,cudaBuffer)
// For more details please see sample code.
// Parameter maps output by NVSDK_NGX_AllocateParameters must NOT be freed using
// the free/delete operator; to free a parameter map
// output by NVSDK_NGX_AllocateParameters, NVSDK_NGX_DestroyParameters should be used.
// Unlike with NVSDK_NGX_GetParameters, parameter maps allocated with NVSDK_NGX_AllocateParameters
// must be destroyed by the app using NVSDK_NGX_DestroyParameters.
// Also unlike with NVSDK_NGX_GetParameters, parameter maps output by NVSDK_NGX_AllocateParameters
// do not come pre-populated with NGX capabilities and available features.
// To create a new parameter map pre-populated with such information, NVSDK_NGX_GetCapabilityParameters
// should be used.
// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
// does not support this API call is being used. In such a case, NVSDK_NGX_GetParameters
// may be used as a fallback.
// This function may only be called after a successful call into NVSDK_NGX_Init.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_GetCapabilityParameters
// ----------------------------------------------------------
//
// OutParameters:
// The parameters interface populated with NGX and feature capabilities
//
// DESCRIPTION:
// This interface allows the app to create a new parameter map
// pre-populated with NGX capabilities and available features.
// The output parameter map can also be used for any purpose
// parameter maps output by NVSDK_NGX_AllocateParameters can be used for
// but it is not recommended to use NVSDK_NGX_GetCapabilityParameters
// unless querying NGX capabilities and available features
// due to the overhead associated with pre-populating the parameter map.
// Parameter maps output by NVSDK_NGX_GetCapabilityParameters must NOT be freed using
// the free/delete operator; to free a parameter map
// output by NVSDK_NGX_GetCapabilityParameters, NVSDK_NGX_DestroyParameters should be used.
// Unlike with NVSDK_NGX_GetParameters, parameter maps allocated with NVSDK_NGX_GetCapabilityParameters
// must be destroyed by the app using NVSDK_NGX_DestroyParameters.
// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
// does not support this API call is being used. This function may only be called
// after a successful call into NVSDK_NGX_Init.
// If NVSDK_NGX_GetCapabilityParameters fails with NVSDK_NGX_Result_FAIL_OutOfDate,
// NVSDK_NGX_GetParameters may be used as a fallback, to get a parameter map pre-populated
// with NGX capabilities and available features.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_DestroyParameters
// ----------------------------------------------------------
//
// InParameters:
// The parameters interface to be destroyed
//
// DESCRIPTION:
// This interface allows the app to destroy the parameter map passed in. Once
// NVSDK_NGX_DestroyParameters is called on a parameter map, it
// must not be used again.
// NVSDK_NGX_DestroyParameters must not be called on any parameter map returned
// by NVSDK_NGX_GetParameters; NGX will manage the lifetime of those
// parameter maps.
// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
// does not support this API call is being used. This function may only be called
// after a successful call into NVSDK_NGX_Init.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_GetScratchBufferSize
// ----------------------------------------------------------
//
// InFeatureId:
// AI feature in question
//
// InParameters:
// Parameters used by the feature to help estimate scratch buffer size
//
// OutSizeInBytes:
// Number of bytes needed for the scratch buffer for the specified feature.
//
// DESCRIPTION:
// SDK needs a buffer of a certain size provided by the client in
// order to initialize AI feature. Once feature is no longer
// needed buffer can be released. It is safe to reuse the same
// scratch buffer for different features as long as minimum size
// requirement is met for all features. Please note that some
// features might not need a scratch buffer so return size of 0
// is completely valid.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
/////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_CreateFeature
// -------------------------------------
//
// InCmdList:[d3d12 only]
// Command list to use to execute GPU commands. Must be:
// - Open and recording
// - With node mask including the device provided in NVSDK_NGX_D3D12_Init
// - Execute on non-copy command queue.
// InDevCtx: [d3d11 only]
// Device context to use to execute GPU commands
//
// InFeatureID:
// AI feature to initialize
//
// InParameters:
// List of parameters
//
// OutHandle:
// Handle which uniquely identifies the feature. If feature with
// provided parameters already exists the "already exists" error code is returned.
//
// DESCRIPTION:
// Each feature needs to be created before it can be used.
// Refer to the sample code to find out which input parameters
// are needed to create specific feature.
//
NVSDK_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);
NVSDK_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);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_CreateFeature(NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
/////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Release
// -------------------------------------
//
// InHandle:
// Handle to feature to be released
//
// DESCRIPTION:
// Releases feature with a given handle.
// Handles are not reference counted so
// after this call it is invalid to use provided handle.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D11_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_D3D12_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_CUDA_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
/////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_EvaluateFeature
// -------------------------------------
//
// InCmdList:[d3d12 only]
// Command list to use to execute GPU commands. Must be:
// - Open and recording
// - With node mask including the device provided in NVSDK_NGX_D3D12_Init
// - Execute on non-copy command queue.
// InDevCtx: [d3d11 only]
// Device context to use to execute GPU commands
//
// InFeatureHandle:
// Handle representing feature to be evaluated
//
// InParameters:
// List of parameters required to evaluate feature
//
// InCallback:
// Optional callback for features which might take longer
// to execture. If specified SDK will call it with progress
// values in range 0.0f - 1.0f
//
// DESCRIPTION:
// Evaluates given feature using the provided parameters and
// pre-trained NN. Please note that for most features
// it can be benefitials to pass as many input buffers and parameters
// as possible (for example provide all render targets like color, albedo, normals, depth etc)
//
#ifdef __cplusplus
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback)(float InCurrentProgress, bool &OutShouldCancel);
NVSDK_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);
NVSDK_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);
NVSDK_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);
#endif
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback_C)(float InCurrentProgress, bool *OutShouldCancel);
NVSDK_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);
NVSDK_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);
NVSDK_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);
// NGX return-code conversion-to-string utility only as a helper for debugging/logging - not for official use.
const wchar_t* NVSDK_CONV GetNGXResultAsString(NVSDK_NGX_Result InNGXResult);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // #define NVSDK_NGX_H

View File

@@ -0,0 +1,597 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#ifndef NVSDK_NGX_DEFS_H
#define NVSDK_NGX_DEFS_H
#pragma once
#ifndef __cplusplus
#include <stddef.h> // For size_t
#include <stdbool.h>
#include <wchar.h>
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
#if defined(NVSDK_NGX) && defined(NV_WINDOWS)
#define NVSDK_NGX_API extern "C" __declspec(dllexport)
#else
#define NVSDK_NGX_API extern "C"
#endif
#else
#if defined(NVSDK_NGX) && defined(NV_WINDOWS)
#define NVSDK_NGX_API __declspec(dllexport)
#else
#define NVSDK_NGX_API
#endif
#endif
#ifdef __GNUC__
#define NVSDK_CONV
#else
#define NVSDK_CONV __cdecl
#endif
#define NVSDK_NGX_ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0]))
// Version Notes:
// Version 0x0000014:
// * Added a logging callback that the app may pass in on init
// * Added ability for the app to override the logging level
// Version 0x0000015:
// * Support multiple GPUs (bug 3270533)
#define NVSDK_NGX_VERSION_API_MACRO 0x0000014 // NGX_VERSION_DOT 1.4.0
typedef struct NVSDK_NGX_FeatureCommonInfo_Internal NVSDK_NGX_FeatureCommonInfo_Internal;
typedef enum NVSDK_NGX_Version { NVSDK_NGX_Version_API = NVSDK_NGX_VERSION_API_MACRO } NVSDK_NGX_Version;
typedef enum NVSDK_NGX_Result
{
NVSDK_NGX_Result_Success = 0x1,
NVSDK_NGX_Result_Fail = 0xBAD00000,
// Feature is not supported on current hardware
NVSDK_NGX_Result_FAIL_FeatureNotSupported = NVSDK_NGX_Result_Fail | 1,
// Platform error - for example - check d3d12 debug layer log for more information
NVSDK_NGX_Result_FAIL_PlatformError = NVSDK_NGX_Result_Fail | 2,
// Feature with given parameters already exists
NVSDK_NGX_Result_FAIL_FeatureAlreadyExists = NVSDK_NGX_Result_Fail | 3,
// Feature with provided handle does not exist
NVSDK_NGX_Result_FAIL_FeatureNotFound = NVSDK_NGX_Result_Fail | 4,
// Invalid parameter was provided
NVSDK_NGX_Result_FAIL_InvalidParameter = NVSDK_NGX_Result_Fail | 5,
// Provided buffer is too small, please use size provided by NVSDK_NGX_GetScratchBufferSize
NVSDK_NGX_Result_FAIL_ScratchBufferTooSmall = NVSDK_NGX_Result_Fail | 6,
// SDK was not initialized properly
NVSDK_NGX_Result_FAIL_NotInitialized = NVSDK_NGX_Result_Fail | 7,
// Unsupported format used for input/output buffers
NVSDK_NGX_Result_FAIL_UnsupportedInputFormat = NVSDK_NGX_Result_Fail | 8,
// Feature input/output needs RW access (UAV) (d3d11/d3d12 specific)
NVSDK_NGX_Result_FAIL_RWFlagMissing = NVSDK_NGX_Result_Fail | 9,
// Feature was created with specific input but none is provided at evaluation
NVSDK_NGX_Result_FAIL_MissingInput = NVSDK_NGX_Result_Fail | 10,
// Feature is not available on the system
NVSDK_NGX_Result_FAIL_UnableToInitializeFeature = NVSDK_NGX_Result_Fail | 11,
// NGX system libraries are old and need an update
NVSDK_NGX_Result_FAIL_OutOfDate = NVSDK_NGX_Result_Fail | 12,
// Feature requires more GPU memory than it is available on system
NVSDK_NGX_Result_FAIL_OutOfGPUMemory = NVSDK_NGX_Result_Fail | 13,
// Format used in input buffer(s) is not supported by feature
NVSDK_NGX_Result_FAIL_UnsupportedFormat = NVSDK_NGX_Result_Fail | 14,
// Path provided in InApplicationDataPath cannot be written to
NVSDK_NGX_Result_FAIL_UnableToWriteToAppDataPath = NVSDK_NGX_Result_Fail | 15,
// Unsupported parameter was provided (e.g. specific scaling factor is unsupported)
NVSDK_NGX_Result_FAIL_UnsupportedParameter = NVSDK_NGX_Result_Fail | 16,
// The feature or application was denied (contact NVIDIA for further details)
NVSDK_NGX_Result_FAIL_Denied = NVSDK_NGX_Result_Fail | 17
} NVSDK_NGX_Result;
#define NVSDK_NGX_SUCCEED(value) (((value) & 0xFFF00000) != NVSDK_NGX_Result_Fail)
#define NVSDK_NGX_FAILED(value) (((value) & 0xFFF00000) == NVSDK_NGX_Result_Fail)
typedef enum NVSDK_NGX_Feature
{
NVSDK_NGX_Feature_Reserved0,
NVSDK_NGX_Feature_SuperSampling,
NVSDK_NGX_Feature_InPainting,
NVSDK_NGX_Feature_ImageSuperResolution,
NVSDK_NGX_Feature_SlowMotion,
NVSDK_NGX_Feature_VideoSuperResolution,
NVSDK_NGX_Feature_Reserved1,
NVSDK_NGX_Feature_Reserved2,
NVSDK_NGX_Feature_Reserved3,
NVSDK_NGX_Feature_ImageSignalProcessing,
NVSDK_NGX_Feature_DeepResolve,
NVSDK_NGX_Feature_Reserved4,
// New features go here
NVSDK_NGX_Feature_Count,
// These members are not strictly NGX features, but are
// components of the NGX system, and it may sometimes
// be useful to identify them using the same enum
NVSDK_NGX_Feature_Reserved_SDK = 32764,
NVSDK_NGX_Feature_Reserved_Core,
NVSDK_NGX_Feature_Reserved_Unknown
} NVSDK_NGX_Feature;
//TODO create grayscale format (R32F?)
typedef enum NVSDK_NGX_Buffer_Format
{
NVSDK_NGX_Buffer_Format_Unknown,
NVSDK_NGX_Buffer_Format_RGB8UI,
NVSDK_NGX_Buffer_Format_RGB16F,
NVSDK_NGX_Buffer_Format_RGB32F,
NVSDK_NGX_Buffer_Format_RGBA8UI,
NVSDK_NGX_Buffer_Format_RGBA16F,
NVSDK_NGX_Buffer_Format_RGBA32F,
} NVSDK_NGX_Buffer_Format;
typedef enum NVSDK_NGX_PerfQuality_Value
{
NVSDK_NGX_PerfQuality_Value_MaxPerf,
NVSDK_NGX_PerfQuality_Value_Balanced,
NVSDK_NGX_PerfQuality_Value_MaxQuality,
// Extended PerfQuality modes
NVSDK_NGX_PerfQuality_Value_UltraPerformance,
NVSDK_NGX_PerfQuality_Value_UltraQuality,
} NVSDK_NGX_PerfQuality_Value;
typedef enum NVSDK_NGX_RTX_Value
{
NVSDK_NGX_RTX_Value_Off,
NVSDK_NGX_RTX_Value_On,
} NVSDK_NGX_RTX_Value;
typedef enum NVSDK_NGX_DLSS_Mode
{
NVSDK_NGX_DLSS_Mode_Off, // use existing in-engine AA + upscale solution
NVSDK_NGX_DLSS_Mode_DLSS_DLISP,
NVSDK_NGX_DLSS_Mode_DLISP_Only, // use existing in-engine AA solution
NVSDK_NGX_DLSS_Mode_DLSS, // DLSS will apply AA and upsample at the same time
} NVSDK_NGX_DLSS_Mode;
typedef struct NVSDK_NGX_Handle { unsigned int Id; } NVSDK_NGX_Handle;
typedef enum NSDK_NGX_GPU_Arch
{
NVSDK_NGX_GPU_Arch_NotSupported = 0,
// Match NvAPI's NV_GPU_ARCHITECTURE_ID values for GV100 and TU100 for
// backwards compatibility with snippets built against NvAPI
NVSDK_NGX_GPU_Arch_Volta = 0x0140,
NVSDK_NGX_GPU_Arch_Turing = 0x0160,
// Presumably something newer
NVSDK_NGX_GPU_Arch_Unknown = 0x7FFFFFF
} NVSDK_NGX_GPU_Arch;
typedef enum NVSDK_NGX_DLSS_Feature_Flags
{
NVSDK_NGX_DLSS_Feature_Flags_IsInvalid = 1 << 31,
NVSDK_NGX_DLSS_Feature_Flags_None = 0,
NVSDK_NGX_DLSS_Feature_Flags_IsHDR = 1 << 0,
NVSDK_NGX_DLSS_Feature_Flags_MVLowRes = 1 << 1,
NVSDK_NGX_DLSS_Feature_Flags_MVJittered = 1 << 2,
NVSDK_NGX_DLSS_Feature_Flags_DepthInverted = 1 << 3,
NVSDK_NGX_DLSS_Feature_Flags_Reserved_0 = 1 << 4,
NVSDK_NGX_DLSS_Feature_Flags_DoSharpening = 1 << 5,
NVSDK_NGX_DLSS_Feature_Flags_AutoExposure = 1 << 6,
} NVSDK_NGX_DLSS_Feature_Flags;
typedef enum NVSDK_NGX_ToneMapperType
{
NVSDK_NGX_TONEMAPPER_STRING = 0,
NVSDK_NGX_TONEMAPPER_REINHARD,
NVSDK_NGX_TONEMAPPER_ONEOVERLUMA,
NVSDK_NGX_TONEMAPPER_ACES,
NVSDK_NGX_TONEMAPPERTYPE_NUM
} NVSDK_NGX_ToneMapperType;
typedef enum NVSDK_NGX_GBufferType
{
NVSDK_NGX_GBUFFER_ALBEDO = 0,
NVSDK_NGX_GBUFFER_ROUGHNESS,
NVSDK_NGX_GBUFFER_METALLIC,
NVSDK_NGX_GBUFFER_SPECULAR,
NVSDK_NGX_GBUFFER_SUBSURFACE,
NVSDK_NGX_GBUFFER_NORMALS,
NVSDK_NGX_GBUFFER_SHADINGMODELID, /* unique identifier for drawn object or how the object is drawn */
NVSDK_NGX_GBUFFER_MATERIALID, /* unique identifier for material */
NVSDK_NGX_GBUFFERTYPE_NUM = 16
} NVSDK_NGX_GBufferType;
typedef struct NVSDK_NGX_Coordinates
{
unsigned int X;
unsigned int Y;
} NVSDK_NGX_Coordinates;
typedef struct NVSDK_NGX_Dimensions
{
unsigned int Width;
unsigned int Height;
} NVSDK_NGX_Dimensions;
typedef struct NVSDK_NGX_PathListInfo
{
wchar_t **Path;
// Path-list length
unsigned int Length;
} NVSDK_NGX_PathListInfo;
typedef enum NVSDK_NGX_Logging_Level
{
NVSDK_NGX_LOGGING_LEVEL_OFF = 0,
NVSDK_NGX_LOGGING_LEVEL_ON,
NVSDK_NGX_LOGGING_LEVEL_VERBOSE,
NVSDK_NGX_LOGGING_LEVEL_NUM
} NVSDK_NGX_Logging_Level;
// A logging callback provided by the app to allow piping log lines back to the app.
// Please take careful note of the signature and calling convention.
// The callback must be able to be called from any thread.
// It must also be fully thread-safe and any number of threads may call into it concurrently.
// It must fully process message by the time it returns, and there is no guarantee that
// message will still be valid or allocated after it returns.
// message will be a null-terminated string and may contain multibyte characters.
#if defined(__GNUC__) || defined(__clang__)
typedef void NVSDK_CONV(*NVSDK_NGX_AppLogCallback)(const char* message, NVSDK_NGX_Logging_Level loggingLevel, NVSDK_NGX_Feature sourceComponent);
#else
typedef void(NVSDK_CONV* NVSDK_NGX_AppLogCallback)(const char* message, NVSDK_NGX_Logging_Level loggingLevel, NVSDK_NGX_Feature sourceComponent);
#endif
typedef struct NGSDK_NGX_LoggingInfo
{
// Fields below were introduced in SDK version 0x0000014
// App-provided logging callback
NVSDK_NGX_AppLogCallback LoggingCallback;
// The minimum logging level to use. If this is higher
// than the logging level otherwise configured, this will override
// that logging level. Otherwise, that logging level will be used.
NVSDK_NGX_Logging_Level MinimumLoggingLevel;
// Whether or not to disable writing log lines to sinks other than the app log callback. This
// may be useful if the app provides a logging callback. LoggingCallback must be non-null and point
// to a valid logging callback if this is set to true.
bool DisableOtherLoggingSinks;
} NGSDK_NGX_LoggingInfo;
typedef struct NVSDK_NGX_FeatureCommonInfo
{
// List of all paths in descending order of search sequence to locate a feature dll in, other than the default path - application folder.
NVSDK_NGX_PathListInfo PathListInfo;
// Used internally by NGX
NVSDK_NGX_FeatureCommonInfo_Internal* InternalData; // Introduced in SDK version 0x0000013
// Fields below were introduced in SDK version 0x0000014
NGSDK_NGX_LoggingInfo LoggingInfo;
} NVSDK_NGX_FeatureCommonInfo;
typedef enum NVSDK_NGX_Resource_VK_Type
{
NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW,
NVSDK_NGX_RESOURCE_VK_TYPE_VK_BUFFER
} NVSDK_NGX_Resource_VK_Type;
typedef enum NVSDK_NGX_Opt_Level
{
NVSDK_NGX_OPT_LEVEL_UNDEFINED = 0,
NVSDK_NGX_OPT_LEVEL_DEBUG = 20,
NVSDK_NGX_OPT_LEVEL_DEVELOP = 30,
NVSDK_NGX_OPT_LEVEL_RELEASE = 40
} NVSDK_NGX_Opt_Level;
typedef enum NVSDK_NGX_EngineType
{
NVSDK_NGX_ENGINE_TYPE_CUSTOM = 0,
NVSDK_NGX_ENGINE_TYPE_UNREAL,
NVSDK_NGX_ENGINE_TYPE_UNITY,
NVSDK_NGX_ENGINE_TYPE_OMNIVERSE,
NVSDK_NGX_ENGINE_COUNT
} NVSDK_NGX_EngineType;
// Read-only parameters provided by NGX
#define NVSDK_NGX_EParameter_Reserved00 "#\x00"
#define NVSDK_NGX_EParameter_SuperSampling_Available "#\x01"
#define NVSDK_NGX_EParameter_InPainting_Available "#\x02"
#define NVSDK_NGX_EParameter_ImageSuperResolution_Available "#\x03"
#define NVSDK_NGX_EParameter_SlowMotion_Available "#\x04"
#define NVSDK_NGX_EParameter_VideoSuperResolution_Available "#\x05"
#define NVSDK_NGX_EParameter_Reserved06 "#\x06"
#define NVSDK_NGX_EParameter_Reserved07 "#\x07"
#define NVSDK_NGX_EParameter_Reserved08 "#\x08"
#define NVSDK_NGX_EParameter_ImageSignalProcessing_Available "#\x09"
#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_2_1 "#\x0a"
#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_3_1 "#\x0b"
#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_3_2 "#\x0c"
#define NVSDK_NGX_EParameter_ImageSuperResolution_ScaleFactor_4_3 "#\x0d"
#define NVSDK_NGX_EParameter_NumFrames "#\x0e"
#define NVSDK_NGX_EParameter_Scale "#\x0f"
#define NVSDK_NGX_EParameter_Width "#\x10"
#define NVSDK_NGX_EParameter_Height "#\x11"
#define NVSDK_NGX_EParameter_OutWidth "#\x12"
#define NVSDK_NGX_EParameter_OutHeight "#\x13"
#define NVSDK_NGX_EParameter_Sharpness "#\x14"
#define NVSDK_NGX_EParameter_Scratch "#\x15"
#define NVSDK_NGX_EParameter_Scratch_SizeInBytes "#\x16"
#define NVSDK_NGX_EParameter_Deprecated_17 "#\x17"
#define NVSDK_NGX_EParameter_Input1 "#\x18"
#define NVSDK_NGX_EParameter_Input1_Format "#\x19"
#define NVSDK_NGX_EParameter_Input1_SizeInBytes "#\x1a"
#define NVSDK_NGX_EParameter_Input2 "#\x1b"
#define NVSDK_NGX_EParameter_Input2_Format "#\x1c"
#define NVSDK_NGX_EParameter_Input2_SizeInBytes "#\x1d"
#define NVSDK_NGX_EParameter_Color "#\x1e"
#define NVSDK_NGX_EParameter_Color_Format "#\x1f"
#define NVSDK_NGX_EParameter_Color_SizeInBytes "#\x20"
#define NVSDK_NGX_EParameter_Albedo "#\x21"
#define NVSDK_NGX_EParameter_Output "#\x22"
#define NVSDK_NGX_EParameter_Output_Format "#\x23"
#define NVSDK_NGX_EParameter_Output_SizeInBytes "#\x24"
#define NVSDK_NGX_EParameter_Reset "#\x25"
#define NVSDK_NGX_EParameter_BlendFactor "#\x26"
#define NVSDK_NGX_EParameter_MotionVectors "#\x27"
#define NVSDK_NGX_EParameter_Rect_X "#\x28"
#define NVSDK_NGX_EParameter_Rect_Y "#\x29"
#define NVSDK_NGX_EParameter_Rect_W "#\x2a"
#define NVSDK_NGX_EParameter_Rect_H "#\x2b"
#define NVSDK_NGX_EParameter_MV_Scale_X "#\x2c"
#define NVSDK_NGX_EParameter_MV_Scale_Y "#\x2d"
#define NVSDK_NGX_EParameter_Model "#\x2e"
#define NVSDK_NGX_EParameter_Format "#\x2f"
#define NVSDK_NGX_EParameter_SizeInBytes "#\x30"
#define NVSDK_NGX_EParameter_ResourceAllocCallback "#\x31"
#define NVSDK_NGX_EParameter_BufferAllocCallback "#\x32"
#define NVSDK_NGX_EParameter_Tex2DAllocCallback "#\x33"
#define NVSDK_NGX_EParameter_ResourceReleaseCallback "#\x34"
#define NVSDK_NGX_EParameter_CreationNodeMask "#\x35"
#define NVSDK_NGX_EParameter_VisibilityNodeMask "#\x36"
#define NVSDK_NGX_EParameter_PreviousOutput "#\x37"
#define NVSDK_NGX_EParameter_MV_Offset_X "#\x38"
#define NVSDK_NGX_EParameter_MV_Offset_Y "#\x39"
#define NVSDK_NGX_EParameter_Hint_UseFireflySwatter "#\x3a"
#define NVSDK_NGX_EParameter_Resource_Width "#\x3b"
#define NVSDK_NGX_EParameter_Resource_Height "#\x3c"
#define NVSDK_NGX_EParameter_Depth "#\x3d"
#define NVSDK_NGX_EParameter_DLSSOptimalSettingsCallback "#\x3e"
#define NVSDK_NGX_EParameter_PerfQualityValue "#\x3f"
#define NVSDK_NGX_EParameter_RTXValue "#\x40"
#define NVSDK_NGX_EParameter_DLSSMode "#\x41"
#define NVSDK_NGX_EParameter_DeepResolve_Available "#\x42"
#define NVSDK_NGX_EParameter_Deprecated_43 "#\x43"
#define NVSDK_NGX_EParameter_OptLevel "#\x44"
#define NVSDK_NGX_EParameter_IsDevSnippetBranch "#\x45"
#define NVSDK_NGX_Parameter_OptLevel "Snippet.OptLevel"
#define NVSDK_NGX_Parameter_IsDevSnippetBranch "Snippet.IsDevBranch"
#define NVSDK_NGX_Parameter_SuperSampling_ScaleFactor "SuperSampling.ScaleFactor"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_ScaleFactor "ImageSignalProcessing.ScaleFactor"
#define NVSDK_NGX_Parameter_SuperSampling_Available "SuperSampling.Available"
#define NVSDK_NGX_Parameter_InPainting_Available "InPainting.Available"
#define NVSDK_NGX_Parameter_ImageSuperResolution_Available "ImageSuperResolution.Available"
#define NVSDK_NGX_Parameter_SlowMotion_Available "SlowMotion.Available"
#define NVSDK_NGX_Parameter_VideoSuperResolution_Available "VideoSuperResolution.Available"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_Available "ImageSignalProcessing.Available"
#define NVSDK_NGX_Parameter_DeepResolve_Available "DeepResolve.Available"
#define NVSDK_NGX_Parameter_SuperSampling_NeedsUpdatedDriver "SuperSampling.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_InPainting_NeedsUpdatedDriver "InPainting.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_ImageSuperResolution_NeedsUpdatedDriver "ImageSuperResolution.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_SlowMotion_NeedsUpdatedDriver "SlowMotion.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_VideoSuperResolution_NeedsUpdatedDriver "VideoSuperResolution.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_NeedsUpdatedDriver "ImageSignalProcessing.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_DeepResolve_NeedsUpdatedDriver "DeepResolve.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_FrameInterpolation_NeedsUpdatedDriver "FrameInterpolation.NeedsUpdatedDriver"
#define NVSDK_NGX_Parameter_SuperSampling_MinDriverVersionMajor "SuperSampling.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_InPainting_MinDriverVersionMajor "InPainting.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_ImageSuperResolution_MinDriverVersionMajor "ImageSuperResolution.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_SlowMotion_MinDriverVersionMajor "SlowMotion.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_VideoSuperResolution_MinDriverVersionMajor "VideoSuperResolution.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_MinDriverVersionMajor "ImageSignalProcessing.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_DeepResolve_MinDriverVersionMajor "DeepResolve.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_FrameInterpolation_MinDriverVersionMajor "FrameInterpolation.MinDriverVersionMajor"
#define NVSDK_NGX_Parameter_SuperSampling_MinDriverVersionMinor "SuperSampling.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_InPainting_MinDriverVersionMinor "InPainting.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_ImageSuperResolution_MinDriverVersionMinor "ImageSuperResolution.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_SlowMotion_MinDriverVersionMinor "SlowMotion.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_VideoSuperResolution_MinDriverVersionMinor "VideoSuperResolution.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_MinDriverVersionMinor "ImageSignalProcessing.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_DeepResolve_MinDriverVersionMinor "DeepResolve.MinDriverVersionMinor"
#define NVSDK_NGX_Parameter_SuperSampling_FeatureInitResult "SuperSampling.FeatureInitResult"
#define NVSDK_NGX_Parameter_InPainting_FeatureInitResult "InPainting.FeatureInitResult"
#define NVSDK_NGX_Parameter_ImageSuperResolution_FeatureInitResult "ImageSuperResolution.FeatureInitResult"
#define NVSDK_NGX_Parameter_SlowMotion_FeatureInitResult "SlowMotion.FeatureInitResult"
#define NVSDK_NGX_Parameter_VideoSuperResolution_FeatureInitResult "VideoSuperResolution.FeatureInitResult"
#define NVSDK_NGX_Parameter_ImageSignalProcessing_FeatureInitResult "ImageSignalProcessing.FeatureInitResult"
#define NVSDK_NGX_Parameter_DeepResolve_FeatureInitResult "DeepResolve.FeatureInitResult"
#define NVSDK_NGX_Parameter_FrameInterpolation_FeatureInitResult "FrameInterpolation.FeatureInitResult"
#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_2_1 "ImageSuperResolution.ScaleFactor.2.1"
#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_3_1 "ImageSuperResolution.ScaleFactor.3.1"
#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_3_2 "ImageSuperResolution.ScaleFactor.3.2"
#define NVSDK_NGX_Parameter_ImageSuperResolution_ScaleFactor_4_3 "ImageSuperResolution.ScaleFactor.4.3"
#define NVSDK_NGX_Parameter_NumFrames "NumFrames"
#define NVSDK_NGX_Parameter_Scale "Scale"
#define NVSDK_NGX_Parameter_Width "Width"
#define NVSDK_NGX_Parameter_Height "Height"
#define NVSDK_NGX_Parameter_OutWidth "OutWidth"
#define NVSDK_NGX_Parameter_OutHeight "OutHeight"
#define NVSDK_NGX_Parameter_Sharpness "Sharpness"
#define NVSDK_NGX_Parameter_Scratch "Scratch"
#define NVSDK_NGX_Parameter_Scratch_SizeInBytes "Scratch.SizeInBytes"
#define NVSDK_NGX_Parameter_Input1 "Input1"
#define NVSDK_NGX_Parameter_Input1_Format "Input1.Format"
#define NVSDK_NGX_Parameter_Input1_SizeInBytes "Input1.SizeInBytes"
#define NVSDK_NGX_Parameter_Input2 "Input2"
#define NVSDK_NGX_Parameter_Input2_Format "Input2.Format"
#define NVSDK_NGX_Parameter_Input2_SizeInBytes "Input2.SizeInBytes"
#define NVSDK_NGX_Parameter_Color "Color"
#define NVSDK_NGX_Parameter_Color_Format "Color.Format"
#define NVSDK_NGX_Parameter_Color_SizeInBytes "Color.SizeInBytes"
#define NVSDK_NGX_Parameter_FI_Color1 "Color1"
#define NVSDK_NGX_Parameter_FI_Color2 "Color2"
#define NVSDK_NGX_Parameter_Albedo "Albedo"
#define NVSDK_NGX_Parameter_Output "Output"
#define NVSDK_NGX_Parameter_Output_SizeInBytes "Output.SizeInBytes"
#define NVSDK_NGX_Parameter_FI_Output1 "Output1"
#define NVSDK_NGX_Parameter_FI_Output2 "Output2"
#define NVSDK_NGX_Parameter_FI_Output3 "Output3"
#define NVSDK_NGX_Parameter_Reset "Reset"
#define NVSDK_NGX_Parameter_BlendFactor "BlendFactor"
#define NVSDK_NGX_Parameter_MotionVectors "MotionVectors"
#define NVSDK_NGX_Parameter_FI_MotionVectors1 "MotionVectors1"
#define NVSDK_NGX_Parameter_FI_MotionVectors2 "MotionVectors2"
#define NVSDK_NGX_Parameter_Rect_X "Rect.X"
#define NVSDK_NGX_Parameter_Rect_Y "Rect.Y"
#define NVSDK_NGX_Parameter_Rect_W "Rect.W"
#define NVSDK_NGX_Parameter_Rect_H "Rect.H"
#define NVSDK_NGX_Parameter_MV_Scale_X "MV.Scale.X"
#define NVSDK_NGX_Parameter_MV_Scale_Y "MV.Scale.Y"
#define NVSDK_NGX_Parameter_Model "Model"
#define NVSDK_NGX_Parameter_Format "Format"
#define NVSDK_NGX_Parameter_SizeInBytes "SizeInBytes"
#define NVSDK_NGX_Parameter_ResourceAllocCallback "ResourceAllocCallback"
#define NVSDK_NGX_Parameter_BufferAllocCallback "BufferAllocCallback"
#define NVSDK_NGX_Parameter_Tex2DAllocCallback "Tex2DAllocCallback"
#define NVSDK_NGX_Parameter_ResourceReleaseCallback "ResourceReleaseCallback"
#define NVSDK_NGX_Parameter_CreationNodeMask "CreationNodeMask"
#define NVSDK_NGX_Parameter_VisibilityNodeMask "VisibilityNodeMask"
#define NVSDK_NGX_Parameter_MV_Offset_X "MV.Offset.X"
#define NVSDK_NGX_Parameter_MV_Offset_Y "MV.Offset.Y"
#define NVSDK_NGX_Parameter_Hint_UseFireflySwatter "Hint.UseFireflySwatter"
#define NVSDK_NGX_Parameter_Resource_Width "ResourceWidth"
#define NVSDK_NGX_Parameter_Resource_Height "ResourceHeight"
#define NVSDK_NGX_Parameter_Resource_OutWidth "ResourceOutWidth"
#define NVSDK_NGX_Parameter_Resource_OutHeight "ResourceOutHeight"
#define NVSDK_NGX_Parameter_Depth "Depth"
#define NVSDK_NGX_Parameter_FI_Depth1 "Depth1"
#define NVSDK_NGX_Parameter_FI_Depth2 "Depth2"
#define NVSDK_NGX_Parameter_DLSSOptimalSettingsCallback "DLSSOptimalSettingsCallback"
#define NVSDK_NGX_Parameter_DLSSGetStatsCallback "DLSSGetStatsCallback"
#define NVSDK_NGX_Parameter_PerfQualityValue "PerfQualityValue"
#define NVSDK_NGX_Parameter_RTXValue "RTXValue"
#define NVSDK_NGX_Parameter_DLSSMode "DLSSMode"
#define NVSDK_NGX_Parameter_FI_Mode "FIMode"
#define NVSDK_NGX_Parameter_FI_OF_Preset "FIOFPreset"
#define NVSDK_NGX_Parameter_FI_OF_GridSize "FIOFGridSize"
#define NVSDK_NGX_Parameter_Jitter_Offset_X "Jitter.Offset.X"
#define NVSDK_NGX_Parameter_Jitter_Offset_Y "Jitter.Offset.Y"
#define NVSDK_NGX_Parameter_Denoise "Denoise"
#define NVSDK_NGX_Parameter_TransparencyMask "TransparencyMask"
#define NVSDK_NGX_Parameter_ExposureTexture "ExposureTexture" // a 1x1 texture containing the final exposure scale
#define NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags "DLSS.Feature.Create.Flags"
#define NVSDK_NGX_Parameter_DLSS_Checkerboard_Jitter_Hack "DLSS.Checkerboard.Jitter.Hack"
#define NVSDK_NGX_Parameter_GBuffer_Albedo "GBuffer.Albedo"
#define NVSDK_NGX_Parameter_GBuffer_Roughness "GBuffer.Roughness"
#define NVSDK_NGX_Parameter_GBuffer_Metallic "GBuffer.Metallic"
#define NVSDK_NGX_Parameter_GBuffer_Specular "GBuffer.Specular"
#define NVSDK_NGX_Parameter_GBuffer_Subsurface "GBuffer.Subsurface"
#define NVSDK_NGX_Parameter_GBuffer_Normals "GBuffer.Normals"
#define NVSDK_NGX_Parameter_GBuffer_ShadingModelId "GBuffer.ShadingModelId"
#define NVSDK_NGX_Parameter_GBuffer_MaterialId "GBuffer.MaterialId"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_8 "GBuffer.Attrib.8"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_9 "GBuffer.Attrib.9"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_10 "GBuffer.Attrib.10"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_11 "GBuffer.Attrib.11"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_12 "GBuffer.Attrib.12"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_13 "GBuffer.Attrib.13"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_14 "GBuffer.Attrib.14"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_15 "GBuffer.Attrib.15"
#define NVSDK_NGX_Parameter_TonemapperType "TonemapperType"
#define NVSDK_NGX_Parameter_FreeMemOnReleaseFeature "FreeMemOnReleaseFeature"
#define NVSDK_NGX_Parameter_MotionVectors3D "MotionVectors3D"
#define NVSDK_NGX_Parameter_IsParticleMask "IsParticleMask"
#define NVSDK_NGX_Parameter_AnimatedTextureMask "AnimatedTextureMask"
#define NVSDK_NGX_Parameter_DepthHighRes "DepthHighRes"
#define NVSDK_NGX_Parameter_Position_ViewSpace "Position.ViewSpace"
#define NVSDK_NGX_Parameter_FrameTimeDeltaInMsec "FrameTimeDeltaInMsec"
#define NVSDK_NGX_Parameter_RayTracingHitDistance "RayTracingHitDistance"
#define NVSDK_NGX_Parameter_MotionVectorsReflection "MotionVectorsReflection"
#define NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects "DLSS.Enable.Output.Subrects"
#define NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X "DLSS.Input.Color.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y "DLSS.Input.Color.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X "DLSS.Input.Depth.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y "DLSS.Input.Depth.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X "DLSS.Input.MV.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y "DLSS.Input.MV.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X "DLSS.Input.Translucency.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y "DLSS.Input.Translucency.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X "DLSS.Output.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y "DLSS.Output.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width "DLSS.Render.Subrect.Dimensions.Width"
#define NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height "DLSS.Render.Subrect.Dimensions.Height"
#define NVSDK_NGX_Parameter_DLSS_Pre_Exposure "DLSS.Pre.Exposure"
#define NVSDK_NGX_Parameter_DLSS_Exposure_Scale "DLSS.Exposure.Scale"
#define NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask "DLSS.Input.Bias.Current.Color.Mask"
#define NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X "DLSS.Input.Bias.Current.Color.Subrect.Base.X"
#define NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y "DLSS.Input.Bias.Current.Color.Subrect.Base.Y"
#define NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis "DLSS.Indicator.Invert.Y.Axis"
#define NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis "DLSS.Indicator.Invert.X.Axis"
#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Width "DLSS.Get.Dynamic.Max.Render.Width"
#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Height "DLSS.Get.Dynamic.Max.Render.Height"
#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Width "DLSS.Get.Dynamic.Min.Render.Width"
#define NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Height "DLSS.Get.Dynamic.Min.Render.Height"
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@@ -0,0 +1,629 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#ifndef NVSDK_NGX_HELPERS_H
#define NVSDK_NGX_HELPERS_H
#pragma once
#include "nvsdk_ngx.h"
#include "nvsdk_ngx_defs.h"
typedef NVSDK_NGX_Result(NVSDK_CONV *PFN_NVSDK_NGX_DLSS_GetStatsCallback)(NVSDK_NGX_Parameter *InParams);
static inline NVSDK_NGX_Result NGX_DLSS_GET_STATS_2(
NVSDK_NGX_Parameter *pInParams,
unsigned long long *pVRAMAllocatedBytes,
unsigned int *pOptLevel, unsigned int *IsDevSnippetBranch)
{
void *Callback = NULL;
NVSDK_NGX_Parameter_GetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSGetStatsCallback, &Callback);
if (!Callback)
{
// Possible reasons for this:
// - Installed DLSS is out of date and does not support the feature we need
// - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
return NVSDK_NGX_Result_FAIL_OutOfDate;
}
NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
PFN_NVSDK_NGX_DLSS_GetStatsCallback PFNCallback = (PFN_NVSDK_NGX_DLSS_GetStatsCallback)Callback;
Res = PFNCallback(pInParams);
if (NVSDK_NGX_FAILED(Res))
{
return Res;
}
NVSDK_NGX_Parameter_GetULL(pInParams, NVSDK_NGX_Parameter_SizeInBytes, pVRAMAllocatedBytes);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_EParameter_OptLevel, pOptLevel);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_EParameter_IsDevSnippetBranch, IsDevSnippetBranch);
return Res;
}
static inline NVSDK_NGX_Result NGX_DLSS_GET_STATS_1(
NVSDK_NGX_Parameter *pInParams,
unsigned long long *pVRAMAllocatedBytes,
unsigned int *pOptLevel)
{
unsigned int dummy = 0;
return NGX_DLSS_GET_STATS_2(pInParams, pVRAMAllocatedBytes, pOptLevel, &dummy);
}
static inline NVSDK_NGX_Result NGX_DLSS_GET_STATS(
NVSDK_NGX_Parameter *pInParams,
unsigned long long *pVRAMAllocatedBytes)
{
unsigned int dummy = 0;
return NGX_DLSS_GET_STATS_2(pInParams, pVRAMAllocatedBytes, &dummy, &dummy);
}
typedef NVSDK_NGX_Result(NVSDK_CONV *PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback)(NVSDK_NGX_Parameter *InParams);
static inline NVSDK_NGX_Result NGX_DLSS_GET_OPTIMAL_SETTINGS(
NVSDK_NGX_Parameter *pInParams,
unsigned int InUserSelectedWidth,
unsigned int InUserSelectedHeight,
NVSDK_NGX_PerfQuality_Value InPerfQualityValue,
unsigned int *pOutRenderOptimalWidth,
unsigned int *pOutRenderOptimalHeight,
unsigned int *pOutRenderMaxWidth,
unsigned int *pOutRenderMaxHeight,
unsigned int *pOutRenderMinWidth,
unsigned int *pOutRenderMinHeight,
float *pOutSharpness)
{
void *Callback = NULL;
NVSDK_NGX_Parameter_GetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSSOptimalSettingsCallback, &Callback);
if (!Callback)
{
// Possible reasons for this:
// - Installed DLSS is out of date and does not support the feature we need
// - You used NVSDK_NGX_AllocateParameters() for creating InParams. Try using NVSDK_NGX_GetCapabilityParameters() instead
return NVSDK_NGX_Result_FAIL_OutOfDate;
}
// These are selections made by user in UI
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, InUserSelectedWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, InUserSelectedHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, InPerfQualityValue);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_RTXValue, false); // Some older DLSS dlls still expect this value to be set
NVSDK_NGX_Result Res = NVSDK_NGX_Result_Success;
PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback PFNCallback = (PFN_NVSDK_NGX_DLSS_GetOptimalSettingsCallback)Callback;
Res = PFNCallback(pInParams);
if (NVSDK_NGX_FAILED(Res))
{
return Res;
}
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pOutRenderOptimalWidth);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pOutRenderOptimalHeight);
// If we have an older DLSS Dll those might need to be set to the optimal dimensions instead
*pOutRenderMaxWidth = *pOutRenderOptimalWidth;
*pOutRenderMaxHeight = *pOutRenderOptimalHeight;
*pOutRenderMinWidth = *pOutRenderOptimalWidth;
*pOutRenderMinHeight = *pOutRenderOptimalHeight;
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Width, pOutRenderMaxWidth);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Max_Render_Height, pOutRenderMaxHeight);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Width, pOutRenderMinWidth);
NVSDK_NGX_Parameter_GetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Get_Dynamic_Min_Render_Height, pOutRenderMinHeight);
NVSDK_NGX_Parameter_GetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pOutSharpness);
return Res;
}
/*** D3D11 ***/
typedef struct NVSDK_NGX_D3D11_Feature_Eval_Params
{
ID3D11Resource* pInColor;
ID3D11Resource* pInOutput;
/*** OPTIONAL for DLSS ***/
float InSharpness;
} NVSDK_NGX_D3D11_Feature_Eval_Params;
typedef struct NVSDK_NGX_CUDA_Feature_Eval_Params
{
CUtexObject* pInColor;
CUtexObject* pInOutput;
/*** OPTIONAL for DLSS ***/
float InSharpness;
} NVSDK_NGX_CUDA_Feature_Eval_Params;
typedef struct NVSDK_NGX_D3D11_GBuffer
{
ID3D11Resource* pInAttrib[NVSDK_NGX_GBUFFERTYPE_NUM];
} NVSDK_NGX_D3D11_GBuffer;
typedef struct NVSDK_NGX_D3D11_DLSS_Eval_Params
{
NVSDK_NGX_D3D11_Feature_Eval_Params Feature;
ID3D11Resource* pInDepth;
ID3D11Resource* pInMotionVectors;
float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
float InJitterOffsetY;
NVSDK_NGX_Dimensions InRenderSubrectDimensions;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
int InReset; /* Set to 1 when scene changes completely (new level etc) */
float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
float InMVScaleY;
ID3D11Resource* pInTransparencyMask; /* Unused/Reserved for future use */
ID3D11Resource* pInExposureTexture;
ID3D11Resource* pInBiasCurrentColorMask;
NVSDK_NGX_Coordinates InColorSubrectBase;
NVSDK_NGX_Coordinates InDepthSubrectBase;
NVSDK_NGX_Coordinates InMVSubrectBase;
NVSDK_NGX_Coordinates InTranslucencySubrectBase;
NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
NVSDK_NGX_Coordinates InOutputSubrectBase;
float InPreExposure;
int InIndicatorInvertXAxis;
int InIndicatorInvertYAxis;
/*** OPTIONAL - only for research purposes ***/
NVSDK_NGX_D3D11_GBuffer GBufferSurface;
NVSDK_NGX_ToneMapperType InToneMapperType;
ID3D11Resource* pInMotionVectors3D;
ID3D11Resource* pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
ID3D11Resource* pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
ID3D11Resource* pInDepthHighRes;
ID3D11Resource* pInPositionViewSpace;
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 */
ID3D11Resource* pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
ID3D11Resource* pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
} NVSDK_NGX_D3D11_DLSS_Eval_Params;
typedef struct NVSDK_NGX_D3D11_DLISP_Eval_Params
{
NVSDK_NGX_D3D11_Feature_Eval_Params Feature;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
unsigned int InRectX;
unsigned int InRectY;
unsigned int InRectW;
unsigned int InRectH;
float InDenoise;
} NVSDK_NGX_D3D11_DLISP_Eval_Params;
typedef struct NVSDK_NGX_CUDA_DLISP_Eval_Params
{
NVSDK_NGX_CUDA_Feature_Eval_Params Feature;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
unsigned int InRectX;
unsigned int InRectY;
unsigned int InRectW;
unsigned int InRectH;
float InDenoise;
} NVSDK_NGX_CUDA_DLISP_Eval_Params;
static inline NVSDK_NGX_Result NGX_D3D11_CREATE_DLSS_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssCreateParams->Feature.InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssCreateParams->Feature.InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssCreateParams->Feature.InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssCreateParams->Feature.InTargetHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssCreateParams->Feature.InPerfQualityValue);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssCreateParams->InFeatureCreateFlags);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssCreateParams->InEnableOutputSubrects ? 1 : 0);
return NVSDK_NGX_D3D11_CreateFeature(pInCtx, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D11_EVALUATE_DLSS_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D11_DLSS_Eval_Params *pInDlssEvalParams)
{
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Color, pInDlssEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Output, pInDlssEvalParams->Feature.pInOutput);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssEvalParams->pInDepth);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssEvalParams->pInMotionVectors);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssEvalParams->InJitterOffsetX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssEvalParams->InJitterOffsetY);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlssEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssEvalParams->InReset);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleY);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssEvalParams->pInTransparencyMask);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssEvalParams->pInExposureTexture);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssEvalParams->pInBiasCurrentColorMask);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssEvalParams->GBufferSurface.pInAttrib[8]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssEvalParams->GBufferSurface.pInAttrib[9]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_10, pInDlssEvalParams->GBufferSurface.pInAttrib[10]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssEvalParams->GBufferSurface.pInAttrib[11]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssEvalParams->GBufferSurface.pInAttrib[12]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssEvalParams->GBufferSurface.pInAttrib[13]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssEvalParams->GBufferSurface.pInAttrib[14]);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssEvalParams->GBufferSurface.pInAttrib[15]);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssEvalParams->InToneMapperType);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssEvalParams->pInMotionVectors3D);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssEvalParams->pInIsParticleMask);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssEvalParams->pInAnimatedTextureMask);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssEvalParams->pInDepthHighRes);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssEvalParams->pInPositionViewSpace);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssEvalParams->InFrameTimeDeltaInMsec);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssEvalParams->pInRayTracingHitDistance);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_MotionVectorsReflection, pInDlssEvalParams->pInMotionVectorsReflections);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssEvalParams->InColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssEvalParams->InColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssEvalParams->InDepthSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssEvalParams->InDepthSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssEvalParams->InMVSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssEvalParams->InMVSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssEvalParams->InTranslucencySubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssEvalParams->InTranslucencySubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssEvalParams->InBiasCurrentColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssEvalParams->InBiasCurrentColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssEvalParams->InOutputSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssEvalParams->InOutputSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssEvalParams->InRenderSubrectDimensions.Width);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssEvalParams->InRenderSubrectDimensions.Height);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssEvalParams->InPreExposure);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssEvalParams->InIndicatorInvertXAxis);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssEvalParams->InIndicatorInvertYAxis);
return NVSDK_NGX_D3D11_EvaluateFeature_C(pInCtx, pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_D3D11_CREATE_DLISP_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pDlispCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlispCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlispCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlispCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlispCreateParams->InTargetHeight);
return NVSDK_NGX_D3D11_CreateFeature(pInCtx, NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_CUDA_CREATE_DLISP_EXT(
NVSDK_NGX_Handle** ppOutHandle,
NVSDK_NGX_Parameter* pInParams,
NVSDK_NGX_Feature_Create_Params* pDlispCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlispCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlispCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlispCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlispCreateParams->InTargetHeight);
return NVSDK_NGX_CUDA_CreateFeature(NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D11_EVALUATE_DLISP_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D11_DLISP_Eval_Params *pDlispEvalParams)
{
if (pDlispEvalParams->Feature.InSharpness < 0.0f || pDlispEvalParams->Feature.InSharpness > 1.0f || pDlispEvalParams->InDenoise < 0.0f || pDlispEvalParams->InDenoise > 1.0f)
{
return NVSDK_NGX_Result_FAIL_InvalidParameter;
}
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlispEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlispEvalParams->Feature.pInOutput);
// Both sharpness and denoise in range [0.0f,1.0f]
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlispEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pDlispEvalParams->InDenoise);
// If input is atlas - use RECT to upscale only the required area
if (pDlispEvalParams->InRectW)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pDlispEvalParams->InRectX);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pDlispEvalParams->InRectY);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pDlispEvalParams->InRectW);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pDlispEvalParams->InRectH);
}
return NVSDK_NGX_D3D11_EvaluateFeature_C(pInCtx, pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_CUDA_EVALUATE_DLISP_EXT(
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_CUDA_DLISP_Eval_Params *pDlispEvalParams)
{
if (pDlispEvalParams->Feature.InSharpness < 0.0f || pDlispEvalParams->Feature.InSharpness > 1.0f || pDlispEvalParams->InDenoise < 0.0f || pDlispEvalParams->InDenoise > 1.0f)
{
return NVSDK_NGX_Result_FAIL_InvalidParameter;
}
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pDlispEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pDlispEvalParams->Feature.pInOutput);
// Both sharpness and denoise in range [0.0f,1.0f]
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlispEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pDlispEvalParams->InDenoise);
// If input is atlas - use RECT to upscale only the required area
if (pDlispEvalParams->InRectW)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pDlispEvalParams->InRectX);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pDlispEvalParams->InRectY);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pDlispEvalParams->InRectW);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pDlispEvalParams->InRectH);
}
return NVSDK_NGX_CUDA_EvaluateFeature_C(pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_D3D11_CREATE_DLRESOLVE_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pDlresolveCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlresolveCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlresolveCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlresolveCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlresolveCreateParams->InTargetHeight);
return NVSDK_NGX_D3D11_CreateFeature(pInCtx, NVSDK_NGX_Feature_DeepResolve, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D11_EVALUATE_DLRESOLVE_EXT(
ID3D11DeviceContext *pInCtx,
NVSDK_NGX_Handle *InHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D11_Feature_Eval_Params *pDlresolveEvalParams)
{
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlresolveEvalParams->pInColor);
NVSDK_NGX_Parameter_SetD3d11Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlresolveEvalParams->pInOutput);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlresolveEvalParams->InSharpness);
return NVSDK_NGX_D3D11_EvaluateFeature_C(pInCtx, InHandle, pInParams, NULL);
}
/*** D3D12 ***/
typedef struct NVSDK_NGX_D3D12_Feature_Eval_Params
{
ID3D12Resource* pInColor;
ID3D12Resource* pInOutput;
/*** OPTIONAL for DLSS ***/
float InSharpness;
} NVSDK_NGX_D3D12_Feature_Eval_Params;
typedef struct NVSDK_NGX_D3D12_GBuffer
{
ID3D12Resource* pInAttrib[NVSDK_NGX_GBUFFERTYPE_NUM];
} NVSDK_NGX_D3D12_GBuffer;
typedef struct NVSDK_NGX_D3D12_DLSS_Eval_Params
{
NVSDK_NGX_D3D12_Feature_Eval_Params Feature;
ID3D12Resource* pInDepth;
ID3D12Resource* pInMotionVectors;
float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
float InJitterOffsetY;
NVSDK_NGX_Dimensions InRenderSubrectDimensions;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
int InReset; /* Set to 1 when scene changes completely (new level etc) */
float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
float InMVScaleY;
ID3D12Resource* pInTransparencyMask; /* Unused/Reserved for future use */
ID3D12Resource* pInExposureTexture;
ID3D12Resource* pInBiasCurrentColorMask;
NVSDK_NGX_Coordinates InColorSubrectBase;
NVSDK_NGX_Coordinates InDepthSubrectBase;
NVSDK_NGX_Coordinates InMVSubrectBase;
NVSDK_NGX_Coordinates InTranslucencySubrectBase;
NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
NVSDK_NGX_Coordinates InOutputSubrectBase;
float InPreExposure;
int InIndicatorInvertXAxis;
int InIndicatorInvertYAxis;
/*** OPTIONAL - only for research purposes ***/
NVSDK_NGX_D3D12_GBuffer GBufferSurface;
NVSDK_NGX_ToneMapperType InToneMapperType;
ID3D12Resource* pInMotionVectors3D;
ID3D12Resource* pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
ID3D12Resource* pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
ID3D12Resource* pInDepthHighRes;
ID3D12Resource* pInPositionViewSpace;
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 */
ID3D12Resource* pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
ID3D12Resource* pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
} NVSDK_NGX_D3D12_DLSS_Eval_Params;
typedef struct NVSDK_NGX_D3D12_DLISP_Eval_Params
{
NVSDK_NGX_D3D12_Feature_Eval_Params Feature;
/*** OPTIONAL ***/
unsigned int InRectX;
unsigned int InRectY;
unsigned int InRectW;
unsigned int InRectH;
float InDenoise;
} NVSDK_NGX_D3D12_DLISP_Eval_Params;
static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLSS_EXT(
ID3D12GraphicsCommandList *pInCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssCreateParams->Feature.InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssCreateParams->Feature.InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssCreateParams->Feature.InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssCreateParams->Feature.InTargetHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssCreateParams->Feature.InPerfQualityValue);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssCreateParams->InFeatureCreateFlags);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssCreateParams->InEnableOutputSubrects ? 1 : 0);
return NVSDK_NGX_D3D12_CreateFeature(pInCmdList, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLSS_EXT(
ID3D12GraphicsCommandList *pInCmdList,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D12_DLSS_Eval_Params *pInDlssEvalParams)
{
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Color, pInDlssEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Output, pInDlssEvalParams->Feature.pInOutput);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssEvalParams->pInDepth);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssEvalParams->pInMotionVectors);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssEvalParams->InJitterOffsetX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssEvalParams->InJitterOffsetY);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlssEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssEvalParams->InReset);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleY);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssEvalParams->pInTransparencyMask);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssEvalParams->pInExposureTexture);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssEvalParams->pInBiasCurrentColorMask);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssEvalParams->GBufferSurface.pInAttrib[8]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssEvalParams->GBufferSurface.pInAttrib[9]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_10, pInDlssEvalParams->GBufferSurface.pInAttrib[10]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssEvalParams->GBufferSurface.pInAttrib[11]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssEvalParams->GBufferSurface.pInAttrib[12]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssEvalParams->GBufferSurface.pInAttrib[13]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssEvalParams->GBufferSurface.pInAttrib[14]);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssEvalParams->GBufferSurface.pInAttrib[15]);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssEvalParams->InToneMapperType);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssEvalParams->pInMotionVectors3D);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssEvalParams->pInIsParticleMask);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssEvalParams->pInAnimatedTextureMask);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssEvalParams->pInDepthHighRes);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssEvalParams->pInPositionViewSpace);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssEvalParams->InFrameTimeDeltaInMsec);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssEvalParams->pInRayTracingHitDistance);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_MotionVectorsReflection, pInDlssEvalParams->pInMotionVectorsReflections);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssEvalParams->InColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssEvalParams->InColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssEvalParams->InDepthSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssEvalParams->InDepthSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssEvalParams->InMVSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssEvalParams->InMVSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssEvalParams->InTranslucencySubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssEvalParams->InTranslucencySubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssEvalParams->InBiasCurrentColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssEvalParams->InBiasCurrentColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssEvalParams->InOutputSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssEvalParams->InOutputSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssEvalParams->InRenderSubrectDimensions.Width);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssEvalParams->InRenderSubrectDimensions.Height);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssEvalParams->InPreExposure);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssEvalParams->InIndicatorInvertXAxis);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssEvalParams->InIndicatorInvertYAxis);
return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLISP_EXT(
ID3D12GraphicsCommandList *InCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pDlispCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlispCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlispCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlispCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlispCreateParams->InTargetHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pDlispCreateParams->InPerfQualityValue);
return NVSDK_NGX_D3D12_CreateFeature(InCmdList, NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLISP_EXT(
ID3D12GraphicsCommandList *pInCmdList,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D12_DLISP_Eval_Params *pDlispEvalParams)
{
if (pDlispEvalParams->Feature.InSharpness < 0.0f || pDlispEvalParams->Feature.InSharpness > 1.0f || pDlispEvalParams->InDenoise < 0.0f || pDlispEvalParams->InDenoise > 1.0f)
{
return NVSDK_NGX_Result_FAIL_InvalidParameter;
}
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlispEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlispEvalParams->Feature.pInOutput);
// Both sharpness and denoise in range [0.0f,1.0f]
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlispEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pDlispEvalParams->InDenoise);
// If input is atlas - use RECT to upscale only the required area
if (pDlispEvalParams->InRectW)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pDlispEvalParams->InRectX);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pDlispEvalParams->InRectY);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pDlispEvalParams->InRectW);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pDlispEvalParams->InRectH);
}
return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_D3D12_CREATE_DLRESOLVE_EXT(
ID3D12GraphicsCommandList *pInCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pDlresolveCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pDlresolveCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pDlresolveCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pDlresolveCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pDlresolveCreateParams->InTargetHeight);
return NVSDK_NGX_D3D12_CreateFeature(pInCmdList, NVSDK_NGX_Feature_DeepResolve, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_D3D12_EVALUATE_DLRESOLVE_EXT(
ID3D12GraphicsCommandList *pInCmdList,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_D3D12_Feature_Eval_Params *pDlresolveEvalParams)
{
// This call to NVSDK_NGX_Parameter_SetXXX() is equivalent to the Params->Set below functionally
// but to work around the lack of virtual functions and polymorphism in a C only project
// we introduced this new way to set params.
// The test should enforce that both paths work.
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Color, pDlresolveEvalParams->pInColor);
NVSDK_NGX_Parameter_SetD3d12Resource(pInParams, NVSDK_NGX_Parameter_Output, pDlresolveEvalParams->pInOutput);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pDlresolveEvalParams->InSharpness);
return NVSDK_NGX_D3D12_EvaluateFeature_C(pInCmdList, pInHandle, pInParams, NULL);
}
#endif

View File

@@ -0,0 +1,318 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#ifndef NVSDK_NGX_HELPERS_VK_H
#define NVSDK_NGX_HELPERS_VK_H
#pragma once
#include "nvsdk_ngx_vk.h"
#define NVSDK_NGX_ENSURE_VK_IMAGEVIEW(InResource) if ((InResource) && (InResource)->Type != NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW) { return NVSDK_NGX_Result_FAIL_InvalidParameter; }
static 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)
{
NVSDK_NGX_Resource_VK resourceVK = {0};
resourceVK.Type = NVSDK_NGX_RESOURCE_VK_TYPE_VK_IMAGEVIEW;
resourceVK.Resource.ImageViewInfo.ImageView = imageView;
resourceVK.Resource.ImageViewInfo.Image = image;
resourceVK.Resource.ImageViewInfo.SubresourceRange = subresourceRange;
resourceVK.Resource.ImageViewInfo.Height = height;
resourceVK.Resource.ImageViewInfo.Width = width;
resourceVK.Resource.ImageViewInfo.Format = format;
resourceVK.ReadWrite = readWrite;
return resourceVK;
}
static inline NVSDK_NGX_Resource_VK NVSDK_NGX_Create_Buffer_Resource_VK(VkBuffer buffer, unsigned int sizeInBytes, bool readWrite)
{
NVSDK_NGX_Resource_VK resourceVK = {0};
resourceVK.Type = NVSDK_NGX_RESOURCE_VK_TYPE_VK_BUFFER;
resourceVK.Resource.BufferInfo.Buffer = buffer;
resourceVK.Resource.BufferInfo.SizeInBytes = sizeInBytes;
resourceVK.ReadWrite = readWrite;
return resourceVK;
}
typedef struct NVSDK_NGX_VK_Feature_Eval_Params
{
NVSDK_NGX_Resource_VK *pInColor;
NVSDK_NGX_Resource_VK *pInOutput;
/*** OPTIONAL for DLSS ***/
float InSharpness;
} NVSDK_NGX_VK_Feature_Eval_Params;
typedef struct NVSDK_NGX_VK_GBuffer
{
NVSDK_NGX_Resource_VK *pInAttrib[NVSDK_NGX_GBUFFERTYPE_NUM];
} NVSDK_NGX_VK_GBuffer;
typedef struct NVSDK_NGX_Coordinates_VK
{
unsigned int X;
unsigned int Y;
} NVSDK_NGX_Coordinates_VK;
typedef struct NVSDK_NGX_VK_DLSS_Eval_Params
{
NVSDK_NGX_VK_Feature_Eval_Params Feature;
NVSDK_NGX_Resource_VK * pInDepth;
NVSDK_NGX_Resource_VK * pInMotionVectors;
float InJitterOffsetX; /* Jitter offset must be in input/render pixel space */
float InJitterOffsetY;
NVSDK_NGX_Dimensions InRenderSubrectDimensions;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
int InReset; /* Set to 1 when scene changes completely (new level etc) */
float InMVScaleX; /* If MVs need custom scaling to convert to pixel space */
float InMVScaleY;
NVSDK_NGX_Resource_VK * pInTransparencyMask; /* Unused/Reserved for future use */
NVSDK_NGX_Resource_VK * pInExposureTexture;
NVSDK_NGX_Resource_VK * pInBiasCurrentColorMask;
NVSDK_NGX_Coordinates InColorSubrectBase;
NVSDK_NGX_Coordinates InDepthSubrectBase;
NVSDK_NGX_Coordinates InMVSubrectBase;
NVSDK_NGX_Coordinates InTranslucencySubrectBase;
NVSDK_NGX_Coordinates InBiasCurrentColorSubrectBase;
NVSDK_NGX_Coordinates InOutputSubrectBase;
float InPreExposure;
int InIndicatorInvertXAxis;
int InIndicatorInvertYAxis;
/*** OPTIONAL - only for research purposes ***/
NVSDK_NGX_VK_GBuffer GBufferSurface;
NVSDK_NGX_ToneMapperType InToneMapperType;
NVSDK_NGX_Resource_VK * pInMotionVectors3D;
NVSDK_NGX_Resource_VK * pInIsParticleMask; /* to identify which pixels contains particles, essentially that are not drawn as part of base pass */
NVSDK_NGX_Resource_VK * pInAnimatedTextureMask; /* a binary mask covering pixels occupied by animated textures */
NVSDK_NGX_Resource_VK * pInDepthHighRes;
NVSDK_NGX_Resource_VK * pInPositionViewSpace;
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 */
NVSDK_NGX_Resource_VK * pInRayTracingHitDistance; /* for each effect - approximation to the amount of noise in a ray-traced color */
NVSDK_NGX_Resource_VK * pInMotionVectorsReflections; /* motion vectors of reflected objects like for mirrored surfaces */
} NVSDK_NGX_VK_DLSS_Eval_Params;
typedef struct NVSDK_NGX_VK_DLISP_Eval_Params
{
NVSDK_NGX_VK_Feature_Eval_Params Feature;
/*** OPTIONAL - leave to 0/0.0f if unused ***/
unsigned int InRectX;
unsigned int InRectY;
unsigned int InRectW;
unsigned int InRectH;
float InDenoise;
} NVSDK_NGX_VK_DLISP_Eval_Params;
static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLSS_EXT1(
VkDevice InDevice,
VkCommandBuffer InCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssCreateParams->Feature.InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssCreateParams->Feature.InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssCreateParams->Feature.InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssCreateParams->Feature.InTargetHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlssCreateParams->Feature.InPerfQualityValue);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssCreateParams->InFeatureCreateFlags);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Enable_Output_Subrects, pInDlssCreateParams->InEnableOutputSubrects ? 1 : 0);
if (InDevice) return NVSDK_NGX_VULKAN_CreateFeature1(InDevice, InCmdList, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
else return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_SuperSampling, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLSS_EXT(
VkCommandBuffer InCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_DLSS_Create_Params *pInDlssCreateParams)
{
return NGX_VULKAN_CREATE_DLSS_EXT1(NULL, InCmdList, InCreationNodeMask, InVisibilityNodeMask, ppOutHandle, pInParams, pInDlssCreateParams);
}
static inline NVSDK_NGX_Result NGX_VULKAN_EVALUATE_DLSS_EXT(
VkCommandBuffer InCmdList,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_VK_DLSS_Eval_Params *pInDlssEvalParams)
{
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->Feature.pInColor);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInMotionVectors);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->Feature.pInOutput);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInDepth);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInTransparencyMask);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInExposureTexture);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInBiasCurrentColorMask);
for (size_t i = 0; i <= 15; i++)
{
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->GBufferSurface.pInAttrib[i]);
}
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInMotionVectors3D);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInIsParticleMask);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInAnimatedTextureMask);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInDepthHighRes);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInPositionViewSpace);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInRayTracingHitDistance);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlssEvalParams->pInMotionVectorsReflections);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlssEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlssEvalParams->Feature.pInOutput);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Depth, pInDlssEvalParams->pInDepth);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectors, pInDlssEvalParams->pInMotionVectors);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_X, pInDlssEvalParams->InJitterOffsetX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Jitter_Offset_Y, pInDlssEvalParams->InJitterOffsetY);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlssEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_Reset, pInDlssEvalParams->InReset);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_X, pInDlssEvalParams->InMVScaleX == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleX);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_MV_Scale_Y, pInDlssEvalParams->InMVScaleY == 0.0f ? 1.0f : pInDlssEvalParams->InMVScaleY);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_TransparencyMask, pInDlssEvalParams->pInTransparencyMask);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_ExposureTexture, pInDlssEvalParams->pInExposureTexture);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, pInDlssEvalParams->pInBiasCurrentColorMask);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Albedo, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ALBEDO]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Roughness, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_ROUGHNESS]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Metallic, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_METALLIC]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Specular, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SPECULAR]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Subsurface, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SUBSURFACE]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Normals, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_NORMALS]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_ShadingModelId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_SHADINGMODELID]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_MaterialId, pInDlssEvalParams->GBufferSurface.pInAttrib[NVSDK_NGX_GBUFFER_MATERIALID]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_8, pInDlssEvalParams->GBufferSurface.pInAttrib[8]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_9, pInDlssEvalParams->GBufferSurface.pInAttrib[9]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_10, pInDlssEvalParams->GBufferSurface.pInAttrib[10]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_11, pInDlssEvalParams->GBufferSurface.pInAttrib[11]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_12, pInDlssEvalParams->GBufferSurface.pInAttrib[12]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_13, pInDlssEvalParams->GBufferSurface.pInAttrib[13]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_14, pInDlssEvalParams->GBufferSurface.pInAttrib[14]);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_GBuffer_Atrrib_15, pInDlssEvalParams->GBufferSurface.pInAttrib[15]);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_TonemapperType, pInDlssEvalParams->InToneMapperType);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectors3D, pInDlssEvalParams->pInMotionVectors3D);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_IsParticleMask, pInDlssEvalParams->pInIsParticleMask);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_AnimatedTextureMask, pInDlssEvalParams->pInAnimatedTextureMask);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_DepthHighRes, pInDlssEvalParams->pInDepthHighRes);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Position_ViewSpace, pInDlssEvalParams->pInPositionViewSpace);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, pInDlssEvalParams->InFrameTimeDeltaInMsec);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_RayTracingHitDistance, pInDlssEvalParams->pInRayTracingHitDistance);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_MotionVectorsReflection, pInDlssEvalParams->pInMotionVectorsReflections);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_X, pInDlssEvalParams->InColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Color_Subrect_Base_Y, pInDlssEvalParams->InColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_X, pInDlssEvalParams->InDepthSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Depth_Subrect_Base_Y, pInDlssEvalParams->InDepthSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_X, pInDlssEvalParams->InMVSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_MV_SubrectBase_Y, pInDlssEvalParams->InMVSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_X, pInDlssEvalParams->InTranslucencySubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Translucency_SubrectBase_Y, pInDlssEvalParams->InTranslucencySubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_X, pInDlssEvalParams->InBiasCurrentColorSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_SubrectBase_Y, pInDlssEvalParams->InBiasCurrentColorSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_X, pInDlssEvalParams->InOutputSubrectBase.X);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Output_Subrect_Base_Y, pInDlssEvalParams->InOutputSubrectBase.Y);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width , pInDlssEvalParams->InRenderSubrectDimensions.Width);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, pInDlssEvalParams->InRenderSubrectDimensions.Height);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_DLSS_Pre_Exposure, pInDlssEvalParams->InPreExposure == 0.0f ? 1.0f : pInDlssEvalParams->InPreExposure);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_X_Axis, pInDlssEvalParams->InIndicatorInvertXAxis);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Indicator_Invert_Y_Axis, pInDlssEvalParams->InIndicatorInvertYAxis);
return NVSDK_NGX_VULKAN_EvaluateFeature_C(InCmdList, pInHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLISP_EXT(
VkCommandBuffer InCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pInDlispCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlispCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlispCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlispCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlispCreateParams->InTargetHeight);
NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_PerfQualityValue, pInDlispCreateParams->InPerfQualityValue);
return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_ImageSignalProcessing, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_VULKAN_EVALUATE_DLISP_EXT(
VkCommandBuffer InCmdList,
NVSDK_NGX_Handle *InHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_VK_DLISP_Eval_Params *pInDlispEvalParams)
{
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlispEvalParams->Feature.pInColor);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlispEvalParams->Feature.pInOutput);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlispEvalParams->Feature.pInColor);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlispEvalParams->Feature.pInOutput);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlispEvalParams->Feature.InSharpness);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Denoise, pInDlispEvalParams->InDenoise);
// If input is atlas - use RECT to upscale only the required area
if (pInDlispEvalParams->InRectW)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_X, pInDlispEvalParams->InRectX);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_Y, pInDlispEvalParams->InRectY);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_W, pInDlispEvalParams->InRectW);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Rect_H, pInDlispEvalParams->InRectH);
}
return NVSDK_NGX_VULKAN_EvaluateFeature_C(InCmdList, InHandle, pInParams, NULL);
}
static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLRESOLVE_EXT(
VkCommandBuffer InCmdList,
unsigned int InCreationNodeMask,
unsigned int InVisibilityNodeMask,
NVSDK_NGX_Handle **ppOutHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_Feature_Create_Params *pInDlresolveCreateParams)
{
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlresolveCreateParams->InWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlresolveCreateParams->InHeight);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlresolveCreateParams->InTargetWidth);
NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlresolveCreateParams->InTargetHeight);
return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_DeepResolve, pInParams, ppOutHandle);
}
static inline NVSDK_NGX_Result NGX_VULKAN_EVALUATE_DLRESOLVE_EXT(
VkCommandBuffer InCmdList,
NVSDK_NGX_Handle *pInHandle,
NVSDK_NGX_Parameter *pInParams,
NVSDK_NGX_VK_Feature_Eval_Params *pInDlresolveEvalParams)
{
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlresolveEvalParams->pInColor);
NVSDK_NGX_ENSURE_VK_IMAGEVIEW(pInDlresolveEvalParams->pInOutput);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Color, pInDlresolveEvalParams->pInColor);
NVSDK_NGX_Parameter_SetVoidPointer(pInParams, NVSDK_NGX_Parameter_Output, pInDlresolveEvalParams->pInOutput);
NVSDK_NGX_Parameter_SetF(pInParams, NVSDK_NGX_Parameter_Sharpness, pInDlresolveEvalParams->InSharpness);
return NVSDK_NGX_VULKAN_EvaluateFeature_C(InCmdList, pInHandle, pInParams, NULL);
}
#endif // NVSDK_NGX_HELPERS_VK_H

View File

@@ -0,0 +1,117 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#ifndef NVSDK_NGX_PARAMS_H
#define NVSDK_NGX_PARAMS_H
#include "nvsdk_ngx_defs.h"
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct ID3D11Resource ID3D11Resource;
typedef struct ID3D12Resource ID3D12Resource;
typedef struct NVSDK_NGX_Feature_Create_Params
{
unsigned int InWidth;
unsigned int InHeight;
unsigned int InTargetWidth;
unsigned int InTargetHeight;
/*** OPTIONAL ***/
NVSDK_NGX_PerfQuality_Value InPerfQualityValue;
} NVSDK_NGX_Feature_Create_Params;
typedef struct NVSDK_NGX_DLSS_Create_Params
{
NVSDK_NGX_Feature_Create_Params Feature;
/*** OPTIONAL ***/
int InFeatureCreateFlags;
bool InEnableOutputSubrects;
} NVSDK_NGX_DLSS_Create_Params;
#ifdef __cplusplus
typedef struct NVSDK_NGX_Parameter
{
virtual void Set(const char * InName, unsigned long long InValue) = 0;
virtual void Set(const char * InName, float InValue) = 0;
virtual void Set(const char * InName, double InValue) = 0;
virtual void Set(const char * InName, unsigned int InValue) = 0;
virtual void Set(const char * InName, int InValue) = 0;
virtual void Set(const char * InName, ID3D11Resource *InValue) = 0;
virtual void Set(const char * InName, ID3D12Resource *InValue) = 0;
virtual void Set(const char * InName, void *InValue) = 0;
virtual NVSDK_NGX_Result Get(const char * InName, unsigned long long *OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, float *OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, double *OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, unsigned int *OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, int *OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, ID3D11Resource **OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, ID3D12Resource **OutValue) const = 0;
virtual NVSDK_NGX_Result Get(const char * InName, void **OutValue) const = 0;
virtual void Reset() = 0;
} NVSDK_NGX_Parameter;
#else
typedef struct NVSDK_NGX_Parameter NVSDK_NGX_Parameter;
#endif // _cplusplus
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetULL)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetULL(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetF)(NVSDK_NGX_Parameter *InParameter, const char * InName, float InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetF(NVSDK_NGX_Parameter *InParameter, const char * InName, float InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetD)(NVSDK_NGX_Parameter *InParameter, const char * InName, double InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetD(NVSDK_NGX_Parameter *InParameter, const char * InName, double InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetUI)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetUI(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetI)(NVSDK_NGX_Parameter *InParameter, const char * InName, int InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetI(NVSDK_NGX_Parameter *InParameter, const char * InName, int InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetD3d11Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource *InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetD3d11Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource *InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetD3d12Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource *InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetD3d12Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource *InValue);
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_SetVoidPointer)(NVSDK_NGX_Parameter *InParameter, const char * InName, void *InValue);
NVSDK_NGX_API void NVSDK_CONV NVSDK_NGX_Parameter_SetVoidPointer(NVSDK_NGX_Parameter *InParameter, const char * InName, void *InValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetULL)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long *OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetULL(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned long long *OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetF)(NVSDK_NGX_Parameter *InParameter, const char * InName, float *OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetF(NVSDK_NGX_Parameter *InParameter, const char * InName, float *OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetD)(NVSDK_NGX_Parameter *InParameter, const char * InName, double *OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetD(NVSDK_NGX_Parameter *InParameter, const char * InName, double *OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetUI)(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int *OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetUI(NVSDK_NGX_Parameter *InParameter, const char * InName, unsigned int *OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetI)(NVSDK_NGX_Parameter *InParameter, const char * InName, int *OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetI(NVSDK_NGX_Parameter *InParameter, const char * InName, int *OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetD3d11Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource **OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetD3d11Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D11Resource **OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetD3d12Resource)(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource **OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetD3d12Resource(NVSDK_NGX_Parameter *InParameter, const char * InName, ID3D12Resource **OutValue);
typedef NVSDK_NGX_Result (NVSDK_CONV *PFN_NVSDK_NGX_Parameter_GetVoidPointer)(NVSDK_NGX_Parameter *InParameter, const char * InName, void **OutValue);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_Parameter_GetVoidPointer(NVSDK_NGX_Parameter *InParameter, const char * InName, void **OutValue);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // #define NVSDK_NGX_PARAMS_H

View File

@@ -0,0 +1,462 @@
/*
* Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
/*
* HOW TO USE:
*
* IMPORTANT: Methods in this library are NOT thread safe. It is up to the
* client to ensure that thread safety is enforced as needed.
*
* 1) Call NVSDK_CONV NVSDK_NGX_D3D11/D3D12/CUDA_Init and pass your app Id
* and other parameters. This will initialize SDK or return an error code
* if SDK cannot run on target machine. Depending on error user might
* need to update drivers. Please note that application Id is provided
* by NVIDIA so if you do not have one please contact us.
*
* 2) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetParameters to obtain pointer to
* interface used to pass parameters to SDK. Interface instance is
* allocated and released by SDK so there is no need to do any memory
* management on client side.
*
* 3) Set key parameters for the feature you want to use. For example,
* width and height are required for all features and they can be
* set like this:
* Params->Set(NVSDK_NGX_Parameter_Width,MY_WIDTH);
* Params->Set(NVSDK_NGX_Parameter_Height,MY_HEIGHT);
*
* You can also provide hints like NVSDK_NGX_Parameter_Hint_HDR to tell
* SDK that it should expect HDR color space is needed. Please refer to
* samples since different features need different parameters and hints.
*
* 4) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetScratchBufferSize to obtain size of
* the scratch buffer needed by specific feature. This D3D or CUDA buffer
* should be allocated by client and passed as:
* Params->Set(NVSDK_NGX_Parameter_Scratch,MY_SCRATCH_POINTER)
* Params->Set(NVSDK_NGX_Parameter_Scratch_SizeInBytes,MY_SCRATCH_SIZE_IN_BYTES)
* NOTE: Returned size can be 0 if feature does not use any scratch buffer.
* It is OK to use bigger buffer or reuse buffers across features as long
* as minimum size requirement is met.
*
* 5) Call NVSDK_NGX_D3D11/D3D12/CUDA_CreateFeature to create feature you need.
* On success SDK will return a handle which must be used in any successive
* calls to SDK which require feature handle. SDK will use all parameters
* and hints provided by client to generate feature. If feature with the same
* parameters already exists and error code will be returned.
*
* 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_EvaluateFeature to invoke execution of
* specific feature. Before feature can be evaluated input parameters must
* be specified (like for example color/albedo buffer, motion vectors etc)
*
* 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_ReleaseFeature when feature is no longer
* needed. After this call feature handle becomes invalid and cannot be used.
*
* 7) Call NVSDK_NGX_D3D11/D3D12/CUDA_Shutdown when SDK is no longer needed to
* release all resources.
* Contact: ngxsupport@nvidia.com
*/
#ifndef NVSDK_NGX_VK_H
#define NVSDK_NGX_VK_H
#include "nvsdk_ngx_defs.h"
#include "nvsdk_ngx_params.h"
#ifndef __cplusplus
#include <stdbool.h>
#include <wchar.h>
#endif
#ifdef __cplusplus
extern "C"
{
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_ImageViewInfo_VK [Vulkan only]
// Contains ImageView-specific metadata.
// ImageView:
// The VkImageView resource.
//
// Image:
// The VkImage associated to this VkImageView.
//
// SubresourceRange:
// The VkImageSubresourceRange associated to this VkImageView.
//
// Format:
// The format of the resource.
//
// Width:
// The width of the resource.
//
// Height:
// The height of the resource.
//
typedef struct NVSDK_NGX_ImageViewInfo_VK {
VkImageView ImageView;
VkImage Image;
VkImageSubresourceRange SubresourceRange;
VkFormat Format;
unsigned int Width;
unsigned int Height;
} NVSDK_NGX_ImageViewInfo_VK;
///////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_BufferInfo_VK [Vulkan only]
// Contains Buffer-specific metadata.
// Buffer
// The VkBuffer resource.
//
// SizeInBytes:
// The size of the resource (in bytes).
//
typedef struct NVSDK_NGX_BufferInfo_VK {
VkBuffer Buffer;
unsigned int SizeInBytes;
} NVSDK_NGX_BufferInfo_VK;
///////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Resource_VK [Vulkan only]
//
// ImageViewInfo:
// The VkImageView resource, and VkImageView-specific metadata. A NVSDK_NGX_Resource_VK can only have one of ImageViewInfo or BufferInfo.
//
// BufferInfo:
// The VkBuffer Resource, and VkBuffer-specific metadata. A NVSDK_NGX_Resource_VK can only have one of ImageViewInfo or BufferInfo.
//
// Type:
// Whether or this resource is a VkImageView or a VkBuffer.
//
// ReadWrite:
// True if the resource is available for read and write access.
// For VkBuffer resources: VkBufferUsageFlags includes VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT or VK_BUFFER_USAGE_STORAGE_BUFFER_BIT
// For VkImage resources: VkImageUsageFlags for associated VkImage includes VK_IMAGE_USAGE_STORAGE_BIT
//
typedef struct NVSDK_NGX_Resource_VK {
union {
NVSDK_NGX_ImageViewInfo_VK ImageViewInfo;
NVSDK_NGX_BufferInfo_VK BufferInfo;
} Resource;
NVSDK_NGX_Resource_VK_Type Type;
bool ReadWrite;
} NVSDK_NGX_Resource_VK;
///////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_RequiredExtensions [Vulkan only]
//
// OutInstanceExtCount:
// Returns the number of instance extensions NGX requires
//
// OutInstanceExts:
// Returns a pointer to *OutInstanceExtCount strings of instance extensions
//
// OutDeviceExtCount:
// Returns the number of device extensions NGX requires
//
// OutDeviceExts:
// Returns a pointer to *OutDeviceExtCount strings of device extensions
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_RequiredExtensions(unsigned int *OutInstanceExtCount, const char *** OutInstanceExts, unsigned int *OutDeviceExtCount, const char *** OutDeviceExts);
///////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Init
// -------------------------------------
//
// InApplicationId:
// Unique Id provided by NVIDIA
//
// InApplicationDataPath:
// Folder to store logs and other temporary files (write access required),
// Normally this would be a location in Documents or ProgramData.
//
// InDevice: [d3d11/12 only]
// DirectX device to use
//
// DESCRIPTION:
// Initializes new SDK instance.
//
#ifdef __cplusplus
NVSDK_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, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
#else
NVSDK_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, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Init_with_ProjectID
// -------------------------------------
//
// InParojectId:
// Unique Id provided by the rendering engine used
//
// InEngineType:
// Rendering engine used by the application / plugin.
// Use NVSDK_NGX_ENGINE_TYPE_CUSTOM if the specific engine type is not supported explicitly
//
// InEngineVersion:
// Version number of the rendering engine used by the application / plugin.
//
// InApplicationDataPath:
// Folder to store logs and other temporary files (write access required),
// Normally this would be a location in Documents or ProgramData.
//
// InDevice: [d3d11/12 only]
// DirectX device to use
//
// InFeatureInfo:
// Contains information common to all features, presently only a list of all paths
// feature dlls can be located in, other than the default path - application directory.
//
// DESCRIPTION:
// Initializes new SDK instance.
//
#ifdef __cplusplus
NVSDK_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, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo = nullptr, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);
#else
NVSDK_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, const NVSDK_NGX_FeatureCommonInfo *InFeatureInfo, NVSDK_NGX_Version InSDKVersion);
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Shutdown
// -------------------------------------
//
// DESCRIPTION:
// Shuts down the current SDK instance and releases all resources.
// Shutdown1(Device) only affects specified device
// Shutdown1(nullptr) = Shutdown() and shuts down all devices
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Shutdown(void);
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Shutdown1(VkDevice InDevice);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_GetParameters
// ----------------------------------------------------------
//
// OutParameters:
// Parameters interface used to set any parameter needed by the SDK
//
// DESCRIPTION:
// This interface allows simple parameter setup using named fields.
// For example one can set width by calling Set(NVSDK_NGX_Parameter_Denoiser_Width,100) or
// provide CUDA buffer pointer by calling Set(NVSDK_NGX_Parameter_Denoiser_Color,cudaBuffer)
// For more details please see sample code. Please note that allocated memory
// will be freed by NGX so free/delete operator should NOT be called.
// Parameter maps output by NVSDK_NGX_GetParameters are also pre-populated
// with NGX capabilities and available features.
// Unlike with NVSDK_NGX_AllocateParameters, parameter maps output by NVSDK_NGX_GetParameters
// have their lifetimes managed by NGX, and must not
// be destroyed by the app using NVSDK_NGX_DestroyParameters.
// NVSDK_NGX_GetParameters is soon to be deprecated and apps should move to using
// NVSDK_NGX_AllocateParameters and NVSDK_NGX_GetCapabilityParameters when possible.
// Nevertheless, due to the possibility that the user will be using an older driver version,
// NVSDK_NGX_GetParameters should still be used as a fallback if NVSDK_NGX_AllocateParameters
// or NVSDK_NGX_GetCapabilityParameters return NVSDK_NGX_Result_FAIL_OutOfDate.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetParameters(NVSDK_NGX_Parameter **OutParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_AllocateParameters
// ----------------------------------------------------------
//
// OutParameters:
// Parameters interface used to set any parameter needed by the SDK
//
// DESCRIPTION:
// This interface allows allocating a simple parameter setup using named fields, whose
// lifetime the app must manage.
// For example one can set width by calling Set(NVSDK_NGX_Parameter_Denoiser_Width,100) or
// provide CUDA buffer pointer by calling Set(NVSDK_NGX_Parameter_Denoiser_Color,cudaBuffer)
// For more details please see sample code.
// Parameter maps output by NVSDK_NGX_AllocateParameters must NOT be freed using
// the free/delete operator; to free a parameter map
// output by NVSDK_NGX_AllocateParameters, NVSDK_NGX_DestroyParameters should be used.
// Unlike with NVSDK_NGX_GetParameters, parameter maps allocated with NVSDK_NGX_AllocateParameters
// must be destroyed by the app using NVSDK_NGX_DestroyParameters.
// Also unlike with NVSDK_NGX_GetParameters, parameter maps output by NVSDK_NGX_AllocateParameters
// do not come pre-populated with NGX capabilities and available features.
// To create a new parameter map pre-populated with such information, NVSDK_NGX_GetCapabilityParameters
// should be used.
// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
// does not support this API call is being used. In such a case, NVSDK_NGX_GetParameters
// may be used as a fallback.
// This function may only be called after a successful call into NVSDK_NGX_Init.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_GetCapabilityParameters
// ----------------------------------------------------------
//
// OutParameters:
// The parameters interface populated with NGX and feature capabilities
//
// DESCRIPTION:
// This interface allows the app to create a new parameter map
// pre-populated with NGX capabilities and available features.
// The output parameter map can also be used for any purpose
// parameter maps output by NVSDK_NGX_AllocateParameters can be used for
// but it is not recommended to use NVSDK_NGX_GetCapabilityParameters
// unless querying NGX capabilities and available features
// due to the overhead associated with pre-populating the parameter map.
// Parameter maps output by NVSDK_NGX_GetCapabilityParameters must NOT be freed using
// the free/delete operator; to free a parameter map
// output by NVSDK_NGX_GetCapabilityParameters, NVSDK_NGX_DestroyParameters should be used.
// Unlike with NVSDK_NGX_GetParameters, parameter maps allocated with NVSDK_NGX_GetCapabilityParameters
// must be destroyed by the app using NVSDK_NGX_DestroyParameters.
// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
// does not support this API call is being used. This function may only be called
// after a successful call into NVSDK_NGX_Init.
// If NVSDK_NGX_GetCapabilityParameters fails with NVSDK_NGX_Result_FAIL_OutOfDate,
// NVSDK_NGX_GetParameters may be used as a fallback, to get a parameter map pre-populated
// with NGX capabilities and available features.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_DestroyParameters
// ----------------------------------------------------------
//
// InParameters:
// The parameters interface to be destroyed
//
// DESCRIPTION:
// This interface allows the app to destroy the parameter map passed in. Once
// NVSDK_NGX_DestroyParameters is called on a parameter map, it
// must not be used again.
// NVSDK_NGX_DestroyParameters must not be called on any parameter map returned
// by NVSDK_NGX_GetParameters; NGX will manage the lifetime of those
// parameter maps.
// This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
// does not support this API call is being used. This function may only be called
// after a successful call into NVSDK_NGX_Init.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
////////////////////////////////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_GetScratchBufferSize
// ----------------------------------------------------------
//
// InFeatureId:
// AI feature in question
//
// InParameters:
// Parameters used by the feature to help estimate scratch buffer size
//
// OutSizeInBytes:
// Number of bytes needed for the scratch buffer for the specified feature.
//
// DESCRIPTION:
// SDK needs a buffer of a certain size provided by the client in
// order to initialize AI feature. Once feature is no longer
// needed buffer can be released. It is safe to reuse the same
// scratch buffer for different features as long as minimum size
// requirement is met for all features. Please note that some
// features might not need a scratch buffer so return size of 0
// is completely valid.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
/////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_CreateFeature
// -------------------------------------
//
// InCmdBuffer:
// Command buffer to use to execute GPU commands. Must be:
// - Open and recording
// InFeatureID:
// AI feature to initialize
//
// InParameters:
// List of parameters
//
// OutHandle:
// Handle which uniquely identifies the feature. If feature with
// provided parameters already exists the "already exists" error code is returned.
//
// DESCRIPTION:
// Each feature needs to be created before it can be used.
// Refer to the sample code to find out which input parameters
// are needed to create specific feature.
// CreateFeature() creates feature on single existing Device
// CreateFeature1() creates feature on the specified Device
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_CreateFeature(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Feature InFeatureID, const NVSDK_NGX_Parameter *InParameters, NVSDK_NGX_Handle **OutHandle);
NVSDK_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);
/////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_Release
// -------------------------------------
//
// InHandle:
// Handle to feature to be released
//
// DESCRIPTION:
// Releases feature with a given handle.
// Handles are not reference counted so
// after this call it is invalid to use provided handle.
//
NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
/////////////////////////////////////////////////////////////////////////
// NVSDK_NGX_EvaluateFeature
// -------------------------------------
//
// InCmdList:[d3d12 only]
// Command list to use to execute GPU commands. Must be:
// - Open and recording
// - With node mask including the device provided in NVSDK_NGX_D3D12_Init
// - Execute on non-copy command queue.
// InDevCtx: [d3d11 only]
// Device context to use to execute GPU commands
//
// InFeatureHandle:
// Handle representing feature to be evaluated
//
// InParameters:
// List of parameters required to evaluate feature
//
// InCallback:
// Optional callback for features which might take longer
// to execture. If specified SDK will call it with progress
// values in range 0.0f - 1.0f
//
// DESCRIPTION:
// Evaluates given feature using the provided parameters and
// pre-trained NN. Please note that for most features
// it can be benefitials to pass as many input buffers and parameters
// as possible (for example provide all render targets like color, albedo, normals, depth etc)
//
#ifdef __cplusplus
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback)(float InCurrentProgress, bool &OutShouldCancel);
NVSDK_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);
#endif
typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback_C)(float InCurrentProgress, bool *OutShouldCancel);
NVSDK_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);
// NGX return-code conversion-to-string utility only as a helper for debugging/logging - not for official use.
const wchar_t* NVSDK_CONV GetNGXResultAsString(NVSDK_NGX_Result InNGXResult);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // #define NVSDK_NGX_VK_H

View File

@@ -0,0 +1,408 @@
NVIDIA RTX SDKs LICENSE
This license is a legal agreement between you and NVIDIA Corporation ("NVIDIA")
and governs the use of the NVIDIA RTX software development kits, including the
DLSS SDK, NGX SDK, RTXGI SDK, RTXDI SDK and/or NRD SDK, if and when made
available to you under this license (in each case, the "SDK"). This license can
be accepted only by an adult of legal age of majority in the country in which
the SDK is used. If you are under the legal age of majority, you must ask your
parent or legal guardian to consent to this license. If you are entering this
license on behalf of a company or other legal entity, you represent that you
have legal authority and "you" will mean the entity you represent. By using the
SDK, you affirm that you have reached the legal age of majority, you accept the
terms of this license, and you take legal and financial responsibility for the
actions of your permitted users.
You agree to use the SDK only for purposes that are permitted by (a) this
license, and (b) any applicable law, regulation or generally accepted practices
or guidelines in the relevant jurisdictions.
1. LICENSE. Subject to the terms of this license and the terms in the supplement
attached, NVIDIA hereby grants you a non-exclusive, non-transferable license,
without the right to sublicense (except as expressly provided in this license)
to:
(a) Install and use the SDK,
(b) Modify and create derivative works of sample source code delivered in the
SDK, and
(c) Distribute any software and materials within the SDK, other than developer
tools provided for your internal use, as incorporated in object code format into
a software application subject to the distribution requirements indicated in
this license.
2. DISTRIBUTION REQUIREMENTS. These are the distribution requirements for you to
exercise the grants above:
(a) An application must have material additional functionality, beyond the
included portions of the SDK.
(b) The following notice shall be included in modifications and derivative works
of source code distributed: "This software contains source code provided by
NVIDIA Corporation."
(c) You agree to distribute the SDK subject to the terms at least as protective
as the terms of this license, including (without limitation) terms relating to
the license grant, license restrictions and protection of NVIDIA's intellectual
property rights. Additionally, you agree that you will protect the privacy,
security and legal rights of your application users.
(d) You agree to notify NVIDIA in writing of any known or suspected distribution
or use of the SDK not in compliance with the requirements of this license, and
to enforce the terms of your agreements with respect to the distributed portions
of the SDK.
3. AUTHORIZED USERS. You may allow employees and contractors of your entity or
of your subsidiary(ies) to access and use the SDK from your secure network to
perform work on your behalf. If you are an academic institution you may allow
users enrolled or employed by the academic institution to access and use the SDK
from your secure network. You are responsible for the compliance with the terms
of this license by your authorized users.
4. LIMITATIONS. Your license to use the SDK is restricted as follows:
(a) You may not reverse engineer, decompile or disassemble, or remove copyright
or other proprietary notices from any portion of the SDK or copies of the SDK.
(b) Except as expressly provided in this license, you may not copy, sell, rent,
sublicense, transfer, distribute, modify, or create derivative works of any
portion of the SDK. For clarity, you may not distribute or sublicense the SDK as
a stand-alone product.
(c) Unless you have an agreement with NVIDIA for this purpose, you may not
indicate that an application created with the SDK is sponsored or endorsed by
NVIDIA.
(d) You may not bypass, disable, or circumvent any technical limitation,
encryption, security, digital rights management or authentication mechanism in
the SDK.
(e) You may not use the SDK in any manner that would cause it to become subject
to an open source software license. As examples, licenses that require as a
condition of use, modification, and/or distribution that the SDK be: (i)
disclosed or distributed in source code form; (ii) licensed for the purpose of
making derivative works; or (iii) redistributable at no charge.
(f) Unless you have an agreement with NVIDIA for this purpose, you may not use
the SDK with any system or application where the use or failure of the system or
application can reasonably be expected to threaten or result in personal injury,
death, or catastrophic loss. Examples include use in avionics, navigation,
military, medical, life support or other life critical applications. NVIDIA does
not design, test or manufacture the SDK for these critical uses and NVIDIA shall
not be liable to you or any third party, in whole or in part, for any claims or
damages arising from such uses.
(g) You agree to defend, indemnify and hold harmless NVIDIA and its affiliates,
and their respective employees, contractors, agents, officers and directors,
from and against any and all claims, damages, obligations, losses, liabilities,
costs or debt, fines, restitutions and expenses (including but not limited to
attorney's fees and costs incident to establishing the right of indemnification)
arising out of or related to your use of the SDK outside of the scope of this
license, or not in compliance with its terms.
5. UPDATES. NVIDIA may, at its option, make available patches, workarounds or
other updates to this SDK. Unless the updates are provided with their separate
governing terms, they are deemed part of the SDK licensed to you as provided in
this license. You agree that the form and content of the SDK that NVIDIA
provides may change without prior notice to you. While NVIDIA generally
maintains compatibility between versions, NVIDIA may in some cases make changes
that introduce incompatibilities in future versions of the SDK.
6. PRE-RELEASE VERSIONS. SDK versions identified as alpha, beta, preview, early
access or otherwise as pre-release may not be fully functional, may contain
errors or design flaws, and may have reduced or different security, privacy,
availability, and reliability standards relative to commercial versions of
NVIDIA software and materials. You may use a pre-release SDK version at your own
risk, understanding that these versions are not intended for use in production
or business-critical systems. NVIDIA may choose not to make available a
commercial version of any pre-release SDK. NVIDIA may also choose to abandon
development and terminate the availability of a pre-release SDK at any time
without liability.
7. THIRD-PARTY COMPONENTS. The SDK may include third-party components with
separate legal notices or terms as may be described in proprietary notices
accompanying the SDK. If and to the extent there is a conflict between the terms
in this license and the third-party license terms, the third-party terms control
only to the extent necessary to resolve the conflict.
8. OWNERSHIP.
8.1 NVIDIA reserves all rights, title and interest in and to the SDK not
expressly granted to you under this license. NVIDIA and its suppliers hold all
rights, title and interest in and to the SDK, including their respective
intellectual property rights. The SDK is copyrighted and protected by the laws
of the United States and other countries, and international treaty provisions.
8.2 Subject to the rights of NVIDIA and its suppliers in the SDK, you hold all
rights, title and interest in and to your applications and your derivative works
of the sample source code delivered in the SDK including their respective
intellectual property rights.
9. FEEDBACK. You may, but are not obligated to, provide Feedback to NVIDIA.
"Feedback" means all suggestions, fixes, modifications, feature requests or
other feedback regarding the SDK. Feedback, even if designated as confidential
by you, shall not create any confidentiality obligation for NVIDIA. NVIDIA and
its designees have a perpetual, non-exclusive, worldwide, irrevocable license to
use, reproduce, publicly display, modify, create derivative works of, license,
sublicense, and otherwise distribute and exploit Feedback as NVIDIA sees fit
without payment and without obligation or restriction of any kind on account of
intellectual property rights or otherwise.
10. NO WARRANTIES. THE SDK IS PROVIDED AS-IS. TO THE MAXIMUM EXTENT PERMITTED BY
APPLICABLE LAW NVIDIA AND ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF
ANY KIND OR NATURE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT
LIMITED TO, WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR A
PARTICULAR PURPOSE. NVIDIA DOES NOT WARRANT THAT THE SDK WILL MEET YOUR
REQUIREMENTS OR THAT THE OPERATION THEREOF WILL BE UNINTERRUPTED OR ERROR-FREE,
OR THAT ALL ERRORS WILL BE CORRECTED.
11. LIMITATIONS OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW
NVIDIA AND ITS AFFILIATES SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
PUNITIVE OR CONSEQUENTIAL DAMAGES, OR FOR ANY LOST PROFITS, PROJECT DELAYS, LOSS
OF USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF PROCURING SUBSTITUTE
PRODUCTS, ARISING OUT OF OR IN CONNECTION WITH THIS LICENSE OR THE USE OR
PERFORMANCE OF THE SDK, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON
BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT
LIABILITY OR ANY OTHER CAUSE OF ACTION OR THEORY OF LIABILITY, EVEN IF NVIDIA
HAS PREVIOUSLY BEEN ADVISED OF, OR COULD REASONABLY HAVE FORESEEN, THE
POSSIBILITY OF SUCH DAMAGES. IN NO EVENT WILL NVIDIA'S AND ITS AFFILIATES TOTAL
CUMULATIVE LIABILITY UNDER OR ARISING OUT OF THIS LICENSE EXCEED US$10.00. THE
NATURE OF THE LIABILITY OR THE NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR
EXTEND THIS LIMIT.
12. TERMINATION. Your rights under this license will terminate automatically
without notice from NVIDIA if you fail to comply with any term and condition of
this license or if you commence or participate in any legal proceeding against
NVIDIA with respect to the SDK. NVIDIA may terminate this license with advance
written notice to you, if NVIDIA decides to no longer provide the SDK in a
country or, in NVIDIA's sole discretion, the continued use of it is no longer
commercially viable. Upon any termination of this license, you agree to promptly
discontinue use of the SDK and destroy all copies in your possession or control.
Your prior distributions in accordance with this license are not affected by the
termination of this license. All provisions of this license will survive
termination, except for the license granted to you.
13. APPLICABLE LAW. This license will be governed in all respects by the laws of
the United States and of the State of Delaware, without regard to the conflicts
of laws principles. The United Nations Convention on Contracts for the
International Sale of Goods is specifically disclaimed. You agree to all terms
of this license in the English language. The state or federal courts residing in
Santa Clara County, California shall have exclusive jurisdiction over any
dispute or claim arising out of this license. Notwithstanding this, you agree
that NVIDIA shall still be allowed to apply for injunctive remedies or urgent
legal relief in any jurisdiction.
14. NO ASSIGNMENT. This license and your rights and obligations thereunder may
not be assigned by you by any means or operation of law without NVIDIA's
permission. Any attempted assignment not approved by NVIDIA in writing shall be
void and of no effect. NVIDIA may assign, delegate or transfer this license and
its rights and obligations, and if to a non-affiliate you will be notified.
15. EXPORT. The SDK is subject to United States export laws and regulations. You
agree to comply with all applicable U.S. and international export laws,
including the Export Administration Regulations (EAR) administered by the U.S.
Department of Commerce and economic sanctions administered by the U.S.
Department of Treasury's Office of Foreign Assets Control (OFAC). These laws
include restrictions on destinations, end-users and end-use. By accepting this
license, you confirm that you are not currently residing in a country or region
currently embargoed by the U.S. and that you are not otherwise prohibited from
receiving the SDK.
16. GOVERNMENT USE. The SDK is, and shall be treated as being, "Commercial
Items" as that term is defined at 48 CFR § 2.101, consisting of "commercial
computer software" and "commercial computer software documentation",
respectively, as such terms are used in, respectively, 48 CFR § 12.212 and 48
CFR §§ 227.7202 & 252.227-7014(a)(1). Use, duplication or disclosure by the U.S.
Government or a U.S. Government subcontractor is subject to the restrictions in
this license pursuant to 48 CFR § 12.212 or 48 CFR § 227.7202. In no event shall
the US Government user acquire rights in the SDK beyond those specified in 48
C.F.R. 52.227-19(b)(1)-(2).
17. NOTICES. You agree that any notices that NVIDIA sends you electronically,
such as via email, will satisfy any legal communication requirements. Please
direct your legal notices or other correspondence to NVIDIA Corporation, 2788
San Tomas Expressway, Santa Clara, California 95051, United States of America,
Attention: Legal Department.
18. ENTIRE AGREEMENT. This license is the final, complete and exclusive
agreement between the parties relating to the subject matter of this license and
supersedes all prior or contemporaneous understandings and agreements relating
to this subject matter, whether oral or written. If any court of competent
jurisdiction determines that any provision of this license is illegal, invalid
or unenforceable, the remaining provisions will remain in full force and effect.
Any amendment or waiver under this license shall be in writing and signed by
representatives of both parties.
19. LICENSING. If the distribution terms in this license are not suitable for
your organization, or for any questions regarding this license, please contact
NVIDIA at nvidia-rtx-license-questions@nvidia.com.
(v. April 12, 2021)
NVIDIA RTX SUPPLEMENT TO SOFTWARE LICENSE AGREEMENT FOR NVIDIA SOFTWARE
DEVELOPMENT KITS
The terms in this supplement govern your use of the NVIDIA RTX SDKs, including
the DLSS SDK, NGX SDK, RTXGI SDK, RTXDI SDK and/or NRD SDK, if and when made
available to you (in each case, the "SDK") under the terms of your license
agreement ("Agreement") as modified by this supplement. Capitalized terms used
but not defined below have the meaning assigned to them in the Agreement.
This supplement is an exhibit to the Agreement and is incorporated as an
integral part of the Agreement. In the event of conflict between the terms in
this supplement and the terms in the Agreement, the terms in this supplement
govern.
1. Interoperability. Your applications that incorporate, or are based on, the
SDK must be fully interoperable with compatible GPU hardware products designed
by NVIDIA or its affiliates. Further, the DLSS SDK and NGX SDK are licensed for
you to develop applications only for their use in systems with NVIDIA GPUs.
2. Limitations for the DLSS SDK and NGX SDK. Your applications that incorporate,
or are based on, the DLSS SDK or NGX SDK may be deployed in a cloud service that
runs on systems that consume NVIDIA vGPU software, and any other cloud service
use of such SDKs or their functionality is outside of the scope of the
Agreement. For the purpose of this section, cloud services include application
service providers or service bureaus, operators of hosted/virtual system
environments, or hosting, time sharing or providing any other type of service to
others.
3. Notification for the DLSS SDK and NGX SDK. You are required to notify NVIDIA
prior to commercial release of an application (including a plug-in to a
commercial application) that incorporates, or is based on, the DLSS SDK or NGX
SDK. Please send notifications to: https://developer.nvidia.com/sw-notification
and provide the following information in the email: company name, publisher and
developer name, NVIDIA SDK used, application name, platform (i.e. PC, Linux),
scheduled ship date, and weblink to product/video.
4. Audio and Video Encoders and Decoders. You acknowledge and agree that it is
your sole responsibility to obtain any additional third-party licenses required
to make, have made, use, have used, sell, import, and offer for sale your
products or services that include or incorporate any third-party software and
content relating to audio and/or video encoders and decoders from, including but
not limited to, Microsoft, Thomson, Fraunhofer IIS, Sisvel S.p.A., MPEG-LA, and
Coding Technologies. NVIDIA does not grant to you under this Agreement any
necessary patent or other rights with respect to any audio and/or video encoders
and decoders.
5. DLSS SDK Terms. By installing or using the DLSS SDK you agree that NVIDIA can
make over-the-air updates of DLSS in systems that have DLSS installed, including
(without limitation) for quality, stability or performance improvements or to
support new hardware. If you publicly release a DLSS integration in an end user
game or application that presents material stability, performance, image
quality, or other technical issues impacting the user experience, you will work
to quickly address the integration issues. In the case issues are not addressed,
NVIDIA reserves the right, as a last resort, to temporarily disable the DLSS
integration until the issues can be fixed.
6. Marketing.
6.1 Marketing Activities. Your license to the SDK(s) under the Agreement is
subject to your compliance with the following marketing terms:
(a) Identification by You in the DLSS SDK or NGX SDK. During the term of the
Agreement, NVIDIA agrees that you may identify NVIDIA on your websites, printed
collateral, trade-show displays and other retail packaging materials, as the
supplier of the DLSS SDK or NGX SDK for the applications that were developed
with use of such SDKs, provided that all such references to NVIDIA will be
subject to NVIDIA's prior review and written approval, which will not be
unreasonably withheld or delayed.
(b) NVIDIA Trademark Placement in Applications with the DLSS SDK or NGX SDK.
For applications that incorporate the DLSS SDK or NGX SDK or portions thereof,
you must attribute the use of the applicable SDK and include the NVIDIA Marks
on splash screens, in the about box of the application (if present), and in
credits for game applications.
(c) NVIDIA Trademark Placement in Applications with a licensed SDK, other than
the DLSS SDK or NGX SDK. For applications that incorporates and/or makes use of
a licensed SDK, other than the DLSS SDK or NGX SDK, you must attribute the use
of the applicable SDK and include the NVIDIA Marks on the credit screen for
applications that have such credit screen, or where a credit screen is not
present prominently in end user documentation for the application. d)
Identification by NVIDIA in the DLSS SDK or NGX SDK. You agree that NVIDIA may
identify you on NVIDIA's websites, printed collateral, trade-show displays, and
other retail packaging materials as an individual or entity that produces
products and services which incorporate the DLSS SDK or NGX SDK as applicable.
To the extent that you provide NVIDIA with input or usage requests with regard
to the use of your logo or materials, NVIDIA will use commercially reasonable
efforts to comply with such requests. For the avoidance of doubt, NVIDIA's
rights pursuant to this section shall survive any expiration or termination of
the Agreement with respect to existing applications which incorporate the DLSS
SDK or NGX SDK.
(e) Applications Marketing Material in the DLSS SDK or NGX SDK. You may provide
NVIDIA with screenshots, imagery, and video footage of applications
representative of your use of the NVIDIA DLSS SDK or NGX SDKs in your
application (collectively, "Assets"). You hereby grant to NVIDIA the right to
create and display self-promotional demo materials using the Assets, and after
release of the application to the public to distribute, sub-license, and use
the Assets to promote and market the NVIDIA RTX SDKs. To the extent you
provide NVIDIA with input or usage requests with regard to the use of your logo
or materials, NVIDIA will use commercially reasonable efforts to comply with
such requests. For the avoidance of doubt, NVIDIA's rights pursuant to this
section shall survive any termination of the Agreement with respect to
applications which incorporate the NVIDIA RTX SDK.
6.2 Trademark Ownership and Licenses. Trademarks are owned and licenses as
follows:
(a) Ownership of Trademarks. Each party owns the trademarks, logos, and trade
names (collectively "Marks") for their respective products or services,
including without limitation in applications, and the NVIDIA RTX SDKs. Each
party agrees to use the Marks of the other only as permitted in this exhibit.
(b) Trademark License to NVIDIA. You grant to NVIDIA a non-exclusive, non-sub
licensable, non-transferable (except as set forth in the assignment provision
of the Agreement), worldwide license to refer to you and your applications, and
to use your Marks on NVIDIA's marketing materials and on NVIDIA's website
(subject to any reasonable conditions of you) solely for NVIDIA's marketing
activities set forth in this exhibit Sections (d)-(e) above. NVIDIA will
follow your specifications for your Marks as to style, color, and typeface as
reasonably provided to NVIDIA.
(c) Trademark License to You. NVIDIA grants to you a non-exclusive, non-sub
licensable, non-transferable (except as set forth in the assignment provision
of the Agreement), worldwide license, subject to the terms of this exhibit and
the Agreement, to use NVIDIA RTX™, NVIDIA GeForce RTX™ in combination with
GeForce products, and/or NVIDIA Quadro RTX™ in combination with Quadro
products (collectively, the "NVIDIA Marks") on your marketing materials and on
your website (subject to any reasonable conditions of NVIDIA) solely for your
marketing activities set forth in this exhibit Sections 6.1 (a)-(c) above. For
the avoidance of doubt, you will not and will not permit others to use any
NVIDIA Mark for any other goods or services, or in a way that tarnishes,
degrades, disparages or reflects adversely any of the NVIDIA Marks or NVIDIA's
business or reputation, or that dilutes or otherwise harms the value,
reputation or distinctiveness of or NVIDIA's goodwill in any NVIDIA Mark. In
addition to the termination rights set forth in the Agreement, NVIDIA may
terminate this trademark license at any time upon written notice to you. You
will follow NVIDIA's use guidelines and specifications for NVIDIA's Marks as to
style, color and typeface as provided in NVIDIA Marks and submit a sample of
each proposed use of NVIDIA's Marks at least ten (10) business days prior to
the desired implementation of such use to obtain NVIDIA's prior written
approval (which approval will not be unreasonably withheld or delayed. Use of
NVIDIA marks is not authorized until NVIDIA provides written approval. All
goodwill associated with use of NVIDIA Marks will inure to the sole benefit of
NVIDIA.
6.3 Use Guidelines. Use of the NVIDIA Marks is subject to the following
guidelines:
(a) Business Practices. You covenant that you will: (a) conduct business with
respect to NVIDIA's products in a manner that reflects favorably at all times
on the good name, goodwill and reputation of such products; (b) avoid
deceptive, misleading or unethical practices that are detrimental to NVIDIA,
its customers, or end users; (c) make no false or misleading representations
with regard to NVIDIA or its products; and (d) not publish or employ or
cooperate in the publication or employment of any misleading or deceptive
advertising or promotional materials.
(b) No Combination Marks or Similar Marks. You agree not to (a) combine NVIDIA
Marks with any other content without NVIDIA's prior written approval, or (b)
use any other trademark, trade name, or other designation of source which
creates a likelihood of confusion with NVIDIA Marks.
(v. April 12, 2021)

View File

@@ -0,0 +1,109 @@
/*
* Copyright (c) 2020-2021 NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and proprietary
* rights in and to this software, related documentation and any modifications thereto.
* Any use, reproduction, disclosure or distribution of this software and related
* documentation without an express license agreement from NVIDIA Corporation is strictly
* prohibited.
*
* TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
* INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
* SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
* BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
* INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGES.
*/
#if UE_5_0_OR_LATER
using EpicGames.Core;
#else
using Tools.DotNETCommon;
#endif
using UnrealBuildTool;
using System.IO;
public class NGX : ModuleRules
{
protected virtual bool IsSupportedWindowsPlatform(ReadOnlyTargetRules Target)
{
return Target.Platform == UnrealTargetPlatform.Win64;
}
public NGX (ReadOnlyTargetRules Target) : base(Target)
{
Type = ModuleType.External;
if (IsSupportedWindowsPlatform(Target))
{
string NGXPath = ModuleDirectory + "/";
PublicSystemIncludePaths.Add(NGXPath + "Include/");
PublicIncludePaths.Add(NGXPath + "Include/");
if ((Target.Configuration == UnrealTargetConfiguration.Debug) && Target.bDebugBuildsActuallyUseDebugCRT)
{
if (Target.bUseStaticCRT)
{
PublicAdditionalLibraries.Add(NGXPath + "Lib/x64/" + "nvsdk_ngx_s_dbg.lib");
}
else
{
PublicAdditionalLibraries.Add(NGXPath + "Lib/x64/" + "nvsdk_ngx_d_dbg.lib");
}
}
else
{
if (Target.bUseStaticCRT)
{
PublicAdditionalLibraries.Add(NGXPath + "Lib/x64/" + "nvsdk_ngx_s.lib");
}
else
{
PublicAdditionalLibraries.Add(NGXPath + "Lib/x64/" + "nvsdk_ngx_d.lib");
}
}
string[] NGXSnippetDLLs =
{
"nvngx_dlss.dll",
};
PublicDefinitions.Add("NGX_DLSS_BINARY_NAME=TEXT(\"" + NGXSnippetDLLs[0] + "\")");
foreach (string NGXSnippetDLL in NGXSnippetDLLs)
{
bool bHasProjectBinary = false;
if (Target.ProjectFile != null)
{
string ProjectDLLPath = DirectoryReference.Combine(Target.ProjectFile.Directory, "Binaries/ThirdParty/NVIDIA/NGX/Win64", NGXSnippetDLL).FullName;
if (File.Exists(ProjectDLLPath))
{
bHasProjectBinary = true;
//Log.TraceInformation("NGX project specific production DLSS binary found at {0}.", ProjectDLLPath);
RuntimeDependencies.Add(ProjectDLLPath, StagedFileType.NonUFS);
}
}
// useful to have both plugin and project specific binary during testing, but if we have a project specific binary, then we want to ship with only that
if (!bHasProjectBinary || Target.Configuration != UnrealTargetConfiguration.Shipping)
{
RuntimeDependencies.Add("$(PluginDir)/Binaries/ThirdParty/Win64/" + NGXSnippetDLL, StagedFileType.NonUFS);
}
// useful to have debug overlay during testing, but we don't want to ship with that
if (Target.Configuration != UnrealTargetConfiguration.Shipping)
{
RuntimeDependencies.Add("$(PluginDir)/Binaries/ThirdParty/Win64/Development/" + NGXSnippetDLL, StagedFileType.DebugNonUFS);
}
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<TpsData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>NGX</Name>
<Location>/Engine/Source/ThirdParty/NVIDIA/NGX</Location>
<Function>NGX</Function>
<Justification>SDK for DLSS and other NVIDIA DeepLearning technologies</Justification>
</TpsData>

View File

@@ -0,0 +1,87 @@
Jitter Offset Configurations
To assist in debugging issues with sub-pixel jitter, the DLSS SDK library can optionally adjust the jitter offset components using the CTRL+ALT+F9 hotkey. The configurations are listed below and pressing the hotkey cycles through them in order.
To exchange (ie swap) the X and Y offsets, use the CTRL+ALT+F10 hotkey.
// By default, jitter offsets are used as sent from the engine
Config 0: OFF
// Combinations halving and negating both vector components
Config 1:
JitterOffsetX *= 0.5f;
JitterOffsetY *= 0.5f;
Config 2:
JitterOffsetX *= 0.5f;
JitterOffsetY *= -0.5f;
Config 3:
JitterOffsetX *= -0.5f;
JitterOffsetY *= 0.5f;
Config 4:
JitterOffsetX *= -0.5f;
JitterOffsetY *= -0.5f;
// Combinations doubling and negating both vector components
Config 5:
JitterOffsetX *= 2.0f;
JitterOffsetY *= 2.0f;
Config 6:
JitterOffsetX *= 2.0f;
JitterOffsetY *= -2.0f;
Config 7:
JitterOffsetX *= -2.0f;
JitterOffsetY *= 2.0f;
Config 8:
JitterOffsetX *= -2.0f;
JitterOffsetY *= -2.0f;
// Combinations negating one or both vector components
Config 9:
JitterOffsetX *= 1.0f;
JitterOffsetY *= -1.0f;
Config 10:
JitterOffsetX *= -1.0f;
JitterOffsetY *= 1.0f;
Config 11:
JitterOffsetX *= -1.0f;
JitterOffsetY *= -1.0f;
// Combinations halving and negating individual vector components
Config 12:
JitterOffsetX *= 0.5f;
Config 13:
JitterOffsetY *= 0.5f;
Config 14:
JitterOffsetX *= -0.5f;
Config 15:
JitterOffsetY *= -0.5f;
// Combinations doubling and negating individual vector components
Config 16:
JitterOffsetX *= 2.0f;
Config 17:
JitterOffsetY *= 2.0f;
Config 18:
JitterOffsetX *= -2.0f;
Config 19:
JitterOffsetY *= -2.0f;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.