mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-26 08:06:33 +00:00
Added display res motion vector checks to RCAS/DA shaders
This commit is contained in:
@@ -67,7 +67,14 @@ void RCAS_Dx11::FillMotionConstants(InternalConstants& OutConstants, const RcasC
|
||||
OutConstants.Threshold = Config::Instance()->MotionThreshold.value_or_default();
|
||||
OutConstants.ScaleLimit = Config::Instance()->MotionScaleLimit.value_or_default();
|
||||
|
||||
OutConstants.MotionTextureScale = (float) feature->RenderWidth() / (float) feature->TargetWidth();
|
||||
if (feature->LowResMV())
|
||||
{
|
||||
OutConstants.MotionTextureScale = (float) feature->RenderWidth() / (float) feature->TargetWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
OutConstants.MotionTextureScale = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void RCAS_Dx11::FillMotionConstants(InternalConstantsDA& OutConstants, const RcasConstants& InConstants)
|
||||
@@ -116,7 +123,7 @@ void RCAS_Dx11::FillMotionConstants(InternalConstantsDA& OutConstants, const Rca
|
||||
OutConstants.DepthWidth = feature->RenderWidth();
|
||||
OutConstants.DepthHeight = feature->RenderHeight();
|
||||
|
||||
OutConstants.MotionTextureScale = (float) feature->RenderWidth() / (float) feature->TargetWidth();
|
||||
OutConstants.MotionTextureScale = (float) OutConstants.MotionWidth / (float) feature->TargetWidth();
|
||||
}
|
||||
|
||||
bool RCAS_Dx11::CreateBufferResource(ID3D11Device* InDevice, ID3D11Resource* InResource)
|
||||
@@ -359,9 +366,8 @@ bool RCAS_Dx11::DispatchDepthAdaptive(ID3D11Device* InDevice, ID3D11DeviceContex
|
||||
InContext->CSSetShaderResources(0, 3, srvs);
|
||||
InContext->CSSetUnorderedAccessViews(0, 1, &_uavOutput, nullptr);
|
||||
|
||||
auto feature = State::Instance().currentFeature;
|
||||
UINT dispatchWidth = (feature->TargetWidth() + InNumThreadsX - 1) / InNumThreadsX;
|
||||
UINT dispatchHeight = (feature->TargetHeight() + InNumThreadsY - 1) / InNumThreadsY;
|
||||
UINT dispatchWidth = (constants.DisplayWidth + InNumThreadsX - 1) / InNumThreadsX;
|
||||
UINT dispatchHeight = (constants.DisplayHeight + InNumThreadsY - 1) / InNumThreadsY;
|
||||
|
||||
InContext->Dispatch(dispatchWidth, dispatchHeight, 1);
|
||||
|
||||
|
||||
@@ -59,8 +59,15 @@ void RCAS_Dx12::FillMotionConstants(InternalConstants& OutConstants, const RcasC
|
||||
OutConstants.Threshold = Config::Instance()->MotionThreshold.value_or_default();
|
||||
OutConstants.ScaleLimit = Config::Instance()->MotionScaleLimit.value_or_default();
|
||||
|
||||
if (feature->LowResMV())
|
||||
{
|
||||
OutConstants.MotionTextureScale = (float) feature->RenderWidth() / (float) feature->TargetWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
OutConstants.MotionTextureScale = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void RCAS_Dx12::FillMotionConstants(InternalConstantsDA& OutConstants, const RcasConstants& InConstants)
|
||||
{
|
||||
@@ -97,11 +104,13 @@ void RCAS_Dx12::FillMotionConstants(InternalConstantsDA& OutConstants, const Rca
|
||||
{
|
||||
OutConstants.MotionWidth = feature->RenderWidth();
|
||||
OutConstants.MotionHeight = feature->RenderHeight();
|
||||
OutConstants.MotionTextureScale = (float) OutConstants.MotionWidth / (float) feature->TargetWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
OutConstants.MotionWidth = feature->TargetWidth();
|
||||
OutConstants.MotionHeight = feature->TargetHeight();
|
||||
OutConstants.MotionTextureScale = 1.0f;
|
||||
}
|
||||
|
||||
OutConstants.DepthWidth = feature->RenderWidth();
|
||||
@@ -172,9 +181,8 @@ bool RCAS_Dx12::DispatchDepthAdaptive(ID3D12GraphicsCommandList* InCmdList, ID3D
|
||||
InCmdList->SetPipelineState(_pipelineStateDA);
|
||||
InCmdList->SetComputeRootDescriptorTable(0, currentHeap.GetTableGPUStart());
|
||||
|
||||
auto inDesc = InResource->GetDesc();
|
||||
UINT dispatchWidth = static_cast<UINT>((inDesc.Width + InNumThreadsX - 1) / InNumThreadsX);
|
||||
UINT dispatchHeight = (inDesc.Height + InNumThreadsY - 1) / InNumThreadsY;
|
||||
UINT dispatchWidth = static_cast<UINT>((constants.DisplayWidth + InNumThreadsX - 1) / InNumThreadsX);
|
||||
UINT dispatchHeight = (constants.DisplayHeight + InNumThreadsY - 1) / InNumThreadsY;
|
||||
InCmdList->Dispatch(dispatchWidth, dispatchHeight, 1);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -502,10 +502,14 @@ void RCAS_Vk::FillMotionConstants(InternalConstants& OutConstants, const RcasCon
|
||||
OutConstants.Threshold = Config::Instance()->MotionThreshold.value_or_default();
|
||||
OutConstants.ScaleLimit = Config::Instance()->MotionScaleLimit.value_or_default();
|
||||
|
||||
if (feature->TargetWidth() == 0)
|
||||
OutConstants.MotionTextureScale = 1.0f;
|
||||
else
|
||||
if (feature->LowResMV())
|
||||
{
|
||||
OutConstants.MotionTextureScale = (float) feature->RenderWidth() / (float) feature->TargetWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
OutConstants.MotionTextureScale = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void RCAS_Vk::FillMotionConstants(InternalConstantsDA& OutConstants, const RcasConstants& InConstants)
|
||||
@@ -535,11 +539,7 @@ void RCAS_Vk::FillMotionConstants(InternalConstantsDA& OutConstants, const RcasC
|
||||
OutConstants.DepthLinearA = InConstants.CameraNear * InConstants.CameraFar;
|
||||
OutConstants.DepthLinearB = InConstants.CameraFar;
|
||||
OutConstants.DepthLinearC = InConstants.CameraFar - InConstants.CameraNear;
|
||||
|
||||
if (feature->DisplayWidth() == 0)
|
||||
OutConstants.DepthTextureScale = 1.0f;
|
||||
else
|
||||
OutConstants.DepthTextureScale = (float) feature->RenderWidth() / (float) feature->DisplayWidth();
|
||||
OutConstants.DepthTextureScale = (float) feature->RenderWidth() / (float) feature->DisplayWidth();
|
||||
|
||||
OutConstants.ClampOutput = Config::Instance()->DAClampOutput.value_or(feature->IsHdr()) ? 0 : 1;
|
||||
|
||||
@@ -550,17 +550,14 @@ void RCAS_Vk::FillMotionConstants(InternalConstantsDA& OutConstants, const RcasC
|
||||
}
|
||||
else
|
||||
{
|
||||
OutConstants.MotionWidth = feature->DisplayWidth();
|
||||
OutConstants.MotionHeight = feature->DisplayHeight();
|
||||
OutConstants.MotionWidth = feature->TargetWidth();
|
||||
OutConstants.MotionHeight = feature->TargetHeight();
|
||||
}
|
||||
|
||||
OutConstants.DepthWidth = feature->RenderWidth();
|
||||
OutConstants.DepthHeight = feature->RenderHeight();
|
||||
|
||||
if (feature->TargetWidth() == 0)
|
||||
OutConstants.MotionTextureScale = 1.0f;
|
||||
else
|
||||
OutConstants.MotionTextureScale = (float) feature->RenderWidth() / (float) feature->TargetWidth();
|
||||
OutConstants.MotionTextureScale = (float) OutConstants.MotionWidth / (float) feature->TargetWidth();
|
||||
}
|
||||
|
||||
bool RCAS_Vk::DispatchRCAS(VkDevice InDevice, VkCommandBuffer InCmdList, RcasConstants InConstants,
|
||||
|
||||
Reference in New Issue
Block a user