fix gc
This commit is contained in:
parent
b10f60af99
commit
ab5498f47a
@ -47427,6 +47427,10 @@ PrefabInstance:
|
|||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
value: 1
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6968620290940108330, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3}
|
||||||
|
propertyPath: m_Enabled
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7019485897165914674, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3}
|
- target: {fileID: 7019485897165914674, guid: 8e5bed6b8dcfed240a38affefd9c58f6, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: 0
|
value: 0
|
||||||
|
|||||||
@ -84,8 +84,8 @@ public class Test : MonoBehaviour
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", false);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", false);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", 0);
|
SuperResolutionParamSets.Set<float>("MipmapBias", 0);
|
||||||
asset.superResolution = ESuperResolution.None;
|
asset.superResolution = ESuperResolution.None;
|
||||||
dlss.SetActive(false);
|
dlss.SetActive(false);
|
||||||
}
|
}
|
||||||
@ -129,8 +129,8 @@ public class Test : MonoBehaviour
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", false);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", false);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", 0);
|
SuperResolutionParamSets.Set<float>("MipmapBias", 0);
|
||||||
asset.superResolution = ESuperResolution.None;
|
asset.superResolution = ESuperResolution.None;
|
||||||
xess.SetSR(ESuperResolution.None);
|
xess.SetSR(ESuperResolution.None);
|
||||||
}
|
}
|
||||||
@ -199,8 +199,8 @@ public class Test : MonoBehaviour
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", false);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", false);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", 0);
|
SuperResolutionParamSets.Set<float>("MipmapBias", 0);
|
||||||
asset.superResolution = ESuperResolution.None;
|
asset.superResolution = ESuperResolution.None;
|
||||||
hwsr.SetSR(ESuperResolution.None);
|
hwsr.SetSR(ESuperResolution.None);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ MonoBehaviour:
|
|||||||
m_SupportsHDR: 1
|
m_SupportsHDR: 1
|
||||||
m_HDRColorBufferPrecision: 0
|
m_HDRColorBufferPrecision: 0
|
||||||
m_MSAA: 1
|
m_MSAA: 1
|
||||||
m_RenderScale: 0.6666667
|
m_RenderScale: 1
|
||||||
m_UpscalingFilter: 1
|
m_UpscalingFilter: 1
|
||||||
m_FsrOverrideSharpness: 1
|
m_FsrOverrideSharpness: 1
|
||||||
m_FsrSharpness: 1
|
m_FsrSharpness: 1
|
||||||
@ -114,5 +114,5 @@ MonoBehaviour:
|
|||||||
m_PrefilterNativeRenderPass: 1
|
m_PrefilterNativeRenderPass: 1
|
||||||
m_ShaderVariantLogLevel: 0
|
m_ShaderVariantLogLevel: 0
|
||||||
m_ShadowCascades: 0
|
m_ShadowCascades: 0
|
||||||
superResolution: 3
|
superResolution: 5
|
||||||
vrsRate: 0
|
vrsRate: 0
|
||||||
|
|||||||
@ -31,7 +31,6 @@ MonoBehaviour:
|
|||||||
useOptimalSetting: 0
|
useOptimalSetting: 0
|
||||||
sharpness: 0
|
sharpness: 0
|
||||||
preExposure: 0
|
preExposure: 0
|
||||||
mipMapBias: 0
|
|
||||||
--- !u!114 &-7284859345190182597
|
--- !u!114 &-7284859345190182597
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -44,7 +43,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 386e439eeef2849448d91896c74ff1d5, type: 3}
|
m_Script: {fileID: 11500000, guid: 386e439eeef2849448d91896c74ff1d5, type: 3}
|
||||||
m_Name: FSR
|
m_Name: FSR
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Active: 1
|
m_Active: 0
|
||||||
Quality: 1
|
Quality: 1
|
||||||
v1setting:
|
v1setting:
|
||||||
EasuCompute: {fileID: 7200000, guid: 787b0c165dad9074e9489817de945916, type: 3}
|
EasuCompute: {fileID: 7200000, guid: 787b0c165dad9074e9489817de945916, type: 3}
|
||||||
@ -137,17 +136,16 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: a00dddc5b3ea7fe45953ccbd49b58b94, type: 3}
|
m_Script: {fileID: 11500000, guid: a00dddc5b3ea7fe45953ccbd49b58b94, type: 3}
|
||||||
m_Name: GSR
|
m_Name: GSR
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Active: 0
|
m_Active: 1
|
||||||
quality: 3
|
quality: 1
|
||||||
v1settings:
|
v1settings:
|
||||||
EnableEdgeDirection: 1
|
EnableEdgeDirection: 1
|
||||||
Mode: 1
|
Mode: 1
|
||||||
Sharp: 1.68
|
Sharp: 1.68
|
||||||
MipMapBias: -0.35
|
|
||||||
GSRV1Material: {fileID: 2100000, guid: d57e64d5723127243b429034bed82c7d, type: 2}
|
GSRV1Material: {fileID: 2100000, guid: d57e64d5723127243b429034bed82c7d, type: 2}
|
||||||
v2settings:
|
v2settings:
|
||||||
UseCompute2Pass: 1
|
UseCompute2Pass: 0
|
||||||
UseCompute3Pass: 1
|
UseCompute3Pass: 0
|
||||||
GSRV2Material: {fileID: 2100000, guid: faa906817c0647f42a0cec70faeb91c1, type: 2}
|
GSRV2Material: {fileID: 2100000, guid: faa906817c0647f42a0cec70faeb91c1, type: 2}
|
||||||
GSR2psComputeShader: {fileID: 7200000, guid: 9a4e6ff1f9a33fa4ea1e9744e313e2fd, type: 3}
|
GSR2psComputeShader: {fileID: 7200000, guid: 9a4e6ff1f9a33fa4ea1e9744e313e2fd, type: 3}
|
||||||
GSR3psComputeShader: {fileID: 7200000, guid: e1d5384c19bf4498b85b157bf0642a27, type: 3}
|
GSR3psComputeShader: {fileID: 7200000, guid: e1d5384c19bf4498b85b157bf0642a27, type: 3}
|
||||||
@ -404,7 +402,7 @@ MonoBehaviour:
|
|||||||
m_Name: XESS2
|
m_Name: XESS2
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Active: 0
|
m_Active: 0
|
||||||
Quality: 106
|
Quality: 104
|
||||||
--- !u!114 &4395980931634258890
|
--- !u!114 &4395980931634258890
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -302,7 +302,7 @@ namespace UnityEngine.Rendering.Universal
|
|||||||
{
|
{
|
||||||
// Start by pre-fetching all builtin effect settings we need
|
// Start by pre-fetching all builtin effect settings we need
|
||||||
// Some of the color-grading settings are only used in the color grading lut pass
|
// Some of the color-grading settings are only used in the color grading lut pass
|
||||||
SuperResolutionParamSets.Instance.RenderContext = context;
|
SuperResolutionParamSets.RenderContext = context;
|
||||||
var stack = VolumeManager.instance.stack;
|
var stack = VolumeManager.instance.stack;
|
||||||
m_DepthOfField = stack.GetComponent<DepthOfField>();
|
m_DepthOfField = stack.GetComponent<DepthOfField>();
|
||||||
m_MotionBlur = stack.GetComponent<MotionBlur>();
|
m_MotionBlur = stack.GetComponent<MotionBlur>();
|
||||||
|
|||||||
@ -275,7 +275,7 @@ namespace UnityEngine.Rendering.Universal
|
|||||||
float mipBias = Math.Min((float)-Math.Log(cameraWidth / scaledCameraWidth, 2.0f), 0.0f);
|
float mipBias = Math.Min((float)-Math.Log(cameraWidth / scaledCameraWidth, 2.0f), 0.0f);
|
||||||
// Temporal Anti-aliasing can use negative mip bias to increase texture sharpness and new information for the jitter.
|
// Temporal Anti-aliasing can use negative mip bias to increase texture sharpness and new information for the jitter.
|
||||||
float ssMipBias = 0;
|
float ssMipBias = 0;
|
||||||
SuperResolutionParamSets.Instance.Get<float>("MipmapBias", ref ssMipBias);
|
SuperResolutionParamSets.Get<float>("MipmapBias", ref ssMipBias);
|
||||||
float taaMipBias = Math.Min(cameraData.taaSettings.mipBias, ssMipBias);
|
float taaMipBias = Math.Min(cameraData.taaSettings.mipBias, ssMipBias);
|
||||||
mipBias = Math.Min(mipBias, taaMipBias);
|
mipBias = Math.Min(mipBias, taaMipBias);
|
||||||
cmd.SetGlobalVector(ShaderPropertyId.globalMipBias, new Vector2(mipBias, Mathf.Pow(2.0f, mipBias)));
|
cmd.SetGlobalVector(ShaderPropertyId.globalMipBias, new Vector2(mipBias, Mathf.Pow(2.0f, mipBias)));
|
||||||
|
|||||||
@ -164,8 +164,8 @@ namespace X.Rendering.Feature
|
|||||||
//biasColorMask = biasColorMask
|
//biasColorMask = biasColorMask
|
||||||
};
|
};
|
||||||
|
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", true);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", Fsr2.GetMipmapBiasOffset(source.referenceSize.x, (int)outputWidth));
|
SuperResolutionParamSets.Set<float>("MipmapBias", Fsr2.GetMipmapBiasOffset(source.referenceSize.x, (int)outputWidth));
|
||||||
|
|
||||||
var jitter = TemporalAA.CurrentJitter;
|
var jitter = TemporalAA.CurrentJitter;
|
||||||
|
|
||||||
|
|||||||
@ -289,7 +289,7 @@ namespace X.Rendering.Feature
|
|||||||
float inputH = source.referenceSize.y;
|
float inputH = source.referenceSize.y;
|
||||||
float outputW = destination.referenceSize.x;
|
float outputW = destination.referenceSize.x;
|
||||||
float outputH = destination.referenceSize.y;
|
float outputH = destination.referenceSize.y;
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", v1setting.MipMapBias);
|
SuperResolutionParamSets.Set<float>("MipmapBias", v1setting.MipMapBias);
|
||||||
|
|
||||||
// FIXME: vulkan 异常
|
// FIXME: vulkan 异常
|
||||||
cbFsr1Step1[0].const0 = new float4(inputW / outputW, inputH / outputH, 0.5f * inputW / outputW - 0.5f, 0.5f * inputH / outputH - 0.5f);
|
cbFsr1Step1[0].const0 = new float4(inputW / outputW, inputH / outputH, 0.5f * inputW / outputW - 0.5f, 0.5f * inputH / outputH - 0.5f);
|
||||||
@ -410,8 +410,8 @@ namespace X.Rendering.Feature
|
|||||||
dispatchDescription.TransparencyAndComposition = new ResourceView(setting.TransparencyAndCompositionMask);
|
dispatchDescription.TransparencyAndComposition = new ResourceView(setting.TransparencyAndCompositionMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", true);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", mipBias);
|
SuperResolutionParamSets.Set<float>("MipmapBias", mipBias);
|
||||||
var jitter = TemporalAA.CurrentJitter;
|
var jitter = TemporalAA.CurrentJitter;
|
||||||
|
|
||||||
dispatchDescription.Output = new ResourceView(destination.rt);
|
dispatchDescription.Output = new ResourceView(destination.rt);
|
||||||
@ -547,8 +547,8 @@ namespace X.Rendering.Feature
|
|||||||
|
|
||||||
mipBias = Fsr3Upscaler.GetMipmapBiasOffset(scaledRenderSize.x, upscaleSize.x);
|
mipBias = Fsr3Upscaler.GetMipmapBiasOffset(scaledRenderSize.x, upscaleSize.x);
|
||||||
|
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", true);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", mipBias);
|
SuperResolutionParamSets.Set<float>("MipmapBias", mipBias);
|
||||||
var jitter = TemporalAA.CurrentJitter;
|
var jitter = TemporalAA.CurrentJitter;
|
||||||
|
|
||||||
dispatchDescription.Output = new ResourceView(destination.rt);
|
dispatchDescription.Output = new ResourceView(destination.rt);
|
||||||
|
|||||||
@ -197,7 +197,7 @@ namespace X.Rendering.Feature
|
|||||||
{
|
{
|
||||||
v1settings.GSRV1Material.DisableKeyword("UseEdgeDirection");
|
v1settings.GSRV1Material.DisableKeyword("UseEdgeDirection");
|
||||||
}
|
}
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", false);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", false);
|
||||||
|
|
||||||
cmd.SetRenderTarget(destination);
|
cmd.SetRenderTarget(destination);
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ namespace X.Rendering.Feature
|
|||||||
cameraData.imageScalingMode = ImageScalingMode.None;
|
cameraData.imageScalingMode = ImageScalingMode.None;
|
||||||
cameraData.upscalingFilter = ImageUpscalingFilter.None;
|
cameraData.upscalingFilter = ImageUpscalingFilter.None;
|
||||||
|
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", Fsr2.GetMipmapBiasOffset(source.referenceSize.x, cameraData.camera.pixelWidth));
|
SuperResolutionParamSets.Set<float>("MipmapBias", Fsr2.GetMipmapBiasOffset(source.referenceSize.x, cameraData.camera.pixelWidth));
|
||||||
|
|
||||||
cmd.SetGlobalVector(ViewportInfoId, new Vector4(1.0f / pixW, 1.0f / pixH, pixW, pixH));
|
cmd.SetGlobalVector(ViewportInfoId, new Vector4(1.0f / pixW, 1.0f / pixH, pixW, pixH));
|
||||||
cmd.SetGlobalVector(GSR1ParamsId, new Vector4(v1settings.Mode, v1settings.Sharp, 0, 0));
|
cmd.SetGlobalVector(GSR1ParamsId, new Vector4(v1settings.Mode, v1settings.Sharp, 0, 0));
|
||||||
@ -279,7 +279,7 @@ namespace X.Rendering.Feature
|
|||||||
|
|
||||||
private void UpscalePass(CommandBuffer cmdBuffer, RTHandle source, RTHandle destination)
|
private void UpscalePass(CommandBuffer cmdBuffer, RTHandle source, RTHandle destination)
|
||||||
{
|
{
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", true);
|
||||||
var jitter = TemporalAA.CurrentJitter;
|
var jitter = TemporalAA.CurrentJitter;
|
||||||
|
|
||||||
cmdBuffer.SetGlobalTexture("_PrevSceneColorTexture", prevSceneColorTexture1);
|
cmdBuffer.SetGlobalTexture("_PrevSceneColorTexture", prevSceneColorTexture1);
|
||||||
@ -321,7 +321,7 @@ namespace X.Rendering.Feature
|
|||||||
private void DispatchUpscale2ps(CommandBuffer cmdBuffer, RTHandle historyIn, RTHandle historyOut, RTHandle destination)
|
private void DispatchUpscale2ps(CommandBuffer cmdBuffer, RTHandle historyIn, RTHandle historyOut, RTHandle destination)
|
||||||
{
|
{
|
||||||
var compute = v2settings.GSR2psComputeShader;
|
var compute = v2settings.GSR2psComputeShader;
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", true);
|
||||||
var jitter = TemporalAA.CurrentJitter;
|
var jitter = TemporalAA.CurrentJitter;
|
||||||
cmdBuffer.SetComputeTextureParam(compute, 1, "_inputPrevHistoryOutput", historyIn);
|
cmdBuffer.SetComputeTextureParam(compute, 1, "_inputPrevHistoryOutput", historyIn);
|
||||||
cmdBuffer.SetComputeTextureParam(compute, 1, "_inputYCoCgColor", YCoCgColor);
|
cmdBuffer.SetComputeTextureParam(compute, 1, "_inputYCoCgColor", YCoCgColor);
|
||||||
@ -389,7 +389,7 @@ namespace X.Rendering.Feature
|
|||||||
private void DispatchUpscale3ps(CommandBuffer cmdBuffer, RTHandle historyIn, RTHandle historyOut, RTHandle destination)
|
private void DispatchUpscale3ps(CommandBuffer cmdBuffer, RTHandle historyIn, RTHandle historyOut, RTHandle destination)
|
||||||
{
|
{
|
||||||
var compute = v2settings.GSR3psComputeShader;
|
var compute = v2settings.GSR3psComputeShader;
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", true);
|
||||||
var jitter = TemporalAA.CurrentJitter;
|
var jitter = TemporalAA.CurrentJitter;
|
||||||
|
|
||||||
cmdBuffer.SetComputeTextureParam(compute, 2, "UpscaleInYCoCgColor", YCoCgColor);
|
cmdBuffer.SetComputeTextureParam(compute, 2, "UpscaleInYCoCgColor", YCoCgColor);
|
||||||
@ -493,7 +493,7 @@ namespace X.Rendering.Feature
|
|||||||
{
|
{
|
||||||
width = camera.pixelWidth,
|
width = camera.pixelWidth,
|
||||||
height = camera.pixelHeight,
|
height = camera.pixelHeight,
|
||||||
graphicsFormat = useCompute ? GraphicsFormat.R16G16B16A16_SFloat : GraphicsFormat.B10G11R11_UFloatPack32,
|
graphicsFormat = useCompute ? GraphicsFormat.R16G16B16A16_SFloat : source.rt.graphicsFormat,
|
||||||
depthBufferBits = 0,
|
depthBufferBits = 0,
|
||||||
enableRandomWrite = useCompute ? true : false,
|
enableRandomWrite = useCompute ? true : false,
|
||||||
dimension = TextureDimension.Tex2D,
|
dimension = TextureDimension.Tex2D,
|
||||||
@ -503,13 +503,13 @@ namespace X.Rendering.Feature
|
|||||||
{
|
{
|
||||||
width = camera.pixelWidth,
|
width = camera.pixelWidth,
|
||||||
height = camera.pixelHeight,
|
height = camera.pixelHeight,
|
||||||
graphicsFormat = GraphicsFormat.R16G16B16A16_SFloat,
|
graphicsFormat = useCompute ? GraphicsFormat.R16G16B16A16_SFloat : source.rt.graphicsFormat,
|
||||||
depthBufferBits = 0,
|
depthBufferBits = 0,
|
||||||
enableRandomWrite = useCompute ? true : false,
|
enableRandomWrite = useCompute ? true : false,
|
||||||
dimension = TextureDimension.Tex2D,
|
dimension = TextureDimension.Tex2D,
|
||||||
msaaSamples = 1,
|
msaaSamples = 1,
|
||||||
});
|
});
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", Fsr2.GetMipmapBiasOffset(source.referenceSize.x, camera.pixelWidth));
|
SuperResolutionParamSets.Set<float>("MipmapBias", Fsr2.GetMipmapBiasOffset(source.referenceSize.x, camera.pixelWidth));
|
||||||
|
|
||||||
if (useCompute)
|
if (useCompute)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -47,7 +47,7 @@ namespace X.Rendering.Feature
|
|||||||
}
|
}
|
||||||
using var scp = new ProfilingScope(cmd, profiler);
|
using var scp = new ProfilingScope(cmd, profiler);
|
||||||
|
|
||||||
//SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
|
//SuperResolutionParamSets.Set<bool>("NeedJitter", true);
|
||||||
if (superResolution == ESuperResolution.HW_SPATIAL_SR)
|
if (superResolution == ESuperResolution.HW_SPATIAL_SR)
|
||||||
{
|
{
|
||||||
hwSpatialUpScale.DoSR(cmd, source, destination, motionVector, ref renderingData);
|
hwSpatialUpScale.DoSR(cmd, source, destination, motionVector, ref renderingData);
|
||||||
|
|||||||
@ -42,89 +42,30 @@ namespace X.Rendering.Feature
|
|||||||
UltraPerformance,
|
UltraPerformance,
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SuperResolutionParamSets
|
public static class SuperResolutionParamSets
|
||||||
{
|
{
|
||||||
private static SuperResolutionParamSets instance;
|
public static ScriptableRenderContext RenderContext;
|
||||||
public static SuperResolutionParamSets Instance
|
|
||||||
|
internal class ParamSet<T>
|
||||||
{
|
{
|
||||||
get
|
public Dictionary<string, T> paramMap = new();
|
||||||
|
|
||||||
|
private static ParamSet<T> instance;
|
||||||
|
|
||||||
|
public static ParamSet<T> Instance => instance ??= new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Get<T>(string name, ref T value)
|
||||||
|
{
|
||||||
|
if (!ParamSet<T>.Instance.paramMap.TryGetValue(name, out value))
|
||||||
{
|
{
|
||||||
if (instance == null)
|
value = default(T);
|
||||||
{
|
|
||||||
instance = new();
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScriptableRenderContext RenderContext;
|
public static void Set<T>(string name, in T value)
|
||||||
|
|
||||||
Dictionary<string, bool> boolMap = new ();
|
|
||||||
Dictionary<string, int> intMap = new ();
|
|
||||||
Dictionary<string, float> floatMap = new ();
|
|
||||||
Dictionary<string, string> stringMap = new ();
|
|
||||||
|
|
||||||
public void Get<T>(string name, ref T value)
|
|
||||||
{
|
{
|
||||||
switch (value)
|
ParamSet<T>.Instance.paramMap[name] = value;
|
||||||
{
|
|
||||||
case int v:
|
|
||||||
{
|
|
||||||
var map = intMap as Dictionary<string, T>;
|
|
||||||
map.TryGetValue(name, out value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case float v:
|
|
||||||
{
|
|
||||||
var map = floatMap as Dictionary<string, T>;
|
|
||||||
map.TryGetValue(name, out value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case string v:
|
|
||||||
{
|
|
||||||
var map = stringMap as Dictionary<string, T>;
|
|
||||||
map.TryGetValue(name, out value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case bool v:
|
|
||||||
{
|
|
||||||
var map = boolMap as Dictionary<string, T>;
|
|
||||||
map.TryGetValue(name, out value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
throw new ArgumentException($"type err:{typeof(T)}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void Set<T>(string name, in T value)
|
|
||||||
{
|
|
||||||
switch (value)
|
|
||||||
{
|
|
||||||
case int v:
|
|
||||||
{
|
|
||||||
intMap[name] = v;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case float v:
|
|
||||||
{
|
|
||||||
floatMap[name] = v;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case string v:
|
|
||||||
{
|
|
||||||
stringMap[name] = v;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case bool v:
|
|
||||||
{
|
|
||||||
boolMap[name] = v;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
throw new ArgumentException($"type err:{typeof(T)}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -174,10 +174,10 @@ namespace X.Rendering.Feature
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", true);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", MipMapBias);
|
SuperResolutionParamSets.Set<float>("MipmapBias", MipMapBias);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("JitterScale", xess1ConfigParam.JitterScaleX);
|
SuperResolutionParamSets.Set<float>("JitterScale", xess1ConfigParam.JitterScaleX);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("AntiGhosting", antiGhosting);
|
SuperResolutionParamSets.Set<float>("AntiGhosting", antiGhosting);
|
||||||
|
|
||||||
var jitter = TemporalAA.CurrentJitter;
|
var jitter = TemporalAA.CurrentJitter;
|
||||||
|
|
||||||
|
|||||||
@ -110,8 +110,8 @@ namespace X.Rendering.Feature
|
|||||||
lastQuality = Quality;
|
lastQuality = Quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", true);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", mipBias);
|
SuperResolutionParamSets.Set<float>("MipmapBias", mipBias);
|
||||||
|
|
||||||
var jitter = TemporalAA.CurrentJitter;
|
var jitter = TemporalAA.CurrentJitter;
|
||||||
|
|
||||||
@ -179,8 +179,8 @@ namespace X.Rendering.Feature
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", false);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", false);
|
||||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", 0);
|
SuperResolutionParamSets.Set<float>("MipmapBias", 0);
|
||||||
if(xessContext != null && xessContext.context != IntPtr.Zero)
|
if(xessContext != null && xessContext.context != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
XeSS.xessDestroyContext(xessContext);
|
XeSS.xessDestroyContext(xessContext);
|
||||||
|
|||||||
@ -36,7 +36,7 @@ namespace UnityEngine.Rendering.Universal
|
|||||||
if (!hasActive)
|
if (!hasActive)
|
||||||
{
|
{
|
||||||
superResolution = ESuperResolution.None;
|
superResolution = ESuperResolution.None;
|
||||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", false);
|
SuperResolutionParamSets.Set<bool>("NeedJitter", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -302,7 +302,7 @@ namespace UnityEngine.Rendering.Universal
|
|||||||
{
|
{
|
||||||
Matrix4x4 jitterMat = Matrix4x4.identity;
|
Matrix4x4 jitterMat = Matrix4x4.identity;
|
||||||
bool needJitter = false;
|
bool needJitter = false;
|
||||||
SuperResolutionParamSets.Instance.Get<bool>("NeedJitter", ref needJitter);
|
SuperResolutionParamSets.Get<bool>("NeedJitter", ref needJitter);
|
||||||
|
|
||||||
bool isJitter = cameraData.IsTemporalAAEnabled() || needJitter;
|
bool isJitter = cameraData.IsTemporalAAEnabled() || needJitter;
|
||||||
jitter = Vector2.zero;
|
jitter = Vector2.zero;
|
||||||
@ -314,7 +314,7 @@ namespace UnityEngine.Rendering.Universal
|
|||||||
float actualWidth = cameraData.cameraTargetDescriptor.width;
|
float actualWidth = cameraData.cameraTargetDescriptor.width;
|
||||||
float actualHeight = cameraData.cameraTargetDescriptor.height;
|
float actualHeight = cameraData.cameraTargetDescriptor.height;
|
||||||
float srJitterScale = 0;
|
float srJitterScale = 0;
|
||||||
SuperResolutionParamSets.Instance.Get<float>("JitterScale", ref srJitterScale);
|
SuperResolutionParamSets.Get<float>("JitterScale", ref srJitterScale);
|
||||||
float jitterScale = Mathf.Max(cameraData.taaSettings.jitterScale, srJitterScale);
|
float jitterScale = Mathf.Max(cameraData.taaSettings.jitterScale, srJitterScale);
|
||||||
|
|
||||||
jitter = CalculateJitter(taaFrameIndex) * jitterScale;
|
jitter = CalculateJitter(taaFrameIndex) * jitterScale;
|
||||||
@ -342,7 +342,7 @@ namespace UnityEngine.Rendering.Universal
|
|||||||
float jitterX = HaltonSequence.Get((frameIndex & 1023) + 1, 2) - 0.5f;
|
float jitterX = HaltonSequence.Get((frameIndex & 1023) + 1, 2) - 0.5f;
|
||||||
float jitterY = HaltonSequence.Get((frameIndex & 1023) + 1, 3) - 0.5f;
|
float jitterY = HaltonSequence.Get((frameIndex & 1023) + 1, 3) - 0.5f;
|
||||||
float antiGhosting = 0;
|
float antiGhosting = 0;
|
||||||
SuperResolutionParamSets.Instance.Get<float>("AntiGhosting", ref antiGhosting);
|
SuperResolutionParamSets.Get<float>("AntiGhosting", ref antiGhosting);
|
||||||
|
|
||||||
if (antiGhosting > 0.0f)
|
if (antiGhosting > 0.0f)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user