Update rendering architecture and resource management

Added a new `Ref<T>` struct for reference semantics.
Added the `RenderGraph` system for managing rendering passes.
Added the `RenderTexture` class for encapsulating GPU resources.
Added `GraphicsBuffer` class for effective GPU resource management.
Changed `CommandList` methods from public to internal for visibility control.
Changed `IRenderPass` interface from internal to public for accessibility.
Changed `GetData<T>()` in `ComponentObject.cs` to return `CompRef<T>`.
Changed `GetComponent<T>()` in `EntityManager.cs` to return `CompRef<T>`.
Changed `GetSingleton<T>()` in `World.cs` to use `CompRef<T>`.
Changed `IQueryTypeParameter` to use `CompRef<T>` for consistency.
Changed `QueryItem<T0>` and related structs to use `CompRef<T>`.
Changed `Material` class to support bindless textures.
Changed `Shader` class to support bindless rendering.
Changed `Mesh` class to support bindless vertex and index buffer access.
Updated documentation to reflect the new bindless rendering architecture.
This commit is contained in:
2025-08-01 21:34:48 +09:00
parent 1284bb17de
commit eafbfb2fa1
43 changed files with 3845 additions and 2183 deletions

View File

@@ -10,11 +10,9 @@ namespace Ghost.Graphics.D3D12;
internal unsafe class GraphicsDevice
{
#if DEBUG
private readonly DebugLayer _debugLayer;
#endif
private ComPtr<IDXGIFactory7> _dxgiFactory;
private ComPtr<ID3D12Device14> _device;
private ComPtr<IDXGIAdapter1> _adapter;
private ComPtr<ID3D12CommandQueue> _commandQueue;
private ImmutableArray<Renderer> _initializeQueue;
@@ -27,14 +25,11 @@ internal unsafe class GraphicsDevice
public ConstPtr<ID3D12Device14> NativeDevice => new(_device.Get());
public ConstPtr<IDXGIFactory7> DXGIFactory => new(_dxgiFactory.Get());
public ConstPtr<IDXGIAdapter1> Adapter => new(_adapter.Get());
public ConstPtr<ID3D12CommandQueue> CommandQueue => new(_commandQueue.Get());
public GraphicsDevice()
{
#if DEBUG
_debugLayer = new DebugLayer();
#endif
InitializeDevice();
InitializeCommandQueue();
@@ -67,6 +62,7 @@ internal unsafe class GraphicsDevice
if (D3D12CreateDevice((IUnknown*)adapter.Get(), FeatureLevel.Level_12_0, __uuidof<ID3D12Device14>(), _device.GetVoidAddressOf()).Success)
{
_adapter = adapter.Move();
break;
}
}
@@ -150,9 +146,6 @@ internal unsafe class GraphicsDevice
_device.Reset();
_dxgiFactory.Dispose();
#if DEBUG
_debugLayer.Dispose();
#endif
_disposed = true;
}
}