implementation fiddleing

This commit is contained in:
cdozdil
2024-06-03 00:02:50 +03:00
parent f54000f665
commit 388eb6cbdd
2 changed files with 99 additions and 2 deletions
+5
View File
@@ -1,4 +1,8 @@
#pragma once
#include "IFeatureCreateParams.h"
#include "IFeatureEvaluateParams.h"
#include <nvsdk_ngx.h>
#include <nvsdk_ngx_defs.h>
@@ -16,6 +20,7 @@ private:
protected:
NVSDK_NGX_Handle* _handle = nullptr;
IFeatureCreateParams _createParams = {};
float _sharpness = 0;
bool _hasColor = false;
+94 -2
View File
@@ -179,7 +179,7 @@ bool XeSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
else
params.pOutputTexture = paramOutput;
if (Config::Instance()->RcasEnabled.value_or(true) &&
if (Config::Instance()->RcasEnabled.value_or(true) &&
(sharpness > 0.0f || (Config::Instance()->MotionSharpnessEnabled.value_or(false) && Config::Instance()->MotionSharpness.value_or(0.4) > 0.0f)) &&
RCAS->IsInit() && RCAS->CreateBufferResource(Device, params.pOutputTexture, D3D12_RESOURCE_STATE_UNORDERED_ACCESS))
{
@@ -306,7 +306,7 @@ bool XeSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
}
// apply rcas
if (Config::Instance()->RcasEnabled.value_or(true) &&
if (Config::Instance()->RcasEnabled.value_or(true) &&
(sharpness > 0.0f || (Config::Instance()->MotionSharpnessEnabled.value_or(false) && Config::Instance()->MotionSharpness.value_or(0.4) > 0.0f)) &&
RCAS->CanRender())
{
@@ -412,6 +412,98 @@ bool XeSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_N
return true;
}
bool XeSSFeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, const IFeatureEvaluateParams* InParams)
{
spdlog::debug("XeSSFeatureDx12::Evaluate");
if (!IsInited() || !_xessContext || !ModuleLoaded())
{
spdlog::error("XeSSFeatureDx12::Evaluate Not inited!");
return false;
}
if (!RCAS->IsInit())
Config::Instance()->RcasEnabled = false;
if (!OutputScaler->IsInit())
Config::Instance()->OutputScalingEnabled = false;
if (Config::Instance()->xessDebug)
{
spdlog::error("XeSSFeatureDx12::Evaluate xessDebug");
xess_dump_parameters_t dumpParams{};
dumpParams.frame_count = Config::Instance()->xessDebugFrames;
dumpParams.frame_idx = dumpCount;
dumpParams.path = ".";
dumpParams.dump_elements_mask = XESS_DUMP_INPUT_COLOR | XESS_DUMP_INPUT_VELOCITY | XESS_DUMP_INPUT_DEPTH | XESS_DUMP_OUTPUT | XESS_DUMP_EXECUTION_PARAMETERS | XESS_DUMP_HISTORY;
if (!Config::Instance()->DisableReactiveMask.value_or(true))
dumpParams.dump_elements_mask |= XESS_DUMP_INPUT_RESPONSIVE_PIXEL_MASK;
StartDump()(_xessContext, &dumpParams);
Config::Instance()->xessDebug = false;
dumpCount += Config::Instance()->xessDebugFrames;
}
xess_result_t xessResult;
xess_d3d12_execute_params_t params{};
params.jitterOffsetX = InParams->JitterOffsetX();
params.jitterOffsetY = InParams->JitterOffsetY();
params.exposureScale = InParams->ExposureScale();
params.resetHistory = InParams->Reset() ? 1 : 0;
if (InParams->RenderWidth() > 0)
params.inputWidth = InParams->RenderWidth();
else
params.inputWidth = RenderWidth();
if (InParams->RenderHeight() > 0)
params.inputHeight = InParams->RenderHeight();
else
params.inputHeight = RenderHeight();
spdlog::debug("XeSSFeatureDx12::Evaluate Input Resolution: {0}x{1}", params.inputWidth, params.inputHeight);
auto sharpness = InParams->Sharpness();
auto beforeResult = BeforeEvaluate(InCommandList, InParams, params.pOutputTexture);
// Autoexposure Reset
if (Config::Instance()->changeBackend)
return true;
params.pColorTexture = (ID3D12Resource*)InParams->InputColor();
params.pDepthTexture = (ID3D12Resource*)InParams->InputDepth();
params.pExposureScaleTexture = (ID3D12Resource*)InParams->InputExposure();
params.pVelocityTexture = (ID3D12Resource*)InParams->InputMotion();
params.pResponsivePixelMaskTexture = (ID3D12Resource*)InParams->InputMask();
xessResult = SetVelocityScale()(_xessContext, InParams->MvScaleX(), InParams->MvScaleY());
if (xessResult != XESS_RESULT_SUCCESS)
{
spdlog::error("XeSSFeatureDx12::Evaluate xessSetVelocityScale: {0}", ResultToString(xessResult));
return false;
}
spdlog::debug("XeSSFeatureDx12::Evaluate Executing!!");
xessResult = D3D12Execute()(_xessContext, InCommandList, &params);
if (xessResult != XESS_RESULT_SUCCESS)
{
spdlog::error("XeSSFeatureDx12::Evaluate xessD3D12Execute error: {0}", ResultToString(xessResult));
return false;
}
AfterEvaluate(InCommandList, InParams, params.pOutputTexture);
_frameCount++;
return true;
}
XeSSFeatureDx12::~XeSSFeatureDx12()
{
if (RCAS != nullptr && RCAS.get() != nullptr)