Browse Source

Query the FidelityFX library for upscaler versions upon load, and log the default FSR version that's available.

master
Nico de Poel 1 year ago
parent
commit
77942d25b0
  1. 28
      FSR3UnityPlugin.cpp

28
FSR3UnityPlugin.cpp

@ -1,5 +1,6 @@
#include <stdint.h> #include <stdint.h>
#include <sstream>
#include <vector> #include <vector>
#include <queue> #include <queue>
#include <mutex> #include <mutex>
@ -198,6 +199,33 @@ static bool LoadFidelityFXLibrary(_In_ LPCWSTR lpLibFileName)
return false; return false;
} }
// Check that we can actually create an upscaler with this library
ffx::QueryDescGetVersions versionQuery{};
versionQuery.createDescType = FFX_API_CREATE_CONTEXT_DESC_TYPE_UPSCALE;
versionQuery.device = s_DX12BackendDesc.device;
uint64_t versionCount = 0;
versionQuery.outputCount = &versionCount;
s_ffxFunctions.Query(nullptr, &versionQuery.header);
if (versionCount == 0)
{
UNITY_LOG_ERROR(s_Log, "Failed to load FidelityFX upscaler versions!");
return false;
}
// Obtain the default upscaler version and log its name
std::vector<const char*> versionNames;
std::vector<uint64_t> versionIds;
versionIds.resize(versionCount);
versionNames.resize(versionCount);
versionQuery.versionIds = versionIds.data();
versionQuery.versionNames = versionNames.data();
s_ffxFunctions.Query(nullptr, &versionQuery.header);
std::stringstream ss;
ss << "Loaded FidelityFX upscaler: FSR " << versionNames[0];
UNITY_LOG(s_Log, ss.str().c_str());
return true; return true;
} }

Loading…
Cancel
Save