forked from Misaki/GhostEngine
Add render graph proof of concept and refactor graphics
Implemented a transient render graph system as a proof of concept, including resource aliasing, pass culling, and typed pass data. Added new project `Ghost.RenderGraph.Concept` targeting `.NET 10.0`. Refactored graphics-related components: - Simplified resource state transitions in `RenderingContext`. - Improved resize handling in `GraphicsTestWindow`. - Updated `D3D12GraphicsEngine` to streamline frame rendering. - Enhanced `D3D12ResourceDatabase` and `D3D12SwapChain` for better resource management. Added detailed documentation: - `ALIASING.md` explains resource aliasing techniques. - `API_DESIGN.md` outlines the render graph API design. Updated solution to include the new render graph project.
This commit is contained in:
86
Ghost.RenderGraph.Concept/ICommandBuffer.cs
Normal file
86
Ghost.RenderGraph.Concept/ICommandBuffer.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
namespace Ghost.RenderGraph.Concept;
|
||||
|
||||
public interface ICommandBuffer
|
||||
{
|
||||
void ResourceBarrier(string resourceName, ResourceState beforeState, ResourceState afterState);
|
||||
void AliasingBarrier(string beforeResourceName, string afterResourceName, string physicalAllocationName);
|
||||
void BeginRenderPass(string passName);
|
||||
void EndRenderPass();
|
||||
void SetRenderTarget(string textureName);
|
||||
void SetDepthStencil(string textureName);
|
||||
void BindShaderResource(string resourceName, int slot);
|
||||
void BindUnorderedAccess(string resourceName, int slot);
|
||||
void Draw(int vertexCount);
|
||||
void Dispatch(int x, int y, int z);
|
||||
void ClearRenderTarget(string textureName, float r, float g, float b, float a);
|
||||
void ClearDepth(string textureName, float depth);
|
||||
void CopyTexture(string source, string destination);
|
||||
}
|
||||
|
||||
public class SimulatedCommandBuffer : ICommandBuffer
|
||||
{
|
||||
public void ResourceBarrier(string resourceName, ResourceState beforeState, ResourceState afterState)
|
||||
{
|
||||
Console.WriteLine($" [BARRIER] Transition '{resourceName}' from {beforeState} to {afterState}");
|
||||
}
|
||||
|
||||
public void AliasingBarrier(string beforeResourceName, string afterResourceName, string physicalAllocationName)
|
||||
{
|
||||
Console.WriteLine($" [ALIAS_BARRIER] Alias '{physicalAllocationName}': '{beforeResourceName}' -> '{afterResourceName}'");
|
||||
}
|
||||
|
||||
public void BeginRenderPass(string passName)
|
||||
{
|
||||
Console.WriteLine($" [BEGIN] RenderPass '{passName}'");
|
||||
}
|
||||
|
||||
public void EndRenderPass()
|
||||
{
|
||||
Console.WriteLine($" [END] RenderPass");
|
||||
}
|
||||
|
||||
public void SetRenderTarget(string textureName)
|
||||
{
|
||||
Console.WriteLine($" [RT] Set RenderTarget: '{textureName}'");
|
||||
}
|
||||
|
||||
public void SetDepthStencil(string textureName)
|
||||
{
|
||||
Console.WriteLine($" [DS] Set DepthStencil: '{textureName}'");
|
||||
}
|
||||
|
||||
public void BindShaderResource(string resourceName, int slot)
|
||||
{
|
||||
Console.WriteLine($" [SRV] Bind ShaderResource: '{resourceName}' at slot {slot}");
|
||||
}
|
||||
|
||||
public void BindUnorderedAccess(string resourceName, int slot)
|
||||
{
|
||||
Console.WriteLine($" [UAV] Bind UnorderedAccess: '{resourceName}' at slot {slot}");
|
||||
}
|
||||
|
||||
public void Draw(int vertexCount)
|
||||
{
|
||||
Console.WriteLine($" [DRAW] Drawing {vertexCount} vertices");
|
||||
}
|
||||
|
||||
public void Dispatch(int x, int y, int z)
|
||||
{
|
||||
Console.WriteLine($" [DISPATCH] Compute ({x}, {y}, {z})");
|
||||
}
|
||||
|
||||
public void ClearRenderTarget(string textureName, float r, float g, float b, float a)
|
||||
{
|
||||
Console.WriteLine($" [CLEAR_RT] Clear '{textureName}' to ({r}, {g}, {b}, {a})");
|
||||
}
|
||||
|
||||
public void ClearDepth(string textureName, float depth)
|
||||
{
|
||||
Console.WriteLine($" [CLEAR_DEPTH] Clear '{textureName}' to {depth}");
|
||||
}
|
||||
|
||||
public void CopyTexture(string source, string destination)
|
||||
{
|
||||
Console.WriteLine($" [COPY] Copy from '{source}' to '{destination}'");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user