Add Editor configs, refactor test core, DXC test
Added Debug_Editor/Release_Editor configs to all projects and solution. Refactored test utilities into Ghost.TestCore and updated references. Introduced DXCBindingTest for shader compilation. Updated conditional compilation to use GHOST_EDITOR. Improved platform mappings and performed minor code cleanup.
This commit is contained in:
@@ -5,15 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>$(DefineConstants);MHP_ENABLE_SAFETY_CHECKS;MHP_ENABLE_MIMALLOC;MHP_FASTMATH</DefineConstants>
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<IsTrimmable>True</IsTrimmable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<Configurations>Debug;Release;Debug_Editor;Release_Editor</Configurations>
|
||||
<DefineConstants>$(DefineConstants);MHP_ENABLE_MIMALLOC;MHP_FASTMATH</DefineConstants>
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<IsTrimmable>True</IsTrimmable>
|
||||
|
||||
@@ -123,22 +123,19 @@ public unsafe partial struct TempJobAllocator : IAllocator
|
||||
#endif
|
||||
}
|
||||
|
||||
public int AdvanceFrame()
|
||||
public void AdvanceFrame()
|
||||
{
|
||||
var allocations = Interlocked.Exchange(ref _allocationsPerFrame[_currentFrameIndex], 0);
|
||||
|
||||
_currentFrameCount++;
|
||||
_currentFrameIndex = _currentFrameCount % _FRAME_LATENCY;
|
||||
|
||||
(_pArena + _currentFrameIndex)->Reset();
|
||||
|
||||
#if MHP_ENABLE_SAFETY_CHECKS
|
||||
if (_allocationsPerFrame[_currentFrameIndex] != 0)
|
||||
var allocations = Interlocked.Exchange(ref _allocationsPerFrame[_currentFrameIndex], 0);
|
||||
if (allocations != 0)
|
||||
{
|
||||
Logger.Error($"TempJobAllocator: Detected {_allocationsPerFrame[_currentFrameIndex]} leaked allocations from frame {_currentFrameCount - _FRAME_LATENCY}.");
|
||||
Logger.Error($"TempJobAllocator: Detected {allocations} leaked allocations from frame {_currentFrameCount - _FRAME_LATENCY}.");
|
||||
}
|
||||
#endif
|
||||
|
||||
return allocations;
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<IsTrimmable>True</IsTrimmable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<Configurations>Debug;Release;Debug_Editor;Release_Editor</Configurations>
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<IsTrimmable>True</IsTrimmable>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<Configurations>Debug;Release;Debug_Editor;Release_Editor</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
|
||||
@@ -86,15 +86,18 @@ internal class AssetHandlerRegistrationGenerator : IIncrementalGenerator
|
||||
var registerTypeName = "g_assethandler_registeration";
|
||||
var code = $@"// <auto-generated />
|
||||
|
||||
#if GHOST_EDITOR
|
||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal static partial class {registerTypeName}
|
||||
{{
|
||||
|
||||
[global::System.Runtime.CompilerServices.ModuleInitializer]
|
||||
internal static void RegisterAssetHandlers()
|
||||
{{
|
||||
{sb}
|
||||
}}
|
||||
}}";
|
||||
}}
|
||||
#endif";
|
||||
|
||||
context.AddSource($"{registerTypeName}.gen.cs", code);
|
||||
}
|
||||
@@ -156,6 +159,7 @@ internal class IAssetSettingsRegistrationGenerator : IIncrementalGenerator
|
||||
var registerTypeName = "g_iassetsettings_registeration";
|
||||
var code = $@"// <auto-generated />
|
||||
|
||||
#if GHOST_EDITOR
|
||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal static partial class {registerTypeName}
|
||||
{{
|
||||
@@ -164,7 +168,8 @@ internal static partial class {registerTypeName}
|
||||
{{
|
||||
{sb}
|
||||
}}
|
||||
}}";
|
||||
}}
|
||||
#endif";
|
||||
|
||||
context.AddSource($"{registerTypeName}.gen.cs", code);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<LangVersion>14.0</LangVersion>
|
||||
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
|
||||
<Configurations>Debug;Release;Debug_Editor;Release_Editor</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace {info.TypeSymbol.ContainingNamespace.ToDisplayString()}
|
||||
[global::System.Runtime.InteropServices.StructLayout(global::System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 4)]
|
||||
{info.TypeSymbol.DeclaredAccessibility.ToString().ToLower()} partial struct {info.TypeSymbol.Name}
|
||||
{{
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
#if GHOST_EDITOR
|
||||
public const string HLSL_SOURCE = @""
|
||||
# ifndef {definedSymbol}
|
||||
# define {definedSymbol}
|
||||
@@ -199,17 +199,17 @@ struct {info.Name}
|
||||
var registerTypeName = "g_shaderproperty_registeration";
|
||||
var registerCode = $@"// <auto-generated/>
|
||||
|
||||
#if GHOST_EDITOR
|
||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal static partial class {registerTypeName}
|
||||
{{
|
||||
#if DEBUG || GHOST_EDITOR
|
||||
[global::System.Runtime.CompilerServices.ModuleInitializer]
|
||||
internal unsafe static void RegisterShaderProperties()
|
||||
{{
|
||||
{registerBuilder}
|
||||
}}
|
||||
#endif
|
||||
}}";
|
||||
}}
|
||||
#endif";
|
||||
|
||||
context.AddSource($"{registerTypeName}.gen.cs", registerCode);
|
||||
}
|
||||
|
||||
@@ -6,14 +6,9 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<PublishAot>true</PublishAot>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<Configurations>Debug;Release;Debug_Editor;Release_Editor</Configurations>
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<IsTrimmable>True</IsTrimmable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,14 +5,9 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<Configurations>Debug;Release;Debug_Editor;Release_Editor</Configurations>
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<IsTrimmable>True</IsTrimmable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,16 +5,17 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<Configurations>Debug;Release;Debug_Editor;Release_Editor</Configurations>
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<IsTrimmable>True</IsTrimmable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>embedded</DebugType>
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<IsTrimmable>True</IsTrimmable>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Editor|AnyCPU'">
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user