Skip to content

Commit

Permalink
0.0.1-preview.9 - 2019/03/15
Browse files Browse the repository at this point in the history
@2019.1
  • Loading branch information
ErikMoczi committed Mar 16, 2019
1 parent ffba672 commit 247c297
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 35 deletions.
19 changes: 0 additions & 19 deletions package/Unity.Rendering.Hybrid/InstancedRenderMeshBatchGroup.cs
Expand Up @@ -398,7 +398,6 @@ public unsafe class InstancedRenderMeshBatchGroup

// Our idea of batches. This is indexed by local batch indices.
NativeMultiHashMap<LocalGroupKey, BatchChunkData> m_BatchToChunkMap;
NativeMultiHashMap<LocalGroupKey, RootLodRequirement> m_RootLods;

// Maps from internal to external batch ids
NativeArray<int> m_InternalToExternalIds;
Expand Down Expand Up @@ -457,7 +456,6 @@ public InstancedRenderMeshBatchGroup(EntityManager entityManager, ComponentSyste
m_ComponentSystem = componentSystem;
m_CullingJobDependencyGroup = cullingJobDependencyGroup;
m_BatchToChunkMap = new NativeMultiHashMap<LocalGroupKey, BatchChunkData>(32, Allocator.Persistent);
m_RootLods = new NativeMultiHashMap<LocalGroupKey, RootLodRequirement>(32, Allocator.Persistent);
m_LocalIdPool = new NativeArray<int>(kMaxBatchCount, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
m_Tags = new NativeArray<FrozenRenderSceneTag>(kMaxBatchCount, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
m_ForceLowLOD = new NativeArray<byte>(kMaxBatchCount, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
Expand Down Expand Up @@ -496,7 +494,6 @@ public void Dispose()
m_ExternalToInternalIds.Dispose();
m_InternalToExternalIds.Dispose();
m_BatchRendererGroup.Dispose();
m_RootLods.Dispose();
m_BatchToChunkMap.Dispose();
m_Tags.Dispose();
m_ForceLowLOD.Dispose();
Expand All @@ -517,7 +514,6 @@ public void Clear()
m_ExternalBatchCount = 0;

m_BatchToChunkMap.Clear();
m_RootLods.Clear();

ResetLocalIdPool();
}
Expand Down Expand Up @@ -707,20 +703,6 @@ public unsafe void AddBatch(FrozenRenderSceneTag tag, int rendererSharedComponen

runningOffset += chunk.Count;

// Pick up all root LOD requirements from chunk and track by local batch index for LOD selection preprocessing
{
var rootLodArray = chunk.GetNativeArray(rootLodRequirements);
var chunkIndex = 0;
var rootIndex = 0;
while (chunkIndex < rootLodArray.Length)
{
RootLodRequirement root = rootLodArray[rootIndex];
m_RootLods.Add(localKey, root);
chunkIndex += root.InstanceCount;
rootIndex++;
}
}

var matrixSizeOf = UnsafeUtility.SizeOf<float4x4>();
var localToWorld = chunk.GetNativeArray(localToWorldType);
float4x4* srcMatrices = (float4x4*) localToWorld.GetUnsafeReadOnlyPtr();
Expand Down Expand Up @@ -881,7 +863,6 @@ public void RemoveTag(FrozenRenderSceneTag tag)

var localKey = new LocalGroupKey { Value = i };
m_BatchToChunkMap.Remove(localKey);
m_RootLods.Remove(localKey);

m_ExternalBatchCount--;
}
Expand Down
16 changes: 3 additions & 13 deletions package/Unity.Rendering.Hybrid/LodRequirementsUpdateSystem.cs
Expand Up @@ -80,19 +80,13 @@ public LodRequirement(MeshLODGroupComponent lodGroup, LocalToWorld localToWorld,
[ExecuteAlways]
public class LodRequirementsUpdateSystem : JobComponentSystem
{
ComponentGroup m_MissingWorldMeshRenderBounds;
ComponentGroup m_MissingChunkWorldMeshRenderBounds;

ComponentGroup m_Group;
ComponentGroup m_MissingRootLodRequirement;
ComponentGroup m_MissingLodRequirement;

[BurstCompile]
struct UpdateLodRequirementsJob : IJobParallelFor
struct UpdateLodRequirementsJob : IJobChunk
{
[DeallocateOnJobCompletion]
public NativeArray<ArchetypeChunk> Chunks;

[ReadOnly] public ComponentDataFromEntity<MeshLODGroupComponent> MeshLODGroupComponent;

[ReadOnly] public ArchetypeChunkComponentType<MeshLODComponent> MeshLODComponent;
Expand All @@ -101,11 +95,8 @@ struct UpdateLodRequirementsJob : IJobParallelFor
public ArchetypeChunkComponentType<LodRequirement> LodRequirement;
public ArchetypeChunkComponentType<RootLodRequirement> RootLodRequirement;


public void Execute(int index)
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
{
var chunk = Chunks[index];

//@TODO: Delta change...
var lodRequirement = chunk.GetNativeArray(LodRequirement);
var rootLodRequirement = chunk.GetNativeArray(RootLodRequirement);
Expand Down Expand Up @@ -217,14 +208,13 @@ protected override JobHandle OnUpdate(JobHandle dependency)

var updateLodJob = new UpdateLodRequirementsJob
{
Chunks = m_Group.CreateArchetypeChunkArray(Allocator.TempJob),
MeshLODGroupComponent = GetComponentDataFromEntity<MeshLODGroupComponent>(true),
MeshLODComponent = GetArchetypeChunkComponentType<MeshLODComponent>(true),
LocalToWorldLookup = GetComponentDataFromEntity<LocalToWorld>(true),
LodRequirement = GetArchetypeChunkComponentType<LodRequirement>(),
RootLodRequirement = GetArchetypeChunkComponentType<RootLodRequirement>(),
};
return updateLodJob.Schedule(updateLodJob.Chunks.Length, 1, dependency);
return updateLodJob.Schedule(m_Group, dependency);
}
}
}
2 changes: 1 addition & 1 deletion package/Unity.Rendering.Hybrid/RenderMeshSystemV2.cs
Expand Up @@ -72,7 +72,7 @@ public class RenderMeshSystemV2 : ComponentSystem
NativeList<SubSceneTagOrderVersion> m_LastKnownSubsceneTagVersion;

#if UNITY_EDITOR
EditorRenderData m_DefaultEditorRenderData = new EditorRenderData { SceneCullingMask = UnityEditor.SceneManagement.EditorSceneManager.DefaultSceneCullingMask | (1UL << 59)};
EditorRenderData m_DefaultEditorRenderData = new EditorRenderData { SceneCullingMask = UnityEditor.SceneManagement.EditorSceneManager.DefaultSceneCullingMask };
#else
EditorRenderData m_DefaultEditorRenderData = new EditorRenderData { SceneCullingMask = ~0UL };
#endif
Expand Down
4 changes: 2 additions & 2 deletions package/package.json
Expand Up @@ -2,9 +2,9 @@
"displayName": "Hybrid Renderer",
"name": "com.unity.rendering.hybrid",
"unity": "2019.1",
"version": "0.0.1-preview.8",
"version": "0.0.1-preview.9",
"dependencies": {
"com.unity.entities": "0.0.12-preview.28"
"com.unity.entities": "0.0.12-preview.29"
},
"keywords": [
"entities",
Expand Down
1 change: 1 addition & 0 deletions versions.txt
Expand Up @@ -6,3 +6,4 @@
0.0.1-preview.6
0.0.1-preview.7
0.0.1-preview.8
0.0.1-preview.9

0 comments on commit 247c297

Please sign in to comment.