|
|
|
@ -160,6 +160,11 @@ static uint32_t AllocateFeatureSlot() |
|
|
|
|
|
|
|
static void FreeFeatureSlot(uint32_t featureSlot) |
|
|
|
{ |
|
|
|
// Prevent duplicate free slots
|
|
|
|
auto& slots = s_FeatureSlots._Get_container(); |
|
|
|
if (std::find(slots.begin(), slots.end(), featureSlot) != slots.end()) |
|
|
|
return; |
|
|
|
|
|
|
|
s_FeatureSlots.push(featureSlot); |
|
|
|
memset(&s_Features[featureSlot], 0, sizeof(FSR2Feature)); |
|
|
|
} |
|
|
|
@ -221,6 +226,8 @@ extern "C" bool UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API AMDUP_InitApi() |
|
|
|
static void DestroyFeature(uint32_t featureSlot) |
|
|
|
{ |
|
|
|
auto& feature = s_Features[featureSlot]; |
|
|
|
if (!feature.isValid) |
|
|
|
return; |
|
|
|
|
|
|
|
if (s_GraphicsD3D12 != nullptr) |
|
|
|
{ |
|
|
|
@ -244,11 +251,8 @@ static void DestroyFeature(uint32_t featureSlot) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (feature.isValid) |
|
|
|
{ |
|
|
|
ffxFsr2ContextDestroy(&feature.upscalingContext); |
|
|
|
FreeFeatureSlot(featureSlot); |
|
|
|
} |
|
|
|
ffxFsr2ContextDestroy(&feature.upscalingContext); |
|
|
|
FreeFeatureSlot(featureSlot); |
|
|
|
} |
|
|
|
|
|
|
|
extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API AMDUP_ShutdownApi() |
|
|
|
|