mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-25 15:46:45 +00:00
unified infos
This commit is contained in:
@@ -36,13 +36,16 @@ protected:
|
||||
|
||||
public:
|
||||
bool IsInited() { return _isInited; }
|
||||
|
||||
uint32_t RenderWidth() { return _renderWidth; }
|
||||
uint32_t RenderHeight() { return _renderHeight; }
|
||||
uint32_t DisplayWidth() { return _displayWidth; }
|
||||
uint32_t DisplayHeight() { return _displayHeight; }
|
||||
uint32_t TargetWidth() { return _targetWidth; }
|
||||
uint32_t TargetHeight() { return _targetHeight; }
|
||||
|
||||
CommonQualityPreset QualityPreset() { return _pqValue; }
|
||||
|
||||
bool AutoExposure() { return _autoExposure; }
|
||||
bool Hdr() { return _hdr; }
|
||||
bool Sharpening() { return _sharpening; }
|
||||
@@ -50,5 +53,4 @@ public:
|
||||
bool JitterCancellation() { return _jitterCancellation; }
|
||||
bool DisplayResolutionMV() { return _displayResMV; }
|
||||
bool DepthInverted() { return _depthInverted; }
|
||||
|
||||
};
|
||||
@@ -1,12 +1,90 @@
|
||||
#pragma once
|
||||
#include "../pch.h"
|
||||
|
||||
class IFeatureEvaluateParams
|
||||
{
|
||||
private:
|
||||
inline static double _lastFrameTime = -1;
|
||||
|
||||
inline static double MillisecondsNow()
|
||||
{
|
||||
LARGE_INTEGER s_frequency;
|
||||
bool s_use_qpc = QueryPerformanceFrequency(&s_frequency);
|
||||
double milliseconds = 0;
|
||||
|
||||
if (s_use_qpc)
|
||||
{
|
||||
LARGE_INTEGER now;
|
||||
QueryPerformanceCounter(&now);
|
||||
milliseconds = double(1000.0 * now.QuadPart) / s_frequency.QuadPart;
|
||||
}
|
||||
else
|
||||
{
|
||||
milliseconds = double(GetTickCount64());
|
||||
}
|
||||
|
||||
return milliseconds;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool _isInited = false;
|
||||
|
||||
void* _inputColor = nullptr;
|
||||
void* _inputDepth = nullptr;
|
||||
void* _inputMotion = nullptr;
|
||||
void* _inputExposure = nullptr;
|
||||
void* _inputMask = nullptr;
|
||||
void* _outputColor = nullptr;
|
||||
|
||||
uint32_t _renderWidth = 0;
|
||||
uint32_t _renderHeight = 0;
|
||||
|
||||
float _jitterOffsetX = 0.0f;
|
||||
float _jitterOffsetY = 0.0f;
|
||||
|
||||
float _mvScaleX = 1.0f;
|
||||
float _mvScaleY = 1.0f;
|
||||
|
||||
float _sharpness = 0.0f;
|
||||
float _exposureScale = 1.0f;
|
||||
float _frameTimeDelta = 0.0f;
|
||||
|
||||
bool _reset = false;
|
||||
|
||||
public:
|
||||
IFeatureEvaluateParams()
|
||||
{
|
||||
if (_lastFrameTime < 0)
|
||||
{
|
||||
_lastFrameTime = MillisecondsNow();
|
||||
}
|
||||
else
|
||||
{
|
||||
double currentTime = MillisecondsNow();
|
||||
_frameTimeDelta = currentTime - _lastFrameTime;
|
||||
_lastFrameTime = currentTime;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsInited() const { return _isInited; }
|
||||
|
||||
void* InputColor() const { return _inputColor; }
|
||||
void* InputDepth() const { return _inputDepth; }
|
||||
void* InputMotion() const { return _inputMotion; }
|
||||
void* InputExposure() const { return _inputExposure; }
|
||||
void* InputMask() const { return _inputMask; }
|
||||
void* OutputColor() const { return _outputColor; }
|
||||
|
||||
uint32_t RenderWidth() const { return _renderWidth; }
|
||||
uint32_t RenderHeight() const { return _renderHeight; }
|
||||
|
||||
float JitterOffsetX() const { return _jitterOffsetX; }
|
||||
float JitterOffsetY() const { return _jitterOffsetY; }
|
||||
float MvScaleX() const { return _mvScaleX; }
|
||||
float MvScaleY() const { return _mvScaleY; }
|
||||
float Sharpness() const { return _sharpness; }
|
||||
float ExposureScale() const { return _exposureScale; }
|
||||
float FrameTimeDelta() const { return _frameTimeDelta; }
|
||||
|
||||
bool Reset() const { return _reset; }
|
||||
};
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#pragma once
|
||||
|
||||
#include "IFeatureEvaluateParams.h"
|
||||
|
||||
class IFeatureEvaluateParams_DLSS : public IFeatureEvaluateParams
|
||||
{
|
||||
private:
|
||||
void GetRenderResolution(const NVSDK_NGX_Parameter* InParameters)
|
||||
{
|
||||
uint32_t OutWidth;
|
||||
uint32_t OutHeight;
|
||||
|
||||
if (InParameters->Get(NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Width, &OutWidth) != NVSDK_NGX_Result_Success ||
|
||||
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Render_Subrect_Dimensions_Height, &OutHeight) != NVSDK_NGX_Result_Success)
|
||||
{
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int outWidth;
|
||||
unsigned int outHeight;
|
||||
|
||||
do
|
||||
{
|
||||
if (InParameters->Get(NVSDK_NGX_Parameter_Width, &width) == NVSDK_NGX_Result_Success &&
|
||||
InParameters->Get(NVSDK_NGX_Parameter_Height, &height) == NVSDK_NGX_Result_Success)
|
||||
{
|
||||
if (InParameters->Get(NVSDK_NGX_Parameter_OutWidth, &outWidth) == NVSDK_NGX_Result_Success &&
|
||||
InParameters->Get(NVSDK_NGX_Parameter_OutHeight, &outHeight) == NVSDK_NGX_Result_Success)
|
||||
{
|
||||
if (width < outWidth)
|
||||
{
|
||||
OutWidth = width;
|
||||
OutHeight = height;
|
||||
break;
|
||||
}
|
||||
|
||||
OutWidth = outWidth;
|
||||
OutHeight = outHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (width < RenderWidth())
|
||||
{
|
||||
OutWidth = width;
|
||||
OutHeight = height;
|
||||
break;
|
||||
}
|
||||
|
||||
OutWidth = -1;
|
||||
OutHeight = -1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
OutWidth = -1;
|
||||
OutHeight = -1;
|
||||
|
||||
} while (false);
|
||||
}
|
||||
|
||||
_renderWidth = OutWidth;
|
||||
_renderHeight = OutHeight;
|
||||
}
|
||||
|
||||
public:
|
||||
IFeatureEvaluateParams_DLSS(const NVSDK_NGX_Parameter* InParameters) : IFeatureEvaluateParams()
|
||||
{
|
||||
InParameters->Get(NVSDK_NGX_Parameter_Jitter_Offset_X, &_jitterOffsetX);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_Jitter_Offset_Y, &_jitterOffsetY);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Exposure_Scale, &_exposureScale);
|
||||
|
||||
int reset = 0;
|
||||
InParameters->Get(NVSDK_NGX_Parameter_Reset, &reset);
|
||||
_reset = reset != 0;
|
||||
|
||||
InParameters->Get(NVSDK_NGX_Parameter_Color, &_inputColor);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_MotionVectors, &_inputMotion);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_Depth, &_inputDepth);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_ExposureTexture, &_inputExposure);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Input_Bias_Current_Color_Mask, &_inputMask);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_Output, &_outputColor);
|
||||
|
||||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &_mvScaleX);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &_mvScaleY);
|
||||
|
||||
float ftDelta = 0.0f;
|
||||
if (InParameters->Get(NVSDK_NGX_Parameter_FrameTimeDeltaInMsec, &ftDelta) == NVSDK_NGX_Result_Success || ftDelta > 1.0f)
|
||||
_frameTimeDelta = ftDelta;
|
||||
|
||||
InParameters->Get(NVSDK_NGX_Parameter_Sharpness, &_sharpness);
|
||||
|
||||
GetRenderResolution(InParameters);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user