add xess2
This commit is contained in:
parent
e6105d57f4
commit
f97cace79c
@ -5,7 +5,6 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace AssetDependencyGraph
|
||||
{
|
||||
@ -219,65 +218,6 @@ namespace AssetDependencyGraph
|
||||
}
|
||||
}
|
||||
|
||||
public class UnityDependencyAnalysis1 : IDependencyAnalysis
|
||||
{
|
||||
HashSet<string> processed = new();
|
||||
|
||||
public void Analyze(string path, ConcurrentDictionary<AssetIdentify, AssetNode> result)
|
||||
{
|
||||
if (!processed.Add(path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var dependencyAnalysis = (this as IDependencyAnalysis);
|
||||
|
||||
var kv = dependencyAnalysis.GetOrCreateAssetNode(path, result);
|
||||
var relatePath = path.ToUnityRelatePath();
|
||||
kv.id.Guid = AssetDatabase.AssetPathToGUID(relatePath);
|
||||
var selfNode = kv.node;
|
||||
if (FileExtensionHelper.GetTypeByExtension(Path.GetExtension(path)) is string assetType && assetType != null)
|
||||
{
|
||||
kv.id.AssetType = assetType;
|
||||
selfNode.AssetType = assetType;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (relatePath.EndsWith("Rock_01_Prefab.prefab"))
|
||||
{
|
||||
Console.WriteLine();
|
||||
}
|
||||
Object mainObject = AssetDatabase.LoadMainAssetAtPath(relatePath);
|
||||
if (mainObject != null)
|
||||
{
|
||||
var prefabType = PrefabUtility.GetPrefabAssetType(mainObject);
|
||||
if (prefabType != PrefabAssetType.NotAPrefab)
|
||||
{
|
||||
selfNode.AssetType = prefabType.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
selfNode.AssetType = mainObject.GetType().Name;
|
||||
}
|
||||
kv.id.AssetType = selfNode.AssetType;
|
||||
|
||||
string[] dependencies = AssetDatabase.GetDependencies(relatePath, false);
|
||||
for (int i = 0; i < dependencies.Length; i++)
|
||||
{
|
||||
var dep = dependencies[i].ToUnityRelatePath();
|
||||
var depkv = dependencyAnalysis.GetOrCreateAssetNode(dep, result);
|
||||
depkv.node.Dependent.Add(selfNode.Self);
|
||||
selfNode.Dependencies.Add(depkv.id);
|
||||
Analyze(dep, result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.Debug.LogWarning("unknown type:" + path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class FolderDependencyAnalysis : IDependencyAnalysis
|
||||
{
|
||||
public void Analyze(string path, ConcurrentDictionary<AssetIdentify, AssetNode> result)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -3097,6 +3097,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Tent_01_Prefab
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2302073556517278132, guid: 74aeec6002edd31428364ee5a1c44741, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2970688348012063075, guid: 74aeec6002edd31428364ee5a1c44741, type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 0
|
||||
@ -29052,6 +29056,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: BigRock_01_Prefab (2)
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8354524949365800270, guid: 6d3e30d12bb32d545b4735d5456a5597, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
|
||||
@ -28,7 +28,7 @@ MonoBehaviour:
|
||||
m_SupportsHDR: 1
|
||||
m_HDRColorBufferPrecision: 0
|
||||
m_MSAA: 1
|
||||
m_RenderScale: 1
|
||||
m_RenderScale: 0.6667969
|
||||
m_UpscalingFilter: 0
|
||||
m_FsrOverrideSharpness: 1
|
||||
m_FsrSharpness: 1
|
||||
@ -114,5 +114,5 @@ MonoBehaviour:
|
||||
m_PrefilterNativeRenderPass: 1
|
||||
m_ShaderVariantLogLevel: 0
|
||||
m_ShadowCascades: 0
|
||||
superResolution: 0
|
||||
superResolution: 16
|
||||
vrsRate: 0
|
||||
|
||||
@ -198,7 +198,8 @@ MonoBehaviour:
|
||||
- {fileID: 4395980931634258890}
|
||||
- {fileID: -8043853166483734676}
|
||||
- {fileID: -4454652084718109581}
|
||||
m_RendererFeatureMap: bc3f630842f2e70dd6a559c442a94bfd4529d15534f2d3de228858dca8d12222716523fbf3439fdb7a327b7bff4bdd446ac59dfa966ffa88e5fca93e10ae6e99ca6373cd5da9013d6cff55ca297e5e90737c6cdc87e52dc2
|
||||
- {fileID: 4071882023117421450}
|
||||
m_RendererFeatureMap: bc3f630842f2e70dd6a559c442a94bfd4529d15534f2d3de228858dca8d12222716523fbf3439fdb7a327b7bff4bdd446ac59dfa966ffa88e5fca93e10ae6e99ca6373cd5da9013d6cff55ca297e5e90737c6cdc87e52dc28a7b3653203b8238
|
||||
m_UseNativeRenderPass: 0
|
||||
postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2}
|
||||
shaders:
|
||||
@ -350,6 +351,20 @@ MonoBehaviour:
|
||||
restoreCamera: 1
|
||||
offset: {x: 0, y: 0, z: 0, w: 0}
|
||||
cameraFieldOfView: 60
|
||||
--- !u!114 &4071882023117421450
|
||||
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: beb28c5693a39894e85d538fac962200, type: 3}
|
||||
m_Name: XESS2
|
||||
m_EditorClassIdentifier:
|
||||
m_Active: 1
|
||||
Quality: 104
|
||||
--- !u!114 &4395980931634258890
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -507,6 +507,7 @@ namespace UnityEngine.Rendering.Universal
|
||||
|| asset.SuperResolution == ESuperResolution.DLSS2
|
||||
|| asset.SuperResolution == ESuperResolution.DLSS3
|
||||
|| asset.SuperResolution == ESuperResolution.FSR1
|
||||
|| asset.SuperResolution == ESuperResolution.XESS2
|
||||
)
|
||||
{
|
||||
colorDescriptor.enableRandomWrite = true;
|
||||
|
||||
@ -8,10 +8,18 @@ namespace X.Rendering.Feature
|
||||
{
|
||||
internal class XESS2 : ScriptableRendererFeature, ISuperResolutionFeature
|
||||
{
|
||||
[SerializeField]
|
||||
private XessQuality Quality;
|
||||
|
||||
private ProfilingSampler profiler;
|
||||
private XeSS.xess_context_handle_t xessContext;
|
||||
private bool xessCreated;
|
||||
private bool xessInitialized;
|
||||
private float mipBias = 0.0f;
|
||||
private XessQuality lastQuality;
|
||||
private bool needTurnOnXess = false;
|
||||
private XeSS.xess_2d_t rendererSize;
|
||||
private bool resetHistory = false;
|
||||
|
||||
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
|
||||
{
|
||||
@ -19,6 +27,7 @@ namespace X.Rendering.Feature
|
||||
|
||||
public override void Create()
|
||||
{
|
||||
needTurnOnXess = true;
|
||||
profiler = new ProfilingSampler("Xess2");
|
||||
}
|
||||
|
||||
@ -31,6 +40,7 @@ namespace X.Rendering.Feature
|
||||
}
|
||||
|
||||
XeSS.xess_result_t ret;
|
||||
xessContext = new();
|
||||
if ((ret = XeSS.xessCreateContext(ref xessContext)) != XeSS.xess_result_t.XESS_RESULT_SUCCESS)
|
||||
{
|
||||
xessCreated = false;
|
||||
@ -38,22 +48,140 @@ namespace X.Rendering.Feature
|
||||
Debug.Log("XeSS context create failed:" + ret.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
xessCreated = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void DoSR(CommandBuffer cmd, RTHandle source, RTHandle destination, RTHandle motionVector, ref RenderingData renderingData)
|
||||
{
|
||||
}
|
||||
using var scp = new ProfilingScope(cmd, profiler);
|
||||
var cameraData = renderingData.cameraData;
|
||||
var camera = cameraData.camera;
|
||||
XeSS.xess_result_t ret;
|
||||
if (needTurnOnXess || lastQuality != Quality)
|
||||
{
|
||||
needTurnOnXess = false;
|
||||
InitFeature();
|
||||
XeSS.xess_2d_t displaySize = new()
|
||||
{
|
||||
x = (uint)camera.pixelWidth,
|
||||
y = (uint)camera.pixelHeight
|
||||
};
|
||||
|
||||
if ((ret = XeSS.xessGetInputResolution(xessContext, displaySize, (XeSS.xess_quality_settings_t)Quality, out rendererSize)) != XeSS.xess_result_t.XESS_RESULT_SUCCESS)
|
||||
{
|
||||
xessInitialized = false;
|
||||
Debug.LogWarning("XeSS get input resolution failed:" + ret.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
XeSS.xess_init_params_t initParams = default(XeSS.xess_init_params_t);
|
||||
initParams.outputResolution = displaySize;
|
||||
initParams.qualitySetting = (XeSS.xess_quality_settings_t)Quality;
|
||||
initParams.creationNodeMask = initParams.visibleNodeMask = 0;
|
||||
initParams.initFlags = (uint)XeSS.xess_init_flags_t.XESS_INIT_FLAG_ENABLE_AUTOEXPOSURE;
|
||||
if (SystemInfo.usesReversedZBuffer)
|
||||
{
|
||||
initParams.initFlags |= (uint)XeSS.xess_init_flags_t.XESS_INIT_FLAG_INVERTED_DEPTH;
|
||||
}
|
||||
if (!camera.allowHDR)
|
||||
{
|
||||
initParams.initFlags |= (uint)XeSS.xess_init_flags_t.XESS_INIT_FLAG_LDR_INPUT_COLOR;
|
||||
}
|
||||
|
||||
if ((ret = XeSS.xessInitialize(xessContext, cmd, initParams)) != XeSS.xess_result_t.XESS_RESULT_SUCCESS)
|
||||
{
|
||||
xessInitialized = false;
|
||||
Debug.LogWarning("XeSS initialization failed:" + ret.ToString());
|
||||
return;
|
||||
}
|
||||
xessInitialized = true;
|
||||
mipBias = XeSS.Utility.GetMipmapBiasOffset(rendererSize.x, displaySize.x);
|
||||
//resetHistory = true;
|
||||
}
|
||||
|
||||
if (lastQuality != Quality)
|
||||
{
|
||||
UniversalRenderPipeline.asset.renderScale = GetRenderScale();
|
||||
lastQuality = Quality;
|
||||
}
|
||||
|
||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", true);
|
||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", mipBias);
|
||||
|
||||
var jitter = TemporalAA.CurrentJitter;
|
||||
|
||||
cmd.SetGlobalTexture(XeSSShaderIDs.SrvInputColor, source, RenderTextureSubElement.Color);
|
||||
cmd.SetGlobalTexture(XeSSShaderIDs.SrvInputDepth, renderingData.cameraData.renderer.cameraDepthTargetHandle, RenderTextureSubElement.Depth);
|
||||
cmd.SetGlobalTexture(XeSSShaderIDs.SrvInputMotionVectors, motionVector);
|
||||
cmd.SetGlobalTexture(XeSSShaderIDs.UavUpscaledOutput, destination);
|
||||
|
||||
camera.ResetProjectionMatrix();
|
||||
|
||||
XeSS.xess_execute_params_t executeParams = default(XeSS.xess_execute_params_t);
|
||||
executeParams.colorTexture = source;
|
||||
executeParams.depthTexture = renderingData.cameraData.renderer.cameraDepthTargetHandle;
|
||||
executeParams.velocityTexture = motionVector;
|
||||
executeParams.exposureScaleTexture = null;
|
||||
executeParams.responsivePixelMaskTexture = null;
|
||||
executeParams.outputTexture = destination;
|
||||
executeParams.jitterOffsetX = jitter.x;
|
||||
executeParams.jitterOffsetY = jitter.y;
|
||||
executeParams.exposureScale = 1;
|
||||
executeParams.resetHistory = (uint)(resetHistory ? 1 : 0);
|
||||
resetHistory = false;
|
||||
executeParams.inputWidth = rendererSize.x;
|
||||
executeParams.inputHeight = rendererSize.y;
|
||||
ret = XeSS.xessExecute(xessContext, cmd, executeParams);
|
||||
if (ret != XeSS.xess_result_t.XESS_RESULT_SUCCESS)
|
||||
{
|
||||
Debug.LogWarning("XeSS execute failed:" + ret);
|
||||
}
|
||||
}
|
||||
|
||||
public float GetRenderScale()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
switch (Quality)
|
||||
{
|
||||
case XessQuality.UltraPerformance:
|
||||
return 0.3335938f;
|
||||
case XessQuality.Performance:
|
||||
return 0.4351563f;
|
||||
case XessQuality.Balanced:
|
||||
return 0.5f;
|
||||
case XessQuality.Quality:
|
||||
return 0.5882813f;
|
||||
case XessQuality.UltraQuality:
|
||||
return 0.6667969f;
|
||||
case XessQuality.UltraQualityPlus:
|
||||
return 0.7695313f;
|
||||
case XessQuality.NativeAA:
|
||||
return 1.0f;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(XessQuality));
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSR(ESuperResolution resolution)
|
||||
{
|
||||
switch (resolution)
|
||||
{
|
||||
case ESuperResolution.XESS2:
|
||||
{
|
||||
SetActive(true);
|
||||
needTurnOnXess = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
SetActive(false);
|
||||
SuperResolutionParamSets.Instance.Set<bool>("NeedJitter", false);
|
||||
SuperResolutionParamSets.Instance.Set<float>("MipmapBias", 0);
|
||||
XeSS.xessDestroyContext(xessContext);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,11 +140,6 @@ namespace UnityEngine.Rendering.Universal
|
||||
{
|
||||
get
|
||||
{
|
||||
#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;
|
||||
#endif
|
||||
// Must match: Input.hlsl, MAX_VISIBLE_LIGHTS
|
||||
bool isMobile = GraphicsSettings.HasShaderDefine(BuiltinShaderDefine.SHADER_API_MOBILE);
|
||||
if (isMobile && (SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES2 || (SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3 && Graphics.minOpenGLESVersion <= OpenGLESVersion.OpenGLES30)))
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"com.unity.burst": "1.8.18",
|
||||
"com.unity.cinemachine": "2.10.1",
|
||||
"com.unity.collab-proxy": "2.5.2",
|
||||
"com.unity.ide.rider": "3.0.31",
|
||||
"com.unity.cinemachine": "2.10.3",
|
||||
"com.unity.collab-proxy": "2.6.0",
|
||||
"com.unity.ide.rider": "3.0.34",
|
||||
"com.unity.ide.visualstudio": "2.0.22",
|
||||
"com.unity.ide.vscode": "1.2.5",
|
||||
"com.unity.inputsystem": "1.11.0",
|
||||
"com.unity.inputsystem": "1.11.2",
|
||||
"com.unity.learn.iet-framework": "3.1.3",
|
||||
"com.unity.memoryprofiler": "1.1.1",
|
||||
"com.unity.recorder": "4.0.3",
|
||||
"com.unity.render-pipelines.universal": "14.0.11",
|
||||
"com.unity.splines": "2.6.1",
|
||||
"com.unity.splines": "2.7.2",
|
||||
"com.unity.test-framework": "1.1.33",
|
||||
"com.unity.textmeshpro": "3.0.7",
|
||||
"com.unity.timeline": "1.7.6",
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
"url": "https://packages.unity.cn"
|
||||
},
|
||||
"com.unity.cinemachine": {
|
||||
"version": "2.10.1",
|
||||
"version": "2.10.3",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
@ -20,7 +20,7 @@
|
||||
"url": "https://packages.unity.cn"
|
||||
},
|
||||
"com.unity.collab-proxy": {
|
||||
"version": "2.5.2",
|
||||
"version": "2.6.0",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
@ -41,7 +41,7 @@
|
||||
"url": "https://packages.unity.cn"
|
||||
},
|
||||
"com.unity.ide.rider": {
|
||||
"version": "3.0.31",
|
||||
"version": "3.0.34",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
@ -66,7 +66,7 @@
|
||||
"url": "https://packages.unity.cn"
|
||||
},
|
||||
"com.unity.inputsystem": {
|
||||
"version": "1.11.0",
|
||||
"version": "1.11.2",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
@ -164,13 +164,12 @@
|
||||
}
|
||||
},
|
||||
"com.unity.splines": {
|
||||
"version": "2.6.1",
|
||||
"version": "2.7.2",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.settings-manager": "1.0.3",
|
||||
"com.unity.mathematics": "1.2.1",
|
||||
"com.unity.ugui": "1.0.0"
|
||||
"com.unity.settings-manager": "1.0.3"
|
||||
},
|
||||
"url": "https://packages.unity.cn"
|
||||
},
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 2022.3.51f1c1
|
||||
m_EditorVersionWithRevision: 2022.3.51f1c1 (e9648b0586b8)
|
||||
m_EditorVersion: 2022.3.56f1c1
|
||||
m_EditorVersionWithRevision: 2022.3.56f1c1 (bb6410cfcc53)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user