Skip to content

Commit 74f50ad

Browse files
christopherreddenEvergreen
authored andcommitted
6000.4 Fixing API made public for internal reasons
1 parent 0d0ff18 commit 74f50ad

8 files changed

Lines changed: 16 additions & 14 deletions

File tree

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/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/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
}

Packages/com.unity.render-pipelines.core/Runtime/Textures/RTHandle.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ internal void SetTexture(RenderTargetIdentifier tex)
209209
public ulong GetUniqueID()
210210
{
211211
if (m_RT != null)
212-
return m_RT.GetEntityId().GetRawData();
212+
return EntityId.ToULong(m_RT.GetEntityId());
213213
else if (m_ExternalTexture != null)
214-
return m_ExternalTexture.GetEntityId().GetRawData();
214+
return EntityId.ToULong(m_ExternalTexture.GetEntityId());
215215
else
216216
return (ulong)m_NameID.GetHashCode(); // No instance ID so we return the hash code.
217217
}

Packages/com.unity.render-pipelines.core/Runtime/Textures/Texture2DAtlas.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ public int GetTextureID(Texture texture)
746746
/// <returns>The TextureIdentifier, which stores the EntityId of the texture.</returns>
747747
public TextureIdentifier GetTextureIdentifier(Texture texture)
748748
{
749-
return new TextureIdentifier(texture.GetEntityId().GetRawData());
749+
return new TextureIdentifier(EntityId.ToULong(texture.GetEntityId()));
750750
}
751751

752752

Packages/com.unity.render-pipelines.universal/Runtime/LightCookieManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ private struct LightCookieMapping
8686
if (d == 0)
8787
{
8888
// Sort by texture ID if "undecided" to batch fetches to the same cookie texture.
89-
var ai = alc.GetEntityId().GetRawData();
90-
var bi = blc.GetEntityId().GetRawData();
89+
var ai = EntityId.ToULong(alc.GetEntityId());
90+
var bi = EntityId.ToULong(blc.GetEntityId());
9191
return (int)(ai - bi);
9292
}
9393
return d;

0 commit comments

Comments
 (0)