Browse Source
- Moved ResourceView into its own source file.
- Moved ResourceView into its own source file.
- Using texture arrays is now a boolean flag that can be set on dispatch, removing the need for HDRP-specific checks inside the FSR3 code and shaders. - Debug view shader is no longer conditionally included. - Reduced the number of multi-compile variants by removing unused keywords for each shader. - Optimized temporary RT use; two resources can reuse the same generic intermediate temp RT. - Reorganized some of the shader code to work nicer with the rest of the FidelityFX SDK sources.fsr3.1
75 changed files with 533 additions and 543 deletions
-
117Assets/Scripts/Core/Fsr3ShaderIDs.cs
-
32Assets/Scripts/Core/Fsr3Upscaler.cs
-
11Assets/Scripts/Core/Fsr3UpscalerAssets.cs
-
4Assets/Scripts/Core/Fsr3UpscalerCallbacks.cs
-
5Assets/Scripts/Core/Fsr3UpscalerContext.cs
-
16Assets/Scripts/Core/Fsr3UpscalerPass.cs
-
7Assets/Scripts/Core/Fsr3UpscalerResources.cs
-
55Assets/Scripts/Core/ResourceView.cs
-
11Assets/Scripts/Core/ResourceView.cs.meta
-
6Assets/Shaders/FSR3/ffx_fsr3upscaler_accumulate_pass.compute
-
7Assets/Shaders/FSR3/ffx_fsr3upscaler_autogen_reactive_pass.compute
-
10Assets/Shaders/FSR3/ffx_fsr3upscaler_debug_view_pass.compute
-
10Assets/Shaders/FSR3/ffx_fsr3upscaler_luma_instability_pass.compute
-
10Assets/Shaders/FSR3/ffx_fsr3upscaler_luma_pyramid_pass.compute
-
9Assets/Shaders/FSR3/ffx_fsr3upscaler_prepare_inputs_pass.compute
-
10Assets/Shaders/FSR3/ffx_fsr3upscaler_prepare_reactivity_pass.compute
-
10Assets/Shaders/FSR3/ffx_fsr3upscaler_rcas_pass.compute
-
10Assets/Shaders/FSR3/ffx_fsr3upscaler_shading_change_pass.compute
-
10Assets/Shaders/FSR3/ffx_fsr3upscaler_shading_change_pyramid_pass.compute
-
6Assets/Shaders/FSR3/ffx_fsr3upscaler_tcr_autogen_pass.compute
-
60Assets/Shaders/FSR3/ffx_fsr_unity_common.cginc
-
0Assets/Shaders/FSR3/ffx_fsr_unity_common.cginc.meta
-
2Assets/Shaders/FSR3/shaders.meta
-
0Assets/Shaders/FSR3/shaders/ffx_common_types.h
-
10Assets/Shaders/FSR3/shaders/ffx_common_types.h.meta
-
0Assets/Shaders/FSR3/shaders/ffx_core.h
-
10Assets/Shaders/FSR3/shaders/ffx_core.h.meta
-
0Assets/Shaders/FSR3/shaders/ffx_core_gpu_common.h
-
10Assets/Shaders/FSR3/shaders/ffx_core_gpu_common.h.meta
-
0Assets/Shaders/FSR3/shaders/ffx_core_gpu_common_half.h
-
10Assets/Shaders/FSR3/shaders/ffx_core_gpu_common_half.h.meta
-
0Assets/Shaders/FSR3/shaders/ffx_core_hlsl.h
-
10Assets/Shaders/FSR3/shaders/ffx_core_hlsl.h.meta
-
0Assets/Shaders/FSR3/shaders/ffx_core_portability.h
-
10Assets/Shaders/FSR3/shaders/ffx_core_portability.h.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_accumulate_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_debug_view_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_luma_instability_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_luma_pyramid_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_prepare_inputs_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_prepare_reactivity_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_rcas_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_shading_change_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_shading_change_pyramid_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl.meta
-
2Assets/Shaders/FSR3/shaders/fsr1.meta
-
0Assets/Shaders/FSR3/shaders/fsr1/ffx_fsr1.h
-
60Assets/Shaders/FSR3/shaders/fsr1/ffx_fsr1.h.meta
-
2Assets/Shaders/FSR3/shaders/fsr3upscaler.meta
-
10Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h.meta
-
62Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h
-
10Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h.meta
-
10Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h.meta
-
22Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_debug_view.h.meta
-
22Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_luma_instability.h.meta
-
2Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_luma_pyramid.h
-
22Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_luma_pyramid.h.meta
-
22Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_prepare_inputs.h.meta
-
22Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_prepare_reactivity.h.meta
-
4Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_rcas.h
-
10Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_rcas.h.meta
-
10Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h.meta
-
10Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_resources.h.meta
-
10Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_sample.h.meta
-
22Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_shading_change.h.meta
-
2Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_shading_change_pyramid.h
-
22Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_shading_change_pyramid.h.meta
-
10Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_tcr_autogen.h.meta
-
10Assets/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_upsample.h.meta
-
68Assets/Shaders/FSR3/shaders/fsr3upscaler/fsr1/ffx_fsr1.h.meta
-
68Assets/Shaders/FSR3/shaders/fsr3upscaler/spd/ffx_spd.h.meta
-
2Assets/Shaders/FSR3/shaders/spd.meta
-
0Assets/Shaders/FSR3/shaders/spd/ffx_spd.h
-
60Assets/Shaders/FSR3/shaders/spd/ffx_spd.h.meta
@ -0,0 +1,55 @@ |
|||||
|
// Copyright (c) 2024 Nico de Poel
|
||||
|
//
|
||||
|
// 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.
|
||||
|
|
||||
|
using UnityEngine.Rendering; |
||||
|
|
||||
|
namespace FidelityFX |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// An immutable structure wrapping all of the necessary information to bind a specific buffer or attachment of a render target to a compute shader.
|
||||
|
/// </summary>
|
||||
|
public readonly struct ResourceView |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// This value is the equivalent of not setting any value at all; all struct fields will have their default values.
|
||||
|
/// It does not refer to a valid texture, therefore any variable set to this value should be checked for IsValid and reassigned before being bound to a shader.
|
||||
|
/// </summary>
|
||||
|
public static readonly ResourceView Unassigned = new ResourceView(default); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// This value contains a valid texture reference that can be bound to a shader, however it is just an empty placeholder texture.
|
||||
|
/// Binding this to a shader can be seen as setting the texture variable inside the shader to null.
|
||||
|
/// </summary>
|
||||
|
public static readonly ResourceView None = new ResourceView(BuiltinRenderTextureType.None); |
||||
|
|
||||
|
public ResourceView(in RenderTargetIdentifier renderTarget, RenderTextureSubElement subElement = RenderTextureSubElement.Default, int mipLevel = 0) |
||||
|
{ |
||||
|
RenderTarget = renderTarget; |
||||
|
SubElement = subElement; |
||||
|
MipLevel = mipLevel; |
||||
|
} |
||||
|
|
||||
|
public bool IsValid => !RenderTarget.Equals(default); |
||||
|
|
||||
|
public readonly RenderTargetIdentifier RenderTarget; |
||||
|
public readonly RenderTextureSubElement SubElement; |
||||
|
public readonly int MipLevel; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: eb9fdfac33a070740b66520d88f43ab7 |
||||
|
MonoImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
defaultReferences: [] |
||||
|
executionOrder: 0 |
||||
|
icon: {instanceID: 0} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
@ -1,5 +1,5 @@ |
|||||
fileFormatVersion: 2 |
fileFormatVersion: 2 |
||||
guid: 09438bc445e66204f970dc99ca8dae5a |
|
||||
|
guid: dafd228fb8a2f4e478fe1df6d38589f9 |
||||
folderAsset: yes |
folderAsset: yes |
||||
DefaultImporter: |
DefaultImporter: |
||||
externalObjects: {} |
externalObjects: {} |
||||
@ -0,0 +1,60 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: e73be06d181f19f42a1e8f1cf6ebc92b |
||||
|
PluginImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
iconMap: {} |
||||
|
executionOrder: {} |
||||
|
defineConstraints: [] |
||||
|
isPreloaded: 0 |
||||
|
isOverridable: 1 |
||||
|
isExplicitlyReferenced: 0 |
||||
|
validateReferences: 1 |
||||
|
platformData: |
||||
|
- first: |
||||
|
: Any |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
Exclude Editor: 1 |
||||
|
Exclude GameCoreScarlett: 1 |
||||
|
Exclude GameCoreXboxOne: 1 |
||||
|
Exclude Linux64: 1 |
||||
|
Exclude OSXUniversal: 1 |
||||
|
Exclude PS4: 1 |
||||
|
Exclude PS5: 1 |
||||
|
Exclude WebGL: 1 |
||||
|
Exclude Win: 1 |
||||
|
Exclude Win64: 1 |
||||
|
- first: |
||||
|
Any: |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: {} |
||||
|
- first: |
||||
|
Editor: Editor |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
DefaultValueInitialized: true |
||||
|
- first: |
||||
|
Standalone: Linux64 |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
CPU: None |
||||
|
- first: |
||||
|
Standalone: Win |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
CPU: None |
||||
|
- first: |
||||
|
Standalone: Win64 |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
CPU: None |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
@ -1,68 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: 628e23510f46ef44bbf0035ce9a63be0 |
|
||||
PluginImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
iconMap: {} |
|
||||
executionOrder: {} |
|
||||
defineConstraints: [] |
|
||||
isPreloaded: 0 |
|
||||
isOverridable: 0 |
|
||||
isExplicitlyReferenced: 0 |
|
||||
validateReferences: 1 |
|
||||
platformData: |
|
||||
- first: |
|
||||
: Any |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
Exclude Editor: 1 |
|
||||
Exclude GameCoreScarlett: 1 |
|
||||
Exclude GameCoreXboxOne: 1 |
|
||||
Exclude Linux64: 1 |
|
||||
Exclude OSXUniversal: 1 |
|
||||
Exclude PS4: 1 |
|
||||
Exclude PS5: 1 |
|
||||
Exclude WebGL: 1 |
|
||||
Exclude Win: 1 |
|
||||
Exclude Win64: 1 |
|
||||
- first: |
|
||||
Any: |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: {} |
|
||||
- first: |
|
||||
Editor: Editor |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
CPU: AnyCPU |
|
||||
DefaultValueInitialized: true |
|
||||
OS: AnyOS |
|
||||
- first: |
|
||||
Standalone: Linux64 |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
CPU: None |
|
||||
- first: |
|
||||
Standalone: OSXUniversal |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
CPU: None |
|
||||
- first: |
|
||||
Standalone: Win |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
CPU: None |
|
||||
- first: |
|
||||
Standalone: Win64 |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
CPU: None |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,68 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: face65176ee3b82498bd0b8fed0ddacd |
|
||||
PluginImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
iconMap: {} |
|
||||
executionOrder: {} |
|
||||
defineConstraints: [] |
|
||||
isPreloaded: 0 |
|
||||
isOverridable: 0 |
|
||||
isExplicitlyReferenced: 0 |
|
||||
validateReferences: 1 |
|
||||
platformData: |
|
||||
- first: |
|
||||
: Any |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
Exclude Editor: 1 |
|
||||
Exclude GameCoreScarlett: 1 |
|
||||
Exclude GameCoreXboxOne: 1 |
|
||||
Exclude Linux64: 1 |
|
||||
Exclude OSXUniversal: 1 |
|
||||
Exclude PS4: 1 |
|
||||
Exclude PS5: 1 |
|
||||
Exclude WebGL: 1 |
|
||||
Exclude Win: 1 |
|
||||
Exclude Win64: 1 |
|
||||
- first: |
|
||||
Any: |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: {} |
|
||||
- first: |
|
||||
Editor: Editor |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
CPU: AnyCPU |
|
||||
DefaultValueInitialized: true |
|
||||
OS: AnyOS |
|
||||
- first: |
|
||||
Standalone: Linux64 |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
CPU: None |
|
||||
- first: |
|
||||
Standalone: OSXUniversal |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
CPU: None |
|
||||
- first: |
|
||||
Standalone: Win |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
CPU: None |
|
||||
- first: |
|
||||
Standalone: Win64 |
|
||||
second: |
|
||||
enabled: 0 |
|
||||
settings: |
|
||||
CPU: None |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,5 +1,5 @@ |
|||||
fileFormatVersion: 2 |
fileFormatVersion: 2 |
||||
guid: 0f03de1579ac3294595ae4f40106b7a2 |
|
||||
|
guid: bd7cab5c46d4cd740ae57c03c8789ca4 |
||||
folderAsset: yes |
folderAsset: yes |
||||
DefaultImporter: |
DefaultImporter: |
||||
externalObjects: {} |
externalObjects: {} |
||||
@ -0,0 +1,60 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: fe8e621d12c641c4297675f3015697fc |
||||
|
PluginImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
iconMap: {} |
||||
|
executionOrder: {} |
||||
|
defineConstraints: [] |
||||
|
isPreloaded: 0 |
||||
|
isOverridable: 1 |
||||
|
isExplicitlyReferenced: 0 |
||||
|
validateReferences: 1 |
||||
|
platformData: |
||||
|
- first: |
||||
|
: Any |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
Exclude Editor: 1 |
||||
|
Exclude GameCoreScarlett: 1 |
||||
|
Exclude GameCoreXboxOne: 1 |
||||
|
Exclude Linux64: 1 |
||||
|
Exclude OSXUniversal: 1 |
||||
|
Exclude PS4: 1 |
||||
|
Exclude PS5: 1 |
||||
|
Exclude WebGL: 1 |
||||
|
Exclude Win: 1 |
||||
|
Exclude Win64: 1 |
||||
|
- first: |
||||
|
Any: |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: {} |
||||
|
- first: |
||||
|
Editor: Editor |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
DefaultValueInitialized: true |
||||
|
- first: |
||||
|
Standalone: Linux64 |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
CPU: None |
||||
|
- first: |
||||
|
Standalone: Win |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
CPU: None |
||||
|
- first: |
||||
|
Standalone: Win64 |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
CPU: None |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue