Nico de Poel
9668b132e7
Clear initial exposure value with zero. Seems to work fine for all tested platforms, and eliminates the black screen flashes on Metal without requiring any platform-specific hacks.
3 years ago
Nico de Poel
c65cab824e
Clear auto-exposure texture using zeroes on Metal. Should fix black screen flashes on accumulation reset, when auto-exposure is enabled.
3 years ago
Nico de Poel
e577240354
Reset atomic counter on any kind of reset, not just on first execution. Fixes black screen on Metal when doing a history reset.
3 years ago
Nico de Poel
b3bc46fcb7
Moved management of aliasable resources to the Fsr2Resources class and gave the methods more logical names.
3 years ago
Nico de Poel
63d6fd3203
Changed atomic counter from a temporary RT to a permanent one, and set it to 0 only on the first frame. Potential fix for auto-exposure on MacOS.
3 years ago
Nico de Poel
47c2560476
Consolidated accumulate and accumulate+sharpen pipelines into a single pipeline, with the sharpening option being changed into a local keyword that can be enabled or disabled on-the-fly.
This removes the need for an additional copy of the accumulate shader, which saves a considerable amount of memory.
3 years ago
Nico de Poel
53e8164f0e
Clear the atomic counter used by the luminance pyramid pass. This fixes auto-exposure being broken and causing a black screen on some platforms (Xbox, OpenGL).
3 years ago
Nico de Poel
ef20869c48
Added support for experimental auto-TCR generation pass
3 years ago
Nico de Poel
38cc3a83fd
Don't validate input/output resources on reset, so the application has a way to prevent error messages when re-enabling a camera.
In this situation, the previous frame won't have bound the required resources, leading to those errors. Now, if the application calls Reset() after re-enabling the camera, the error messages won't show.
3 years ago
Nico de Poel
e0027ed77a
Added MIT license header to every source file, similar to the FFX FSR2 codebase
3 years ago
Nico de Poel
1cc0de7c89
Moved Shader ID constants to a separate class file
3 years ago
Nico de Poel
1ff980bea9
Changing my mind yet again about directory names
3 years ago
Nico de Poel
da651c3d6f
Moved some files
3 years ago
Nico de Poel
8cd818a3d9
A bit of comment cleanup
3 years ago
Nico de Poel
3ffbc0573e
Implemented auto-exposure feature.
The way this works: compute luminance always outputs an auto-exposure value. The passes using exposure as input can either use this auto-exposure, or use the default read-only exposure value, or use an application-provided exposure.
3 years ago
Nico de Poel
9b83409c71
Added debug checks for input and output resources, either through direct assignment or through existing global texture bindings.
3 years ago
Nico de Poel
92e360aa24
Implemented the debug checking upon dispatch from the original FSR2 source, with some Unity adaptations.
Used this to good effect to fix a few small issues that had gone unnoticed.
Also removed the Message callback which was kind of pointless, since Unity already has a well-established way of outputting warnings and errors.
3 years ago
Nico de Poel
8f1be6d3e6
Re-added transparency & composition parameter, even though we never use it and just fall back to the default reactivity mask, we officially support it as an input now.
3 years ago
Nico de Poel
5ed7a5279b
Progressed implementation of reactive mask generation pass.
Added temporary RT to contain the generated reactive mask, bind it to the FSR2 inputs, and made it available as a toggle on the script.
3 years ago
Nico de Poel
158d5bc176
Perform render scaling by manipulating the Camera viewport rect, which removes the need for a second game object and camera altogether.
This eliminates the stupid full screen quad drawing that the second camera was doing, while also making the entire setup a lot simpler.
3 years ago
Nico de Poel
c1326fc261
Added some comments to the main FSR2 classes
3 years ago
Nico de Poel
8ceffcadd1
Further cleanup and small details
3 years ago
Nico de Poel
86c16e3694
- Replaced all input/output parameters with RenderTargetIdentifiers, allowing more flexibility in how these resources are assigned
- Cleaned up main MonoBehaviour ahead of a big refactor, and added camera event-based command buffers to set opaque-only and motion vector resources
3 years ago
Nico de Poel
1a0945a283
Allow FSR2 commands to be added to a CommandBuffer passed in externally
3 years ago
Nico de Poel
84c02a1110
ExecuteCommandBuffer needs to be done last, otherwise the commands to release temporary RTs won't be executed and they'll be cleared on the next frame. Oops.
3 years ago
Nico de Poel
903c2f71f3
Updated code to make it compatible with Unity 2020.1, i.e. the oldest version that's technically usable.
3 years ago
Nico de Poel
141a4a8335
Added a bit of missing resource management
3 years ago
Nico de Poel
0f584b1098
Implemented generate reactive pass, which can be used separately from the main FSR2 upscale process.
Untested still, but its fairly straightforward.
3 years ago
Nico de Poel
e624b61ea5
Removed all of the TCR auto-generation stuff, as I have no intention of actually supporting this anytime soon
3 years ago
Nico de Poel
0f5f3d9a69
Bits and bobs
3 years ago
Nico de Poel
2440486872
Implemented resource clearing logic on first execution and reset
3 years ago
Nico de Poel
13eb24289e
Initial implementation of accumulation pass. It's doing... something but it's definitely not correct yet.
Changed scene luminance into a persistent RT, since that makes it easier to control mipmaps and bind specific mip levels.
3 years ago
Nico de Poel
d044cf2789
Moved resources into their own source file, to make it easier to pass them to pipelines in bulk. Added creation of resources for the accumulate pass.
3 years ago
Nico de Poel
6b74532793
Some cleanup and a few small details
3 years ago
Nico de Poel
650e805af8
Combined color and depth into a single dispatch parameter, which makes it easier to follow what's going on at the various stages.
3 years ago
Nico de Poel
d607b1bf5a
Apply jitter offset to dispatch parameters
3 years ago
Nico de Poel
56da810b50
Implemented lock pass
3 years ago
Nico de Poel
34598f3900
Moved default exposure and reactive resources to Fsr2Context
3 years ago
Nico de Poel
934a3d60fa
Implemented depth clip pass. Solved the problem of UAV/SRV name mismatch by monkey-patching the relevant shaders. Added default reactive mask.
3 years ago
Nico de Poel
834c396321
Color, depth and motion vectors are now provided as regular texture inputs to the compute shaders, by blitting them from the game camera ahead of time.
3 years ago
Nico de Poel
8633cdcfc2
Initial implementation of Reconstruct & Dilate pass. Got a pretty decent way of dealing with double-buffered resources.
Uploading Lanczos table in R16_SFloat format using pre-normalized values.
Fixed frametime delta being converted improperly.
3 years ago
Nico de Poel
1b41f6b2d7
Provide pipelines with the entire context description, which makes intiialization a bit simpler. Also provide it when registering resources so that the corrext *max* render size can be used. Started on the reconstruct depth pipeline.
3 years ago
Nico de Poel
16f529bce8
Made shading change mip level into a reusable const value, and fixed mip sizes for exposure RTs.
Actually tested the output of the luminance pyramid shader now and it seems to be working.
3 years ago
Nico de Poel
cd414d75f1
Register aliasable UAV resources globally, before and after scheduling shader dispatches, so that all compute shaders can make use of them but without requiring a whole lot of additional resource management code.
3 years ago
Nico de Poel
9489a19cd8
Progress on managing resources. Compute luminance pyramid shader is starting to do something.
Also looked at the Lanczos LUT resource and ran into some roadblocks there.
3 years ago
Nico de Poel
16055d7dd9
Continued pipeline implementations: declaring all input/output bindings using shared resource IDs.
3 years ago
Nico de Poel
913c5879fa
Started work on luminance pyramid and acculumate pipelines.
Added keywords for customization options to the compute shaders using multi_compile_local.
3 years ago
Nico de Poel
08e034584c
Reorganized context and dispatch code:
- Resource binding and shader dispatch is now done in separate Pipeline classes per stage, mirroring the design of the original FSR2 code.
- Moved some classes and structs around to make them available outside of the Fsr2Context class.
3 years ago
Nico de Poel
70dc9e29d4
Use a CommandBuffer to queue up commands and dispatch them all in one go
3 years ago
Nico de Poel
ce66799787
Implemented pretty much all of the constant buffer setup during dispatch.
3 years ago