Skip to content

Commit 594f8dc

Browse files
Merge pull request #8184 from Unity-Technologies/internal/master
Internal/master
2 parents a44ef5e + 0389cb9 commit 594f8dc

File tree

1,680 files changed

+322569
-6805
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,680 files changed

+322569
-6805
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,3 +378,7 @@ Editor/Resources/unity[[:space:]]editor[[:space:]]resources filter=lfs diff=lfs
378378

379379
# buginfo tools
380380
/Tools/Unity.BugInfo.Coverage/bin/* filter=lfs diff=lfs merge=lfs -text
381+
382+
# search test cases
383+
/Modules/QuickSearch/Tests/QuickSearch/Assets/Cases/UUM-113048/uum-113048.index filter=lfs diff=lfs merge=lfs -text
384+

Packages/com.unity.render-pipelines.core/Documentation~/Examples/BlitColorAndDepth.shader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Shader "Hidden/Universal/CoreBlitColorAndDepth"
55
#pragma editor_sync_compilation
66
// Core.hlsl for XR dependencies
77
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
8-
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/BlitColorAndDepth.hlsl"
8+
#include_with_pragmas "Packages/com.unity.render-pipelines.core/Runtime/Utilities/BlitColorAndDepth.hlsl"
99
ENDHLSL
1010

1111
SubShader
-98 KB
Binary file not shown.

Packages/com.unity.render-pipelines.core/Documentation~/whats-new-17.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# What's new in SRP Core 17.1 / Unity 6.1
1+
# What's new in SRP Core 17 / Unity 6
2+
3+
**Note:** Starting with 17.2 (Unity 6.2), refer to [What’s new in Unity](xref:um-whats-new) for the latest updates and improvements.
4+
5+
## What's new in SRP Core 17.1 / Unity 6.1
26
The following are the new features and improvements added to the SRP Core package 17.1, embedded Unity 6.1.
37

48
## Added

Packages/com.unity.render-pipelines.high-definition/Editor/Upgraders.meta renamed to Packages/com.unity.render-pipelines.core/Editor-PrivateShared/AssetCallbacks.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
using System;
2+
using System.IO;
3+
using UnityEngine;
4+
5+
namespace UnityEditor.RenderPipelines.Core
6+
{
7+
internal static class AssetCreationUtil
8+
{
9+
/// <summary>
10+
/// Prompts the user to save a new <seealso cref="Shader"/> asset created from the shader template, and creates and <seealso cref="Material"/> with it.
11+
/// </summary>
12+
/// <param name="name">Default material name.</param>
13+
/// <param name="callback">A delegate (callback) that will be invoked with the <see cref="Material"/>.</param>
14+
/// <param name="shaderTemplateAssetPath">Path of the Shader Template file.</param>
15+
internal static void CreateShaderAndMaterial(string name, Action<Material> callback, string shaderTemplateAssetPath)
16+
{
17+
CreateShader(
18+
name,
19+
(shader) =>
20+
{
21+
Material material = new Material(shader);
22+
var path = AssetDatabase.GetAssetPath(shader);
23+
AssetDatabase.CreateAsset(material, Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + ".mat"));
24+
AssetDatabase.SaveAssetIfDirty(material);
25+
AssetDatabase.Refresh(ImportAssetOptions.Default);
26+
callback?.Invoke(material);
27+
},
28+
shaderTemplateAssetPath);
29+
}
30+
31+
/// <summary>
32+
/// Prompts the user to save a new <seealso cref="Material"/> asset created using the <paramref name="shader"/>.
33+
/// </summary>
34+
/// <param name="name">Default material name.</param>
35+
/// <param name="callback">A delegate (callback) that will be invoked with the <see cref="Material"/>.</param>
36+
/// <param name="shader"><seealso cref="Shader"/> to create the new <seealso cref="Material"/> with.</param>
37+
internal static void CreateMaterial(string name, Action<Material> callback, Shader shader)
38+
{
39+
if (shader == null)
40+
{
41+
Debug.LogError($"Null Shader reference. Cannot create Material {name}.");
42+
return;
43+
}
44+
45+
CreateAsset(
46+
name,
47+
(materialPath) =>
48+
{
49+
Material material = new Material(shader);
50+
AssetDatabase.CreateAsset(material, materialPath);
51+
AssetDatabase.SaveAssetIfDirty(material);
52+
AssetDatabase.Refresh(ImportAssetOptions.Default);
53+
callback?.Invoke(material);
54+
},
55+
"mat",
56+
typeof(Material)
57+
);
58+
}
59+
60+
internal static void CreateShader(string name, Action<Shader> callback, string shaderTemplateAssetPath)
61+
{
62+
if (!AssetDatabase.AssetPathExists(shaderTemplateAssetPath))
63+
{
64+
Debug.LogError($"Shader Template File missing at path: {shaderTemplateAssetPath}.");
65+
return;
66+
}
67+
68+
CreateAsset(
69+
name,
70+
(shaderPath) =>
71+
{
72+
string fileName = Path.GetFileNameWithoutExtension(shaderPath);
73+
string templateCode = File.ReadAllText(shaderTemplateAssetPath);
74+
templateCode = templateCode.Replace("#SCRIPTNAME#", fileName);
75+
File.WriteAllText(shaderPath, templateCode);
76+
77+
AssetDatabase.Refresh();
78+
AssetDatabase.ImportAsset(shaderPath);
79+
Shader shader = AssetDatabase.LoadAssetAtPath<Shader>(shaderPath);
80+
81+
callback?.Invoke(shader);
82+
},
83+
"shader",
84+
typeof(Shader)
85+
);
86+
}
87+
88+
static void CreateAsset(string name, Action<string> callback = null, string extension = "asset", Type type = null)
89+
{
90+
AssetCreationCallback assetCreationCallback = ScriptableObject.CreateInstance<AssetCreationCallback>();
91+
assetCreationCallback.callback = callback;
92+
assetCreationCallback.extension = extension;
93+
94+
var icon = AssetPreview.GetMiniTypeThumbnail(type);
95+
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, assetCreationCallback, name, icon, null, false);
96+
}
97+
98+
class AssetCreationCallback : ProjectWindowCallback.EndNameEditAction
99+
{
100+
public Action<string> callback;
101+
public string extension;
102+
103+
public override void Action(int instanceId, string pathName, string resourceFile)
104+
{
105+
string path = AssetDatabase.GenerateUniqueAssetPath(pathName + $".{extension}");
106+
callback?.Invoke(path);
107+
}
108+
}
109+
}
110+
}

Packages/com.unity.render-pipelines.core/Editor-PrivateShared/AssetCallbacks/AssetCreationUtil.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/com.unity.render-pipelines.core/Editor/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
[assembly: InternalsVisibleTo("Unity.RenderPipelines.Core.Editor.Shared")]
44
[assembly: InternalsVisibleTo("Unity.RenderPipelines.Core.Editor.Tests")]
55
[assembly: InternalsVisibleTo("Unity.RenderPipelines.HighDefinition.Editor.Tests")]
6-
[assembly: InternalsVisibleTo("Unity.RenderPipelines.HighDefinition.Editor.Tests")]
6+
[assembly: InternalsVisibleTo("Unity.RenderPipelines.Universal.Editor.Tests")]
77
[assembly: InternalsVisibleTo("Assembly-CSharp-Editor-testable")]
88

Packages/com.unity.render-pipelines.core/Editor/Icons/.buginfo

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
area: SRP Settings
1+
default:
2+
area: SRP Settings
23

34
graphic-tools:
45
when:
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
using System;
2+
using System.Reflection;
3+
using System.Runtime.CompilerServices;
4+
using UnityEditor.LightBaking;
5+
6+
namespace UnityEngine.Rendering
7+
{
8+
partial class AdaptiveProbeVolumes
9+
{
10+
// This class is used to (1) access the internal class UnityEditor.LightBaking.BakePipelineDriver and (2) provide a slightly higher level API.
11+
private sealed class BakePipelineDriver : IDisposable
12+
{
13+
// Keep in sync with the enum BakePipeline::Run::StageName
14+
public enum StageName : int
15+
{
16+
Initialized,
17+
Preprocess,
18+
Bake,
19+
PostProcess,
20+
AdditionalBake,
21+
Done
22+
}
23+
24+
private readonly object _bakePipelineDriver;
25+
private readonly Type _bakePipelineDriverType;
26+
27+
internal BakePipelineDriver()
28+
{
29+
_bakePipelineDriverType = Type.GetType("UnityEditor.LightBaking.BakePipelineDriver, UnityEditor");
30+
bool newed = _bakePipelineDriverType != null;
31+
Debug.Assert(newed, "Unexpected, could not find the type UnityEditor.LightBaking.BakePipelineDriver");
32+
_bakePipelineDriver = newed ? Activator.CreateInstance(_bakePipelineDriverType) : null;
33+
Debug.Assert(_bakePipelineDriver != null, "Unexpected, could not new up a BakePipelineDriver");
34+
}
35+
36+
internal void StartBake(bool enablePatching, ref float progress, ref StageName stage)
37+
{
38+
SetEnableBakedLightmaps(false); // Additional only
39+
SetEnablePatching(enablePatching);
40+
Update(false, true, true, out progress, out stage);
41+
}
42+
43+
internal bool RunInProgress()
44+
{
45+
if (!InvokeMethod(new object[] { }, out object result))
46+
return false;
47+
48+
return result is true;
49+
}
50+
51+
internal void Step(ref float progress, ref StageName stage) =>
52+
Update(true, true, true, out progress, out stage);
53+
54+
private void SetEnableBakedLightmaps(bool enable) =>
55+
InvokeMethod(new object[] { enable }, out _);
56+
57+
private void SetEnablePatching(bool enable) =>
58+
InvokeMethod(new object[] { enable }, out _);
59+
60+
private void Update(bool isOnDemandBakeInProgress, bool isOnDemandBakeAsync, bool shouldBeRunning,
61+
out float progress, out StageName stage)
62+
{
63+
object[] parameters = { isOnDemandBakeInProgress, isOnDemandBakeAsync, shouldBeRunning, -1.0f, -1 };
64+
InvokeMethod(parameters, out _);
65+
progress = (float)parameters[3];
66+
stage = (StageName)parameters[4];
67+
}
68+
69+
public void Dispose() =>
70+
InvokeMethod(new object[] { }, out _);
71+
72+
private bool InvokeMethod(object[] parameters, out object result, [CallerMemberName] string methodName = "")
73+
{
74+
MethodInfo methodInfo = _bakePipelineDriverType.GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
75+
bool gotMethod = methodInfo != null;
76+
Debug.Assert(gotMethod, $"Unexpected, could not find {methodName} on BakePipelineDriver");
77+
if (!gotMethod)
78+
{
79+
result = null;
80+
return false;
81+
}
82+
83+
result = methodInfo.Invoke(_bakePipelineDriver, parameters);
84+
85+
return true;
86+
}
87+
}
88+
}
89+
}

0 commit comments

Comments
 (0)