Skip to content

Commit 062bce0

Browse files
authored
Merge pull request #8262 from Unity-Technologies/internal/6000.4/staging
Mirror Internal/6000.4/staging
2 parents 3e58ebf + 933cfff commit 062bce0

File tree

61 files changed

+1900
-259
lines changed

Some content is hidden

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

61 files changed

+1900
-259
lines changed

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.RenderingLayers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ static AccelStructAdapter BuildAccelerationStructure()
127127
Span<bool> perSubMeshOpaqueness = stackalloc bool[subMeshCount];
128128
perSubMeshOpaqueness.Fill(true);
129129

130-
accelStruct.AddInstance(renderer.component.GetEntityId().GetRawData(), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1);
130+
accelStruct.AddInstance(EntityId.ToULong(renderer.component.GetEntityId()), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1);
131131
}
132132

133133
foreach (var terrain in contributors.terrains)
134134
{
135135
uint mask = GetInstanceMask(terrain.component.shadowCastingMode);
136136
uint materialID = terrain.component.renderingLayerMask; // repurpose the material id as we don't need it here
137-
accelStruct.AddInstance(terrain.component.GetEntityId().GetRawData(), terrain.component, new uint[1] { mask }, new uint[1] { materialID }, new bool[1] { true }, 1);
137+
accelStruct.AddInstance(EntityId.ToULong(terrain.component.GetEntityId()), terrain.component, new uint[1] { mask }, new uint[1] { materialID }, new bool[1] { true }, 1);
138138
}
139139

140140
return accelStruct;

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.SkyOcclusion.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,13 @@ static AccelStructAdapter BuildAccelerationStructure()
223223
Span<bool> perSubMeshOpaqueness = stackalloc bool[subMeshCount];
224224
perSubMeshOpaqueness.Fill(true);
225225

226-
accelStruct.AddInstance(renderer.component.GetEntityId().GetRawData(), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1);
226+
accelStruct.AddInstance(EntityId.ToULong(renderer.component.GetEntityId()), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1);
227227
}
228228

229229
foreach (var terrain in contributors.terrains)
230230
{
231231
uint mask = GetInstanceMask(terrain.component.shadowCastingMode);
232-
accelStruct.AddInstance(terrain.component.GetEntityId().GetRawData(), terrain.component, new uint[1] { mask }, new uint[1] { 0 }, new bool[1] { true }, 1);
232+
accelStruct.AddInstance(EntityId.ToULong(terrain.component.GetEntityId()), terrain.component, new uint[1] { mask }, new uint[1] { 0 }, new bool[1] { true }, 1);
233233
}
234234

235235
return accelStruct;

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Runtime.InteropServices;
44
using Unity.Collections;
5+
using Unity.Collections.LowLevel.Unsafe;
56
using UnityEditor;
67
using UnityEngine.Rendering.UnifiedRayTracing;
78

@@ -149,15 +150,15 @@ static AccelStructAdapter BuildAccelerationStructure(int mask)
149150
Span<bool> perSubMeshOpaqueness = stackalloc bool[subMeshCount];
150151
perSubMeshOpaqueness.Fill(true);
151152

152-
accelStruct.AddInstance(renderer.component.GetEntityId().GetRawData(), renderer.component, maskAndMatDummy, maskAndMatDummy, perSubMeshOpaqueness, 1);
153+
accelStruct.AddInstance(EntityId.ToULong(renderer.component.GetEntityId()), renderer.component, maskAndMatDummy, maskAndMatDummy, perSubMeshOpaqueness, 1);
153154
}
154155

155156
foreach (var terrain in contributors.terrains)
156157
{
157158
int layerMask = 1 << terrain.component.gameObject.layer;
158159
if ((layerMask & mask) == 0)
159160
continue;
160-
accelStruct.AddInstance(terrain.component.GetEntityId().GetRawData(), terrain.component, new uint[1] { 0xFFFFFFFF }, new uint[1] { 0xFFFFFFFF }, new bool[1] { true }, 1);
161+
accelStruct.AddInstance(EntityId.ToULong(terrain.component.GetEntityId()), terrain.component, new uint[1] { 0xFFFFFFFF }, new uint[1] { 0xFFFFFFFF }, new bool[1] { true }, 1);
161162
}
162163

163164
return accelStruct;
@@ -478,8 +479,9 @@ static uint[] GetMaterialIndices(Renderer renderer)
478479
uint[] matIndices = new uint[submeshCount];
479480
for (int i = 0; i < matIndices.Length; ++i)
480481
{
482+
Debug.Assert(UnsafeUtility.SizeOf<EntityId>() == sizeof(int), "If this assert is firing, the size of EntityId has changed. This downcase to uint is unsafe.");
481483
if (i < renderer.sharedMaterials.Length && renderer.sharedMaterials[i] != null)
482-
matIndices[i] = (uint)renderer.sharedMaterials[i].GetEntityId().GetRawData();
484+
matIndices[i] = (uint)EntityId.ToULong(renderer.sharedMaterials[i].GetEntityId());
483485
else
484486
matIndices[i] = 0;
485487
}

Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ VisualElement panelRoot
4848
{
4949
get
5050
{
51-
_panelRoot ??= injectingElement.panel.visualTree;
51+
_panelRoot ??= injectingElement?.panel?.visualTree;
5252
return _panelRoot;
5353
}
5454
}
@@ -82,11 +82,11 @@ VisualElement IPackageManagerExtension.CreateExtensionUI()
8282

8383
void RefreshSampleButtons()
8484
{
85-
if (injectingElement == null || m_PackageInfo == null || m_SampleList == null)
85+
if (injectingElement == null || m_PackageInfo == null || m_SampleList == null || panelRoot == null)
8686
return;
8787

8888
// Call refresh of samples and button injection when switching to the "Samples" tab.
89-
if (samplesButton == null )
89+
if (samplesButton == null)
9090
{
9191
samplesButton = panelRoot.Q<Button>(name: samplesButtonName);
9292
if (samplesButton != null)

Packages/com.unity.render-pipelines.core/Editor/UnifiedRayTracing/CreateUnifiedRTShaderMenuItem.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ namespace UnityEditor.Rendering.UnifiedRayTracing
77
{
88
internal class ShaderTemplates
99
{
10+
internal static readonly Texture2D shaderIcon = EditorGUIUtility.IconContent("d_TextAsset Icon").image as Texture2D;
11+
1012
[MenuItem("Assets/Create/Shader/Unified Ray Tracing Shader", false, 1)]
1113
internal static void CreateNewUnifiedRayTracingShader()
1214
{
1315
var action = ScriptableObject.CreateInstance<DoCreateUnifiedRayTracingShader>();
14-
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(EntityId.None, action, "NewUnifiedRayTracingShader.urtshader", null, null);
16+
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(EntityId.None, action, "NewUnifiedRayTracingShader.urtshader", shaderIcon, null);
1517
}
1618

1719
internal class DoCreateUnifiedRayTracingShader : AssetCreationEndAction

Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ private void Reset()
3232
/// <param name="settings"><see cref="IDebugDisplaySettings"/> to be registered</param>
3333
public void RegisterDebug(IDebugDisplaySettings settings)
3434
{
35-
#if UNITY_EDITOR
36-
if (UnityEditor.BuildPipeline.isBuildingPlayer)
37-
return;
38-
#endif
3935
DebugManager debugManager = DebugManager.instance;
4036
List<IDebugDisplaySettingsPanelDisposable> panels = new List<IDebugDisplaySettingsPanelDisposable>();
4137

Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceCuller.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,7 @@ public unsafe JobHandle CreateCullJobTree(
20272027
{
20282028
EntityId viewEntityId = cc.viewID.GetEntityId();
20292029
indirectContextIndex = m_IndirectStorage.TryAllocateContext(viewEntityId);
2030-
cullingOutput.customCullingResult[0] = (IntPtr)viewEntityId.GetRawData();
2030+
cullingOutput.customCullingResult[0] = (IntPtr)EntityId.ToULong(viewEntityId);
20312031
}
20322032
IndirectBufferLimits indirectBufferLimits = m_IndirectStorage.GetLimits(indirectContextIndex);
20332033
NativeArray<IndirectBufferAllocInfo> indirectBufferAllocInfo = m_IndirectStorage.GetAllocInfoSubArray(indirectContextIndex);

Packages/com.unity.render-pipelines.core/Runtime/Lighting/SurfaceCache/PatchUtil.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ namespace PatchUtil
9999
float2 SphereToSquare(float3 n)
100100
{
101101
n /= (abs(n.x) + abs(n.y) + abs(n.z));
102-
n.xy = n.z >= 0.0 ? n.xy : OctWrap(n.xy);
102+
n.xy = VECTOR_LOGIC_SELECT(n.z >= 0.0, n.xy, OctWrap(n.xy));
103103
n.xy = n.xy * 0.5 + 0.5;
104104
return n.xy;
105105
}
@@ -151,7 +151,7 @@ namespace PatchUtil
151151
uint3 SignedIntegerModulo(int3 x, uint modulus)
152152
{
153153
const uint3 remainder = uint3(abs(x)) % modulus;
154-
return VECTOR_LOGIC_SELECT(x < 0 && remainder != 0, modulus - remainder, remainder);
154+
return VECTOR_LOGIC_SELECT(VECTOR_LOGIC_AND(x < 0, remainder != 0), modulus - remainder, remainder);
155155
}
156156

157157
uint3 ConvertGridSpaceToStorageSpace(uint3 posGridSpace, uint gridSize, int3 cascadeOffset)

Packages/com.unity.render-pipelines.core/Runtime/Lighting/SurfaceCache/VectorLogic.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#ifndef VECTOR_LOGIC
22
#define VECTOR_LOGIC
33

4-
#if defined(XBOX)
4+
#if defined(SHADER_API_GAMECORE)
55
#define USE_HLSL2021_VECTOR_LOGIC_INTRINSICS
66
#endif
77

88
#if defined(USE_HLSL2021_VECTOR_LOGIC_INTRINSICS)
99

1010
#define VECTOR_LOGIC_AND(x, y) and(x, y)
1111
#define VECTOR_LOGIC_OR(x, y) or(x, y)
12-
#define VECTOR_LOGIC_SELECT(condition, trueValue, falseValue) select(condition, trueValue, falseValue)
12+
#define VECTOR_LOGIC_SELECT(condition, trueValue, falseValue) select((condition), (trueValue), (falseValue))
1313

1414
#else
1515

Packages/com.unity.render-pipelines.core/Runtime/PathTracing/PathTracingUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ internal static ulong EntityIDToUlong(EntityId id)
264264
Debug.Assert(UnsafeUtility.SizeOf<EntityId>() == sizeof(int),
265265
"If this assert is firing, the size of EntityId has changed. Remove the intermediate cast to int below, and cast directly to ulong instead.");
266266

267-
return (ulong)(int)id.GetRawData();
267+
return (ulong)(int)EntityId.ToULong(id);
268268
}
269269
}
270270
}

0 commit comments

Comments
 (0)