change #if DEBUG || GHOST_EDITOR to #if GHOST_EDITOR
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug_Editor'">
|
||||
<DefineConstants>$(DefineConstants);DEBUG;GHOST_EDITOR;MHP_ENABLE_SAFETY_CHECKS;</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);DEBUG;GHOST_EDITOR;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release_Editor'">
|
||||
<DefineConstants>$(DefineConstants);GHOST_EDITOR;MHP_ENABLE_SAFETY_CHECKS;</DefineConstants>
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug_Editor'">
|
||||
<DefineConstants>$(DefineConstants);MHP_ENABLE_STACKTRACE</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);MHP_ENABLE_SAFETY_CHECKS;MHP_ENABLE_STACKTRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release_Editor'">
|
||||
<DefineConstants>$(DefineConstants);MHP_ENABLE_SAFETY_CHECKS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -33,7 +33,7 @@ public readonly struct ShaderPropertyFieldInfo
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
public struct ShaderPropertyInfo
|
||||
{
|
||||
public string ShaderName
|
||||
|
||||
@@ -114,7 +114,7 @@ public readonly struct Result<T>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
if (IsFailure)
|
||||
{
|
||||
throw new InvalidOperationException($"Cannot access Value when Result is a failure. {_message}");
|
||||
@@ -176,7 +176,7 @@ public readonly struct Result<T, E>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
if (IsFailure)
|
||||
{
|
||||
throw new InvalidOperationException($"Cannot access Value when Result is a failure. Error: {_error}");
|
||||
@@ -235,7 +235,7 @@ public readonly ref struct RefResult<T, E>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
if (IsFailure)
|
||||
{
|
||||
throw new InvalidOperationException($"Cannot access Value when Result is a failure. Error: {_error}");
|
||||
|
||||
@@ -116,7 +116,7 @@ internal unsafe struct Chunk : IDisposable
|
||||
internal int _count;
|
||||
internal readonly int _capacity;
|
||||
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
// For debugging purpose
|
||||
internal int _worldID;
|
||||
internal int _archetypeID;
|
||||
@@ -363,7 +363,7 @@ internal unsafe struct Archetype : IDisposable
|
||||
|
||||
// Need to allocate a new chunk
|
||||
var newChunk = new Chunk(Chunk.CHUNK_BUFFER_SIZE, _entityCapacity, _layouts.Count, world.Version);
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
newChunk._worldID = _worldID;
|
||||
newChunk._archetypeID = _id;
|
||||
#endif
|
||||
|
||||
@@ -44,7 +44,7 @@ internal static class ComponentRegistry
|
||||
private static readonly Dictionary<IntPtr, int> s_typeHandleToID = new();
|
||||
private static readonly Dictionary<string, int> s_nameToRuntimeID = new();
|
||||
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
internal static readonly Dictionary<int, Type> s_runtimeIDToType = new();
|
||||
#endif
|
||||
|
||||
@@ -83,7 +83,7 @@ internal static class ComponentRegistry
|
||||
|
||||
s_typeHandleToID[typeHandle] = newID;
|
||||
s_nameToRuntimeID[stableName] = newID;
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
s_runtimeIDToType[newID.Value] = typeof(T);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ internal static class ManagedComponentRegistry
|
||||
private static readonly List<ManagedComponentInfo> s_registeredComponents = new();
|
||||
private static readonly Dictionary<IntPtr, int> s_typeHandleToID = new();
|
||||
private static readonly Dictionary<string, int> s_nameToRuntimeID = new();
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
internal static readonly Dictionary<int, Type> s_runtimeIDToType = new();
|
||||
#endif
|
||||
|
||||
@@ -66,7 +66,7 @@ internal static class ManagedComponentRegistry
|
||||
|
||||
s_typeHandleToID[typeHandle] = newID;
|
||||
s_nameToRuntimeID[stableName] = newID;
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
s_runtimeIDToType[newID.Value] = typeof(T);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public partial class World
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static World GetWorldUncheck(Identifier<World> id)
|
||||
{
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
if (id.Value < 0 || id.Value >= s_worlds.Count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(id), "World ID is out of range.");
|
||||
|
||||
@@ -147,10 +147,10 @@ internal unsafe class D3D12DescriptorHeap : IDisposable
|
||||
{
|
||||
for (var index = baseIndex; index < baseIndex + count; index++)
|
||||
{
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
if (!_allocatedDescriptors.IsSet(index))
|
||||
{
|
||||
Debug.WriteLine("Error: Attempted to release an un-allocated descriptor");
|
||||
Logger.Debug("Error: Attempted to release an un-allocated descriptor");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ internal unsafe class D3D12ResourceDatabase : IResourceDatabase
|
||||
|
||||
private UnsafeSlotMap<ResourceRecord> _resources;
|
||||
private UnsafeHashMap<SamplerDesc, Identifier<Sampler>> _samplers;
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
private readonly Dictionary<Handle<GPUResource>, string> _resourceName;
|
||||
#endif
|
||||
|
||||
@@ -129,7 +129,7 @@ internal unsafe class D3D12ResourceDatabase : IResourceDatabase
|
||||
|
||||
_resources = new UnsafeSlotMap<ResourceRecord>(64, AllocationHandle.Persistent, AllocationOption.Clear);
|
||||
_samplers = new UnsafeHashMap<SamplerDesc, Identifier<Sampler>>(32, AllocationHandle.Persistent);
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
_resourceName = new Dictionary<Handle<GPUResource>, string>(64);
|
||||
#endif
|
||||
|
||||
@@ -162,7 +162,7 @@ internal unsafe class D3D12ResourceDatabase : IResourceDatabase
|
||||
var id = _resources.Add(new ResourceRecord(pResource, initialBarrierData, viewGroup, desc), out var generation);
|
||||
var handle = new Handle<GPUResource>(id, generation);
|
||||
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
pResource->SetName(name);
|
||||
@@ -191,7 +191,7 @@ internal unsafe class D3D12ResourceDatabase : IResourceDatabase
|
||||
var id = _resources.Add(new ResourceRecord(allocation, initialBarrierData, resourceDescriptor, desc), out var generation);
|
||||
var handle = new Handle<GPUResource>(id, generation);
|
||||
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
allocation->SetName(name);
|
||||
@@ -293,7 +293,7 @@ internal unsafe class D3D12ResourceDatabase : IResourceDatabase
|
||||
{
|
||||
Logger.DebugAssert(!_disposed);
|
||||
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
if (_resourceName.TryGetValue(handle, out var name))
|
||||
{
|
||||
return name;
|
||||
@@ -316,7 +316,7 @@ internal unsafe class D3D12ResourceDatabase : IResourceDatabase
|
||||
_releaseQueue.Enqueue(entry);
|
||||
_resources.Remove(handle.ID, handle.Generation);
|
||||
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
_resourceName.Remove(handle, out _);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user