My DX12 app fails to load nvngx_dlss.dll

NVSDK_NGX_D3D12_Init() and NVSDK_NGX_D3D12_GetCapabilityParameters(&ngxParameters) succeed but ngxParameters->Get(NVSDK_NGX_Parameter_SuperSampling_Available, &isDLSSAvailable) returns NVSDK_NGX_Result_FAIL_UnsupportedParameter.

I think, this is because the SDK doesn’t find the nvngx_dlss.dll.

I’m getting either
[NGXLoadAndValidateSnippet:1781] nvLoadSignedLibraryW() failed on snippet './nvngx_dlss.dll' missing or corrupted - last error One or more arguments are not correct.
or
[NGXSecureLoadFeature:519] warning: ModuleName - nvngx_dlss.dll doesn't exist in any of the search paths!
in the log, depending on whether I fill out NVSDK_NGX_FeatureCommonInfo.PathListInfo. I’ve copied the DLL to the working directory, to the binary directory, to the directory of the DLL that loads it and added it to PATH. I’ve also tested the sample that comes with the SDK, which works fine. If I delete the DLL from the sample, I’m getting the same behavior.

I’m initializing NGX like this:

	const char* paths[] = {  // I've also tried backslashes and backslashes at the end
		"C:/Programmierung/C++/ExternalLibs/dlss-2_4/lib/Windows_x86_64/dev",
		"C:/Programmierung/C++/ExternalLibs/dlss-2_4/lib/Windows_x86_64/rel",
		".",
		"C:/Programmierung/C++/Private/DLSSTest/bin/x64/Debug DX12",
	};

	NVSDK_NGX_FeatureCommonInfo featureCommonInfo = {};
	featureCommonInfo.LoggingInfo.LoggingCallback = AppLogCallback;
	featureCommonInfo.LoggingInfo.MinimumLoggingLevel = NVSDK_NGX_LOGGING_LEVEL_VERBOSE;
	featureCommonInfo.LoggingInfo.DisableOtherLoggingSinks = true;
	featureCommonInfo.PathListInfo.Path = const_cast<char**>(paths);
	featureCommonInfo.PathListInfo.Length = 4;

	NGXCHECK(NVSDK_NGX_D3D12_Init_with_ProjectID(
			projectGuid.c_str(),
			NVSDK_NGX_ENGINE_TYPE_CUSTOM,
			CORELIB_VERSION_STRING,
			logPath.c_str(),
			renderingWindow->GetDevice().Get(),
			&featureCommonInfo,
			static_cast<NVSDK_NGX_Version>(0x00000014)
		), "Failed to initialize NGX");

but I’ve also tried it the way the sample does:

	auto result = NVSDK_NGX_D3D12_Init(
		1245561,
		L".",
		renderingWindow->GetDevice().Get());
	NGXCHECK(result, "Failed to initialize NGX");

I don’t understand what I’m doing wrong. Is it not possible to initialize NGX from within a DLL maybe? Does this have something to do with nvLoadSignedLibrary failing to recognize that the library is signed? I’ve tried both the debug and release DLLs.

I’ve attached the entire log.

dlss_log.txt (27.5 KB)

Answering my own question, in case somebody else runs into this as well. There are multiple gotchas here:

  • Unlike other DLLs, nvngx_dlss.dll won’t be found if you put it in the PATH
  • If you are not specifying PathListInfo, then nvngx_dlss.dll has to be next to the DLL which contains the NVSDK_NGX_D3D12_Init call.
  • If you do specify PathListInfo, you have to #define NV_WINDOWS before including the headers. This changes the paths to wchar_t. I’m not entirely sure when this is necessary, but it was required in my case.

Of course, this is totally undocumented. I’ve tried the second tip but it didn’t work at the time because I also specified paths without defining NV_WINDOWS.