add fsr1
This commit is contained in:
parent
91c7f57d09
commit
58ad6cbb43
1
.gitignore
vendored
1
.gitignore
vendored
@ -59,3 +59,4 @@ UserSettings/
|
||||
|
||||
**/.DS_Store
|
||||
out/
|
||||
.vscode/
|
||||
@ -1,5 +1,5 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:yousandi.cn,2023:
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
|
||||
@ -68,7 +68,7 @@ Material:
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _Tex:
|
||||
m_Texture: {fileID: 8900000, guid: 870ca4df5e7d0044eb0d94414730e50c, type: 3}
|
||||
m_Texture: {fileID: 8900000, guid: 5500c7bc667b55f49b29485c043a2b42, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:yousandi.cn,2023:
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-4720686990112659349
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
|
||||
@ -28,7 +28,7 @@ MonoBehaviour:
|
||||
m_SupportsHDR: 1
|
||||
m_HDRColorBufferPrecision: 0
|
||||
m_MSAA: 1
|
||||
m_RenderScale: 0.58823526
|
||||
m_RenderScale: 0.5
|
||||
m_UpscalingFilter: 0
|
||||
m_FsrOverrideSharpness: 1
|
||||
m_FsrSharpness: 1
|
||||
@ -114,5 +114,5 @@ MonoBehaviour:
|
||||
m_PrefilterNativeRenderPass: 1
|
||||
m_ShaderVariantLogLevel: 0
|
||||
m_ShadowCascades: 0
|
||||
superResolution: 5
|
||||
superResolution: 1
|
||||
vrsRate: 0
|
||||
|
||||
@ -14,6 +14,30 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
m_Active: 0
|
||||
quality: 0
|
||||
--- !u!114 &-7390778553674367771
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 386e439eeef2849448d91896c74ff1d5, type: 3}
|
||||
m_Name: FSR
|
||||
m_EditorClassIdentifier:
|
||||
m_Active: 1
|
||||
quality: 5
|
||||
v1setting:
|
||||
EasuCompute: {fileID: 7200000, guid: 787b0c165dad9074e9489817de945916, type: 3}
|
||||
RacsCompute: {fileID: 7200000, guid: a50f730ab549f794cbe91f005703e208, type: 3}
|
||||
IsHdr: 1
|
||||
Sharpness: 0.922
|
||||
MipMapBias: -1.74
|
||||
v2setting:
|
||||
ComputeShader: {fileID: 7200000, guid: 7b9233ff11584414688b5f10a526ca15, type: 3}
|
||||
v3setting:
|
||||
ComputeShader: {fileID: 7200000, guid: b79f3a2fdeeac5745b545fc41148f6c3, type: 3}
|
||||
--- !u!114 &-2621301742936824463
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -26,7 +50,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: a00dddc5b3ea7fe45953ccbd49b58b94, type: 3}
|
||||
m_Name: GSR
|
||||
m_EditorClassIdentifier:
|
||||
m_Active: 1
|
||||
m_Active: 0
|
||||
quality: 4
|
||||
v1settings:
|
||||
EnableEdgeDirection: 1
|
||||
@ -40,7 +64,7 @@ MonoBehaviour:
|
||||
GSRV2ComputeShader: {fileID: 7200000, guid: 9a4e6ff1f9a33fa4ea1e9744e313e2fd, type: 3}
|
||||
FiveSample: 0
|
||||
Exposure_co_rcp: 1
|
||||
MipMapBias: -1.34
|
||||
MipMapBias: 0
|
||||
--- !u!114 &-2390300670611609275
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -154,7 +178,8 @@ MonoBehaviour:
|
||||
- {fileID: -2621301742936824463}
|
||||
- {fileID: 4962205925092569722}
|
||||
- {fileID: -8576419846133267094}
|
||||
m_RendererFeatureMap: bc3f630842f2e70dd6a559c442a94bfd4529d15534f2d3de228858dca8d122222735d34a93f399f2716523fbf3439fdb7a327b7bff4bdd446ac59dfa966ffa88
|
||||
- {fileID: -7390778553674367771}
|
||||
m_RendererFeatureMap: bc3f630842f2e70dd6a559c442a94bfd4529d15534f2d3de228858dca8d122222735d34a93f399f2716523fbf3439fdb7a327b7bff4bdd446ac59dfa966ffa88e5fca93e10ae6e99
|
||||
m_UseNativeRenderPass: 0
|
||||
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
|
||||
shaders:
|
||||
@ -339,7 +364,7 @@ MonoBehaviour:
|
||||
MipMapBias: 0
|
||||
antiGhosting: 0.1
|
||||
sharpMaterial: {fileID: 2100000, guid: b356b97c3a610794582dd87ab85f4e98, type: 2}
|
||||
sharpness: 1.652
|
||||
sharpness: 0.824
|
||||
sharpMipLevel: 0
|
||||
--- !u!114 &6334271670068977784
|
||||
MonoBehaviour:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:yousandi.cn,2023:
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-8189118008837629952
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
@ -170,7 +170,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
|
||||
m_Name: Tonemapping
|
||||
m_EditorClassIdentifier:
|
||||
active: 1
|
||||
active: 0
|
||||
mode:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
|
||||
@ -497,7 +497,7 @@ namespace UnityEngine.Rendering.Universal
|
||||
}
|
||||
var asset = UniversalRenderPipeline.asset;
|
||||
// SuperResolution
|
||||
if (asset.SuperResolution != ESuperResolution.None)
|
||||
if (asset.SuperResolution != ESuperResolution.None && asset.SuperResolution != ESuperResolution.FSR1)
|
||||
{
|
||||
ref var colorDescriptor = ref cameraData.cameraTargetDescriptor;
|
||||
colorDescriptor.width = cameraData.camera.pixelWidth;
|
||||
@ -507,6 +507,7 @@ namespace UnityEngine.Rendering.Universal
|
||||
|| asset.SuperResolution == ESuperResolution.DLSS1
|
||||
|| asset.SuperResolution == ESuperResolution.DLSS2
|
||||
|| asset.SuperResolution == ESuperResolution.DLSS3
|
||||
|| asset.SuperResolution == ESuperResolution.FSR1
|
||||
)
|
||||
{
|
||||
colorDescriptor.enableRandomWrite = true;
|
||||
@ -691,7 +692,6 @@ namespace UnityEngine.Rendering.Universal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal void Present(CommandBuffer cmd, ref CameraData cameraData, RTHandle rt)
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Unity.Mathematics;
|
||||
using UnityEditor.VersionControl;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
@ -21,6 +24,38 @@ namespace X.Rendering.Feature
|
||||
{
|
||||
[SerializeField]
|
||||
private FsrQuality quality;
|
||||
[Serializable]
|
||||
public class V1Setting
|
||||
{
|
||||
public ComputeShader EasuCompute;
|
||||
public ComputeShader RacsCompute;
|
||||
public bool IsHdr;
|
||||
[Range(0.0f, 1.0f)]
|
||||
public float Sharpness;
|
||||
[Range(-5, 5)]
|
||||
public float MipMapBias;
|
||||
}
|
||||
[SerializeField]
|
||||
V1Setting v1setting;
|
||||
|
||||
[Serializable]
|
||||
class V2Setting
|
||||
{
|
||||
public ComputeShader ComputeShader;
|
||||
|
||||
}
|
||||
[SerializeField]
|
||||
V2Setting v2setting;
|
||||
|
||||
|
||||
[Serializable]
|
||||
class V3Setting
|
||||
{
|
||||
public ComputeShader ComputeShader;
|
||||
|
||||
}
|
||||
[SerializeField]
|
||||
V3Setting v3setting;
|
||||
|
||||
FSRV1 fsr1;
|
||||
enum FsrVer
|
||||
@ -38,11 +73,23 @@ namespace X.Rendering.Feature
|
||||
|
||||
public override void Create()
|
||||
{
|
||||
fsr1 = new();
|
||||
fsr1 = new(v1setting);
|
||||
}
|
||||
|
||||
public void DoSR(CommandBuffer cmd, RTHandle source, RTHandle destination, RTHandle motionVector, ref RenderingData renderingData)
|
||||
{
|
||||
switch (fsrVer)
|
||||
{
|
||||
case FsrVer.FSRV1:
|
||||
fsr1.DoSR(cmd, source, destination, motionVector, ref renderingData);
|
||||
break;
|
||||
case FsrVer.FSRV2:
|
||||
break;
|
||||
case FsrVer.FSRV3:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public float GetRenderScale()
|
||||
@ -137,9 +184,90 @@ namespace X.Rendering.Feature
|
||||
|
||||
sealed class FSRV1 : IDisposable
|
||||
{
|
||||
FSR.V1Setting v1setting;
|
||||
ComputeBuffer fsr1BUffer;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct CBFSR1
|
||||
{
|
||||
public float4 const0;
|
||||
public float4 const1;
|
||||
public float4 const2;
|
||||
public float4 const3;
|
||||
public float4 sample;
|
||||
}
|
||||
CBFSR1[] cbFsr1Step1;
|
||||
CBFSR1[] cbFsr1sStep2;
|
||||
public FSRV1(FSR.V1Setting v1setting)
|
||||
{
|
||||
this.v1setting = v1setting;
|
||||
fsr1BUffer = new ComputeBuffer(1, Marshal.SizeOf<CBFSR1>(), ComputeBufferType.Structured);
|
||||
cbFsr1Step1 = new CBFSR1[1];
|
||||
cbFsr1sStep2 = new CBFSR1[1];
|
||||
}
|
||||
|
||||
RTHandle tempRT;
|
||||
// 抗锯齿输出,在tonemapping 后最好,在 Film grain, Chromatic aberration 等高频视觉后处理之前
|
||||
public void DoSR(CommandBuffer cmd, in RTHandle source, in RTHandle destination, in RTHandle motionVector, ref RenderingData renderingData)
|
||||
{
|
||||
float inputW = source.referenceSize.x;
|
||||
float inputH = source.referenceSize.y;
|
||||
float outputW = destination.referenceSize.x;
|
||||
float outputH = destination.referenceSize.y;
|
||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", v1setting.MipMapBias);
|
||||
|
||||
|
||||
cbFsr1Step1[0].const0 = new float4(inputW / outputW, inputH / outputH, 0.5f * inputW / outputW - 0.5f, 0.5f * inputH / outputH - 0.5f);
|
||||
cbFsr1Step1[0].const1 = new float4(1 / inputW, 1 / inputH, 1 / inputW, -1 / inputH);
|
||||
cbFsr1Step1[0].const2 = new float4(-1 / inputW, 2 / inputH, 1 / inputW, 2 / inputH);
|
||||
cbFsr1Step1[0].const3 = new float4(0, 4 / inputH, 0, 0);
|
||||
cbFsr1Step1[0].sample = v1setting.IsHdr ? 1 : 0;
|
||||
cmd.SetBufferData(fsr1BUffer, cbFsr1Step1);
|
||||
|
||||
var cameraData = renderingData.cameraData;
|
||||
var colorDescriptor = cameraData.cameraTargetDescriptor;
|
||||
colorDescriptor.width = cameraData.camera.pixelWidth;
|
||||
colorDescriptor.height = cameraData.camera.pixelHeight;
|
||||
colorDescriptor.enableRandomWrite = true;
|
||||
colorDescriptor.depthBufferBits = 0;
|
||||
colorDescriptor.graphicsFormat = UnityEngine.Experimental.Rendering.GraphicsFormat.B10G11R11_UFloatPack32;
|
||||
|
||||
RenderingUtils.ReAllocateIfNeeded(ref tempRT, colorDescriptor);
|
||||
cmd.SetComputeConstantBufferParam(v1setting.EasuCompute, "cbFSR1", fsr1BUffer, 0 , 1);
|
||||
cmd.SetComputeTextureParam(v1setting.EasuCompute, 0, "r_input_color", source);
|
||||
cmd.SetComputeTextureParam(v1setting.EasuCompute, 0, "rw_upscaled_output", tempRT);
|
||||
|
||||
const int threadGroupWorkRegionDim = 16;
|
||||
int dispatchX = Mathf.CeilToInt(outputW / threadGroupWorkRegionDim);
|
||||
int dispatchY = Mathf.CeilToInt(outputH / threadGroupWorkRegionDim);
|
||||
|
||||
cmd.DispatchCompute(v1setting.EasuCompute, 0, dispatchX, dispatchY, 1);
|
||||
|
||||
float sharpenessRemapped = (1 - v1setting.Sharpness) * 2.5f;
|
||||
float sharpness = Mathf.Pow(2.0f, -sharpenessRemapped);
|
||||
uint sharpnessAsHalf = Mathf.FloatToHalf(sharpness);
|
||||
int packedSharpness = (int)(sharpnessAsHalf | (sharpnessAsHalf << 16));
|
||||
float packedSharpnessAsFloat = BitConverter.Int32BitsToSingle(packedSharpness);
|
||||
|
||||
cbFsr1sStep2[0].const0 = new float4(sharpness, packedSharpnessAsFloat, 0, 0);
|
||||
cbFsr1sStep2[0].sample = v1setting.IsHdr ? 1 : 0;
|
||||
|
||||
cmd.SetBufferData(fsr1BUffer, cbFsr1sStep2);
|
||||
cmd.SetComputeConstantBufferParam(v1setting.RacsCompute, "cbFSR1", fsr1BUffer, 0, 1);
|
||||
cmd.SetComputeTextureParam(v1setting.RacsCompute, 0, "r_internal_upscaled_color", tempRT);
|
||||
|
||||
cmd.SetComputeTextureParam(v1setting.RacsCompute, 0, "rw_upscaled_output", destination);
|
||||
|
||||
cmd.DispatchCompute(v1setting.RacsCompute, 0, dispatchX, dispatchY, 1);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (tempRT?.rt)
|
||||
{
|
||||
fsr1BUffer?.Release();
|
||||
tempRT.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,8 +25,40 @@ namespace X.Rendering.Feature
|
||||
public sealed class GSR : ScriptableRendererFeature, ISuperResolutionFeature
|
||||
{
|
||||
public GsrQuality quality;
|
||||
[Serializable]
|
||||
public sealed class V1Setting
|
||||
{
|
||||
[SerializeField]
|
||||
public bool EnableEdgeDirection = true;
|
||||
[SerializeField, Range(1, 4)]
|
||||
public int Mode = 1;
|
||||
[SerializeField, Range(0.5f, 2.5f)]
|
||||
public float Sharp = 2;
|
||||
[SerializeField, Range(-5f, 2.5f)]
|
||||
public float MipMapBias = 0;
|
||||
[SerializeField]
|
||||
public Material GSRV1Material;
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private V1Setting v1settings;
|
||||
|
||||
[Serializable]
|
||||
public sealed class V2Setting
|
||||
{
|
||||
[SerializeField]
|
||||
public bool UseCompute2Pass = false;
|
||||
[SerializeField]
|
||||
public Material GSRV2Material;
|
||||
[SerializeField]
|
||||
public ComputeShader GSRV2ComputeShader;
|
||||
[SerializeField]
|
||||
public bool FiveSample = false;
|
||||
[SerializeField]
|
||||
public float Exposure_co_rcp = 1;
|
||||
[SerializeField, Range(-5f, 2.5f)]
|
||||
public float MipMapBias = 0;
|
||||
}
|
||||
[SerializeField]
|
||||
private V2Setting v2settings;
|
||||
|
||||
@ -136,31 +168,18 @@ namespace X.Rendering.Feature
|
||||
}
|
||||
|
||||
#region GSR1
|
||||
[Serializable]
|
||||
sealed class V1Setting
|
||||
{
|
||||
[SerializeField]
|
||||
public bool EnableEdgeDirection = true;
|
||||
[SerializeField, Range(1, 4)]
|
||||
public int Mode = 1;
|
||||
[SerializeField, Range(0.5f, 2.5f)]
|
||||
public float Sharp = 2;
|
||||
[SerializeField, Range(-5f, 2.5f)]
|
||||
public float MipMapBias = 0;
|
||||
[SerializeField]
|
||||
public Material GSRV1Material;
|
||||
}
|
||||
|
||||
|
||||
sealed class GSRV1 : IDisposable
|
||||
{
|
||||
private V1Setting v1settings;
|
||||
private GSR.V1Setting v1settings;
|
||||
private ProfilingSampler profiler;
|
||||
|
||||
private static readonly int InputTextureId = Shader.PropertyToID("_InputTexture");
|
||||
private static readonly int ViewportInfoId = Shader.PropertyToID("_ViewportInfo");
|
||||
private static readonly int GSR1ParamsId = Shader.PropertyToID("_GSR1Params");
|
||||
|
||||
public GSRV1(V1Setting v1settings)
|
||||
public GSRV1(GSR.V1Setting v1settings)
|
||||
{
|
||||
this.v1settings = v1settings;
|
||||
profiler = new ProfilingSampler(nameof(GSRV1));
|
||||
@ -206,26 +225,9 @@ namespace X.Rendering.Feature
|
||||
#endregion
|
||||
|
||||
#region GSR2
|
||||
[Serializable]
|
||||
sealed class V2Setting
|
||||
{
|
||||
[SerializeField]
|
||||
public bool UseCompute2Pass = false;
|
||||
[SerializeField]
|
||||
public Material GSRV2Material;
|
||||
[SerializeField]
|
||||
public ComputeShader GSRV2ComputeShader;
|
||||
[SerializeField]
|
||||
public bool FiveSample = false;
|
||||
[SerializeField]
|
||||
public float Exposure_co_rcp = 1;
|
||||
[SerializeField, Range(-5f, 2.5f)]
|
||||
public float MipMapBias = 0;
|
||||
}
|
||||
|
||||
sealed class GSRV2 : IDisposable
|
||||
{
|
||||
private V2Setting v2settings;
|
||||
private GSR.V2Setting v2settings;
|
||||
private static Matrix4x4 prevViewProjMatrix;
|
||||
private static int cameraStillFrameCnt;
|
||||
private ProfilingSampler profiler;
|
||||
@ -248,7 +250,7 @@ namespace X.Rendering.Feature
|
||||
public int sameCameraFrmNum;
|
||||
|
||||
|
||||
public GSRV2(V2Setting v2settings)
|
||||
public GSRV2(GSR.V2Setting v2settings)
|
||||
{
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
#pragma kernel EASUCS
|
||||
// #pragma kernel RCASCS
|
||||
|
||||
#define FSR1_BIND_SRV_INPUT_COLOR 0
|
||||
#define FSR1_BIND_UAV_INTERNAL_UPSCALED_COLOR 0
|
||||
#define FSR1_BIND_UAV_UPSCALED_OUTPUT 1
|
||||
#define FFX_GPU 1
|
||||
|
||||
#define FSR1_BIND_CB_FSR1 0
|
||||
|
||||
#include "fsr1/ffx_fsr1_callbacks_hlsl.h"
|
||||
#include "fsr1/ffx_fsr1_easu.h"
|
||||
|
||||
#ifndef FFX_FSR1_THREAD_GROUP_WIDTH
|
||||
#define FFX_FSR1_THREAD_GROUP_WIDTH 64
|
||||
#endif // #ifndef FFX_FSR1_THREAD_GROUP_WIDTH
|
||||
#ifndef FFX_FSR1_THREAD_GROUP_HEIGHT
|
||||
#define FFX_FSR1_THREAD_GROUP_HEIGHT 1
|
||||
#endif // FFX_FSR1_THREAD_GROUP_HEIGHT
|
||||
#ifndef FFX_FSR1_THREAD_GROUP_DEPTH
|
||||
#define FFX_FSR1_THREAD_GROUP_DEPTH 1
|
||||
#endif // #ifndef FFX_FSR1_THREAD_GROUP_DEPTH
|
||||
#ifndef FFX_FSR1_NUM_THREADS
|
||||
#define FFX_FSR1_NUM_THREADS [numthreads(FFX_FSR1_THREAD_GROUP_WIDTH, FFX_FSR1_THREAD_GROUP_HEIGHT, FFX_FSR1_THREAD_GROUP_DEPTH)]
|
||||
#endif // #ifndef FFX_FSR1_NUM_THREADS
|
||||
|
||||
[WaveSize(64)]
|
||||
FFX_FSR1_NUM_THREADS
|
||||
void EASUCS(uint3 LocalThreadId : SV_GroupThreadID, uint3 WorkGroupId : SV_GroupID, uint3 Dtid : SV_DispatchThreadID)
|
||||
{
|
||||
EASU(LocalThreadId, WorkGroupId, Dtid);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 787b0c165dad9074e9489817de945916
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,29 @@
|
||||
#pragma kernel RCASCS
|
||||
|
||||
#define FSR1_BIND_SRV_INTERNAL_UPSCALED_COLOR 0
|
||||
#define FSR1_BIND_UAV_UPSCALED_OUTPUT 0
|
||||
#define FSR1_BIND_CB_FSR1 0
|
||||
#define FFX_GPU 1
|
||||
|
||||
#include "fsr1/ffx_fsr1_callbacks_hlsl.h"
|
||||
#include "fsr1/ffx_fsr1_rcas.h"
|
||||
|
||||
#ifndef FFX_FSR1_THREAD_GROUP_WIDTH
|
||||
#define FFX_FSR1_THREAD_GROUP_WIDTH 64
|
||||
#endif // #ifndef FFX_FSR1_THREAD_GROUP_WIDTH
|
||||
#ifndef FFX_FSR1_THREAD_GROUP_HEIGHT
|
||||
#define FFX_FSR1_THREAD_GROUP_HEIGHT 1
|
||||
#endif // FFX_FSR1_THREAD_GROUP_HEIGHT
|
||||
#ifndef FFX_FSR1_THREAD_GROUP_DEPTH
|
||||
#define FFX_FSR1_THREAD_GROUP_DEPTH 1
|
||||
#endif // #ifndef FFX_FSR1_THREAD_GROUP_DEPTH
|
||||
#ifndef FFX_FSR1_NUM_THREADS
|
||||
#define FFX_FSR1_NUM_THREADS [numthreads(FFX_FSR1_THREAD_GROUP_WIDTH, FFX_FSR1_THREAD_GROUP_HEIGHT, FFX_FSR1_THREAD_GROUP_DEPTH)]
|
||||
#endif // #ifndef FFX_FSR1_NUM_THREADS
|
||||
|
||||
[WaveSize(64)]
|
||||
FFX_FSR1_NUM_THREADS
|
||||
void RCASCS(uint3 LocalThreadId : SV_GroupThreadID, uint3 WorkGroupId : SV_GroupID, uint3 Dtid : SV_DispatchThreadID)
|
||||
{
|
||||
RCAS(LocalThreadId, WorkGroupId, Dtid);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a50f730ab549f794cbe91f005703e208
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,14 @@
|
||||
// Each #kernel tells which function to compile; you can have many kernels
|
||||
#pragma kernel CSMain
|
||||
|
||||
// Create a RenderTexture with enableRandomWrite flag and set it
|
||||
// with cs.SetTexture
|
||||
RWTexture2D<float4> Result;
|
||||
|
||||
[numthreads(8,8,1)]
|
||||
void CSMain (uint3 id : SV_DispatchThreadID)
|
||||
{
|
||||
// TODO: insert actual code here!
|
||||
|
||||
Result[id.xy] = float4(id.x & id.y, (id.x & 15)/15.0, (id.y & 15)/15.0, 0.0);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b9233ff11584414688b5f10a526ca15
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,14 @@
|
||||
// Each #kernel tells which function to compile; you can have many kernels
|
||||
#pragma kernel CSMain
|
||||
|
||||
// Create a RenderTexture with enableRandomWrite flag and set it
|
||||
// with cs.SetTexture
|
||||
RWTexture2D<float4> Result;
|
||||
|
||||
[numthreads(8,8,1)]
|
||||
void CSMain (uint3 id : SV_DispatchThreadID)
|
||||
{
|
||||
// TODO: insert actual code here!
|
||||
|
||||
Result[id.xy] = float4(id.x & id.y, (id.x & 15)/15.0, (id.y & 15)/15.0, 0.0);
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b79f3a2fdeeac5745b545fc41148f6c3
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,558 @@
|
||||
// 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_COMMON_TYPES_H
|
||||
#define FFX_COMMON_TYPES_H
|
||||
|
||||
#if defined(FFX_CPU)
|
||||
#define FFX_PARAMETER_IN
|
||||
#define FFX_PARAMETER_OUT
|
||||
#define FFX_PARAMETER_INOUT
|
||||
#define FFX_PARAMETER_UNIFORM
|
||||
#elif defined(FFX_HLSL)
|
||||
#define FFX_PARAMETER_IN in
|
||||
#define FFX_PARAMETER_OUT out
|
||||
#define FFX_PARAMETER_INOUT inout
|
||||
#define FFX_PARAMETER_UNIFORM uniform
|
||||
#elif defined(FFX_GLSL)
|
||||
#define FFX_PARAMETER_IN in
|
||||
#define FFX_PARAMETER_OUT out
|
||||
#define FFX_PARAMETER_INOUT inout
|
||||
#define FFX_PARAMETER_UNIFORM const //[cacao_placeholder] until a better fit is found!
|
||||
#endif // #if defined(FFX_CPU)
|
||||
|
||||
#if defined(FFX_CPU)
|
||||
/// A typedef for a boolean value.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef bool FfxBoolean;
|
||||
|
||||
/// A typedef for a unsigned 8bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint8_t FfxUInt8;
|
||||
|
||||
/// A typedef for a unsigned 16bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint16_t FfxUInt16;
|
||||
|
||||
/// A typedef for a unsigned 32bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint32_t FfxUInt32;
|
||||
|
||||
/// A typedef for a unsigned 64bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint64_t FfxUInt64;
|
||||
|
||||
/// A typedef for a signed 8bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int8_t FfxInt8;
|
||||
|
||||
/// A typedef for a signed 16bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int16_t FfxInt16;
|
||||
|
||||
/// A typedef for a signed 32bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int32_t FfxInt32;
|
||||
|
||||
/// A typedef for a signed 64bit integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int64_t FfxInt64;
|
||||
|
||||
/// A typedef for a floating point value.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32;
|
||||
|
||||
/// A typedef for a 2-dimensional floating point value.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32x2[2];
|
||||
|
||||
/// A typedef for a 3-dimensional floating point value.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32x3[3];
|
||||
|
||||
/// A typedef for a 4-dimensional floating point value.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32x4[4];
|
||||
|
||||
/// A typedef for a 2x2 floating point matrix.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32x2x2[4];
|
||||
|
||||
/// A typedef for a 3x3 floating point matrix.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32x3x3[9];
|
||||
|
||||
/// A typedef for a 3x4 floating point matrix.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32x3x4[12];
|
||||
|
||||
/// A typedef for a 4x4 floating point matrix.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef float FfxFloat32x4x4[16];
|
||||
|
||||
/// A typedef for a 2-dimensional 32bit signed integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int32_t FfxInt32x2[2];
|
||||
|
||||
/// A typedef for a 3-dimensional 32bit signed integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int32_t FfxInt32x3[3];
|
||||
|
||||
/// A typedef for a 4-dimensional 32bit signed integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef int32_t FfxInt32x4[4];
|
||||
|
||||
/// A typedef for a 2-dimensional 32bit usigned integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint32_t FfxUInt32x2[2];
|
||||
|
||||
/// A typedef for a 3-dimensional 32bit unsigned integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint32_t FfxUInt32x3[3];
|
||||
|
||||
/// A typedef for a 4-dimensional 32bit unsigned integer.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
typedef uint32_t FfxUInt32x4[4];
|
||||
#endif // #if defined(FFX_CPU)
|
||||
|
||||
#if defined(FFX_HLSL)
|
||||
|
||||
#define FfxFloat32Mat4 matrix <float, 4, 4>
|
||||
#define FfxFloat32Mat3 matrix <float, 3, 3>
|
||||
|
||||
/// A typedef for a boolean value.
|
||||
///
|
||||
/// @ingroup HLSLTypes
|
||||
typedef bool FfxBoolean;
|
||||
|
||||
#if FFX_HLSL_SM>=62
|
||||
|
||||
/// @defgroup HLSL62Types HLSL 6.2 And Above Types
|
||||
/// HLSL 6.2 and above type defines for all commonly used variables
|
||||
///
|
||||
/// @ingroup HLSLTypes
|
||||
|
||||
/// A typedef for a floating point value.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef float32_t FfxFloat32;
|
||||
|
||||
/// A typedef for a 2-dimensional floating point value.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef float32_t2 FfxFloat32x2;
|
||||
|
||||
/// A typedef for a 3-dimensional floating point value.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef float32_t3 FfxFloat32x3;
|
||||
|
||||
/// A typedef for a 4-dimensional floating point value.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef float32_t4 FfxFloat32x4;
|
||||
|
||||
/// A [cacao_placeholder] typedef for matrix type until confirmed.
|
||||
typedef float4x4 FfxFloat32x4x4;
|
||||
typedef float3x4 FfxFloat32x3x4;
|
||||
typedef float3x3 FfxFloat32x3x3;
|
||||
typedef float2x2 FfxFloat32x2x2;
|
||||
|
||||
/// A typedef for a unsigned 32bit integer.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef uint32_t FfxUInt32;
|
||||
|
||||
/// A typedef for a 2-dimensional 32bit unsigned integer.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef uint32_t2 FfxUInt32x2;
|
||||
|
||||
/// A typedef for a 3-dimensional 32bit unsigned integer.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef uint32_t3 FfxUInt32x3;
|
||||
|
||||
/// A typedef for a 4-dimensional 32bit unsigned integer.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef uint32_t4 FfxUInt32x4;
|
||||
|
||||
/// A typedef for a signed 32bit integer.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef int32_t FfxInt32;
|
||||
|
||||
/// A typedef for a 2-dimensional signed 32bit integer.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef int32_t2 FfxInt32x2;
|
||||
|
||||
/// A typedef for a 3-dimensional signed 32bit integer.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef int32_t3 FfxInt32x3;
|
||||
|
||||
/// A typedef for a 4-dimensional signed 32bit integer.
|
||||
///
|
||||
/// @ingroup HLSL62Types
|
||||
typedef int32_t4 FfxInt32x4;
|
||||
|
||||
#else // #if FFX_HLSL_SM>=62
|
||||
|
||||
/// @defgroup HLSLBaseTypes HLSL 6.1 And Below Types
|
||||
/// HLSL 6.1 and below type defines for all commonly used variables
|
||||
///
|
||||
/// @ingroup HLSLTypes
|
||||
|
||||
#define FfxFloat32 float
|
||||
#define FfxFloat32x2 float2
|
||||
#define FfxFloat32x3 float3
|
||||
#define FfxFloat32x4 float4
|
||||
|
||||
/// A [cacao_placeholder] typedef for matrix type until confirmed.
|
||||
#define FfxFloat32x4x4 float4x4
|
||||
#define FfxFloat32x3x4 float3x4
|
||||
#define FfxFloat32x3x3 float3x3
|
||||
#define FfxFloat32x2x2 float2x2
|
||||
|
||||
/// A typedef for a unsigned 32bit integer.
|
||||
///
|
||||
/// @ingroup GPU
|
||||
typedef uint FfxUInt32;
|
||||
typedef uint2 FfxUInt32x2;
|
||||
typedef uint3 FfxUInt32x3;
|
||||
typedef uint4 FfxUInt32x4;
|
||||
|
||||
typedef int FfxInt32;
|
||||
typedef int2 FfxInt32x2;
|
||||
typedef int3 FfxInt32x3;
|
||||
typedef int4 FfxInt32x4;
|
||||
|
||||
#endif // #if FFX_HLSL_SM>=62
|
||||
|
||||
#if FFX_HALF
|
||||
|
||||
#if FFX_HLSL_SM >= 62
|
||||
|
||||
typedef float16_t FfxFloat16;
|
||||
typedef float16_t2 FfxFloat16x2;
|
||||
typedef float16_t3 FfxFloat16x3;
|
||||
typedef float16_t4 FfxFloat16x4;
|
||||
|
||||
/// A typedef for an unsigned 16bit integer.
|
||||
///
|
||||
/// @ingroup HLSLTypes
|
||||
typedef uint16_t FfxUInt16;
|
||||
typedef uint16_t2 FfxUInt16x2;
|
||||
typedef uint16_t3 FfxUInt16x3;
|
||||
typedef uint16_t4 FfxUInt16x4;
|
||||
|
||||
/// A typedef for a signed 16bit integer.
|
||||
///
|
||||
/// @ingroup HLSLTypes
|
||||
typedef int16_t FfxInt16;
|
||||
typedef int16_t2 FfxInt16x2;
|
||||
typedef int16_t3 FfxInt16x3;
|
||||
typedef int16_t4 FfxInt16x4;
|
||||
#else // #if FFX_HLSL_SM>=62
|
||||
typedef min16float FfxFloat16;
|
||||
typedef min16float2 FfxFloat16x2;
|
||||
typedef min16float3 FfxFloat16x3;
|
||||
typedef min16float4 FfxFloat16x4;
|
||||
|
||||
/// A typedef for an unsigned 16bit integer.
|
||||
///
|
||||
/// @ingroup HLSLTypes
|
||||
typedef min16uint FfxUInt16;
|
||||
typedef min16uint2 FfxUInt16x2;
|
||||
typedef min16uint3 FfxUInt16x3;
|
||||
typedef min16uint4 FfxUInt16x4;
|
||||
|
||||
/// A typedef for a signed 16bit integer.
|
||||
///
|
||||
/// @ingroup HLSLTypes
|
||||
typedef min16int FfxInt16;
|
||||
typedef min16int2 FfxInt16x2;
|
||||
typedef min16int3 FfxInt16x3;
|
||||
typedef min16int4 FfxInt16x4;
|
||||
#endif // #if FFX_HLSL_SM>=62
|
||||
|
||||
#endif // FFX_HALF
|
||||
|
||||
#endif // #if defined(FFX_HLSL)
|
||||
|
||||
#if defined(FFX_GLSL)
|
||||
|
||||
#define FfxFloat32Mat4 mat4
|
||||
#define FfxFloat32Mat3 mat3
|
||||
|
||||
/// A typedef for a boolean value.
|
||||
///
|
||||
/// @ingroup GLSLTypes
|
||||
#define FfxBoolean bool
|
||||
#define FfxFloat32 float
|
||||
#define FfxFloat32x2 vec2
|
||||
#define FfxFloat32x3 vec3
|
||||
#define FfxFloat32x4 vec4
|
||||
#define FfxUInt32 uint
|
||||
#define FfxUInt32x2 uvec2
|
||||
#define FfxUInt32x3 uvec3
|
||||
#define FfxUInt32x4 uvec4
|
||||
#define FfxInt32 int
|
||||
#define FfxInt32x2 ivec2
|
||||
#define FfxInt32x3 ivec3
|
||||
#define FfxInt32x4 ivec4
|
||||
|
||||
/// A [cacao_placeholder] typedef for matrix type until confirmed.
|
||||
#define FfxFloat32x4x4 mat4
|
||||
#define FfxFloat32x3x4 mat4x3
|
||||
#define FfxFloat32x3x3 mat3
|
||||
#define FfxFloat32x2x2 mat2
|
||||
|
||||
#if FFX_HALF
|
||||
#define FfxFloat16 float16_t
|
||||
#define FfxFloat16x2 f16vec2
|
||||
#define FfxFloat16x3 f16vec3
|
||||
#define FfxFloat16x4 f16vec4
|
||||
#define FfxUInt16 uint16_t
|
||||
#define FfxUInt16x2 u16vec2
|
||||
#define FfxUInt16x3 u16vec3
|
||||
#define FfxUInt16x4 u16vec4
|
||||
#define FfxInt16 int16_t
|
||||
#define FfxInt16x2 i16vec2
|
||||
#define FfxInt16x3 i16vec3
|
||||
#define FfxInt16x4 i16vec4
|
||||
#endif // FFX_HALF
|
||||
#endif // #if defined(FFX_GLSL)
|
||||
|
||||
// Global toggles:
|
||||
// #define FFX_HALF (1)
|
||||
// #define FFX_HLSL_SM (62)
|
||||
|
||||
#if FFX_HALF
|
||||
|
||||
#if FFX_HLSL_SM >= 62
|
||||
|
||||
#define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType##16_t TypeName;
|
||||
#define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector<BaseComponentType##16_t, COL> TypeName;
|
||||
#define FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix<BaseComponentType##16_t, ROW, COL> TypeName;
|
||||
|
||||
#define FFX_16BIT_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType##16_t TypeName;
|
||||
#define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) typedef vector<BaseComponentType##16_t, COL> TypeName;
|
||||
#define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix<BaseComponentType##16_t, ROW, COL> TypeName;
|
||||
|
||||
#else //FFX_HLSL_SM>=62
|
||||
|
||||
#define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef min16##BaseComponentType TypeName;
|
||||
#define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector<min16##BaseComponentType, COL> TypeName;
|
||||
#define FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix<min16##BaseComponentType, ROW, COL> TypeName;
|
||||
|
||||
#define FFX_16BIT_SCALAR( TypeName, BaseComponentType ) FFX_MIN16_SCALAR( TypeName, BaseComponentType );
|
||||
#define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL );
|
||||
#define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL );
|
||||
|
||||
#endif //FFX_HLSL_SM>=62
|
||||
|
||||
#else //FFX_HALF
|
||||
|
||||
#define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType TypeName;
|
||||
#define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector<BaseComponentType, COL> TypeName;
|
||||
#define FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix<BaseComponentType, ROW, COL> TypeName;
|
||||
|
||||
#define FFX_16BIT_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType TypeName;
|
||||
#define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) typedef vector<BaseComponentType, COL> TypeName;
|
||||
#define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix<BaseComponentType, ROW, COL> TypeName;
|
||||
|
||||
#endif //FFX_HALF
|
||||
|
||||
#if defined(FFX_GPU)
|
||||
// Common typedefs:
|
||||
#if defined(FFX_HLSL)
|
||||
FFX_MIN16_SCALAR( FFX_MIN16_F , float );
|
||||
FFX_MIN16_VECTOR( FFX_MIN16_F2, float, 2 );
|
||||
FFX_MIN16_VECTOR( FFX_MIN16_F3, float, 3 );
|
||||
FFX_MIN16_VECTOR( FFX_MIN16_F4, float, 4 );
|
||||
|
||||
FFX_MIN16_SCALAR( FFX_MIN16_I, int );
|
||||
FFX_MIN16_VECTOR( FFX_MIN16_I2, int, 2 );
|
||||
FFX_MIN16_VECTOR( FFX_MIN16_I3, int, 3 );
|
||||
FFX_MIN16_VECTOR( FFX_MIN16_I4, int, 4 );
|
||||
|
||||
FFX_MIN16_SCALAR( FFX_MIN16_U, uint );
|
||||
FFX_MIN16_VECTOR( FFX_MIN16_U2, uint, 2 );
|
||||
FFX_MIN16_VECTOR( FFX_MIN16_U3, uint, 3 );
|
||||
FFX_MIN16_VECTOR( FFX_MIN16_U4, uint, 4 );
|
||||
|
||||
FFX_16BIT_SCALAR( FFX_F16_t , float );
|
||||
FFX_16BIT_VECTOR( FFX_F16_t2, float, 2 );
|
||||
FFX_16BIT_VECTOR( FFX_F16_t3, float, 3 );
|
||||
FFX_16BIT_VECTOR( FFX_F16_t4, float, 4 );
|
||||
|
||||
FFX_16BIT_SCALAR( FFX_I16_t, int );
|
||||
FFX_16BIT_VECTOR( FFX_I16_t2, int, 2 );
|
||||
FFX_16BIT_VECTOR( FFX_I16_t3, int, 3 );
|
||||
FFX_16BIT_VECTOR( FFX_I16_t4, int, 4 );
|
||||
|
||||
FFX_16BIT_SCALAR( FFX_U16_t, uint );
|
||||
FFX_16BIT_VECTOR( FFX_U16_t2, uint, 2 );
|
||||
FFX_16BIT_VECTOR( FFX_U16_t3, uint, 3 );
|
||||
FFX_16BIT_VECTOR( FFX_U16_t4, uint, 4 );
|
||||
|
||||
#define TYPEDEF_MIN16_TYPES(Prefix) \
|
||||
typedef FFX_MIN16_F Prefix##_F; \
|
||||
typedef FFX_MIN16_F2 Prefix##_F2; \
|
||||
typedef FFX_MIN16_F3 Prefix##_F3; \
|
||||
typedef FFX_MIN16_F4 Prefix##_F4; \
|
||||
typedef FFX_MIN16_I Prefix##_I; \
|
||||
typedef FFX_MIN16_I2 Prefix##_I2; \
|
||||
typedef FFX_MIN16_I3 Prefix##_I3; \
|
||||
typedef FFX_MIN16_I4 Prefix##_I4; \
|
||||
typedef FFX_MIN16_U Prefix##_U; \
|
||||
typedef FFX_MIN16_U2 Prefix##_U2; \
|
||||
typedef FFX_MIN16_U3 Prefix##_U3; \
|
||||
typedef FFX_MIN16_U4 Prefix##_U4;
|
||||
|
||||
#define TYPEDEF_16BIT_TYPES(Prefix) \
|
||||
typedef FFX_16BIT_F Prefix##_F; \
|
||||
typedef FFX_16BIT_F2 Prefix##_F2; \
|
||||
typedef FFX_16BIT_F3 Prefix##_F3; \
|
||||
typedef FFX_16BIT_F4 Prefix##_F4; \
|
||||
typedef FFX_16BIT_I Prefix##_I; \
|
||||
typedef FFX_16BIT_I2 Prefix##_I2; \
|
||||
typedef FFX_16BIT_I3 Prefix##_I3; \
|
||||
typedef FFX_16BIT_I4 Prefix##_I4; \
|
||||
typedef FFX_16BIT_U Prefix##_U; \
|
||||
typedef FFX_16BIT_U2 Prefix##_U2; \
|
||||
typedef FFX_16BIT_U3 Prefix##_U3; \
|
||||
typedef FFX_16BIT_U4 Prefix##_U4;
|
||||
|
||||
#define TYPEDEF_FULL_PRECISION_TYPES(Prefix) \
|
||||
typedef FfxFloat32 Prefix##_F; \
|
||||
typedef FfxFloat32x2 Prefix##_F2; \
|
||||
typedef FfxFloat32x3 Prefix##_F3; \
|
||||
typedef FfxFloat32x4 Prefix##_F4; \
|
||||
typedef FfxInt32 Prefix##_I; \
|
||||
typedef FfxInt32x2 Prefix##_I2; \
|
||||
typedef FfxInt32x3 Prefix##_I3; \
|
||||
typedef FfxInt32x4 Prefix##_I4; \
|
||||
typedef FfxUInt32 Prefix##_U; \
|
||||
typedef FfxUInt32x2 Prefix##_U2; \
|
||||
typedef FfxUInt32x3 Prefix##_U3; \
|
||||
typedef FfxUInt32x4 Prefix##_U4;
|
||||
#endif // #if defined(FFX_HLSL)
|
||||
|
||||
#if defined(FFX_GLSL)
|
||||
|
||||
#if FFX_HALF
|
||||
|
||||
#define FFX_MIN16_F float16_t
|
||||
#define FFX_MIN16_F2 f16vec2
|
||||
#define FFX_MIN16_F3 f16vec3
|
||||
#define FFX_MIN16_F4 f16vec4
|
||||
|
||||
#define FFX_MIN16_I int16_t
|
||||
#define FFX_MIN16_I2 i16vec2
|
||||
#define FFX_MIN16_I3 i16vec3
|
||||
#define FFX_MIN16_I4 i16vec4
|
||||
|
||||
#define FFX_MIN16_U uint16_t
|
||||
#define FFX_MIN16_U2 u16vec2
|
||||
#define FFX_MIN16_U3 u16vec3
|
||||
#define FFX_MIN16_U4 u16vec4
|
||||
|
||||
#define FFX_16BIT_F float16_t
|
||||
#define FFX_16BIT_F2 f16vec2
|
||||
#define FFX_16BIT_F3 f16vec3
|
||||
#define FFX_16BIT_F4 f16vec4
|
||||
|
||||
#define FFX_16BIT_I int16_t
|
||||
#define FFX_16BIT_I2 i16vec2
|
||||
#define FFX_16BIT_I3 i16vec3
|
||||
#define FFX_16BIT_I4 i16vec4
|
||||
|
||||
#define FFX_16BIT_U uint16_t
|
||||
#define FFX_16BIT_U2 u16vec2
|
||||
#define FFX_16BIT_U3 u16vec3
|
||||
#define FFX_16BIT_U4 u16vec4
|
||||
|
||||
#else // FFX_HALF
|
||||
|
||||
#define FFX_MIN16_F float
|
||||
#define FFX_MIN16_F2 vec2
|
||||
#define FFX_MIN16_F3 vec3
|
||||
#define FFX_MIN16_F4 vec4
|
||||
|
||||
#define FFX_MIN16_I int
|
||||
#define FFX_MIN16_I2 ivec2
|
||||
#define FFX_MIN16_I3 ivec3
|
||||
#define FFX_MIN16_I4 ivec4
|
||||
|
||||
#define FFX_MIN16_U uint
|
||||
#define FFX_MIN16_U2 uvec2
|
||||
#define FFX_MIN16_U3 uvec3
|
||||
#define FFX_MIN16_U4 uvec4
|
||||
|
||||
#define FFX_16BIT_F float
|
||||
#define FFX_16BIT_F2 vec2
|
||||
#define FFX_16BIT_F3 vec3
|
||||
#define FFX_16BIT_F4 vec4
|
||||
|
||||
#define FFX_16BIT_I int
|
||||
#define FFX_16BIT_I2 ivec2
|
||||
#define FFX_16BIT_I3 ivec3
|
||||
#define FFX_16BIT_I4 ivec4
|
||||
|
||||
#define FFX_16BIT_U uint
|
||||
#define FFX_16BIT_U2 uvec2
|
||||
#define FFX_16BIT_U3 uvec3
|
||||
#define FFX_16BIT_U4 uvec4
|
||||
|
||||
#endif // FFX_HALF
|
||||
|
||||
#endif // #if defined(FFX_GLSL)
|
||||
|
||||
#endif // #if defined(FFX_GPU)
|
||||
#endif // #ifndef FFX_COMMON_TYPES_H
|
||||
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 760c5fa13b805d240a834996d19dafb3
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,83 @@
|
||||
// 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.
|
||||
|
||||
/// @defgroup FfxGPU GPU
|
||||
/// The FidelityFX SDK GPU References
|
||||
///
|
||||
/// @ingroup ffxSDK
|
||||
|
||||
/// @defgroup FfxHLSL HLSL References
|
||||
/// FidelityFX SDK HLSL GPU References
|
||||
///
|
||||
/// @ingroup FfxGPU
|
||||
|
||||
/// @defgroup FfxGLSL GLSL References
|
||||
/// FidelityFX SDK GLSL GPU References
|
||||
///
|
||||
/// @ingroup FfxGPU
|
||||
|
||||
/// @defgroup FfxGPUEffects FidelityFX GPU References
|
||||
/// FidelityFX Effect GPU Reference Documentation
|
||||
///
|
||||
/// @ingroup FfxGPU
|
||||
|
||||
/// @defgroup GPUCore GPU Core
|
||||
/// GPU defines and functions
|
||||
///
|
||||
/// @ingroup FfxGPU
|
||||
|
||||
#if !defined(FFX_CORE_H)
|
||||
#define FFX_CORE_H
|
||||
|
||||
#define FFX_HLSL
|
||||
#define FFX_GPU
|
||||
|
||||
#ifdef __hlsl_dx_compiler
|
||||
#pragma dxc diagnostic push
|
||||
#pragma dxc diagnostic ignored "-Wambig-lit-shift"
|
||||
#endif //__hlsl_dx_compiler
|
||||
|
||||
#include "ffx_common_types.h"
|
||||
|
||||
#if defined(FFX_CPU)
|
||||
#include "ffx_core_cpu.h"
|
||||
#endif // #if defined(FFX_CPU)
|
||||
|
||||
#if defined(FFX_GLSL) && defined(FFX_GPU)
|
||||
#include "ffx_core_glsl.h"
|
||||
#endif // #if defined(FFX_GLSL) && defined(FFX_GPU)
|
||||
|
||||
#if defined(FFX_HLSL) && defined(FFX_GPU)
|
||||
#include "ffx_core_hlsl.h"
|
||||
#endif // #if defined(FFX_HLSL) && defined(FFX_GPU)
|
||||
|
||||
#if defined(FFX_GPU)
|
||||
#include "ffx_core_gpu_common.h"
|
||||
#include "ffx_core_gpu_common_half.h"
|
||||
#include "ffx_core_portability.h"
|
||||
#endif // #if defined(FFX_GPU)
|
||||
|
||||
#ifdef __hlsl_dx_compiler
|
||||
#pragma dxc diagnostic pop
|
||||
#endif //__hlsl_dx_compiler
|
||||
|
||||
#endif // #if !defined(FFX_CORE_H)
|
||||
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea0017a7ac0ca58409fbdb344448b2b2
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,338 @@
|
||||
// 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.
|
||||
|
||||
/// A define for a true value in a boolean expression.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
#define FFX_TRUE (1)
|
||||
|
||||
/// A define for a false value in a boolean expression.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
#define FFX_FALSE (0)
|
||||
|
||||
#if !defined(FFX_STATIC)
|
||||
/// A define to abstract declaration of static variables and functions.
|
||||
///
|
||||
/// @ingroup CPUTypes
|
||||
#define FFX_STATIC static
|
||||
#endif // #if !defined(FFX_STATIC)
|
||||
|
||||
/// @defgroup CPUCore CPU Core
|
||||
/// Core CPU-side defines and functions
|
||||
///
|
||||
/// @ingroup ffxHost
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
/// Interpret the bit layout of an IEEE-754 floating point value as an unsigned integer.
|
||||
///
|
||||
/// @param [in] x A 32bit floating value.
|
||||
///
|
||||
/// @returns
|
||||
/// An unsigned 32bit integer value containing the bit pattern of <c><i>x</i></c>.
|
||||
///
|
||||
/// @ingroup CPUCore
|
||||
FFX_STATIC FfxUInt32 ffxAsUInt32(FfxFloat32 x)
|
||||
{
|
||||
union
|
||||
{
|
||||
FfxFloat32 f;
|
||||
FfxUInt32 u;
|
||||
} bits;
|
||||
|
||||
bits.f = x;
|
||||
return bits.u;
|
||||
}
|
||||
|
||||
FFX_STATIC FfxFloat32 ffxDot2(FfxFloat32x2 a, FfxFloat32x2 b)
|
||||
{
|
||||
return a[0] * b[0] + a[1] * b[1];
|
||||
}
|
||||
|
||||
FFX_STATIC FfxFloat32 ffxDot3(FfxFloat32x3 a, FfxFloat32x3 b)
|
||||
{
|
||||
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
||||
}
|
||||
|
||||
FFX_STATIC FfxFloat32 ffxDot4(FfxFloat32x4 a, FfxFloat32x4 b)
|
||||
{
|
||||
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
|
||||
}
|
||||
|
||||
/// Compute the linear interopation between two values.
|
||||
///
|
||||
/// Implemented by calling the GLSL <c><i>mix</i></c> instrinsic function. Implements the
|
||||
/// following math:
|
||||
///
|
||||
/// (1 - t) * x + t * y
|
||||
///
|
||||
/// @param [in] x The first value to lerp between.
|
||||
/// @param [in] y The second value to lerp between.
|
||||
/// @param [in] t The value to determine how much of <c><i>x</i></c> and how much of <c><i>y</i></c>.
|
||||
///
|
||||
/// @returns
|
||||
/// A linearly interpolated value between <c><i>x</i></c> and <c><i>y</i></c> according to <c><i>t</i></c>.
|
||||
///
|
||||
/// @ingroup CPUCore
|
||||
FFX_STATIC FfxFloat32 ffxLerp(FfxFloat32 x, FfxFloat32 y, FfxFloat32 t)
|
||||
{
|
||||
return y * t + (-x * t + x);
|
||||
}
|
||||
|
||||
/// Compute the reciprocal of a value.
|
||||
///
|
||||
/// @param [in] x The value to compute the reciprocal for.
|
||||
///
|
||||
/// @returns
|
||||
/// The reciprocal value of <c><i>x</i></c>.
|
||||
///
|
||||
/// @ingroup CPUCore
|
||||
FFX_STATIC FfxFloat32 ffxReciprocal(FfxFloat32 x)
|
||||
{
|
||||
return 1.0f / x;
|
||||
}
|
||||
|
||||
/// Compute the square root of a value.
|
||||
///
|
||||
/// @param [in] x The first value to compute the min of.
|
||||
///
|
||||
/// @returns
|
||||
/// The the square root of <c><i>x</i></c>.
|
||||
///
|
||||
/// @ingroup CPUCore
|
||||
FFX_STATIC FfxFloat32 ffxSqrt(FfxFloat32 x)
|
||||
{
|
||||
return FfxFloat32(sqrt(x));
|
||||
}
|
||||
|
||||
FFX_STATIC FfxUInt32 ffxAShrSU1(FfxUInt32 a, FfxUInt32 b)
|
||||
{
|
||||
return FfxUInt32(FfxInt32(a) >> FfxInt32(b));
|
||||
}
|
||||
|
||||
/// Compute the factional part of a decimal value.
|
||||
///
|
||||
/// This function calculates <c><i>x - floor(x)</i></c>.
|
||||
///
|
||||
/// @param [in] x The value to compute the fractional part from.
|
||||
///
|
||||
/// @returns
|
||||
/// The fractional part of <c><i>x</i></c>.
|
||||
///
|
||||
/// @ingroup CPUCore
|
||||
FFX_STATIC FfxFloat32 ffxFract(FfxFloat32 x)
|
||||
{
|
||||
return x - FfxFloat32(floor(x));
|
||||
}
|
||||
|
||||
/// Compute the reciprocal square root of a value.
|
||||
///
|
||||
/// @param [in] x The value to compute the reciprocal for.
|
||||
///
|
||||
/// @returns
|
||||
/// The reciprocal square root value of <c><i>x</i></c>.
|
||||
///
|
||||
/// @ingroup CPUCore
|
||||
FFX_STATIC FfxFloat32 ffxRsqrt(FfxFloat32 x)
|
||||
{
|
||||
return ffxReciprocal(ffxSqrt(x));
|
||||
}
|
||||
|
||||
FFX_STATIC FfxFloat32 ffxMin(FfxFloat32 x, FfxFloat32 y)
|
||||
{
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
FFX_STATIC FfxUInt32 ffxMin(FfxUInt32 x, FfxUInt32 y)
|
||||
{
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
FFX_STATIC FfxFloat32 ffxMax(FfxFloat32 x, FfxFloat32 y)
|
||||
{
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
FFX_STATIC FfxUInt32 ffxMax(FfxUInt32 x, FfxUInt32 y)
|
||||
{
|
||||
return x > y ? x : y;
|
||||
}
|
||||
|
||||
/// Clamp a value to a [0..1] range.
|
||||
///
|
||||
/// @param [in] x The value to clamp to [0..1] range.
|
||||
///
|
||||
/// @returns
|
||||
/// The clamped version of <c><i>x</i></c>.
|
||||
///
|
||||
/// @ingroup CPUCore
|
||||
FFX_STATIC FfxFloat32 ffxSaturate(FfxFloat32 x)
|
||||
{
|
||||
return ffxMin(1.0f, ffxMax(0.0f, x));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FFX_STATIC void ffxOpAAddOneF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b)
|
||||
{
|
||||
d[0] = a[0] + b;
|
||||
d[1] = a[1] + b;
|
||||
d[2] = a[2] + b;
|
||||
return;
|
||||
}
|
||||
|
||||
FFX_STATIC void ffxOpACpyF3(FfxFloat32x3 d, FfxFloat32x3 a)
|
||||
{
|
||||
d[0] = a[0];
|
||||
d[1] = a[1];
|
||||
d[2] = a[2];
|
||||
return;
|
||||
}
|
||||
|
||||
FFX_STATIC void ffxOpAMulF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32x3 b)
|
||||
{
|
||||
d[0] = a[0] * b[0];
|
||||
d[1] = a[1] * b[1];
|
||||
d[2] = a[2] * b[2];
|
||||
return;
|
||||
}
|
||||
|
||||
FFX_STATIC void ffxOpAMulOneF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b)
|
||||
{
|
||||
d[0] = a[0] * b;
|
||||
d[1] = a[1] * b;
|
||||
d[2] = a[2] * b;
|
||||
return;
|
||||
}
|
||||
|
||||
FFX_STATIC void ffxOpARcpF3(FfxFloat32x3 d, FfxFloat32x3 a)
|
||||
{
|
||||
d[0] = ffxReciprocal(a[0]);
|
||||
d[1] = ffxReciprocal(a[1]);
|
||||
d[2] = ffxReciprocal(a[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
/// Convert FfxFloat32 to half (in lower 16-bits of output).
|
||||
///
|
||||
/// This function implements the same fast technique that is documented here: ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf
|
||||
///
|
||||
/// The function supports denormals.
|
||||
///
|
||||
/// Some conversion rules are to make computations possibly "safer" on the GPU,
|
||||
/// -INF & -NaN -> -65504
|
||||
/// +INF & +NaN -> +65504
|
||||
///
|
||||
/// @param [in] f The 32bit floating point value to convert.
|
||||
///
|
||||
/// @returns
|
||||
/// The closest 16bit floating point value to <c><i>f</i></c>.
|
||||
///
|
||||
/// @ingroup CPUCore
|
||||
FFX_STATIC FfxUInt32 ffxF32ToF16(FfxFloat32 f)
|
||||
{
|
||||
static FfxUInt16 base[512] = {
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400,
|
||||
0x0800, 0x0c00, 0x1000, 0x1400, 0x1800, 0x1c00, 0x2000, 0x2400, 0x2800, 0x2c00, 0x3000, 0x3400, 0x3800, 0x3c00, 0x4000, 0x4400, 0x4800, 0x4c00, 0x5000,
|
||||
0x5400, 0x5800, 0x5c00, 0x6000, 0x6400, 0x6800, 0x6c00, 0x7000, 0x7400, 0x7800, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
|
||||
0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
|
||||
0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
|
||||
0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
|
||||
0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
|
||||
0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff,
|
||||
0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
|
||||
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
|
||||
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
|
||||
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
|
||||
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
|
||||
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8001, 0x8002,
|
||||
0x8004, 0x8008, 0x8010, 0x8020, 0x8040, 0x8080, 0x8100, 0x8200, 0x8400, 0x8800, 0x8c00, 0x9000, 0x9400, 0x9800, 0x9c00, 0xa000, 0xa400, 0xa800, 0xac00,
|
||||
0xb000, 0xb400, 0xb800, 0xbc00, 0xc000, 0xc400, 0xc800, 0xcc00, 0xd000, 0xd400, 0xd800, 0xdc00, 0xe000, 0xe400, 0xe800, 0xec00, 0xf000, 0xf400, 0xf800,
|
||||
0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff,
|
||||
0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff,
|
||||
0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff,
|
||||
0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff,
|
||||
0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff,
|
||||
0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff
|
||||
};
|
||||
|
||||
static FfxUInt8 shift[512] = {
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
|
||||
0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
|
||||
0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
|
||||
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18
|
||||
};
|
||||
|
||||
union
|
||||
{
|
||||
FfxFloat32 f;
|
||||
FfxUInt32 u;
|
||||
} bits;
|
||||
|
||||
bits.f = f;
|
||||
FfxUInt32 u = bits.u;
|
||||
FfxUInt32 i = u >> 23;
|
||||
return (FfxUInt32)(base[i]) + ((u & 0x7fffff) >> shift[i]);
|
||||
}
|
||||
|
||||
/// Pack 2x32-bit floating point values in a single 32bit value.
|
||||
///
|
||||
/// This function first converts each component of <c><i>value</i></c> into their nearest 16-bit floating
|
||||
/// point representation, and then stores the X and Y components in the lower and upper 16 bits of the
|
||||
/// 32bit unsigned integer respectively.
|
||||
///
|
||||
/// @param [in] x A 2-dimensional floating point value to convert and pack.
|
||||
///
|
||||
/// @returns
|
||||
/// A packed 32bit value containing 2 16bit floating point values.
|
||||
///
|
||||
/// @ingroup CPUCore
|
||||
FFX_STATIC FfxUInt32 ffxPackHalf2x16(FfxFloat32x2 x)
|
||||
{
|
||||
return ffxF32ToF16(x[0]) + (ffxF32ToF16(x[1]) << 16);
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21ca63a53d7db7b4fa15d57db61f6129
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1cef7785827878448d5c78f36c70d4b
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba1d1b587566f614886a766a2607565d
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37f23fcc81aaddb4bbaab23496484e92
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17eb39589723b2e4da28b7b868648bb5
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
void ffxOpAAddOneF3(FFX_PARAMETER_OUT FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b)
|
||||
{
|
||||
d = a + ffxBroadcast3(b);
|
||||
}
|
||||
|
||||
void ffxOpACpyF3(FFX_PARAMETER_OUT FfxFloat32x3 d, FfxFloat32x3 a)
|
||||
{
|
||||
d = a;
|
||||
}
|
||||
|
||||
void ffxOpAMulF3(FFX_PARAMETER_OUT FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32x3 b)
|
||||
{
|
||||
d = a * b;
|
||||
}
|
||||
|
||||
void ffxOpAMulOneF3(FFX_PARAMETER_OUT FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b)
|
||||
{
|
||||
d = a * b;
|
||||
}
|
||||
|
||||
void ffxOpARcpF3(FFX_PARAMETER_OUT FfxFloat32x3 d, FfxFloat32x3 a)
|
||||
{
|
||||
d = ffxReciprocal(a);
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44bbc01a8b7e1fd4faf626a0ea016ae3
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4c52ea2f2f803f439c092b6bdc94d6a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26bcd1d17b5c164499ee1a76186f6003
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,257 @@
|
||||
// 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 StoreRCasOutputHx2(FfxInt16x2 iPxPos, FfxFloat16x2 fColorR, FfxFloat16x2 fColorG, FfxFloat16x2 fColorB, FfxFloat16x2 fColorA)
|
||||
{
|
||||
rw_upscaled_output[iPxPos] = FfxFloat32x4(fColorR.x, fColorG.x, fColorB.x, fColorA.x);
|
||||
iPxPos.x += 8;
|
||||
rw_upscaled_output[iPxPos] = FfxFloat32x4(fColorR.y, fColorG.y, fColorB.y, fColorA.y);
|
||||
}
|
||||
#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 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 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, FfxFloat32x4 fColor)
|
||||
{
|
||||
rw_upscaled_output[iPxPos] = fColor;
|
||||
}
|
||||
#endif // defined(FSR1_BIND_UAV_UPSCALED_OUTPUT)
|
||||
|
||||
#endif // FFX_HALF
|
||||
|
||||
#endif // #if defined(FFX_GPU)
|
||||
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb13a977b4e7b034a880c7c287c47240
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -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);
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 103b94b0da79ae4499eed56f12a629aa
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,118 @@
|
||||
// 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_HX2 1
|
||||
FfxFloat16x4 FsrRcasLoadHx2(FfxInt16x2 p)
|
||||
{
|
||||
return LoadRCas_Input(p);
|
||||
}
|
||||
void FsrRcasInputHx2(inout FfxFloat16x2 r,inout FfxFloat16x2 g,inout FfxFloat16x2 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
|
||||
FfxFloat16x2 cr, cg, cb, ca;
|
||||
FsrRcasHx2(cr, cg, cb, ca, pos, RCasConfig());
|
||||
#else
|
||||
FfxFloat16x2 cr, cg, cb;
|
||||
FsrRcasHx2(cr, cg, cb, pos, RCasConfig());
|
||||
#endif // FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
|
||||
|
||||
if (RCasSample().x == 1)
|
||||
{
|
||||
cr *= cr;
|
||||
cg *= cg;
|
||||
cb *= cb;
|
||||
}
|
||||
|
||||
#if FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
|
||||
StoreRCasOutputHx2(FfxInt16x2(pos), cr, cg, cb, ca);
|
||||
#else
|
||||
StoreRCasOutputHx2(FfxInt16x2(pos), cr, cg, cb, FfxFloat16x2(1.0, 1.0));
|
||||
#endif
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
#if FFX_FSR1_OPTION_RCAS_PASSTHROUGH_ALPHA
|
||||
StoreRCasOutput(FfxInt32x2(pos), c);
|
||||
#else
|
||||
StoreRCasOutput(FfxInt32x2(pos), FfxFloat32x4(c, 1.0));
|
||||
#endif
|
||||
|
||||
#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);
|
||||
#if FFX_HALF
|
||||
// packed version process left and right 8x8 tile, in total 16x8 region
|
||||
CurrFilter(FFX_MIN16_U2(gxy));
|
||||
gxy.y += 8u;
|
||||
CurrFilter(FFX_MIN16_U2(gxy));
|
||||
#else
|
||||
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));
|
||||
#endif
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 758ff261fb9bc2f42b55fef5d20633d0
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -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 )
|
||||
@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d5909ec74b2cfa488ecd81feb780bf6
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -140,7 +140,7 @@ namespace UnityEngine.Rendering.Universal
|
||||
{
|
||||
get
|
||||
{
|
||||
#if !UNITY_2022_3_51
|
||||
#if !UNITY_2022_3_51 && !UNITY_2022_3_38
|
||||
bool isMaxVisibleLights16 = GraphicsSettings.HasShaderDefine(BuiltinShaderDefine.SHADER_API_MAX_VISIBLE_LIGHTS_16);
|
||||
if (isMaxVisibleLights16)
|
||||
return k_MaxVisibleAdditionalLightsMobileShaderLevelLessThan45;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"com.unity.burst": {
|
||||
"version": "1.8.18",
|
||||
"version": "1.8.16",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:yousandi.cn,2023:
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &1
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 61
|
||||
@ -21,7 +21,7 @@ MonoBehaviour:
|
||||
m_Registries:
|
||||
- m_Id: main
|
||||
m_Name:
|
||||
m_Url: https://packages.tuanjie.cn
|
||||
m_Url: https://packages.unity.cn
|
||||
m_Scopes: []
|
||||
m_IsDefault: 1
|
||||
m_Capabilities: 7
|
||||
@ -31,6 +31,6 @@ MonoBehaviour:
|
||||
m_RegistryInfoDraft:
|
||||
m_Modified: 0
|
||||
m_ErrorMessage:
|
||||
m_UserModificationsInstanceId: -854
|
||||
m_OriginalInstanceId: -856
|
||||
m_UserModificationsInstanceId: -838
|
||||
m_OriginalInstanceId: -840
|
||||
m_LoadAssets: 0
|
||||
|
||||
@ -1,3 +1,2 @@
|
||||
m_EditorVersion: 2022.3.48t2
|
||||
m_EditorVersionWithRevision: 2022.3.48t2 (635b9f68393f)
|
||||
m_TuanjieEditorVersion: 1.3.5
|
||||
m_EditorVersion: 2022.3.38f1c1
|
||||
m_EditorVersionWithRevision: 2022.3.38f1c1 (b17906c7b2b6)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:yousandi.cn,2023:
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &1
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 61
|
||||
|
||||
@ -12,13 +12,13 @@ EditorUserSettings:
|
||||
value: 01060c075556080e0956597315775b14104e4179282b25662b2c1c31b7b63068
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-2:
|
||||
value: 5b00515154055e035459547042705a44154f1e2c2e2e7f677e7d4567e1b9376d
|
||||
value: 57050d5004060d590f56087046700f4445164c7e7a7824312e7c4e6bb0e1376d
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-3:
|
||||
value: 5a57555407545f0b5e0f5f764277594914161e2b787977692b714e64e4b2363b
|
||||
value: 5b00515154055e035459547042705a44154f1e2c2e2e7f677e7d4567e1b9376d
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-4:
|
||||
value: 57050d5004060d590f56087046700f4445164c7e7a7824312e7c4e6bb0e1376d
|
||||
value: 5a57555407545f0b5e0f5f764277594914161e2b787977692b714e64e4b2363b
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user