change #if DEBUG || GHOST_EDITOR to #if GHOST_EDITOR

This commit is contained in:
2026-05-10 12:01:06 +09:00
parent 2ea3c509b0
commit 7e1db7b908
10 changed files with 28 additions and 24 deletions

View File

@@ -1,8 +1,8 @@
<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>
</PropertyGroup>
</Project>
</Project>

View File

@@ -12,9 +12,13 @@
</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>
<PackageReference Include="Misaki.HighPerformance" Version="1.0.9" />
<PackageReference Include="Misaki.HighPerformance.Jobs" Version="3.1.6" />

View File

@@ -33,7 +33,7 @@ public readonly struct ShaderPropertyFieldInfo
}
}
#if DEBUG || GHOST_EDITOR
#if GHOST_EDITOR
public struct ShaderPropertyInfo
{
public string ShaderName
@@ -71,4 +71,4 @@ public static class ShaderPropertiesRegistry
return s_nameToCode.TryGetValue(name, out info);
}
}
#endif
#endif

View File

@@ -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}");

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.");

View File

@@ -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

View File

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