mirror of
https://github.com/optiscaler/OptiScaler.git
synced 2026-05-04 00:31:35 +00:00
852ffc76b9
* Add support for dlssg-to-fsr3 mod * Add custom lock guard * Misc changes
99 lines
3.4 KiB
C++
99 lines
3.4 KiB
C++
/*
|
|
* Copyright (c) 2022-2023 NVIDIA CORPORATION. All rights reserved
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
* copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*/
|
|
#pragma once
|
|
|
|
#define SL_VERSION_MAJOR 2
|
|
#define SL_VERSION_MINOR 4
|
|
#define SL_VERSION_PATCH 15
|
|
|
|
#include <string>
|
|
|
|
namespace sl
|
|
{
|
|
constexpr uint64_t kSDKVersionMagic = 0xfedc;
|
|
constexpr uint64_t kSDKVersion = (uint64_t(SL_VERSION_MAJOR) << 48) | (uint64_t(SL_VERSION_MINOR) << 32) | (uint64_t(SL_VERSION_PATCH) << 16) | kSDKVersionMagic;
|
|
|
|
struct Version
|
|
{
|
|
Version() : major(0), minor(0), build(0) {};
|
|
Version(uint32_t v1, uint32_t v2, uint32_t v3) : major(v1), minor(v2), build(v3) {};
|
|
|
|
inline operator bool() const { return major != 0 || minor != 0 || build != 0; }
|
|
|
|
inline std::string toStr() const
|
|
{
|
|
return std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(build);
|
|
}
|
|
inline std::wstring toWStr() const
|
|
{
|
|
return std::to_wstring(major) + L"." + std::to_wstring(minor) + L"." + std::to_wstring(build);
|
|
}
|
|
inline std::wstring toWStrOTAId() const
|
|
{
|
|
return std::to_wstring((major << 16) | (minor << 8) | build);
|
|
}
|
|
inline bool operator==(const Version& rhs) const
|
|
{
|
|
return major == rhs.major && minor == rhs.minor && build == rhs.build;
|
|
}
|
|
inline bool operator>(const Version& rhs) const
|
|
{
|
|
if (major < rhs.major) return false;
|
|
else if (major > rhs.major) return true;
|
|
// major version the same
|
|
if (minor < rhs.minor) return false;
|
|
else if (minor > rhs.minor) return true;
|
|
// minor version the same
|
|
if (build < rhs.build) return false;
|
|
else if (build > rhs.build) return true;
|
|
// build version the same
|
|
return false;
|
|
};
|
|
inline bool operator>=(const Version& rhs) const
|
|
{
|
|
return operator>(rhs) || operator==(rhs);
|
|
};
|
|
inline bool operator<(const Version& rhs) const
|
|
{
|
|
if (major > rhs.major) return false;
|
|
else if (major < rhs.major) return true;
|
|
// major version the same
|
|
if (minor > rhs.minor) return false;
|
|
else if (minor < rhs.minor) return true;
|
|
// minor version the same
|
|
if (build > rhs.build) return false;
|
|
else if (build < rhs.build) return true;
|
|
// build version the same
|
|
return false;
|
|
};
|
|
inline bool operator<=(const Version& rhs) const
|
|
{
|
|
return operator<(rhs) || operator==(rhs);
|
|
};
|
|
|
|
uint32_t major;
|
|
uint32_t minor;
|
|
uint32_t build;
|
|
};
|
|
|
|
}
|