MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / initializeNGX

Method initializeNGX

Source/RenderPasses/DLSSPass/NGXWrapper.cpp:106–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106void NGXWrapper::initializeNGX(const std::filesystem::path& applicationDataPath, const std::filesystem::path& featureSearchPath)
107{
108 NVSDK_NGX_Result result = NVSDK_NGX_Result_Fail;
109
110 NVSDK_NGX_FeatureCommonInfo featureInfo = {};
111 const wchar_t* pathList[] = {featureSearchPath.c_str()};
112 featureInfo.PathListInfo.Length = 1;
113 featureInfo.PathListInfo.Path = const_cast<wchar_t**>(&pathList[0]);
114
115 switch (mpDevice->getType())
116 {
117 case Device::Type::D3D12:
118#if FALCOR_HAS_D3D12
119 result = NVSDK_NGX_D3D12_Init(kAppID, applicationDataPath.c_str(), mpDevice->getNativeHandle().as<ID3D12Device*>(), &featureInfo);
120#endif
121 break;
122 case Device::Type::Vulkan:
123#if FALCOR_HAS_VULKAN
124 result = NVSDK_NGX_VULKAN_Init(
125 kAppID,
126 applicationDataPath.c_str(),
127 mpDevice->getNativeHandle(0).as<VkInstance>(),
128 mpDevice->getNativeHandle(1).as<VkPhysicalDevice>(),
129 mpDevice->getNativeHandle(2).as<VkDevice>(),
130 nullptr,
131 nullptr,
132 &featureInfo
133 );
134#endif
135 break;
136 }
137
138 if (NVSDK_NGX_FAILED(result))
139 {
140 if (result == NVSDK_NGX_Result_FAIL_FeatureNotSupported || result == NVSDK_NGX_Result_FAIL_PlatformError)
141 {
142 FALCOR_THROW("NVIDIA NGX is not available on this hardware/platform " + resultToString(result));
143 }
144 else
145 {
146 FALCOR_THROW("Failed to initialize NGX " + resultToString(result));
147 }
148 }
149
150 mInitialized = true;
151
152 switch (mpDevice->getType())
153 {
154 case Device::Type::D3D12:
155#if FALCOR_HAS_D3D12
156 THROW_IF_FAILED(NVSDK_NGX_D3D12_GetCapabilityParameters(&mpParameters));
157#endif
158 break;
159 case Device::Type::Vulkan:
160#if FALCOR_HAS_VULKAN
161 THROW_IF_FAILED(NVSDK_NGX_VULKAN_GetCapabilityParameters(&mpParameters));
162#endif
163 break;

Callers

nothing calls this directly

Calls 3

resultToStringFunction · 0.85
getTypeMethod · 0.45
getNativeHandleMethod · 0.45

Tested by

no test coverage detected