Clean up MV Scale query

This commit is contained in:
FakeMichau
2026-04-19 21:25:29 +02:00
parent ea6ad1bc2f
commit 166d19962d
13 changed files with 62 additions and 152 deletions
+4 -12
View File
@@ -492,21 +492,13 @@ bool FSR2FeatureDx11::Evaluate(ID3D11DeviceContext* InContext, NVSDK_NGX_Paramet
_accessToReactiveMask = paramReactiveMask != nullptr;
_hasOutput = params.output.resource != nullptr;
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) != NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
if (DepthInverted())
@@ -272,15 +272,15 @@ bool FSR2FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_N
_hasTM = params.transparencyAndComposition.resource != nullptr;
_hasOutput = params.output.resource != nullptr;
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) != NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) != NVSDK_NGX_Result_Success)
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) !=
NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
if (DepthInverted())
{
+5 -13
View File
@@ -253,24 +253,16 @@ bool FSR2FeatureDx12::EvaluateInternal(ID3D12GraphicsCommandList* InCommandList,
_accessToReactiveMask = paramReactiveMask != nullptr;
_hasOutput = params.output.resource != nullptr;
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) != NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
if (!Config::Instance()->FsrUseFsrInputValues.value_or_default() ||
if (!cfg.FsrUseFsrInputValues.value_or_default() ||
InParameters->Get("FSR.cameraNear", &params.cameraNear) != NVSDK_NGX_Result_Success)
{
if (DepthInverted())
+4 -12
View File
@@ -466,21 +466,13 @@ bool FSR2FeatureVk::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter* I
_accessToReactiveMask = paramReactiveMask != nullptr || paramReactiveMask2 != nullptr;
_hasOutput = params.output.resource != nullptr;
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) != NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
if (rcasEnabled)
@@ -267,21 +267,14 @@ bool FSR2FeatureDx11on12_212::Evaluate(ID3D11DeviceContext* InDeviceContext, NVS
_hasTM = params.transparencyAndComposition.resource != nullptr;
_hasOutput = params.output.resource != nullptr;
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) !=
NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
if (DepthInverted())
@@ -259,21 +259,13 @@ bool FSR2FeatureDx12_212::EvaluateInternal(ID3D12GraphicsCommandList* InCommandL
_accessToReactiveMask = paramReactiveMask != nullptr;
_hasOutput = params.output.resource != nullptr;
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) != NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
LOG_DEBUG("Sharpness: {0}", params.sharpness);
@@ -385,21 +385,14 @@ bool FSR2FeatureVkOnDx12_212::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Pa
_hasTM = params.transparencyAndComposition.resource != nullptr;
_hasOutput = params.output.resource != nullptr;
// For FSR 4 - resolve typeless formats
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) !=
NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
if (Config::Instance()->FsrCameraNear.has_value() ||
@@ -489,21 +489,13 @@ bool FSR2FeatureVk212::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter
_accessToReactiveMask = paramReactiveMask != nullptr || paramReactiveMask2 != nullptr;
_hasOutput = params.output.resource != nullptr;
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) != NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
if (rcasEnabled)
@@ -406,21 +406,13 @@ bool FSR31FeatureDx11::Evaluate(ID3D11DeviceContext* DeviceContext, NVSDK_NGX_Pa
_accessToReactiveMask = paramReactiveMask != nullptr;
_hasOutput = params.upscaleOutput.resource != nullptr;
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) != NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
LOG_DEBUG("Sharpness: {0}", params.sharpness);
@@ -310,21 +310,14 @@ bool FSR31FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_
ffxResolveTypelessFormat(params.output.description.format);
}
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) !=
NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
if (DepthInverted())
@@ -309,21 +309,13 @@ bool FSR31FeatureDx12::EvaluateInternal(ID3D12GraphicsCommandList* InCommandList
ffxResolveTypelessFormat(params.output.description.format);
}
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) != NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
LOG_DEBUG("Sharpness: {0}", params.sharpness);
+4 -12
View File
@@ -605,21 +605,13 @@ bool FSR31FeatureVk::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter*
_accessToReactiveMask = paramReactiveMask != nullptr || paramReactiveMask2 != nullptr;
_hasOutput = params.output.resource != nullptr;
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) != NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
if (rcasEnabled)
@@ -287,7 +287,8 @@ bool FSR31FeatureVkOn12::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Paramet
_hasTM = params.transparencyAndComposition.resource != nullptr;
_hasOutput = params.output.resource != nullptr;
// For FSR 4 - resolve typeless formats
// For FSR 4 as it seems to be missing some conversions from typeless
// transparencyAndComposition and exposure might be unnecessary here
if (Version().major >= 4)
{
ffxResolveTypelessFormat(params.color.description.format);
@@ -298,20 +299,14 @@ bool FSR31FeatureVkOn12::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Paramet
ffxResolveTypelessFormat(params.output.description.format);
}
float MVScaleX = 1.0f;
float MVScaleY = 1.0f;
params.motionVectorScale.x = 1.0f;
params.motionVectorScale.y = 1.0f;
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &MVScaleX) == NVSDK_NGX_Result_Success &&
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &MVScaleY) == NVSDK_NGX_Result_Success)
{
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
else
if (InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &params.motionVectorScale.x) !=
NVSDK_NGX_Result_Success ||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &params.motionVectorScale.y) != NVSDK_NGX_Result_Success)
{
LOG_WARN("Can't get motion vector scales!");
params.motionVectorScale.x = MVScaleX;
params.motionVectorScale.y = MVScaleY;
}
if (DepthInverted())