added velocity factor

This commit is contained in:
cdozdil
2024-10-02 00:04:18 +03:00
parent 0f9759f8cb
commit a99d64c143
4 changed files with 44 additions and 3 deletions
+6 -3
View File
@@ -39,10 +39,10 @@ private:
bool _depthInverted = false;
unsigned int _lastWidth = 0;
unsigned int _lastHeight = 0;
static inline feature_version _version{ 3, 1, 0 };
static inline feature_version _version{ 3, 1, 1 };
protected:
std::string _name = "FSR 3.1.0";
std::string _name = "FSR 3.X";
ffxContext _context = nullptr;
ffxCreateContextDescUpscale _contextDesc = {};
@@ -59,11 +59,14 @@ protected:
double GetDeltaTime();
void SetDepthInverted(bool InValue);
static inline void parse_version(const char* version_str) {
static inline void parse_version(const char* version_str)
{
if (sscanf_s(version_str, "%u.%u.%u", &_version.major, &_version.minor, &_version.patch) != 3)
LOG_WARN("can't parse {0}", version_str);
}
float _velocity = 0.0f;
public:
bool IsDepthInverted() const;
feature_version Version() final { return _version; }
@@ -346,6 +346,19 @@ bool FSR31FeatureDx11on12::Evaluate(ID3D11DeviceContext* InDeviceContext, NVSDK_
params.preExposure = 1.0f;
params.viewSpaceToMetersFactor = 1.0f;
if (_velocity != Config::Instance()->FsrVelocity.value_or(0.3f))
{
_velocity = Config::Instance()->FsrVelocity.value_or(0.3f);
ffxConfigureDescUpscaleKeyValue m_upscalerKeyValueConfig{};
m_upscalerKeyValueConfig.header.type = FFX_API_CONFIGURE_DESC_TYPE_UPSCALE_KEYVALUE;
m_upscalerKeyValueConfig.key = FFX_API_CONFIGURE_UPSCALE_KEY_FVELOCITYFACTOR;
m_upscalerKeyValueConfig.ptr = &_velocity;
auto result = _configure(&_context, &m_upscalerKeyValueConfig.header);
if (result != FFX_API_RETURN_OK)
LOG_WARN("Velocity configure result: {}", (UINT)result);
}
LOG_DEBUG("Dispatch!!");
auto ffxresult = _dispatch(&_context, &params.header);
@@ -370,6 +370,19 @@ bool FSR31FeatureDx12::Evaluate(ID3D12GraphicsCommandList* InCommandList, NVSDK_
params.preExposure = 1.0f;
InParameters->Get(NVSDK_NGX_Parameter_DLSS_Pre_Exposure, &params.preExposure);
if (_velocity != Config::Instance()->FsrVelocity.value_or(0.3f))
{
_velocity = Config::Instance()->FsrVelocity.value_or(0.3f);
ffxConfigureDescUpscaleKeyValue m_upscalerKeyValueConfig{};
m_upscalerKeyValueConfig.header.type = FFX_API_CONFIGURE_DESC_TYPE_UPSCALE_KEYVALUE;
m_upscalerKeyValueConfig.key = FFX_API_CONFIGURE_UPSCALE_KEY_FVELOCITYFACTOR;
m_upscalerKeyValueConfig.ptr = &_velocity;
auto result = _configure(&_context, &m_upscalerKeyValueConfig.header);
if (result != FFX_API_RETURN_OK)
LOG_WARN("Velocity configure result: {}", (UINT)result);
}
LOG_DEBUG("Dispatch!!");
auto result = _dispatch(&_context, &params.header);
@@ -476,6 +476,18 @@ bool FSR31FeatureVk::Evaluate(VkCommandBuffer InCmdBuffer, NVSDK_NGX_Parameter*
params.preExposure = 1.0f; InParameters->Get(NVSDK_NGX_Parameter_DLSS_Pre_Exposure, &params.preExposure);
if (_velocity != Config::Instance()->FsrVelocity.value_or(0.3f))
{
_velocity = Config::Instance()->FsrVelocity.value_or(0.3f);
ffxConfigureDescUpscaleKeyValue m_upscalerKeyValueConfig{};
m_upscalerKeyValueConfig.header.type = FFX_API_CONFIGURE_DESC_TYPE_UPSCALE_KEYVALUE;
m_upscalerKeyValueConfig.key = FFX_API_CONFIGURE_UPSCALE_KEY_FVELOCITYFACTOR;
m_upscalerKeyValueConfig.ptr = &_velocity;
auto result = _configure(&_context, &m_upscalerKeyValueConfig.header);
if (result != FFX_API_RETURN_OK)
LOG_WARN("Velocity configure result: {}", (UINT)result);
}
LOG_DEBUG("Dispatch!!");
auto result = _dispatch(&_context, &params.header);