mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 12:49:18 +02:00
Some renaming
This commit is contained in:
42
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/CMakeCompileLPMShaders.txt
vendored
Normal file
42
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/CMakeCompileLPMShaders.txt
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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(LPM_BASE_ARGS
|
||||
-reflection -deps=gcc -DFFX_GPU=1)
|
||||
|
||||
set(LPM_INCLUDE_ARGS
|
||||
"${FFX_GPU_PATH}"
|
||||
"${FFX_GPU_PATH}/lpm")
|
||||
|
||||
if (NOT LPM_SHADER_EXT)
|
||||
set(LPM_SHADER_EXT *)
|
||||
endif()
|
||||
|
||||
file(GLOB LPM_SHADERS
|
||||
"shaders/lpm/ffx_lpm_filter_pass.${LPM_SHADER_EXT}")
|
||||
|
||||
compile_shaders_with_depfile(
|
||||
"${FFX_SC_EXECUTABLE}"
|
||||
"${LPM_BASE_ARGS}" "${LPM_API_BASE_ARGS}" "${LPM_PERMUTATION_ARGS}" "${LPM_INCLUDE_ARGS}"
|
||||
"${LPM_SHADERS}" "${FFX_PASS_SHADER_OUTPUT_PATH}" LPM_PERMUTATION_OUTPUTS)
|
||||
|
||||
add_shader_output("${LPM_PERMUTATION_OUTPUTS}")
|
||||
1147
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/ffx_lpm.h
vendored
Normal file
1147
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/ffx_lpm.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
171
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/ffx_lpm_callbacks_glsl.h
vendored
Normal file
171
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/ffx_lpm_callbacks_glsl.h
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
// 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_lpm_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(LPM_BIND_CB_LPM)
|
||||
layout (set = 0, binding = LPM_BIND_CB_LPM, std140) uniform cbLPM_t
|
||||
{
|
||||
FfxUInt32x4 ctl[24];
|
||||
FfxBoolean shoulder;
|
||||
FfxBoolean con;
|
||||
FfxBoolean soft;
|
||||
FfxBoolean con2;
|
||||
FfxBoolean clip;
|
||||
FfxBoolean scaleOnly;
|
||||
FfxUInt32 displayMode;
|
||||
FfxUInt32 pad;
|
||||
} cbLPM;
|
||||
#else
|
||||
#define ctl 0
|
||||
#define shoulder 0
|
||||
#define con 0
|
||||
#define soft 0
|
||||
#define con2 0
|
||||
#define clip 0
|
||||
#define scaleOnly 0
|
||||
#define displayMode 0
|
||||
#define pad 0
|
||||
#endif
|
||||
|
||||
FfxUInt32x4 LpmFilterCtl(FfxUInt32 i)
|
||||
{
|
||||
return cbLPM.ctl[i];
|
||||
}
|
||||
|
||||
FfxBoolean GetShoulder()
|
||||
{
|
||||
return cbLPM.shoulder;
|
||||
}
|
||||
|
||||
FfxBoolean GetCon()
|
||||
{
|
||||
return cbLPM.con;
|
||||
}
|
||||
|
||||
FfxBoolean GetSoft()
|
||||
{
|
||||
return cbLPM.soft;
|
||||
}
|
||||
|
||||
FfxBoolean GetCon2()
|
||||
{
|
||||
return cbLPM.con2;
|
||||
}
|
||||
|
||||
FfxBoolean GetClip()
|
||||
{
|
||||
return cbLPM.clip;
|
||||
}
|
||||
|
||||
FfxBoolean GetScaleOnly()
|
||||
{
|
||||
return cbLPM.scaleOnly;
|
||||
}
|
||||
|
||||
FfxUInt32 GetMonitorDisplayMode()
|
||||
{
|
||||
return cbLPM.displayMode;
|
||||
}
|
||||
|
||||
#if FFX_HALF
|
||||
FfxFloat16x3 ApplyGamma(FfxFloat16x3 color)
|
||||
{
|
||||
color = pow(color, FfxFloat16x3(1.0 / 2.2, 1.0 / 2.2, 1.0 / 2.2));
|
||||
return color;
|
||||
}
|
||||
|
||||
FfxFloat16x3 ApplyPQ(FfxFloat16x3 color)
|
||||
{
|
||||
// Apply ST2084 curve
|
||||
FfxFloat16 m1 = FfxFloat16(2610.0 / 4096.0 / 4.0);
|
||||
FfxFloat16 m2 = FfxFloat16(2523.0 / 4096.0 * 128.0);
|
||||
FfxFloat16 c1 = FfxFloat16(3424.0 / 4096.0);
|
||||
FfxFloat16 c2 = FfxFloat16(2413.0 / 4096.0 * 32.0);
|
||||
FfxFloat16 c3 = FfxFloat16(2392.0 / 4096.0 * 32.0);
|
||||
FfxFloat16x3 cp = pow(abs(color.xyz), FfxFloat16x3(m1, m1, m1));
|
||||
color.xyz = pow((c1 + c2 * cp) / (FfxFloat16(1.0) + c3 * cp), FfxFloat16x3(m2, m2, m2));
|
||||
return color;
|
||||
}
|
||||
#else
|
||||
FfxFloat32x3 ApplyGamma(FfxFloat32x3 color)
|
||||
{
|
||||
color = pow(color, FfxFloat32x3(1.0 / 2.2, 1.0 / 2.2, 1.0 / 2.2));
|
||||
return color;
|
||||
}
|
||||
|
||||
FfxFloat32x3 ApplyPQ(FfxFloat32x3 color)
|
||||
{
|
||||
// Apply ST2084 curve
|
||||
FfxFloat32 m1 = 2610.0 / 4096.0 / 4;
|
||||
FfxFloat32 m2 = 2523.0 / 4096.0 * 128;
|
||||
FfxFloat32 c1 = 3424.0 / 4096.0;
|
||||
FfxFloat32 c2 = 2413.0 / 4096.0 * 32;
|
||||
FfxFloat32 c3 = 2392.0 / 4096.0 * 32;
|
||||
FfxFloat32x3 cp = pow(abs(color.xyz), FfxFloat32x3(m1, m1, m1));
|
||||
color.xyz = pow((c1 + c2 * cp) / (1 + c3 * cp), FfxFloat32x3(m2, m2, m2));
|
||||
return color;
|
||||
}
|
||||
#endif
|
||||
|
||||
layout (set = 0, binding = 1000) uniform sampler s_LinearClamp;
|
||||
|
||||
#if FFX_HALF
|
||||
#define ColorFormat FfxFloat16x4
|
||||
#define OutputFormat rgba16f
|
||||
#else
|
||||
#define ColorFormat FfxFloat32x4
|
||||
#define OutputFormat rgba32f
|
||||
#endif
|
||||
|
||||
// SRVs
|
||||
#if defined LPM_BIND_SRV_INPUT_COLOR
|
||||
layout (set = 0, binding = LPM_BIND_SRV_INPUT_COLOR) uniform texture2D r_input_color;
|
||||
#endif
|
||||
|
||||
// UAV declarations
|
||||
#if defined LPM_BIND_UAV_OUTPUT_COLOR
|
||||
layout (set = 0, binding = LPM_BIND_UAV_OUTPUT_COLOR, OutputFormat) uniform image2D rw_output_color;
|
||||
#endif
|
||||
|
||||
#if defined(LPM_BIND_SRV_INPUT_COLOR)
|
||||
ColorFormat LoadInput(FfxUInt32x2 iPxPos)
|
||||
{
|
||||
return ColorFormat(texelFetch(r_input_color, FfxInt32x2(iPxPos), 0));
|
||||
}
|
||||
#endif // defined(LPM_BIND_SRV_INPUT_COLOR)
|
||||
|
||||
#if defined(LPM_BIND_UAV_OUTPUT_COLOR)
|
||||
void StoreOutput(FfxUInt32x2 iPxPos, ColorFormat fColor)
|
||||
{
|
||||
imageStore(rw_output_color, FfxInt32x2(iPxPos), fColor);
|
||||
}
|
||||
#endif // defined(LPM_BIND_UAV_OUTPUT_COLOR)
|
||||
|
||||
#endif // #if defined(FFX_GPU)
|
||||
205
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/ffx_lpm_callbacks_hlsl.h
vendored
Normal file
205
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/ffx_lpm_callbacks_hlsl.h
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
// 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_lpm_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_LPM_DECLARE_SRV(regIndex) register(DECLARE_SRV_REGISTER(regIndex))
|
||||
#define FFX_LPM_DECLARE_UAV(regIndex) register(DECLARE_UAV_REGISTER(regIndex))
|
||||
#define FFX_LPM_DECLARE_CB(regIndex) register(DECLARE_CB_REGISTER(regIndex))
|
||||
|
||||
#if defined(LPM_BIND_CB_LPM)
|
||||
cbuffer cbLPM : FFX_LPM_DECLARE_CB(LPM_BIND_CB_LPM)
|
||||
{
|
||||
FfxUInt32x4 ctl[24];
|
||||
FfxBoolean shoulder;
|
||||
FfxBoolean con;
|
||||
FfxBoolean soft;
|
||||
FfxBoolean con2;
|
||||
FfxBoolean clip;
|
||||
FfxBoolean scaleOnly;
|
||||
FfxUInt32 displayMode;
|
||||
FfxUInt32 pad;
|
||||
#define FFX_LPM_CONSTANT_BUFFER_1_SIZE 32 // Number of 32-bit values. This must be kept in sync with the cbLPM size.
|
||||
};
|
||||
#else
|
||||
#define ctl 0
|
||||
#define shoulder 0
|
||||
#define con 0
|
||||
#define soft 0
|
||||
#define con2 0
|
||||
#define clip 0
|
||||
#define scaleOnly 0
|
||||
#define displayMode 0
|
||||
#define pad 0
|
||||
#endif
|
||||
|
||||
#if defined(FFX_GPU)
|
||||
#define FFX_LPM_ROOTSIG_STRINGIFY(p) FFX_LPM_ROOTSIG_STR(p)
|
||||
#define FFX_LPM_ROOTSIG_STR(p) #p
|
||||
#define FFX_LPM_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_LPM_ROOTSIG_STRINGIFY(FFX_LPM_RESOURCE_IDENTIFIER_COUNT) ")), " \
|
||||
"DescriptorTable(SRV(t0, numDescriptors = " FFX_LPM_ROOTSIG_STRINGIFY(FFX_LPM_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_LPM_EMBED_ROOTSIG)
|
||||
#define FFX_LPM_EMBED_ROOTSIG_CONTENT FFX_LPM_ROOTSIG
|
||||
#else
|
||||
#define FFX_LPM_EMBED_ROOTSIG_CONTENT
|
||||
#endif // #if FFX_LPM_EMBED_ROOTSIG
|
||||
#endif // #if defined(FFX_GPU)
|
||||
|
||||
FfxUInt32x4 LpmFilterCtl(FfxUInt32 i)
|
||||
{
|
||||
return ctl[i];
|
||||
}
|
||||
|
||||
FfxBoolean GetShoulder()
|
||||
{
|
||||
return shoulder;
|
||||
}
|
||||
|
||||
FfxBoolean GetCon()
|
||||
{
|
||||
return con;
|
||||
}
|
||||
|
||||
FfxBoolean GetSoft()
|
||||
{
|
||||
return soft;
|
||||
}
|
||||
|
||||
FfxBoolean GetCon2()
|
||||
{
|
||||
return con2;
|
||||
}
|
||||
|
||||
FfxBoolean GetClip()
|
||||
{
|
||||
return clip;
|
||||
}
|
||||
|
||||
FfxBoolean GetScaleOnly()
|
||||
{
|
||||
return scaleOnly;
|
||||
}
|
||||
|
||||
FfxUInt32 GetMonitorDisplayMode()
|
||||
{
|
||||
return displayMode;
|
||||
}
|
||||
|
||||
#if FFX_HALF
|
||||
FfxFloat16x3 ApplyGamma(FfxFloat16x3 color)
|
||||
{
|
||||
color = ffxPow(color, FfxFloat16(1.0f / 2.2f));
|
||||
return color;
|
||||
}
|
||||
|
||||
FfxFloat16x3 ApplyPQ(FfxFloat16x3 color)
|
||||
{
|
||||
// Apply ST2084 curve
|
||||
FfxFloat16 m1 = 2610.0 / 4096.0 / 4;
|
||||
FfxFloat16 m2 = 2523.0 / 4096.0 * 128;
|
||||
FfxFloat16 c1 = 3424.0 / 4096.0;
|
||||
FfxFloat16 c2 = 2413.0 / 4096.0 * 32;
|
||||
FfxFloat16 c3 = 2392.0 / 4096.0 * 32;
|
||||
FfxFloat16x3 cp = ffxPow(abs(color.xyz), m1);
|
||||
color.xyz = ffxPow((c1 + c2 * cp) / (1 + c3 * cp), m2);
|
||||
return color;
|
||||
}
|
||||
#else
|
||||
FfxFloat32x3 ApplyGamma(FfxFloat32x3 color)
|
||||
{
|
||||
color = ffxPow(color, 1.0f / 2.2f);
|
||||
return color;
|
||||
}
|
||||
|
||||
FfxFloat32x3 ApplyPQ(FfxFloat32x3 color)
|
||||
{
|
||||
// Apply ST2084 curve
|
||||
FfxFloat32 m1 = 2610.0 / 4096.0 / 4;
|
||||
FfxFloat32 m2 = 2523.0 / 4096.0 * 128;
|
||||
FfxFloat32 c1 = 3424.0 / 4096.0;
|
||||
FfxFloat32 c2 = 2413.0 / 4096.0 * 32;
|
||||
FfxFloat32 c3 = 2392.0 / 4096.0 * 32;
|
||||
FfxFloat32x3 cp = ffxPow(abs(color.xyz), m1);
|
||||
color.xyz = ffxPow((c1 + c2 * cp) / (1 + c3 * cp), m2);
|
||||
return color;
|
||||
}
|
||||
#endif
|
||||
|
||||
SamplerState s_LinearClamp : register(s0);
|
||||
|
||||
#if FFX_HALF
|
||||
#define ColorFormat FfxFloat16x4
|
||||
#else
|
||||
#define ColorFormat FfxFloat32x4
|
||||
#endif
|
||||
|
||||
// SRVs
|
||||
#if defined LPM_BIND_SRV_INPUT_COLOR
|
||||
Texture2D<ColorFormat> r_input_color : FFX_LPM_DECLARE_SRV(LPM_BIND_SRV_INPUT_COLOR);
|
||||
#endif
|
||||
// UAV declarations
|
||||
#if defined LPM_BIND_UAV_OUTPUT_COLOR
|
||||
RWTexture2D<ColorFormat> rw_output_color : FFX_LPM_DECLARE_UAV(LPM_BIND_UAV_OUTPUT_COLOR);
|
||||
#endif
|
||||
|
||||
#if defined(LPM_BIND_SRV_INPUT_COLOR)
|
||||
ColorFormat LoadInput(FfxUInt32x2 iPxPos)
|
||||
{
|
||||
return r_input_color[iPxPos];
|
||||
}
|
||||
#endif // defined(LPM_BIND_SRV_INPUT_COLOR)
|
||||
|
||||
#if defined(LPM_BIND_UAV_OUTPUT_COLOR)
|
||||
void StoreOutput(FfxUInt32x2 iPxPos, ColorFormat fColor)
|
||||
{
|
||||
rw_output_color[iPxPos] = fColor;
|
||||
}
|
||||
#endif // defined(LPM_BIND_UAV_OUTPUT_COLOR)
|
||||
|
||||
#endif // #if defined(FFX_GPU)
|
||||
129
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/ffx_lpm_filter.h
vendored
Normal file
129
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/ffx_lpm_filter.h
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
// 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_core.h"
|
||||
|
||||
#define LPM_NO_SETUP 1
|
||||
#include "lpm/ffx_lpm.h"
|
||||
|
||||
#if FFX_HALF
|
||||
void CurrFilter(FfxUInt32x4 twoPixelPosInQuad)
|
||||
{
|
||||
FfxFloat16x4 pixelOneColor = LoadInput(twoPixelPosInQuad.xy);
|
||||
FfxFloat16x4 pixelTwoColor = LoadInput(twoPixelPosInQuad.zw);
|
||||
|
||||
FfxFloat16x2 redPair = FfxFloat16x2(pixelOneColor.r, pixelTwoColor.r);
|
||||
FfxFloat16x2 greenPair = FfxFloat16x2(pixelOneColor.g, pixelTwoColor.g);
|
||||
FfxFloat16x2 bluePair = FfxFloat16x2(pixelOneColor.b, pixelTwoColor.b);
|
||||
|
||||
LpmFilterH(redPair, greenPair, bluePair, GetShoulder(), GetCon(), GetSoft(), GetCon2(), GetClip(), GetScaleOnly());
|
||||
|
||||
pixelOneColor.rgb = FfxFloat16x3(redPair.x, greenPair.x, bluePair.x);
|
||||
pixelTwoColor.rgb = FfxFloat16x3(redPair.y, greenPair.y, bluePair.y);
|
||||
|
||||
switch (GetMonitorDisplayMode())
|
||||
{
|
||||
case 0: // Corresponds to FFX_LPM_DISPLAYMODE_LDR
|
||||
pixelOneColor.xyz = ApplyGamma(pixelOneColor.xyz);
|
||||
pixelTwoColor.xyz = ApplyGamma(pixelTwoColor.xyz);
|
||||
break;
|
||||
|
||||
case 1: // Corresponds to FFX_LPM_DISPLAYMODE_HDR10_2084
|
||||
case 3: // Corresponds to FFX_LPM_DISPLAYMODE_FSHDR_2084
|
||||
pixelOneColor.xyz = ApplyPQ(pixelOneColor.xyz);
|
||||
pixelTwoColor.xyz = ApplyPQ(pixelTwoColor.xyz);
|
||||
break;
|
||||
}
|
||||
|
||||
StoreOutput(twoPixelPosInQuad.xy, pixelOneColor);
|
||||
StoreOutput(twoPixelPosInQuad.zw, pixelTwoColor);
|
||||
}
|
||||
#else
|
||||
void CurrFilter(FfxUInt32x2 onePixelPosInQuad)
|
||||
{
|
||||
FfxFloat32x4 color = LoadInput(onePixelPosInQuad);
|
||||
LpmFilter(color.r, color.g, color.b, GetShoulder(), GetCon(), GetSoft(), GetCon2(), GetClip(), GetScaleOnly());
|
||||
|
||||
switch (GetMonitorDisplayMode())
|
||||
{
|
||||
case 0: // Corresponds to FFX_LPM_DISPLAYMODE_LDR
|
||||
color.xyz = ApplyGamma(color.xyz);
|
||||
break;
|
||||
|
||||
case 1: // Corresponds to FFX_LPM_DISPLAYMODE_HDR10_2084
|
||||
case 3: // Corresponds to FFX_LPM_DISPLAYMODE_FSHDR_2084
|
||||
color.xyz = ApplyPQ(color.xyz);
|
||||
break;
|
||||
}
|
||||
|
||||
StoreOutput(onePixelPosInQuad, color);
|
||||
}
|
||||
#endif
|
||||
|
||||
void LPMFilter(FfxUInt32x3 LocalThreadId, FfxUInt32x3 WorkGroupId, FfxUInt32x3 Dtid)
|
||||
{
|
||||
#if FFX_HALF
|
||||
// Do remapping of local xy in workgroup for a more PS-like swizzle pattern.
|
||||
// But this time for fp16 since LPM can output two colors at a time, we will store coordinates of two pixels at a time
|
||||
FfxUInt32x4 twoPixelPosInQuad;
|
||||
|
||||
// Get top left pixel in quad and store in xy component
|
||||
twoPixelPosInQuad.xy = ffxRemapForQuad(LocalThreadId.x) + FfxUInt32x2(WorkGroupId.x << 4u, WorkGroupId.y << 4u);
|
||||
|
||||
// Get top right pixel in quad and store in zw component
|
||||
twoPixelPosInQuad.zw = twoPixelPosInQuad.xy;
|
||||
twoPixelPosInQuad.z += 8u;
|
||||
|
||||
// now call lpm fp16 on both together
|
||||
CurrFilter(twoPixelPosInQuad);
|
||||
|
||||
// Get bottom right pixel in quad and store in xy component
|
||||
twoPixelPosInQuad.xy = twoPixelPosInQuad.zw;
|
||||
twoPixelPosInQuad.y += 8u;
|
||||
|
||||
// Get bottom left pixel in quad and store in zw component
|
||||
twoPixelPosInQuad.zw = twoPixelPosInQuad.xy;
|
||||
twoPixelPosInQuad.z -= 8u;
|
||||
|
||||
// now call lpm fp16 on both together
|
||||
CurrFilter(twoPixelPosInQuad);
|
||||
#else
|
||||
// Do remapping of local xy in workgroup for a more PS-like swizzle pattern.
|
||||
FfxUInt32x2 onePixelPosInQuad;
|
||||
|
||||
// Get top left pixel in quad
|
||||
onePixelPosInQuad = ffxRemapForQuad(LocalThreadId.x) + FfxUInt32x2(WorkGroupId.x << 4u, WorkGroupId.y << 4u);
|
||||
CurrFilter(onePixelPosInQuad);
|
||||
|
||||
// Get top right
|
||||
onePixelPosInQuad.x += 8u;
|
||||
CurrFilter(onePixelPosInQuad);
|
||||
|
||||
// Get bottom right
|
||||
onePixelPosInQuad.y += 8u;
|
||||
CurrFilter(onePixelPosInQuad);
|
||||
|
||||
// Get bottom left
|
||||
onePixelPosInQuad.x -= 8u;
|
||||
CurrFilter(onePixelPosInQuad);
|
||||
#endif
|
||||
}
|
||||
37
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/ffx_lpm_resources.h
vendored
Normal file
37
betterRenderer/thirdparty/fsr2/include/FidelityFX/gpu/lpm/ffx_lpm_resources.h
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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_LPM_RESOURCES_H
|
||||
#define FFX_LPM_RESOURCES_H
|
||||
|
||||
#if defined(FFX_CPU) || defined(FFX_GPU)
|
||||
#define FFX_LPM_RESOURCE_IDENTIFIER_NULL 0
|
||||
#define FFX_LPM_RESOURCE_IDENTIFIER_INPUT_COLOR 1
|
||||
#define FFX_LPM_RESOURCE_IDENTIFIER_OUTPUT_COLOR 2
|
||||
|
||||
#define FFX_LPM_RESOURCE_IDENTIFIER_COUNT 3
|
||||
|
||||
#define FFX_LPM_CONSTANTBUFFER_IDENTIFIER_LPM 0
|
||||
|
||||
#endif // #if defined(FFX_CPU) || defined(FFX_GPU)
|
||||
|
||||
#endif //!defined( FFX_LPM_RESOURCES_H )
|
||||
Reference in New Issue
Block a user