16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 16:19:19 +02:00

Some renaming

This commit is contained in:
2025-04-15 01:32:56 +02:00
parent 12d6a1578d
commit a39d972126
864 changed files with 29 additions and 34 deletions

View File

@@ -0,0 +1,49 @@
# This file is part of the FidelityFX SDK.
#
# Copyright (C) 2024 Advanced Micro Devices, Inc.
#
# 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.
set(FSR1_BASE_ARGS
-reflection -deps=gcc -DFFX_GPU=1)
set(FSR1_PERMUTATION_ARGS
# Reproject can use either reference lanczos or LUT
-DFFX_FSR1_OPTION_APPLY_RCAS={0,1}
-DFFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA={0,1}
-DFFX_FSR1_OPTION_SRGB_CONVERSIONS={0,1})
set(FSR1_INCLUDE_ARGS
"${FFX_GPU_PATH}"
"${FFX_GPU_PATH}/fsr1")
if (NOT FSR1_SHADER_EXT)
set(FSR1_SHADER_EXT *)
endif()
file(GLOB FSR1_SHADERS
"shaders/fsr1/ffx_fsr1_easu_pass.${FSR1_SHADER_EXT}"
"shaders/fsr1/ffx_fsr1_rcas_pass.${FSR1_SHADER_EXT}")
compile_shaders_with_depfile(
"${FFX_SC_EXECUTABLE}"
"${FSR1_BASE_ARGS}" "${FSR1_API_BASE_ARGS}" "${FSR1_PERMUTATION_ARGS}" "${FSR1_INCLUDE_ARGS}"
"${FSR1_SHADERS}" "${FFX_PASS_SHADER_OUTPUT_PATH}" FSR1_PERMUTATION_OUTPUTS)
add_shader_output("${FSR1_PERMUTATION_OUTPUTS}")

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,221 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (C) 2024 Advanced Micro Devices, Inc.
//
// 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.
#include "ffx_fsr1_resources.h"
#if defined(FFX_GPU)
#include "ffx_core.h"
#ifndef FFX_PREFER_WAVE64
#define FFX_PREFER_WAVE64
#endif // #ifndef FFX_PREFER_WAVE64
#if defined(FSR1_BIND_CB_FSR1)
layout (set = 0, binding = FSR1_BIND_CB_FSR1, std140) uniform cbFSR1_t
{
FfxUInt32x4 const0;
FfxUInt32x4 const1;
FfxUInt32x4 const2;
FfxUInt32x4 const3;
FfxUInt32x4 sample0;
} cbFSR1;
#endif
FfxUInt32x4 Const0()
{
return cbFSR1.const0;
}
FfxUInt32x4 Const1()
{
return cbFSR1.const1;
}
FfxUInt32x4 Const2()
{
return cbFSR1.const2;
}
FfxUInt32x4 Const3()
{
return cbFSR1.const3;
}
FfxUInt32x4 EASUSample()
{
return cbFSR1.sample0;
}
FfxUInt32x4 RCasSample()
{
return cbFSR1.sample0;
}
FfxUInt32x4 RCasConfig()
{
return cbFSR1.const0;
}
layout (set = 0, binding = 1000) uniform sampler s_LinearClamp;
// SRVs
#if defined FSR1_BIND_SRV_INPUT_COLOR
layout (set = 0, binding = FSR1_BIND_SRV_INPUT_COLOR) uniform texture2D r_input_color;
#endif
#if defined FSR1_BIND_SRV_INTERNAL_UPSCALED_COLOR
layout (set = 0, binding = FSR1_BIND_SRV_INTERNAL_UPSCALED_COLOR) uniform texture2D r_internal_upscaled_color;
#endif
#if defined FSR1_BIND_SRV_UPSCALED_OUTPUT
layout (set = 0, binding = FSR1_BIND_SRV_UPSCALED_OUTPUT) uniform texture2D r_upscaled_output;
#endif
// UAV declarations
#if defined FSR1_BIND_UAV_INPUT_COLOR
layout (set = 0, binding = FSR1_BIND_UAV_INPUT_COLOR, rgba32f) uniform image2D rw_input_color;
#endif
#if defined FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR
layout (set = 0, binding = FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR, rgba32f) uniform image2D rw_internal_upscaled_color;
#endif
#if defined FSR1_BIND_UAV_UPSCALED_OUTPUT
layout (set = 0, binding = FSR1_BIND_UAV_UPSCALED_OUTPUT, rgba32f) uniform image2D rw_upscaled_output;
#endif
#if FFX_HALF
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat16x4 GatherEasuRed(FfxFloat32x2 fPxPos)
{
return FfxFloat16x4(textureGather(sampler2D(r_input_color, s_LinearClamp), fPxPos, 0));
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat16x4 GatherEasuGreen(FfxFloat32x2 fPxPos)
{
return FfxFloat16x4(textureGather(sampler2D(r_input_color, s_LinearClamp), fPxPos, 1));
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat16x4 GatherEasuBlue(FfxFloat32x2 fPxPos)
{
return FfxFloat16x4(textureGather(sampler2D(r_input_color, s_LinearClamp), fPxPos, 2));
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if FFX_FSR1_OPTION_APPLY_RCAS
#if defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
void StoreEASUOutput(FfxUInt32x2 iPxPos, FfxFloat16x3 fColor)
{
imageStore(rw_internal_upscaled_color, FfxInt32x2(iPxPos), FfxFloat32x4(fColor, 1.f));
}
#endif // #if defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
#else
#if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
void StoreEASUOutput(FfxUInt32x2 iPxPos, FfxFloat16x3 fColor)
{
imageStore(rw_upscaled_output, FfxInt32x2(iPxPos), FfxFloat32x4(fColor, 1.f));
}
#endif // #if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
#endif // #if FFX_FSR1_OPTION_APPLY_RCAS
#if defined(FSR1_BIND_SRV_INTERNAL_UPSCALED_COLOR)
FfxFloat16x4 LoadRCas_Input(FfxInt16x2 iPxPos)
{
return FfxFloat16x4(texelFetch(r_internal_upscaled_color, FfxInt32x2(iPxPos), 0));
}
#endif // defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
#if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
void StoreRCasOutput(FfxInt16x2 iPxPos, FfxFloat16x4 fColor)
{
imageStore(rw_upscaled_output, FfxInt32x2(iPxPos), FfxFloat32x4(fColor));
}
void StoreRCasOutput(FfxInt16x2 iPxPos, FfxFloat16x3 fColor)
{
StoreRCasOutput(iPxPos, FfxFloat16x4(fColor, 1.f));
}
#endif // defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
#else // FFX_HALF
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat32x4 GatherEasuRed(FfxFloat32x2 fPxPos)
{
return textureGather(sampler2D(r_input_color, s_LinearClamp), fPxPos, 0);
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat32x4 GatherEasuGreen(FfxFloat32x2 fPxPos)
{
return textureGather(sampler2D(r_input_color, s_LinearClamp), fPxPos, 1);
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat32x4 GatherEasuBlue(FfxFloat32x2 fPxPos)
{
return textureGather(sampler2D(r_input_color, s_LinearClamp), fPxPos, 2);
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if FFX_FSR1_OPTION_APPLY_RCAS
#if defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
void StoreEASUOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor)
{
imageStore(rw_internal_upscaled_color, FfxInt32x2(iPxPos), FfxFloat32x4(fColor, 1.f));
}
#endif // #if defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
#else
#if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
void StoreEASUOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor)
{
imageStore(rw_upscaled_output, FfxInt32x2(iPxPos), FfxFloat32x4(fColor, 1.f));
}
#endif // #if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
#endif // #if FFX_FSR1_OPTION_APPLY_RCAS
#if defined(FSR1_BIND_SRV_INTERNAL_UPSCALED_COLOR)
FfxFloat32x4 LoadRCas_Input(FfxInt32x2 iPxPos)
{
return texelFetch(r_internal_upscaled_color, iPxPos, 0);
}
#endif // defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
#if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
void StoreRCasOutput(FfxInt32x2 iPxPos, FfxFloat32x4 fColor)
{
imageStore(rw_upscaled_output, iPxPos, fColor);
}
void StoreRCasOutput(FfxInt32x2 iPxPos, FfxFloat32x3 fColor)
{
StoreRCasOutput(iPxPos, FfxFloat32x4(fColor, 1.f));
}
#endif // defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
#endif // FFX_HALF
#endif // #if defined(FFX_GPU)

View File

@@ -0,0 +1,255 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (C) 2024 Advanced Micro Devices, Inc.
//
// 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.
#include "ffx_fsr1_resources.h"
#if defined(FFX_GPU)
#ifdef __hlsl_dx_compiler
#pragma dxc diagnostic push
#pragma dxc diagnostic ignored "-Wambig-lit-shift"
#endif //__hlsl_dx_compiler
#include "ffx_core.h"
#ifdef __hlsl_dx_compiler
#pragma dxc diagnostic pop
#endif //__hlsl_dx_compiler
#ifndef FFX_PREFER_WAVE64
#define FFX_PREFER_WAVE64
#endif // #ifndef FFX_PREFER_WAVE64
#pragma warning(disable: 3205) // conversion from larger type to smaller
#define DECLARE_SRV_REGISTER(regIndex) t##regIndex
#define DECLARE_UAV_REGISTER(regIndex) u##regIndex
#define DECLARE_CB_REGISTER(regIndex) b##regIndex
#define FFX_FSR1_DECLARE_SRV(regIndex) register(DECLARE_SRV_REGISTER(regIndex))
#define FFX_FSR1_DECLARE_UAV(regIndex) register(DECLARE_UAV_REGISTER(regIndex))
#define FFX_FSR1_DECLARE_CB(regIndex) register(DECLARE_CB_REGISTER(regIndex))
#if defined(FSR1_BIND_CB_FSR1)
cbuffer cbFSR1 : FFX_FSR1_DECLARE_CB(FSR1_BIND_CB_FSR1)
{
FfxUInt32x4 const0;
FfxUInt32x4 const1;
FfxUInt32x4 const2;
FfxUInt32x4 const3;
FfxUInt32x4 sample;
#define FFX_FSR1_CONSTANT_BUFFER_1_SIZE 20 // Number of 32-bit values. This must be kept in sync with the cbFSR1 size.
};
#else
#define const0 0
#define const1 0
#define const2 0
#define const3 0
#define sample 0
#endif
#if defined(FFX_GPU)
#define FFX_FSR1_ROOTSIG_STRINGIFY(p) FFX_FSR1_ROOTSIG_STR(p)
#define FFX_FSR1_ROOTSIG_STR(p) #p
#define FFX_FSR1_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_FSR1_ROOTSIG_STRINGIFY(FFX_FSR1_RESOURCE_IDENTIFIER_COUNT) ")), " \
"DescriptorTable(SRV(t0, numDescriptors = " FFX_FSR1_ROOTSIG_STRINGIFY(FFX_FSR1_RESOURCE_IDENTIFIER_COUNT) ")), " \
"CBV(b0), " \
"StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_LINEAR, " \
"addressU = TEXTURE_ADDRESS_CLAMP, " \
"addressV = TEXTURE_ADDRESS_CLAMP, " \
"addressW = TEXTURE_ADDRESS_CLAMP, " \
"comparisonFunc = COMPARISON_NEVER, " \
"borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )]
#if defined(FFX_FSR1_EMBED_ROOTSIG)
#define FFX_FSR1_EMBED_ROOTSIG_CONTENT FFX_FSR1_ROOTSIG
#else
#define FFX_FSR1_EMBED_ROOTSIG_CONTENT
#endif // #if FFX_FSR1_EMBED_ROOTSIG
#endif // #if defined(FFX_GPU)
FfxUInt32x4 Const0()
{
return const0;
}
FfxUInt32x4 Const1()
{
return const1;
}
FfxUInt32x4 Const2()
{
return const2;
}
FfxUInt32x4 Const3()
{
return const3;
}
FfxUInt32x4 EASUSample()
{
return sample;
}
FfxUInt32x4 RCasSample()
{
return sample;
}
FfxUInt32x4 RCasConfig()
{
return const0;
}
SamplerState s_LinearClamp : register(s0);
// SRVs
#if defined FSR1_BIND_SRV_INPUT_COLOR
Texture2D<FfxFloat32x4> r_input_color : FFX_FSR1_DECLARE_SRV(FSR1_BIND_SRV_INPUT_COLOR);
#endif
#if defined FSR1_BIND_SRV_INTERNAL_UPSCALED_COLOR
Texture2D<FfxFloat32x4> r_internal_upscaled_color : FFX_FSR1_DECLARE_SRV(FSR1_BIND_SRV_INTERNAL_UPSCALED_COLOR);
#endif
#if defined FSR1_BIND_SRV_UPSCALED_OUTPUT
Texture2D<FfxFloat32x4> r_upscaled_output : FFX_FSR1_DECLARE_SRV(FSR1_BIND_SRV_UPSCALED_OUTPUT);
#endif
// UAV declarations
#if defined FSR1_BIND_UAV_INPUT_COLOR
RWTexture2D<FfxFloat32x4> rw_input_color : FFX_FSR1_DECLARE_UAV(FSR1_BIND_UAV_INPUT_COLOR);
#endif
#if defined FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR
RWTexture2D<FfxFloat32x4> rw_internal_upscaled_color : FFX_FSR1_DECLARE_UAV(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR);
#endif
#if defined FSR1_BIND_UAV_UPSCALED_OUTPUT
RWTexture2D<FfxFloat32x4> rw_upscaled_output : FFX_FSR1_DECLARE_UAV(FSR1_BIND_UAV_UPSCALED_OUTPUT);
#endif
#if FFX_HALF
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat16x4 GatherEasuRed(FfxFloat32x2 fPxPos)
{
return (FfxFloat16x4)r_input_color.GatherRed(s_LinearClamp, fPxPos, FfxInt32x2(0,0));
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat16x4 GatherEasuGreen(FfxFloat32x2 fPxPos)
{
return (FfxFloat16x4)r_input_color.GatherGreen(s_LinearClamp, fPxPos, FfxInt32x2(0, 0));
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat16x4 GatherEasuBlue(FfxFloat32x2 fPxPos)
{
return (FfxFloat16x4)r_input_color.GatherBlue(s_LinearClamp, fPxPos, FfxInt32x2(0, 0));
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if FFX_FSR1_OPTION_APPLY_RCAS
#if defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
void StoreEASUOutput(FfxUInt32x2 iPxPos, FfxFloat16x3 fColor)
{
rw_internal_upscaled_color[iPxPos] = FfxFloat32x4(fColor, 1.f);
}
#endif // #if defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
#else
#if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
void StoreEASUOutput(FfxUInt32x2 iPxPos, FfxFloat16x3 fColor)
{
rw_upscaled_output[iPxPos] = FfxFloat32x4(fColor, 1.f);
}
#endif // #if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
#endif // #if FFX_FSR1_OPTION_APPLY_RCAS
#if defined(FSR1_BIND_SRV_INTERNAL_UPSCALED_COLOR)
FfxFloat16x4 LoadRCas_Input(FfxInt16x2 iPxPos)
{
return (FfxFloat16x4)r_internal_upscaled_color[iPxPos];
}
#endif // defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
#if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
void StoreRCasOutput(FfxInt16x2 iPxPos, FfxFloat16x3 fColor)
{
rw_upscaled_output[iPxPos] = FfxFloat32x4(fColor, 1.f);
}
#endif // defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
#else // FFX_HALF
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat32x4 GatherEasuRed(FfxFloat32x2 fPxPos)
{
return r_input_color.GatherRed(s_LinearClamp, fPxPos, FfxInt32x2(0, 0));
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat32x4 GatherEasuGreen(FfxFloat32x2 fPxPos)
{
return r_input_color.GatherGreen(s_LinearClamp, fPxPos, FfxInt32x2(0, 0));
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if defined(FSR1_BIND_SRV_INPUT_COLOR)
FfxFloat32x4 GatherEasuBlue(FfxFloat32x2 fPxPos)
{
return r_input_color.GatherBlue(s_LinearClamp, fPxPos, FfxInt32x2(0, 0));
}
#endif // defined(FSR1_BIND_SRV_INPUT_COLOR)
#if defined(FFX_FSR1_OPTION_APPLY_RCAS)
#if defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
void StoreEASUOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor)
{
rw_internal_upscaled_color[iPxPos] = FfxFloat32x4(fColor, 1.f);
}
#endif // #if defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
#else
#if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
void StoreEASUOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor)
{
rw_upscaled_output[iPxPos] = FfxFloat32x4(fColor, 1.f);
}
#endif // #if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
#endif // #if defined(FFX_FSR1_OPTION_APPLY_RCAS)
#if defined(FSR1_BIND_SRV_INTERNAL_UPSCALED_COLOR)
FfxFloat32x4 LoadRCas_Input(FfxInt32x2 iPxPos)
{
return r_internal_upscaled_color[iPxPos];
}
#endif // defined(FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR)
#if defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
void StoreRCasOutput(FfxInt32x2 iPxPos, FfxFloat32x3 fColor)
{
rw_upscaled_output[iPxPos] = FfxFloat32x4(fColor, 1.f);
}
#endif // defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
#endif // FFX_HALF
#endif // #if defined(FFX_GPU)

View File

@@ -0,0 +1,98 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (C) 2024 Advanced Micro Devices, Inc.
//
// 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.
#define GROUP_SIZE 8
#define FSR_RCAS_DENOISE 1
#include "ffx_core.h"
#if FFX_HALF
#define FFX_FSR_EASU_HALF 1
FfxFloat16x4 FsrEasuRH(FfxFloat32x2 p) { return GatherEasuRed(p); }
FfxFloat16x4 FsrEasuGH(FfxFloat32x2 p) { return GatherEasuGreen(p); }
FfxFloat16x4 FsrEasuBH(FfxFloat32x2 p) { return GatherEasuBlue(p); }
#else
#define FFX_FSR_EASU_FLOAT 1
FfxFloat32x4 FsrEasuRF(FfxFloat32x2 p) { return GatherEasuRed(p); }
FfxFloat32x4 FsrEasuGF(FfxFloat32x2 p) { return GatherEasuGreen(p); }
FfxFloat32x4 FsrEasuBF(FfxFloat32x2 p) { return GatherEasuBlue(p); }
#endif // FFX_HALF
#if FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
#define FSR_RCAS_PASSTHROUGH_ALPHA
#endif // FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
#include "fsr1/ffx_fsr1.h"
void CurrFilter(FfxUInt32x2 pos)
{
#if FFX_HALF
FfxFloat16x3 c;
FsrEasuH(c, pos, Const0(), Const1(), Const2(), Const3());
if (EASUSample().x == 1)
{
c *= c;
}
#if FFX_FSR1_OPTION_SRGB_CONVERSIONS
// Apply gamma if this is an sRGB format (auto-degamma'd on sampler read)
c = pow(c, FfxFloat16x3(1.0 / 2.2, 1.0 / 2.2, 1.0 / 2.2));
#endif // FFX_FSR1_OPTION_SRGB_CONVERSIONS
StoreEASUOutput(pos, c);
#else
FfxFloat32x3 c;
ffxFsrEasuFloat(c, pos, Const0(), Const1(), Const2(), Const3());
if (EASUSample().x == 1)
{
c *= c;
}
#if FFX_FSR1_OPTION_SRGB_CONVERSIONS
// Apply gamma if this is an sRGB format (auto-degamma'd on sampler read)
c = pow(c, FfxFloat32x3(1.f / 2.2f, 1.f / 2.2f, 1.f / 2.2f));
#endif // FFX_FSR1_OPTION_SRGB_CONVERSIONS
StoreEASUOutput(pos, c);
#endif // FFX_HALF
}
void EASU(FfxUInt32x3 LocalThreadId, FfxUInt32x3 WorkGroupId, FfxUInt32x3 Dtid)
{
// Do remapping of local xy in workgroup for a more PS-like swizzle pattern.
FfxUInt32x2 gxy = ffxRemapForQuad(LocalThreadId.x) + FfxUInt32x2(WorkGroupId.x << 4u, WorkGroupId.y << 4u);
CurrFilter(gxy);
gxy.x += 8u;
CurrFilter(gxy);
gxy.y += 8u;
CurrFilter(gxy);
gxy.x -= 8u;
CurrFilter(gxy);
}

View File

@@ -0,0 +1,99 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (C) 2024 Advanced Micro Devices, Inc.
//
// 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.
#define GROUP_SIZE 8
#define FSR_RCAS_DENOISE 1
#include "ffx_core.h"
#if FFX_HALF
#define FSR_RCAS_H 1
FfxFloat16x4 FsrRcasLoadH(FfxInt16x2 p)
{
return LoadRCas_Input(p);
}
void FsrRcasInputH(inout FfxFloat16 r, inout FfxFloat16 g, inout FfxFloat16 b) {}
#else
#define FSR_RCAS_F 1
FfxFloat32x4 FsrRcasLoadF(FfxInt32x2 p)
{
return LoadRCas_Input(p);
}
void FsrRcasInputF(inout FfxFloat32 r, inout FfxFloat32 g, inout FfxFloat32 b) {}
#endif // FFX_HALF
#if FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
#define FSR_RCAS_PASSTHROUGH_ALPHA
#endif // FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
#include "fsr1/ffx_fsr1.h"
void CurrFilter(FFX_MIN16_U2 pos)
{
#if FFX_HALF
#if FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
FfxFloat16x4 c;
FsrRcasH(c.r, c.g, c.b, c.a, pos, RCasConfig());
#else
FfxFloat16x3 c;
FsrRcasH(c.r, c.g, c.b, pos, RCasConfig());
#endif // FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
if (RCasSample().x == 1)
{
c *= c;
}
StoreRCasOutput(FfxInt16x2(pos), c.rgb);
#else
#if FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
FfxFloat32x4 c;
FsrRcasF(c.r, c.g, c.b, c.a, pos, RCasConfig());
#else
FfxFloat32x3 c;
FsrRcasF(c.r, c.g, c.b, pos, RCasConfig());
#endif // FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
if (RCasSample().x == 1)
{
c *= c;
}
StoreRCasOutput(FfxInt32x2(pos), c.rgb);
#endif
}
void RCAS(FfxUInt32x3 LocalThreadId, FfxUInt32x3 WorkGroupId, FfxUInt32x3 Dtid)
{
// Do remapping of local xy in workgroup for a more PS-like swizzle pattern.
FfxUInt32x2 gxy = ffxRemapForQuad(LocalThreadId.x) + FfxUInt32x2(WorkGroupId.x << 4u, WorkGroupId.y << 4u);
CurrFilter(FFX_MIN16_U2(gxy));
gxy.x += 8u;
CurrFilter(FFX_MIN16_U2(gxy));
gxy.y += 8u;
CurrFilter(FFX_MIN16_U2(gxy));
gxy.x -= 8u;
CurrFilter(FFX_MIN16_U2(gxy));
}

View File

@@ -0,0 +1,38 @@
// This file is part of the FidelityFX SDK.
//
// Copyright (C) 2024 Advanced Micro Devices, Inc.
//
// 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_FSR1_RESOURCES_H
#define FFX_FSR1_RESOURCES_H
#if defined(FFX_CPU) || defined(FFX_GPU)
#define FFX_FSR1_RESOURCE_IDENTIFIER_NULL 0
#define FFX_FSR1_RESOURCE_IDENTIFIER_INPUT_COLOR 1
#define FFX_FSR1_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR 2
#define FFX_FSR1_RESOURCE_IDENTIFIER_UPSCALED_OUTPUT 3
#define FFX_FSR1_RESOURCE_IDENTIFIER_COUNT 4
#define FFX_FSR1_CONSTANTBUFFER_IDENTIFIER_FSR1 0
#endif // #if defined(FFX_CPU) || defined(FFX_GPU)
#endif //!defined( FFX_FSR1_RESOURCES_H )