6 changed files with 0 additions and 208 deletions
-
14Assets/Resources/FSR2/ffx_fsr2_prepare_input_color_pass.compute
-
8Assets/Resources/FSR2/ffx_fsr2_prepare_input_color_pass.compute.meta
-
88Assets/Resources/FSR2/shaders/ffx_fsr2_prepare_input_color.h
-
27Assets/Resources/FSR2/shaders/ffx_fsr2_prepare_input_color.h.meta
-
64Assets/Resources/FSR2/shaders/ffx_fsr2_prepare_input_color_pass.hlsl
-
7Assets/Resources/FSR2/shaders/ffx_fsr2_prepare_input_color_pass.hlsl.meta
@ -1,14 +0,0 @@ |
|||
#pragma kernel CS |
|||
|
|||
#pragma multi_compile_local __ FFX_HALF |
|||
#pragma multi_compile_local __ FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE |
|||
#pragma multi_compile_local __ FFX_FSR2_OPTION_HDR_COLOR_INPUT |
|||
#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS |
|||
#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS |
|||
#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH |
|||
#pragma multi_compile_local __ FFX_FSR2_OPTION_APPLY_SHARPENING |
|||
|
|||
#define FFX_GPU // Compiling for GPU |
|||
#define FFX_HLSL // Compile for plain HLSL |
|||
|
|||
#include "shaders/ffx_fsr2_prepare_input_color_pass.hlsl" |
|||
@ -1,8 +0,0 @@ |
|||
fileFormatVersion: 2 |
|||
guid: b32b97eb4bc4e654c916f74ba1a939fc |
|||
ComputeShaderImporter: |
|||
externalObjects: {} |
|||
preprocessorOverride: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -1,88 +0,0 @@ |
|||
// This file is part of the FidelityFX SDK. |
|||
// |
|||
// Copyright (c) 2022 Advanced Micro Devices, Inc. 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. |
|||
|
|||
#ifndef FFX_FSR2_PREPARE_INPUT_COLOR_H |
|||
#define FFX_FSR2_PREPARE_INPUT_COLOR_H |
|||
|
|||
//TODO: Move to common location & share with Accumulate |
|||
void ClearResourcesForNextFrame(in FfxInt32x2 iPxHrPos) |
|||
{ |
|||
if (all(FFX_LESS_THAN(iPxHrPos, FfxInt32x2(RenderSize())))) |
|||
{ |
|||
#if FFX_FSR2_OPTION_INVERTED_DEPTH |
|||
const FfxUInt32 farZ = 0x0; |
|||
#else |
|||
const FfxUInt32 farZ = 0x3f800000; |
|||
#endif |
|||
SetReconstructedDepth(iPxHrPos, farZ); |
|||
} |
|||
} |
|||
|
|||
void ComputeLumaStabilityFactor(FfxInt32x2 iPxLrPos, FfxFloat32 fCurrentFrameLuma) |
|||
{ |
|||
FfxFloat32x4 fCurrentFrameLumaHistory = LoadRwLumaHistory(iPxLrPos); |
|||
|
|||
fCurrentFrameLumaHistory.a = FfxFloat32(0); |
|||
|
|||
if (FrameIndex() > 3) { |
|||
FfxFloat32 fDiffs0 = MinDividedByMax(fCurrentFrameLumaHistory[2], fCurrentFrameLuma); |
|||
FfxFloat32 fDiffs1 = ffxMax(MinDividedByMax(fCurrentFrameLumaHistory[0], fCurrentFrameLuma), MinDividedByMax(fCurrentFrameLumaHistory[1], fCurrentFrameLuma)); |
|||
|
|||
fCurrentFrameLumaHistory.a = ffxSaturate(fDiffs1 - fDiffs0); |
|||
} |
|||
|
|||
//move history |
|||
fCurrentFrameLumaHistory[0] = fCurrentFrameLumaHistory[1]; |
|||
fCurrentFrameLumaHistory[1] = fCurrentFrameLumaHistory[2]; |
|||
fCurrentFrameLumaHistory[2] = fCurrentFrameLuma; |
|||
|
|||
StoreLumaHistory(iPxLrPos, fCurrentFrameLumaHistory); |
|||
} |
|||
|
|||
void PrepareInputColor(FfxInt32x2 iPxLrPos) |
|||
{ |
|||
//We assume linear data. if non-linear input (sRGB, ...), |
|||
//then we should convert to linear first and back to sRGB on output. |
|||
|
|||
FfxFloat32x3 fRgb = ffxMax(FfxFloat32x3(0, 0, 0), LoadInputColor(iPxLrPos)); |
|||
|
|||
fRgb *= Exposure(); |
|||
|
|||
#if FFX_FSR2_OPTION_HDR_COLOR_INPUT |
|||
// Tonemap color, used in lockstatus and luma stability computations |
|||
fRgb = Tonemap(fRgb); |
|||
#endif |
|||
|
|||
FfxFloat32x4 fYCoCg; |
|||
|
|||
fYCoCg.xyz = RGBToYCoCg(fRgb); |
|||
|
|||
const FfxFloat32 fPerceivedLuma = RGBToPerceivedLuma(fRgb); |
|||
ComputeLumaStabilityFactor(iPxLrPos, fPerceivedLuma); |
|||
|
|||
//compute luma used to lock pixels, if used elsewhere the ffxPow must be moved! |
|||
fYCoCg.w = ffxPow(fPerceivedLuma, FfxFloat32(1.0 / 6.0)); |
|||
|
|||
StorePreparedInputColor(iPxLrPos, fYCoCg); |
|||
ClearResourcesForNextFrame(iPxLrPos); |
|||
} |
|||
|
|||
#endif // FFX_FSR2_PREPARE_INPUT_COLOR_H |
|||
@ -1,27 +0,0 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 778b4088d62d52f49acf76d0c4d97922 |
|||
PluginImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
iconMap: {} |
|||
executionOrder: {} |
|||
defineConstraints: [] |
|||
isPreloaded: 0 |
|||
isOverridable: 0 |
|||
isExplicitlyReferenced: 0 |
|||
validateReferences: 1 |
|||
platformData: |
|||
- first: |
|||
Any: |
|||
second: |
|||
enabled: 1 |
|||
settings: {} |
|||
- first: |
|||
Editor: Editor |
|||
second: |
|||
enabled: 0 |
|||
settings: |
|||
DefaultValueInitialized: true |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
@ -1,64 +0,0 @@ |
|||
// This file is part of the FidelityFX SDK. |
|||
// |
|||
// Copyright (c) 2022 Advanced Micro Devices, Inc. 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. |
|||
|
|||
// FSR2 pass 1 |
|||
// SRV 1 : m_HDR : r_input_color_jittered |
|||
// SRV 4 : FSR2_Exposure : r_exposure |
|||
// UAV 7 : FSR2_ReconstructedPrevNearestDepth : rw_reconstructed_previous_nearest_depth |
|||
// UAV 13 : FSR2_PreparedInputColor : rw_prepared_input_color |
|||
// UAV 14 : FSR2_LumaHistory : rw_luma_history |
|||
// CB 0 : cbFSR2 |
|||
|
|||
#define FSR2_BIND_SRV_INPUT_COLOR 0 |
|||
#define FSR2_BIND_SRV_INPUT_EXPOSURE 1 |
|||
#define FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH 0 |
|||
#define FSR2_BIND_UAV_PREPARED_INPUT_COLOR 1 |
|||
#define FSR2_BIND_UAV_LUMA_HISTORY 2 |
|||
#define FSR2_BIND_CB_FSR2 0 |
|||
|
|||
#include "ffx_fsr2_callbacks_hlsl.h" |
|||
#include "ffx_fsr2_common.h" |
|||
#include "ffx_fsr2_prepare_input_color.h" |
|||
|
|||
#ifndef FFX_FSR2_THREAD_GROUP_WIDTH |
|||
#define FFX_FSR2_THREAD_GROUP_WIDTH 8 |
|||
#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH |
|||
#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT |
|||
#define FFX_FSR2_THREAD_GROUP_HEIGHT 8 |
|||
#endif // #ifndef FFX_FSR2_THREAD_GROUP_HEIGHT |
|||
#ifndef FFX_FSR2_THREAD_GROUP_DEPTH |
|||
#define FFX_FSR2_THREAD_GROUP_DEPTH 1 |
|||
#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH |
|||
#ifndef FFX_FSR2_NUM_THREADS |
|||
#define FFX_FSR2_NUM_THREADS [numthreads(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT, FFX_FSR2_THREAD_GROUP_DEPTH)] |
|||
#endif // #ifndef FFX_FSR2_NUM_THREADS |
|||
|
|||
FFX_FSR2_NUM_THREADS |
|||
FFX_FSR2_EMBED_ROOTSIG_CONTENT |
|||
void CS( |
|||
uint2 uGroupId : SV_GroupID, |
|||
uint2 uDispatchThreadId : SV_DispatchThreadID, |
|||
uint2 uGroupThreadId : SV_GroupThreadID, |
|||
uint uGroupIndex : SV_GroupIndex |
|||
) |
|||
{ |
|||
PrepareInputColor(uDispatchThreadId); |
|||
} |
|||
@ -1,7 +0,0 @@ |
|||
fileFormatVersion: 2 |
|||
guid: 0710c8cc5e741b34882a94dddc5a1a6b |
|||
ShaderIncludeImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue