forked from Misaki/GhostEngine
Refactoring Rendering backend
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Ghost.Core;
|
||||
using Ghost.Graphics.Data;
|
||||
|
||||
namespace Ghost.Graphics.RenderGraphModule;
|
||||
@@ -122,7 +123,7 @@ public sealed class RenderGraph : IDisposable
|
||||
/// <summary>
|
||||
/// Import an external texture (e.g., from previous frame, swap chain)
|
||||
/// </summary>
|
||||
public RGTextureHandle ImportTexture(string name, TextureHandle externalHandle, TextureDescription description)
|
||||
public RGTextureHandle ImportTexture(string name, Handle<Texture> externalHandle, TextureDescription description)
|
||||
{
|
||||
var texture = new RenderGraphTexture(_resources.Count, name, externalHandle, description);
|
||||
|
||||
@@ -133,7 +134,7 @@ public sealed class RenderGraph : IDisposable
|
||||
/// <summary>
|
||||
/// Import an external buffer (e.g., from previous frame)
|
||||
/// </summary>
|
||||
public RGBufferHandle ImportBuffer(string name, BufferHandle externalHandle, BufferDescription description)
|
||||
public RGBufferHandle ImportBuffer(string name, Handle<GraphicsBuffer> externalHandle, BufferDescription description)
|
||||
{
|
||||
var buffer = new RenderGraphBuffer(_resources.Count, name, externalHandle, description);
|
||||
|
||||
@@ -144,7 +145,7 @@ public sealed class RenderGraph : IDisposable
|
||||
/// <summary>
|
||||
/// Export a resource for use in the next frame (for history buffers)
|
||||
/// </summary>
|
||||
public TextureHandle ExportTexture(RGTextureHandle handle)
|
||||
public Handle<Texture> ExportTexture(RGTextureHandle handle)
|
||||
{
|
||||
if (!handle.IsValid || handle._resourceId >= _resources.Count)
|
||||
throw new ArgumentException("Invalid texture handle", nameof(handle));
|
||||
@@ -157,7 +158,7 @@ public sealed class RenderGraph : IDisposable
|
||||
/// <summary>
|
||||
/// Export a buffer for use in the next frame
|
||||
/// </summary>
|
||||
public BufferHandle ExportBuffer(RGBufferHandle handle)
|
||||
public Handle<GraphicsBuffer> ExportBuffer(RGBufferHandle handle)
|
||||
{
|
||||
if (!handle.IsValid || handle._resourceId >= _resources.Count)
|
||||
throw new ArgumentException("Invalid buffer handle", nameof(handle));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Ghost.Core;
|
||||
using Ghost.Graphics.Data;
|
||||
using Win32.Graphics.Direct3D12;
|
||||
using Win32.Graphics.Dxgi.Common;
|
||||
@@ -91,7 +92,7 @@ public abstract class RenderGraphResource
|
||||
/// </summary>
|
||||
public sealed class RenderGraphTexture : RenderGraphResource
|
||||
{
|
||||
internal TextureHandle Handle
|
||||
internal Handle<Texture> Handle
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
@@ -107,7 +108,7 @@ public sealed class RenderGraphTexture : RenderGraphResource
|
||||
Description = description;
|
||||
}
|
||||
|
||||
public RenderGraphTexture(int id, string name, TextureHandle handle, TextureDescription description)
|
||||
public RenderGraphTexture(int id, string name, Handle<Texture> handle, TextureDescription description)
|
||||
: base(id, name, ResourceLifetime.External)
|
||||
{
|
||||
Handle = handle;
|
||||
@@ -152,7 +153,7 @@ public sealed class RenderGraphTexture : RenderGraphResource
|
||||
/// </summary>
|
||||
public sealed class RenderGraphBuffer : RenderGraphResource
|
||||
{
|
||||
internal BufferHandle Handle
|
||||
internal Handle<GraphicsBuffer> Handle
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
@@ -167,7 +168,7 @@ public sealed class RenderGraphBuffer : RenderGraphResource
|
||||
{
|
||||
Description = description;
|
||||
}
|
||||
public RenderGraphBuffer(int id, string name, BufferHandle handle, BufferDescription description)
|
||||
public RenderGraphBuffer(int id, string name, Handle<GraphicsBuffer> handle, BufferDescription description)
|
||||
: base(id, name, ResourceLifetime.External)
|
||||
{
|
||||
Handle = handle;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using Ghost.Graphics.Data;
|
||||
using Win32.Graphics.Direct3D12;
|
||||
|
||||
namespace Ghost.Graphics.RenderGraphModule;
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user