Clean up code

This commit is contained in:
2026-03-28 20:47:00 +09:00
parent 668e66937b
commit 17588439fa
3 changed files with 21 additions and 30 deletions

View File

@@ -3,6 +3,7 @@ using Ghost.Editor.Models;
using Ghost.Engine;
using Misaki.HighPerformance.LowLevel.Buffer;
using System.Reflection;
using System.Runtime.InteropServices;
namespace Ghost.Editor;
@@ -52,6 +53,23 @@ internal static class ActivationHandler
return arguments;
}
private static void LoadDll()
{
var currentDir = AppContext.BaseDirectory;
var platform = OperatingSystem.IsWindows() ? "win" :
OperatingSystem.IsLinux() ? "linux" :
OperatingSystem.IsMacOS() ? "osx" : "unknown";
var arch = Environment.Is64BitProcess ? "x64" : "x86";
var nativeDllDir = Path.Combine(currentDir, "runtimes", platform + "-" + arch, "native");
if (Directory.Exists(nativeDllDir))
{
foreach (var dll in Directory.EnumerateFiles(nativeDllDir, "*.dll"))
{
NativeLibrary.Load(dll);
}
}
}
public static async Task HandleAsync(LaunchArguments args)
{
var opts = new AllocationManagerInitOpts
@@ -66,7 +84,8 @@ internal static class ActivationHandler
await Task.Run(() =>
{
TypeCache.Init();
App.GetService<EngineCore>();
//LoadDll();
//App.GetService<EngineCore>();
});
// await ((Core.AssetHandle.AssetService)App.GetService<IAssetService>()).Init();

View File

@@ -18,7 +18,7 @@ public sealed partial class EngineCore : IDisposable
public JobScheduler JobScheduler => _jobScheduler;
public RenderSystem RenderSystem => _renderSystem;
internal EngineCore()
public EngineCore()
{
_jobScheduler = new JobScheduler(Environment.ProcessorCount - 2); // We -2 here, one for main thread, one for render thread

View File

@@ -357,34 +357,6 @@ public unsafe partial class TestRenderPipeline : IRenderPipeline
builder.SetColorAttachment(backbuffer, 0);
builder.SetRenderFunc<MeshletDebugPassData>(static (data, ctx)=>
{
//var cmd = ctx.GetCommandBufferUnsafe();
//var (backBufferDesc, err) = ctx.ResourceDatabase.GetResourceDescription(ctx.GetActualResource(data.backbuffer.AsResource()));
//if (err != Error.None)
//{
// return;
//}
//var viewportDesc = new ViewportDesc
//{
// X = 0,
// Y = 0,
// Width = backBufferDesc.TextureDescription.Width,
// Height = backBufferDesc.TextureDescription.Height,
// MinDepth = 0,
// MaxDepth = 1
//};
//var rectDesc = new ScissorRectDesc
//{
// Left = 0,
// Top = 0,
// Right = backBufferDesc.TextureDescription.Width,
// Bottom = backBufferDesc.TextureDescription.Height
//};
//cmd.SetViewport(viewportDesc);
//cmd.SetScissorRect(rectDesc);
ctx.SetGlobalData(data.globalIndex, data.viewIndex);
ctx.SetInstanceData(data.instanceIndex);
ctx.SetActiveMaterial(data.material);