mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-08-24 23:26:50 +00:00
stash
This commit is contained in:
@@ -14,16 +14,16 @@ typedef struct _feature_version
|
||||
unsigned int patch;
|
||||
} FeatureVersion;
|
||||
|
||||
inline static unsigned int handleCounter = 1000000;
|
||||
|
||||
class IFeature
|
||||
{
|
||||
private:
|
||||
bool _isInited = false;
|
||||
inline static unsigned int handleCounter = 1000000;
|
||||
|
||||
protected:
|
||||
unsigned int _handleId = 0;
|
||||
IFeatureCreateParams _createParams = {};
|
||||
IFeatureCreateParams _createParams;
|
||||
|
||||
bool _hasColor = false;
|
||||
bool _hasDepth = false;
|
||||
@@ -31,7 +31,7 @@ protected:
|
||||
bool _hasTM = false;
|
||||
bool _hasExposure = false;
|
||||
bool _hasOutput = false;
|
||||
|
||||
|
||||
unsigned int _renderWidth = 0;
|
||||
unsigned int _renderHeight = 0;
|
||||
unsigned int _targetWidth = 0;
|
||||
@@ -44,20 +44,20 @@ protected:
|
||||
long _frameCount = 0;
|
||||
bool _moduleLoaded = false;
|
||||
|
||||
void SetHandle(unsigned int InHandleId)
|
||||
void SetHandle(unsigned int InHandleId)
|
||||
{
|
||||
_handleId = InHandleId;
|
||||
spdlog::info("IFeatureContext::SetHandle Handle: {0}", _handleId);
|
||||
}
|
||||
|
||||
void SetInit(bool InValue)
|
||||
{
|
||||
_isInited = InValue;
|
||||
void SetInit(bool InValue)
|
||||
{
|
||||
_isInited = InValue;
|
||||
}
|
||||
|
||||
public:
|
||||
static unsigned int GetNextHandleId() { return handleCounter++; }
|
||||
|
||||
|
||||
unsigned int DisplayWidth() const { return _displayWidth; };
|
||||
unsigned int DisplayHeight() const { return _displayHeight; };
|
||||
unsigned int TargetWidth() const { return _targetWidth; };
|
||||
@@ -65,10 +65,11 @@ public:
|
||||
unsigned int RenderWidth() const { return _renderWidth; };
|
||||
unsigned int RenderHeight() const { return _renderHeight; };
|
||||
CommonQualityPreset PerfQualityValue() const { return _createParams.QualityPreset(); }
|
||||
|
||||
|
||||
|
||||
const IFeatureCreateParams CreateParams() { return _createParams; }
|
||||
|
||||
bool IsInited() const { return _isInited; }
|
||||
|
||||
|
||||
float Sharpness() const { return _sharpness; }
|
||||
bool HasColor() const { return _hasColor; }
|
||||
bool HasDepth() const { return _hasDepth; }
|
||||
@@ -76,9 +77,9 @@ public:
|
||||
bool HasTM() const { return _hasTM; }
|
||||
bool HasExposure() const { return _hasExposure; }
|
||||
bool HasOutput() const { return _hasOutput; }
|
||||
|
||||
virtual FeatureVersion Version() = 0;
|
||||
virtual const char* Name() = 0;
|
||||
|
||||
virtual FeatureVersion Version() { return {}; }
|
||||
virtual const char* Name() { return "Base"; }
|
||||
|
||||
bool ModuleLoaded() const { return _moduleLoaded; }
|
||||
long FrameCount() const { return _frameCount; }
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
#pragma once
|
||||
#include "../pch.h"
|
||||
|
||||
enum CommonQualityPreset
|
||||
{
|
||||
NativeAA,
|
||||
UltraQuality,
|
||||
Quality,
|
||||
Balanced,
|
||||
Performance,
|
||||
UltraPerformance,
|
||||
Undefined
|
||||
};
|
||||
|
||||
class IFeatureCreateParams
|
||||
{
|
||||
protected:
|
||||
@@ -37,6 +26,8 @@ protected:
|
||||
public:
|
||||
bool IsInited() const { return _isInited; }
|
||||
|
||||
virtual ParamterSource Source() { return Base; }
|
||||
|
||||
uint32_t RenderWidth() const { return _renderWidth; }
|
||||
uint32_t RenderHeight() const { return _renderHeight; }
|
||||
uint32_t DisplayWidth() const { return _displayWidth; }
|
||||
|
||||
@@ -10,6 +10,7 @@ class IFeatureCreateParams_DLSS : public IFeatureCreateParams
|
||||
{
|
||||
private:
|
||||
const NVNGX_Init_Info _initInfo;
|
||||
const NVSDK_NGX_Parameter* _nvParameter = nullptr;
|
||||
|
||||
inline static CommonQualityPreset GetQualityPreset(int pqValue)
|
||||
{
|
||||
@@ -52,6 +53,8 @@ public:
|
||||
if (InParameters == nullptr)
|
||||
return;
|
||||
|
||||
_nvParameter = InParameters;
|
||||
|
||||
NVSDK_NGX_Result result;
|
||||
|
||||
unsigned int width = 0;
|
||||
@@ -191,4 +194,8 @@ public:
|
||||
}
|
||||
|
||||
NVNGX_Init_Info InitInfo() { return _initInfo; }
|
||||
|
||||
const NVSDK_NGX_Parameter* NvParameter() { return _nvParameter; }
|
||||
|
||||
ParamterSource Source() final { return DLSS; }
|
||||
};
|
||||
@@ -47,6 +47,7 @@ protected:
|
||||
|
||||
float _sharpness = 0.0f;
|
||||
float _exposureScale = 1.0f;
|
||||
float _preExposure = 1.0f;
|
||||
float _frameTimeDelta = 0.0f;
|
||||
|
||||
bool _reset = false;
|
||||
@@ -66,6 +67,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual ParamterSource Source() { return Base; }
|
||||
|
||||
bool IsInited() const { return _isInited; }
|
||||
|
||||
void* InputColor() const { return _inputColor; }
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
class IFeatureEvaluateParams_DLSS : public IFeatureEvaluateParams
|
||||
{
|
||||
private:
|
||||
double _lastFrameTime = 0.0;
|
||||
|
||||
const NVSDK_NGX_Parameter* _nvParameter = nullptr;
|
||||
|
||||
void GetRenderResolution(const NVSDK_NGX_Parameter* InParameters)
|
||||
{
|
||||
uint32_t OutWidth;
|
||||
@@ -64,9 +68,15 @@ private:
|
||||
public:
|
||||
IFeatureEvaluateParams_DLSS(const NVSDK_NGX_Parameter* InParameters) : IFeatureEvaluateParams()
|
||||
{
|
||||
_nvParameter = InParameters;
|
||||
|
||||
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);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Pre_Exposure, &_preExposure);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_X, &_mvScaleX);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_MV_Scale_Y, &_mvScaleY);
|
||||
InParameters->Get(NVSDK_NGX_Parameter_Sharpness, &_sharpness);
|
||||
|
||||
int reset = 0;
|
||||
InParameters->Get(NVSDK_NGX_Parameter_Reset, &reset);
|
||||
@@ -79,15 +89,13 @@ public:
|
||||
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);
|
||||
}
|
||||
|
||||
ParamterSource Source() final { return DLSS; }
|
||||
};
|
||||
@@ -25,10 +25,6 @@ protected:
|
||||
public:
|
||||
virtual bool Init(ID3D12Device* InDevice, ID3D12GraphicsCommandList* InCommandList) = 0;
|
||||
virtual bool Evaluate(ID3D12GraphicsCommandList* InCommandList, const IFeatureEvaluateParams* InParams) = 0;
|
||||
virtual bool Evaluate(ID3D12GraphicsCommandList* InCommandList, const IFeatureEvaluateParams* InParams) = 0;
|
||||
|
||||
bool BeforeEvaluate(ID3D12GraphicsCommandList* InCommandList, const IFeatureEvaluateParams* InParams, ID3D12Resource* OutputTexture);
|
||||
void AfterEvaluate(ID3D12GraphicsCommandList* InCommandList, const IFeatureEvaluateParams* InParams, ID3D12Resource* OutputTexture);
|
||||
|
||||
IFeature_Dx12(unsigned int InHandleId, const IFeatureCreateParams InParameters);
|
||||
|
||||
|
||||
@@ -18,5 +18,24 @@
|
||||
#define SPDLOG_USE_STD_FORMAT
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
enum ParamterSource
|
||||
{
|
||||
Base,
|
||||
DLSS,
|
||||
XeSS,
|
||||
FSR
|
||||
};
|
||||
|
||||
enum CommonQualityPreset
|
||||
{
|
||||
NativeAA,
|
||||
UltraQuality,
|
||||
Quality,
|
||||
Balanced,
|
||||
Performance,
|
||||
UltraPerformance,
|
||||
Undefined
|
||||
};
|
||||
|
||||
inline HMODULE dllModule;
|
||||
inline DWORD processId;
|
||||
|
||||
Reference in New Issue
Block a user