Migrate rendering from oop to dod

This commit is contained in:
2025-09-16 20:55:20 +09:00
parent 74bb2ccda5
commit 6a504cefc8
20 changed files with 263 additions and 449 deletions

View File

@@ -22,7 +22,7 @@ public interface ICommandBuffer : IDisposable
/// </summary>
/// <param name="renderTarget">Render target to render into</param>
/// <param name="clearColor">Color to clear the render target with</param>
public void BeginRenderPass(IRenderTarget renderTarget, Color128 clearColor);
public void BeginRenderPass(IRenderTarget renderTarget, Color16 clearColor);
/// <summary>
/// Ends the current render pass

View File

@@ -44,16 +44,4 @@ public interface IResourceAllocator
/// </summary>
/// <param name="handle">Resource handle</param>
public void ReleaseResource(ResourceHandle handle);
}
internal interface IResourceAllocator<T> : IResourceAllocator
where T : unmanaged
{
/// <summary>
/// Get the raw gpu resource pointer from a resource handle
/// </summary>
/// <typeparam name="T">The type of the resource.</typeparam>
/// <param name="handle">Resource handle</param>
/// <returns>Pointer to the resource</returns>
public unsafe T* GetResource(ResourceHandle handle);
}

View File

@@ -0,0 +1,35 @@
using Ghost.Graphics.Data;
namespace Ghost.Graphics.RHI;
public interface IResourceDatabase
{
/// <summary>
/// Get the raw gpu resource pointer from a resource handle
/// </summary>
/// <typeparam name="T">The type of the resource.</typeparam>
/// <param name="handle">Resource handle</param>
/// <returns>Pointer to the resource</returns>
public unsafe T* GetResource<T>(ResourceHandle handle)
where T: unmanaged;
/// <summary>
/// Retrieves the current state of the specified resource.
/// </summary>
/// <param name="handle">The handle that uniquely identifies the resource whose state is to be retrieved. Must not be null.</param>
/// <returns>A ResourceState value representing the current state of the resource associated with the specified handle.</returns>
public ResourceState GetResourceState(ResourceHandle handle);
/// <summary>
/// Sets the state of the specified resource handle to the given value.
/// </summary>
/// <param name="handle">The handle that identifies the resource whose state will be updated. Cannot be null.</param>
/// <param name="state">The new state to assign to the resource represented by <paramref name="handle"/>.</param>
public void SetResourceState(ResourceHandle handle, ResourceState state);
/// <summary>
/// Removes a resource from the database using its handle.
/// </summary>
/// <param name="handle">The handle of the resource to be removed.</param>
public void RemoveResource(ResourceHandle handle);
}