Nico de Poel
d77922cc4b
Backported fixes that we already know are going to be necessary for full Unity support:
- Removed empty parantheses on GroupMemoryBarrier macro, which confuse the 2020.1 shader compiler
- Added padding field to cbFSR2 to make it exactly 128 bytes in size, which gives correct buffer alignment on iOS Metal
- Changed auto-exposure reset threshold value to 1e4f, as part of a fix for black screen flashes in OpenGL Core on Nvidia GPUs
- Clamp luma to >= 0 in auto-exposure to fix artifacting in OpenGL Core on Nvidia GPUs
- Removed #extension directives meant for GLSL, which cause shader compiler warnings in Unity
11 months ago
Nico de Poel
1551a3ccf8
Added the remaining vertex/fragment shader passes and made the same modifications to get them to compile
11 months ago
Nico de Poel
c27195fb9a
Defined a vertex/fragment shader for the accumulate pass, with initial modifications to make things compile as a proof of concept:
- Removed vk::binding directives, as they are only meant for Vulkan and don't mean anything to Unity
- Initialize inout struct as zero to stop Unity compiler complaints
- Renamed vertex main function to VertMain to prevent duplicate main function declaration
- Removed duplicate VertexOut struct declaration
- Removed unused header includes in vertex shader code, preventing duplicate declarations
- Fixed up a few relative header include paths
11 months ago
Nico de Poel
66059cb742
Imported ARM ASR shader code for HLSL without any modifications
11 months ago
Nico de Poel
299200cb9c
Ported over jitter UV fixes from Snapdragon GitHub repo
1 year ago
Nico de Poel
9971d85ce4
Changed output texture formats from half to float, fixes Metal shader compilation issues on iOS
1 year ago
Nico de Poel
9f4b96ea25
Made integration more PPV2-like by using property sheets, material property blocks and the BlitFullScreenTriangle method.
1 year ago
Nico de Poel
df58df61d6
Reorganized shader code such that standard BiRP and PPV2 can share the same common code with only some light wrappers to implement the differences
1 year ago
Nico de Poel
72df347315
Reworked 2-pass FS implementation to integrate more directly with the PPV2 framework, allowing for multi-target rendering using the fullscreen triangle blit, which eliminates the need for an extra blit at the end.
Also fixed a bug where the scale factor was inverted, which caused FS upscaling output to be blurry.
1 year ago
Nico de Poel
cac783bebc
Working SGSR2 2-pass FS implementation, bit dirty but good enough for testing.
1 year ago
Nico de Poel
87237bbddc
Initial conversion to HLSL
1 year ago
Nico de Poel
a0fa2c9e60
First import of GLSL fragment shaders plus some initial Unity shader setup
1 year ago
Nico de Poel
a56f0742b5
Further tweaked motion vector processing, now the camera motion vectors from Unity produce an exact match with the auto-generated motion from the clip-delta matrix, in both D3D, Vulkan and OpenGL. It also makes sense with regards to the flipped Y-coordinate in screen space now. The final result looks good now too.
1 year ago
Nico de Poel
05989857c0
Added an untested and as of yet unused HDRP include file, just as an expression of what this file will look like for SRPs
1 year ago
Nico de Poel
d354d07d81
Added scaleRatio to unify the cbuffer definition for all shaders, including the fragment shader variant.
1 year ago
Nico de Poel
ed566a8beb
Empirically determined the best setup for motion vectors in OpenGL, though it still doesn't make a whole lot of sense. Added opt-in debug symbols line to the upscale shaders to make analysis easier.
1 year ago
Nico de Poel
4f8cf086bf
More specifically, set NDC Y-coordinate to be up when the Unity graphics API has UV's starting at the top
1 year ago
Nico de Poel
80a8532cb4
Cleaned up an unused argument
1 year ago
Nico de Poel
5b203e7ef5
Set normalized device coordinates Y direction to be up, which is standard in Unity, and properly detect non-zero motion vector inputs. This *seems* to be the correct recipe.
1 year ago
Nico de Poel
19b2969e58
Added macros to change nearest-depth and depth-clipping logic based on whether the Unity graphics API uses reversed Z or not
1 year ago
Nico de Poel
8635b131f6
Renamed SGSR2 compute shader resources class, to allow an easier distinction between fragment and compute variants later on
1 year ago
Nico de Poel
8d6036c91c
Moved a bunch of common definitions and functions into a separate file
1 year ago
Nico de Poel
0469bb921f
Reverted use of CBUFFER_ macros, as it was breaking the shaders on Vulkan
1 year ago
Nico de Poel
3285c552f4
Verified motion vector "decoding" against the auto-generated camera MVs based on the clip-space delta matrix, and made a small fix
1 year ago
Nico de Poel
c43c8d11f9
Reworked SGSR2 classes, moving more logic to the base class, and implemented clip-space delta matrix as well as the is-camera-still logic.
1 year ago
Nico de Poel
9bf6a12c97
Minor optimization: use half float types wherever the original GLSL code uses mediump floats.
1 year ago
Nico de Poel
7217b0fc32
Unity-fied all SGSR2 shaders by changing all texture declarations and accesses into TextureXR-style macros, with a shared BiRP definitions file.
1 year ago
Nico de Poel
0f7baf0b52
Implemented 2-pass CS dispatch
1 year ago
Nico de Poel
d4c1d3f56e
Made SGSR2 upscaler plugin abstract and split off 3-pass CS version into its own separate class
1 year ago
Nico de Poel
14fa1bc7d2
Initial port of SGSR2 2-pass compute shaders to HLSL (untested)
1 year ago
Nico de Poel
708e4308c5
Consolidated SGSR2 shaders into single .compute files as there's not much point in using includes, and grouped them together into a 3-pass folder. This will make it easier to add the other variants later.
1 year ago
Nico de Poel
7a259062d8
Working SGSR2 3-pass:
- Added padding field to fix buffer data misalignment issue
- Simplified the translation of GLSL globalInvocationID to HLSL
1 year ago
Nico de Poel
5646e0a325
Added PoC SGSR2 upscaler
1 year ago
Nico de Poel
ceb8421e79
Updated debug tools to allow A/B comparisons between upscalers
1 year ago
Nico de Poel
8db82e664c
Reworked upscaling integration to allow for multiple upscaler algorithms that can be switched on the fly.
1 year ago
Nico de Poel
31eb875b79
Fixed an issue that would cause the wrong depth buffer to be passed to FSR when using forward rendering on newer Unity versions.
2 years ago
Nico de Poel
79298e140b
Updated namespaces now that FSR3 is in a separate sub-namespace.
2 years ago
Nico de Poel
d1808d542e
Updated SuperResolution effect implementation to be compatible with FSR 3.1
2 years ago
Nico de Poel
004cbc9468
Fixed opaque-only copy buffer not keeping dynamic resolution scaling in mind.
2 years ago
Nico de Poel
415154ff54
- Separated FSR3 shader aggregate from the scriptable object, so that they can be embedded directly inside PostProcessResources
- No longer need to send callbacks to the FSR3 Context.
2 years ago
Nico de Poel
6b590b64af
Refactored loading of FSR3 compute shaders, using an aggregate object containing pre-loaded compute shaders instead of the old callbacks.
This gives more control to the application about how shaders are loaded/unloaded, and it fits in much more nicely with PPV2's resources.
2 years ago
Nico de Poel
b7b3842b95
Moved ResourceView out of the Fsr3Upscaler class and into the FidelityFX namespace, making usages of ResourceView a lot cleaner.
ResourceView is also generic enough that it could/should be reused for any other FidelityFX effects, so this move makes sense.
2 years ago
Nico de Poel
c71e487b15
Updated SuperResolution shaders and code to FSR3
2 years ago
Nico de Poel
7384b4486a
Fixed aspect ratio for dual-viewport setups
2 years ago
Nico de Poel
f399aaee4f
Upgraded to PPV2 version 3.4.0 with WebGPU support and several bug fixes
2 years ago
Nico de Poel
ad3966f3f6
Revert "Removed unnecessary aspect ratio lines that broke screen aspect when using non-standard viewports."
This reverts commit 79f2ab14bf .
2 years ago
Nico de Poel
79f2ab14bf
Removed unnecessary aspect ratio lines that broke screen aspect when using non-standard viewports.
2 years ago
Nico de Poel
8c7aeae4a7
Renamed RenderTargetView to ResourceView, which is a bit shorter to type and captures the essence well.
2 years ago
Nico de Poel
87f11b5f7c
Made all RenderTargetView fields non-nullable, and introduced a special Empty value for optional fields.
This removes the need for a lot of HasValue checks, especially since all fields will eventually get a value anyway, making those checks rather redundant. This also makes it clearer that all SRVs will get bound with a valid input texture, even if the input is optional.
2 years ago
Nico de Poel
b4ddc41f1b
Reworked input/output resource management using a new RenderTargetView struct, which encompasses all relevant data required to bind textures from various sources.
This eliminates the need for resource binding code outside of the core FSR2 classes, and makes the public API more strict and consistent. It also removes the need for the slightly awkward input/output resource debug checks.
2 years ago