mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-10-13 23:39:09 +00:00
Prevent NvngxFFX errors from causing a memory leak
This commit is contained in:
1 parent
a098e6fbf6
commit
f6f75ddf01
2 files changed
+11
-1
No files matched your search
@@ -381,6 +381,11 @@ NVSDK_NGX_Result Nvngx_FFX::D3D12_EvaluateFeature(ID3D12GraphicsCommandList* InC
|
||||
const bool outputMismatch = outputFfx.description.width != InOurHandle->swapchainWidth ||
|
||||
outputFfx.description.height != InOurHandle->swapchainHeight;
|
||||
|
||||
if (State::Instance().fgChanged || outputMismatch)
|
||||
InOurHandle->createFailed = false;
|
||||
else if (InOurHandle->createFailed)
|
||||
return NVSDK_NGX_Result_Fail;
|
||||
|
||||
if ((State::Instance().fgChanged || outputMismatch) && InOurHandle->fgContext && InOurHandle->fgContext->ctx)
|
||||
{
|
||||
if (outputMismatch)
|
||||
@@ -496,7 +501,11 @@ NVSDK_NGX_Result Nvngx_FFX::D3D12_EvaluateFeature(ID3D12GraphicsCommandList* InC
|
||||
|
||||
if (retCode != FFX_API_RETURN_OK)
|
||||
{
|
||||
LOG_ERROR("Failed to create FFX context");
|
||||
LOG_ERROR("Failed to create FFX context: {:X}", retCode);
|
||||
|
||||
// Only retry on change, failed create context seems to leak memory
|
||||
InOurHandle->createFailed = true;
|
||||
|
||||
return NVSDK_NGX_Result_Fail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ struct Nvngx_FFX_Handle
|
||||
uint32_t swapchainWidth = 0;
|
||||
uint32_t swapchainHeight = 0;
|
||||
uint64_t lastFrameId = 0;
|
||||
bool createFailed = false;
|
||||
|
||||
// for HDR
|
||||
bool hdrRangeSet = false;
|
||||
|
||||
Reference in new issue
Block a user