Path: blob/master/thirdparty/amd-fsr2/shaders/ffx_fsr2_rcas.h
9902 views
// This file is part of the FidelityFX SDK.1//2// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved.3//4// Permission is hereby granted, free of charge, to any person obtaining a copy5// of this software and associated documentation files (the "Software"), to deal6// in the Software without restriction, including without limitation the rights7// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell8// copies of the Software, and to permit persons to whom the Software is9// furnished to do so, subject to the following conditions:10// The above copyright notice and this permission notice shall be included in11// all copies or substantial portions of the Software.12//13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN19// THE SOFTWARE.2021#define GROUP_SIZE 82223#define FSR_RCAS_DENOISE 12425void WriteUpscaledOutput(FFX_MIN16_U2 iPxHrPos, FfxFloat32x3 fUpscaledColor)26{27StoreUpscaledOutput(FFX_MIN16_I2(iPxHrPos), fUpscaledColor);28}2930#define FSR_RCAS_F31FfxFloat32x4 FsrRcasLoadF(FfxInt32x2 p)32{33FfxFloat32x4 fColor = LoadRCAS_Input(p);3435fColor.rgb = PrepareRgb(fColor.rgb, Exposure(), PreExposure());3637return fColor;38}3940void FsrRcasInputF(inout FfxFloat32 r, inout FfxFloat32 g, inout FfxFloat32 b) {}4142#include "ffx_fsr1.h"434445void CurrFilter(FFX_MIN16_U2 pos)46{47FfxFloat32x3 c;48FsrRcasF(c.r, c.g, c.b, pos, RCASConfig());4950c = UnprepareRgb(c, Exposure());5152WriteUpscaledOutput(pos, c);53}5455void RCAS(FfxUInt32x3 LocalThreadId, FfxUInt32x3 WorkGroupId, FfxUInt32x3 Dtid)56{57// Do remapping of local xy in workgroup for a more PS-like swizzle pattern.58FfxUInt32x2 gxy = ffxRemapForQuad(LocalThreadId.x) + FfxUInt32x2(WorkGroupId.x << 4u, WorkGroupId.y << 4u);59CurrFilter(FFX_MIN16_U2(gxy));60gxy.x += 8u;61CurrFilter(FFX_MIN16_U2(gxy));62gxy.y += 8u;63CurrFilter(FFX_MIN16_U2(gxy));64gxy.x -= 8u;65CurrFilter(FFX_MIN16_U2(gxy));66}676869