nvsdk_ngx_vk.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. /*
  2. * Copyright (c) 2018 NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * NVIDIA Corporation and its licensors retain all intellectual property and proprietary
  5. * rights in and to this software, related documentation and any modifications thereto.
  6. * Any use, reproduction, disclosure or distribution of this software and related
  7. * documentation without an express license agreement from NVIDIA Corporation is strictly
  8. * prohibited.
  9. *
  10. * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
  11. * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
  12. * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  13. * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
  14. * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
  15. * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
  16. * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
  17. * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
  18. * SUCH DAMAGES.
  19. */
  20. /*
  21. * HOW TO USE:
  22. *
  23. * IMPORTANT: Methods in this library are NOT thread safe. It is up to the
  24. * client to ensure that thread safety is enforced as needed.
  25. *
  26. * 1) Call NVSDK_CONV NVSDK_NGX_D3D11/D3D12/CUDA_Init and pass your app Id
  27. * and other parameters. This will initialize SDK or return an error code
  28. * if SDK cannot run on target machine. Depending on error user might
  29. * need to update drivers. Please note that application Id is provided
  30. * by NVIDIA so if you do not have one please contact us.
  31. *
  32. * 2) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetParameters to obtain pointer to
  33. * interface used to pass parameters to SDK. Interface instance is
  34. * allocated and released by SDK so there is no need to do any memory
  35. * management on client side.
  36. *
  37. * 3) Set key parameters for the feature you want to use. For example,
  38. * width and height are required for all features and they can be
  39. * set like this:
  40. * Params->Set(NVSDK_NGX_Parameter_Width,MY_WIDTH);
  41. * Params->Set(NVSDK_NGX_Parameter_Height,MY_HEIGHT);
  42. *
  43. * You can also provide hints like NVSDK_NGX_Parameter_Hint_HDR to tell
  44. * SDK that it should expect HDR color space is needed. Please refer to
  45. * samples since different features need different parameters and hints.
  46. *
  47. * 4) Call NVSDK_NGX_D3D11/D3D12/CUDA_GetScratchBufferSize to obtain size of
  48. * the scratch buffer needed by specific feature. This D3D or CUDA buffer
  49. * should be allocated by client and passed as:
  50. * Params->Set(NVSDK_NGX_Parameter_Scratch,MY_SCRATCH_POINTER)
  51. * Params->Set(NVSDK_NGX_Parameter_Scratch_SizeInBytes,MY_SCRATCH_SIZE_IN_BYTES)
  52. * NOTE: Returned size can be 0 if feature does not use any scratch buffer.
  53. * It is OK to use bigger buffer or reuse buffers across features as long
  54. * as minimum size requirement is met.
  55. *
  56. * 5) Call NVSDK_NGX_D3D11/D3D12/CUDA_CreateFeature to create feature you need.
  57. * On success SDK will return a handle which must be used in any successive
  58. * calls to SDK which require feature handle. SDK will use all parameters
  59. * and hints provided by client to generate feature. If feature with the same
  60. * parameters already exists and error code will be returned.
  61. *
  62. * 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_EvaluateFeature to invoke execution of
  63. * specific feature. Before feature can be evaluated input parameters must
  64. * be specified (like for example color/albedo buffer, motion vectors etc)
  65. *
  66. * 6) Call NVSDK_NGX_D3D11/D3D12/CUDA_ReleaseFeature when feature is no longer
  67. * needed. After this call feature handle becomes invalid and cannot be used.
  68. *
  69. * 7) Call NVSDK_NGX_D3D11/D3D12/CUDA_Shutdown when SDK is no longer needed to
  70. * release all resources.
  71. * Contact: [email protected]
  72. */
  73. #ifndef NVSDK_NGX_VK_H
  74. #define NVSDK_NGX_VK_H
  75. #include "nvsdk_ngx_defs.h"
  76. #include "nvsdk_ngx_params.h"
  77. #ifndef __cplusplus
  78. #include <stdbool.h>
  79. #include <wchar.h>
  80. #endif
  81. #ifdef __cplusplus
  82. extern "C"
  83. {
  84. #endif
  85. ///////////////////////////////////////////////////////////////////////////////////////////////////
  86. // NVSDK_NGX_ImageViewInfo_VK [Vulkan only]
  87. // Contains ImageView-specific metadata.
  88. // ImageView:
  89. // The VkImageView resource.
  90. //
  91. // Image:
  92. // The VkImage associated to this VkImageView.
  93. //
  94. // SubresourceRange:
  95. // The VkImageSubresourceRange associated to this VkImageView.
  96. //
  97. // Format:
  98. // The format of the resource.
  99. //
  100. // Width:
  101. // The width of the resource.
  102. //
  103. // Height:
  104. // The height of the resource.
  105. //
  106. typedef struct NVSDK_NGX_ImageViewInfo_VK {
  107. VkImageView ImageView;
  108. VkImage Image;
  109. VkImageSubresourceRange SubresourceRange;
  110. VkFormat Format;
  111. unsigned int Width;
  112. unsigned int Height;
  113. } NVSDK_NGX_ImageViewInfo_VK;
  114. ///////////////////////////////////////////////////////////////////////////////////////////////////
  115. // NVSDK_NGX_BufferInfo_VK [Vulkan only]
  116. // Contains Buffer-specific metadata.
  117. // Buffer
  118. // The VkBuffer resource.
  119. //
  120. // SizeInBytes:
  121. // The size of the resource (in bytes).
  122. //
  123. typedef struct NVSDK_NGX_BufferInfo_VK {
  124. VkBuffer Buffer;
  125. unsigned int SizeInBytes;
  126. } NVSDK_NGX_BufferInfo_VK;
  127. ///////////////////////////////////////////////////////////////////////////////////////////////////
  128. // NVSDK_NGX_Resource_VK [Vulkan only]
  129. //
  130. // ImageViewInfo:
  131. // The VkImageView resource, and VkImageView-specific metadata. A NVSDK_NGX_Resource_VK can only have one of ImageViewInfo or BufferInfo.
  132. //
  133. // BufferInfo:
  134. // The VkBuffer Resource, and VkBuffer-specific metadata. A NVSDK_NGX_Resource_VK can only have one of ImageViewInfo or BufferInfo.
  135. //
  136. // Type:
  137. // Whether or this resource is a VkImageView or a VkBuffer.
  138. //
  139. // ReadWrite:
  140. // True if the resource is available for read and write access.
  141. // For VkBuffer resources: VkBufferUsageFlags includes VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT or VK_BUFFER_USAGE_STORAGE_BUFFER_BIT
  142. // For VkImage resources: VkImageUsageFlags for associated VkImage includes VK_IMAGE_USAGE_STORAGE_BIT
  143. //
  144. typedef struct NVSDK_NGX_Resource_VK {
  145. union {
  146. NVSDK_NGX_ImageViewInfo_VK ImageViewInfo;
  147. NVSDK_NGX_BufferInfo_VK BufferInfo;
  148. } Resource;
  149. NVSDK_NGX_Resource_VK_Type Type;
  150. bool ReadWrite;
  151. } NVSDK_NGX_Resource_VK;
  152. ///////////////////////////////////////////////////////////////////////////////////////////////////
  153. // NVSDK_NGX_RequiredExtensions [Vulkan only]
  154. //
  155. // OutInstanceExtCount:
  156. // Returns the number of instance extensions NGX requires
  157. //
  158. // OutInstanceExts:
  159. // Returns a pointer to *OutInstanceExtCount strings of instance extensions
  160. //
  161. // OutDeviceExtCount:
  162. // Returns the number of device extensions NGX requires
  163. //
  164. // OutDeviceExts:
  165. // Returns a pointer to *OutDeviceExtCount strings of device extensions
  166. //
  167. NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_RequiredExtensions(unsigned int *OutInstanceExtCount, const char *** OutInstanceExts, unsigned int *OutDeviceExtCount, const char *** OutDeviceExts);
  168. ///////////////////////////////////////////////////////////////////////////////////////////////////
  169. // NVSDK_NGX_Init
  170. // -------------------------------------
  171. //
  172. // InApplicationId:
  173. // Unique Id provided by NVIDIA
  174. //
  175. // InApplicationDataPath:
  176. // Folder to store logs and other temporary files (write access required),
  177. // Normally this would be a location in Documents or ProgramData.
  178. //
  179. // InDevice: [d3d11/12 only]
  180. // DirectX device to use
  181. //
  182. // DESCRIPTION:
  183. // Initializes new SDK instance.
  184. //
  185. #ifdef __cplusplus
  186. 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);
  187. #else
  188. 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);
  189. #endif
  190. ///////////////////////////////////////////////////////////////////////////////////////////////////
  191. // NVSDK_NGX_Init_with_ProjectID
  192. // -------------------------------------
  193. //
  194. // InParojectId:
  195. // Unique Id provided by the rendering engine used
  196. //
  197. // InEngineType:
  198. // Rendering engine used by the application / plugin.
  199. // Use NVSDK_NGX_ENGINE_TYPE_CUSTOM if the specific engine type is not supported explicitly
  200. //
  201. // InEngineVersion:
  202. // Version number of the rendering engine used by the application / plugin.
  203. //
  204. // InApplicationDataPath:
  205. // Folder to store logs and other temporary files (write access required),
  206. // Normally this would be a location in Documents or ProgramData.
  207. //
  208. // InDevice: [d3d11/12 only]
  209. // DirectX device to use
  210. //
  211. // InFeatureInfo:
  212. // Contains information common to all features, presently only a list of all paths
  213. // feature dlls can be located in, other than the default path - application directory.
  214. //
  215. // DESCRIPTION:
  216. // Initializes new SDK instance.
  217. //
  218. #ifdef __cplusplus
  219. 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);
  220. #else
  221. 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);
  222. #endif
  223. ////////////////////////////////////////////////////////////////////////////////////////////////////
  224. // NVSDK_NGX_Shutdown
  225. // -------------------------------------
  226. //
  227. // DESCRIPTION:
  228. // Shuts down the current SDK instance and releases all resources.
  229. // Shutdown1(Device) only affects specified device
  230. // Shutdown1(nullptr) = Shutdown() and shuts down all devices
  231. //
  232. NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Shutdown(void);
  233. NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_Shutdown1(VkDevice InDevice);
  234. #ifdef NGX_ENABLE_DEPRECATED_GET_PARAMETERS
  235. ////////////////////////////////////////////////////////////////////////////////////////////////////
  236. // NVSDK_NGX_GetParameters
  237. // ----------------------------------------------------------
  238. //
  239. // OutParameters:
  240. // Parameters interface used to set any parameter needed by the SDK
  241. //
  242. // DESCRIPTION:
  243. // This interface allows simple parameter setup using named fields.
  244. // For example one can set width by calling Set(NVSDK_NGX_Parameter_Denoiser_Width,100) or
  245. // provide CUDA buffer pointer by calling Set(NVSDK_NGX_Parameter_Denoiser_Color,cudaBuffer)
  246. // For more details please see sample code. Please note that allocated memory
  247. // will be freed by NGX so free/delete operator should NOT be called.
  248. // Parameter maps output by NVSDK_NGX_GetParameters are also pre-populated
  249. // with NGX capabilities and available features.
  250. // Unlike with NVSDK_NGX_AllocateParameters, parameter maps output by NVSDK_NGX_GetParameters
  251. // have their lifetimes managed by NGX, and must not
  252. // be destroyed by the app using NVSDK_NGX_DestroyParameters.
  253. // NVSDK_NGX_GetParameters is deprecated and apps should move to using
  254. // NVSDK_NGX_AllocateParameters and NVSDK_NGX_GetCapabilityParameters when possible.
  255. // Nevertheless, due to the possibility that the user will be using an older driver version,
  256. // NVSDK_NGX_GetParameters may still be used as a fallback if NVSDK_NGX_AllocateParameters
  257. // or NVSDK_NGX_GetCapabilityParameters return NVSDK_NGX_Result_FAIL_OutOfDate.
  258. //
  259. NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetParameters(NVSDK_NGX_Parameter **OutParameters);
  260. #endif // NGX_ENABLE_DEPRECATED_GET_PARAMETERS
  261. ////////////////////////////////////////////////////////////////////////////////////////////////////
  262. // NVSDK_NGX_AllocateParameters
  263. // ----------------------------------------------------------
  264. //
  265. // OutParameters:
  266. // Parameters interface used to set any parameter needed by the SDK
  267. //
  268. // DESCRIPTION:
  269. // This interface allows allocating a simple parameter setup using named fields, whose
  270. // lifetime the app must manage.
  271. // For example one can set width by calling Set(NVSDK_NGX_Parameter_Denoiser_Width,100) or
  272. // provide CUDA buffer pointer by calling Set(NVSDK_NGX_Parameter_Denoiser_Color,cudaBuffer)
  273. // For more details please see sample code.
  274. // Parameter maps output by NVSDK_NGX_AllocateParameters must NOT be freed using
  275. // the free/delete operator; to free a parameter map
  276. // output by NVSDK_NGX_AllocateParameters, NVSDK_NGX_DestroyParameters should be used.
  277. // Unlike with NVSDK_NGX_GetParameters, parameter maps allocated with NVSDK_NGX_AllocateParameters
  278. // must be destroyed by the app using NVSDK_NGX_DestroyParameters.
  279. // Also unlike with NVSDK_NGX_GetParameters, parameter maps output by NVSDK_NGX_AllocateParameters
  280. // do not come pre-populated with NGX capabilities and available features.
  281. // To create a new parameter map pre-populated with such information, NVSDK_NGX_GetCapabilityParameters
  282. // should be used.
  283. // This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
  284. // does not support this API call is being used. In such a case, NVSDK_NGX_GetParameters
  285. // may be used as a fallback.
  286. // This function may only be called after a successful call into NVSDK_NGX_Init.
  287. //
  288. NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_AllocateParameters(NVSDK_NGX_Parameter** OutParameters);
  289. ////////////////////////////////////////////////////////////////////////////////////////////////////
  290. // NVSDK_NGX_GetCapabilityParameters
  291. // ----------------------------------------------------------
  292. //
  293. // OutParameters:
  294. // The parameters interface populated with NGX and feature capabilities
  295. //
  296. // DESCRIPTION:
  297. // This interface allows the app to create a new parameter map
  298. // pre-populated with NGX capabilities and available features.
  299. // The output parameter map can also be used for any purpose
  300. // parameter maps output by NVSDK_NGX_AllocateParameters can be used for
  301. // but it is not recommended to use NVSDK_NGX_GetCapabilityParameters
  302. // unless querying NGX capabilities and available features
  303. // due to the overhead associated with pre-populating the parameter map.
  304. // Parameter maps output by NVSDK_NGX_GetCapabilityParameters must NOT be freed using
  305. // the free/delete operator; to free a parameter map
  306. // output by NVSDK_NGX_GetCapabilityParameters, NVSDK_NGX_DestroyParameters should be used.
  307. // Unlike with NVSDK_NGX_GetParameters, parameter maps allocated with NVSDK_NGX_GetCapabilityParameters
  308. // must be destroyed by the app using NVSDK_NGX_DestroyParameters.
  309. // This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
  310. // does not support this API call is being used. This function may only be called
  311. // after a successful call into NVSDK_NGX_Init.
  312. // If NVSDK_NGX_GetCapabilityParameters fails with NVSDK_NGX_Result_FAIL_OutOfDate,
  313. // NVSDK_NGX_GetParameters may be used as a fallback, to get a parameter map pre-populated
  314. // with NGX capabilities and available features.
  315. //
  316. NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetCapabilityParameters(NVSDK_NGX_Parameter** OutParameters);
  317. ////////////////////////////////////////////////////////////////////////////////////////////////////
  318. // NVSDK_NGX_DestroyParameters
  319. // ----------------------------------------------------------
  320. //
  321. // InParameters:
  322. // The parameters interface to be destroyed
  323. //
  324. // DESCRIPTION:
  325. // This interface allows the app to destroy the parameter map passed in. Once
  326. // NVSDK_NGX_DestroyParameters is called on a parameter map, it
  327. // must not be used again.
  328. // NVSDK_NGX_DestroyParameters must not be called on any parameter map returned
  329. // by NVSDK_NGX_GetParameters; NGX will manage the lifetime of those
  330. // parameter maps.
  331. // This function may return NVSDK_NGX_Result_FAIL_OutOfDate if an older driver, which
  332. // does not support this API call is being used. This function may only be called
  333. // after a successful call into NVSDK_NGX_Init.
  334. //
  335. NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_DestroyParameters(NVSDK_NGX_Parameter* InParameters);
  336. ////////////////////////////////////////////////////////////////////////////////////////////////////
  337. // NVSDK_NGX_GetScratchBufferSize
  338. // ----------------------------------------------------------
  339. //
  340. // InFeatureId:
  341. // AI feature in question
  342. //
  343. // InParameters:
  344. // Parameters used by the feature to help estimate scratch buffer size
  345. //
  346. // OutSizeInBytes:
  347. // Number of bytes needed for the scratch buffer for the specified feature.
  348. //
  349. // DESCRIPTION:
  350. // SDK needs a buffer of a certain size provided by the client in
  351. // order to initialize AI feature. Once feature is no longer
  352. // needed buffer can be released. It is safe to reuse the same
  353. // scratch buffer for different features as long as minimum size
  354. // requirement is met for all features. Please note that some
  355. // features might not need a scratch buffer so return size of 0
  356. // is completely valid.
  357. //
  358. NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_GetScratchBufferSize(NVSDK_NGX_Feature InFeatureId, const NVSDK_NGX_Parameter *InParameters, size_t *OutSizeInBytes);
  359. /////////////////////////////////////////////////////////////////////////
  360. // NVSDK_NGX_CreateFeature
  361. // -------------------------------------
  362. //
  363. // InCmdBuffer:
  364. // Command buffer to use to execute GPU commands. Must be:
  365. // - Open and recording
  366. // InFeatureID:
  367. // AI feature to initialize
  368. //
  369. // InParameters:
  370. // List of parameters
  371. //
  372. // OutHandle:
  373. // Handle which uniquely identifies the feature. If feature with
  374. // provided parameters already exists the "already exists" error code is returned.
  375. //
  376. // DESCRIPTION:
  377. // Each feature needs to be created before it can be used.
  378. // Refer to the sample code to find out which input parameters
  379. // are needed to create specific feature.
  380. // CreateFeature() creates feature on single existing Device
  381. // CreateFeature1() creates feature on the specified Device
  382. //
  383. 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);
  384. 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);
  385. /////////////////////////////////////////////////////////////////////////
  386. // NVSDK_NGX_Release
  387. // -------------------------------------
  388. //
  389. // InHandle:
  390. // Handle to feature to be released
  391. //
  392. // DESCRIPTION:
  393. // Releases feature with a given handle.
  394. // Handles are not reference counted so
  395. // after this call it is invalid to use provided handle.
  396. //
  397. NVSDK_NGX_API NVSDK_NGX_Result NVSDK_CONV NVSDK_NGX_VULKAN_ReleaseFeature(NVSDK_NGX_Handle *InHandle);
  398. /////////////////////////////////////////////////////////////////////////
  399. // NVSDK_NGX_EvaluateFeature
  400. // -------------------------------------
  401. //
  402. // InCmdList:[d3d12 only]
  403. // Command list to use to execute GPU commands. Must be:
  404. // - Open and recording
  405. // - With node mask including the device provided in NVSDK_NGX_D3D12_Init
  406. // - Execute on non-copy command queue.
  407. // InDevCtx: [d3d11 only]
  408. // Device context to use to execute GPU commands
  409. //
  410. // InFeatureHandle:
  411. // Handle representing feature to be evaluated
  412. //
  413. // InParameters:
  414. // List of parameters required to evaluate feature
  415. //
  416. // InCallback:
  417. // Optional callback for features which might take longer
  418. // to execture. If specified SDK will call it with progress
  419. // values in range 0.0f - 1.0f
  420. //
  421. // DESCRIPTION:
  422. // Evaluates given feature using the provided parameters and
  423. // pre-trained NN. Please note that for most features
  424. // it can be benefitials to pass as many input buffers and parameters
  425. // as possible (for example provide all render targets like color, albedo, normals, depth etc)
  426. //
  427. #ifdef __cplusplus
  428. typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback)(float InCurrentProgress, bool &OutShouldCancel);
  429. 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);
  430. #endif
  431. typedef void (NVSDK_CONV *PFN_NVSDK_NGX_ProgressCallback_C)(float InCurrentProgress, bool *OutShouldCancel);
  432. 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);
  433. // NGX return-code conversion-to-string utility only as a helper for debugging/logging - not for official use.
  434. const wchar_t* NVSDK_CONV GetNGXResultAsString(NVSDK_NGX_Result InNGXResult);
  435. #ifdef __cplusplus
  436. } // extern "C"
  437. #endif
  438. #endif // #define NVSDK_NGX_VK_H