-
Notifications
You must be signed in to change notification settings - Fork 232
Fix NGX Lifetime Management and Manual FSR FOV Conversion #875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ZachHembree
wants to merge
8
commits into
optiscaler:master
Choose a base branch
from
ZachHembree:fix-ngx-alloc-and-fsr-fov
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,115
−672
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
305f683
Clean up DLSS DX12 inputs
ZachHembree 0b57bf2
Fix: Correct NGX Parameter table lifetime and deallocation
ZachHembree 2d42774
Start gathering unique string literals in header
ZachHembree 4d639bb
Fix incorrect configurable FOV conversion in FSR
ZachHembree 3305d5e
Update ffxResolveTypelessFormat usage
ZachHembree 09077b6
Run clang formatting
ZachHembree f987562
Fix potential NGX handle memory leak if device couldn't be acquired
ZachHembree 2649058
Fix Vulkan upscaler typo and DX11 init error
ZachHembree File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #pragma once | ||
| #include <numbers> | ||
| #include <cmath> | ||
|
|
||
| namespace OptiMath | ||
| { | ||
| // Radians per degree. Used to convert from degrees to radians | ||
| inline constexpr float DegToRad = std::numbers::pi_v<float> / 180.0f; | ||
| // Degrees per radian. Used to convert from radians to degrees | ||
| inline constexpr float RadToDeg = 180.0f / std::numbers::pi_v<float>; | ||
|
|
||
| // Converts from an angle in degrees to radians | ||
| [[nodiscard]] inline constexpr float GetRadiansFromDeg(const float deg) { return deg * DegToRad; } | ||
|
|
||
| // Converts from an angle in radians to degrees | ||
| [[nodiscard]] inline constexpr float GetDegreesFromRad(const float rad) { return rad * RadToDeg; } | ||
|
|
||
| /** | ||
| * @brief Calculates the vertical field of view for a camera from its horizontal FOV and its | ||
| * viewport dimensions according to the formula: vFov = 2 * arctan( tan( hFov / 2 ) * ( h / w ) ). | ||
| * @param hFovRad: Horizontal field of view | ||
| * @param width: Width of the camera viewport | ||
| * @param height: Height of the camera viewport | ||
| * @return Vertical FOV in radians | ||
| */ | ||
| [[nodiscard]] inline float GetVerticalFovFromHorizontal(const float hFovRad, const float width, const float height) | ||
| { | ||
| if (width <= 0.0f) | ||
| return 0.0f; | ||
| return 2.0f * std::atan(std::tan(hFovRad * 0.5f) * (height / width)); | ||
| } | ||
|
|
||
| /** | ||
| * @brief Calculates the horizontal field of view for a camera from its vertical FOV and its | ||
| * viewport dimensions according to the formula: hFov = 2 * arctan( tan( vFov / 2 ) * ( w / h ) ). | ||
| * @param vFovRad: Vertical field of view in radians | ||
| * @param width: Width of the camera viewport | ||
| * @param height: Height of the camera viewport | ||
| * @return Horizontal FOV in radians | ||
| */ | ||
| [[nodiscard]] inline float GetHorizontalFovFromVertical(const float vFovRad, const float width, const float height) | ||
| { | ||
| if (height <= 0.0f) | ||
| return 0.0f; | ||
| return 2.0f * std::atan(std::tan(vFovRad * 0.5f) * (width / height)); | ||
| } | ||
| } // namespace OptiMath | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #pragma once | ||
|
|
||
| /** | ||
| * @brief Common strings and identifiers used internally by OptiScaler | ||
| */ | ||
| namespace OptiKeys | ||
| { | ||
| using CString = const char[]; | ||
|
|
||
| // Application name provided to upscalers | ||
| inline constexpr CString ProjectID = "OptiScaler"; | ||
|
|
||
| // ID code used for the Vulkan input provider | ||
| inline constexpr CString VkProvider = "OptiVk"; | ||
| // ID code used for the DX11 input provider | ||
| inline constexpr CString Dx11Provider = "OptiDx11"; | ||
| // ID code used for the DX12 input provider | ||
| inline constexpr CString Dx12Provider = "OptiDx12"; | ||
|
|
||
| // ID code used for the XeSS upscaler backend | ||
| inline constexpr CString XeSS = "xess"; | ||
| // ID code used for the XeSS upscaler backend used with the DirectX 11 on 12 compatibility layer | ||
| inline constexpr CString XeSS_11on12 = "xess_12"; | ||
| // ID code used for the FSR 2.1.x upscaler backend | ||
| inline constexpr CString FSR21 = "fsr21"; | ||
| // ID code used for the FSR 2.1.x upscaler backend used with the DirectX 11 on 12 compatibility layer | ||
| inline constexpr CString FSR21_11on12 = "fsr21_12"; | ||
| // ID code used for the FSR 2.2.x upscaler backend | ||
| inline constexpr CString FSR22 = "fsr22"; | ||
| // ID code used for the FSR 2.2.x upscaler backend used with the DirectX 11 on 12 compatibility layer | ||
| inline constexpr CString FSR22_11on12 = "fsr22_12"; | ||
| // ID code used for the FSR 3.1+ upscaler backend | ||
| inline constexpr CString FSR31 = "fsr31"; | ||
| // ID code used for the FSR 3.1+ upscaler backend used with the DirectX 11 on 12 compatibility layer | ||
| inline constexpr CString FSR31_11on12 = "fsr31_12"; | ||
| // ID code used for the DLSS upscaler backend | ||
| inline constexpr CString DLSS = "dlss"; | ||
| // ID code used for the DLSS-D/Ray Reconstruction upscaler+denoiser backend | ||
| inline constexpr CString DLSSD = "dlssd"; | ||
|
|
||
| inline constexpr CString FSR_UpscaleWidth = "FSR.upscaleSize.width"; | ||
| inline constexpr CString FSR_UpscaleHeight = "FSR.upscaleSize.height"; | ||
|
|
||
| inline constexpr CString FSR_NearPlane = "FSR.cameraNear"; | ||
| inline constexpr CString FSR_FarPlane = "FSR.cameraFar"; | ||
| inline constexpr CString FSR_CameraFovVertical = "FSR.cameraFovAngleVertical"; | ||
| inline constexpr CString FSR_FrameTimeDelta = "FSR.frameTimeDelta"; | ||
| inline constexpr CString FSR_ViewSpaceToMetersFactor = "FSR.viewSpaceToMetersFactor"; | ||
| inline constexpr CString FSR_TransparencyAndComp = "FSR.transparencyAndComposition"; | ||
| inline constexpr CString FSR_Reactive = "FSR.reactive"; | ||
|
|
||
| } // namespace OptiKeys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.