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:
@@ -3,9 +3,9 @@ using Win32.Graphics.Direct3D12;
|
||||
namespace Ghost.Graphics.D3D12;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for D3D12 descriptor implementations.
|
||||
/// Base class descriptor implementations.
|
||||
/// </summary>
|
||||
internal abstract class Descriptor
|
||||
public abstract class Descriptor
|
||||
{
|
||||
protected readonly uint index;
|
||||
protected readonly bool isShaderVisible;
|
||||
@@ -38,9 +38,9 @@ internal abstract class Descriptor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// D3D12 implementation of render target view (RTV) descriptor.
|
||||
/// Implementation of render target view (RTV) descriptor.
|
||||
/// </summary>
|
||||
internal sealed class RenderTargetDescriptor : Descriptor
|
||||
public sealed class RenderTargetDescriptor : Descriptor
|
||||
{
|
||||
private readonly CpuDescriptorHandle _cpuHandle;
|
||||
|
||||
@@ -55,9 +55,9 @@ internal sealed class RenderTargetDescriptor : Descriptor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// D3D12 implementation of depth stencil view (DSV) descriptor.
|
||||
/// Implementation of depth stencil view (DSV) descriptor.
|
||||
/// </summary>
|
||||
internal sealed class DepthStencilDescriptor : Descriptor
|
||||
public sealed class DepthStencilDescriptor : Descriptor
|
||||
{
|
||||
private readonly CpuDescriptorHandle _cpuHandle;
|
||||
|
||||
@@ -72,9 +72,9 @@ internal sealed class DepthStencilDescriptor : Descriptor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// D3D12 implementation of shader resource view (SRV) descriptor.
|
||||
/// Implementation of shader resource view (SRV) descriptor.
|
||||
/// </summary>
|
||||
internal sealed class ShaderResourceDescriptor : Descriptor
|
||||
public sealed class ShaderResourceDescriptor : Descriptor
|
||||
{
|
||||
private readonly CpuDescriptorHandle _cpuHandle;
|
||||
private readonly GpuDescriptorHandle _gpuHandle;
|
||||
@@ -91,9 +91,9 @@ internal sealed class ShaderResourceDescriptor : Descriptor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// D3D12 implementation of sampler descriptor.
|
||||
/// Implementation of sampler descriptor.
|
||||
/// </summary>
|
||||
internal sealed class SamplerDescriptor : Descriptor
|
||||
public sealed class SamplerDescriptor : Descriptor
|
||||
{
|
||||
private readonly CpuDescriptorHandle _cpuHandle;
|
||||
private readonly GpuDescriptorHandle _gpuHandle;
|
||||
@@ -105,6 +105,26 @@ internal sealed class SamplerDescriptor : Descriptor
|
||||
_gpuHandle = gpuHandle;
|
||||
}
|
||||
|
||||
public override CpuDescriptorHandle CpuHandle => _cpuHandle;
|
||||
public override GpuDescriptorHandle GpuHandle => _gpuHandle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of bindless descriptor for SM 6.6 rendering.
|
||||
/// This descriptor maintains a 1:1 relationship between allocation indices and shader indices.
|
||||
/// </summary>
|
||||
public sealed class BindlessDescriptor : Descriptor
|
||||
{
|
||||
private readonly CpuDescriptorHandle _cpuHandle;
|
||||
private readonly GpuDescriptorHandle _gpuHandle;
|
||||
|
||||
public BindlessDescriptor(uint index, CpuDescriptorHandle cpuHandle, GpuDescriptorHandle gpuHandle)
|
||||
: base(index, true)
|
||||
{
|
||||
_cpuHandle = cpuHandle;
|
||||
_gpuHandle = gpuHandle;
|
||||
}
|
||||
|
||||
public override CpuDescriptorHandle CpuHandle => _cpuHandle;
|
||||
public override GpuDescriptorHandle GpuHandle => _gpuHandle;
|
||||
}
|
||||
Reference in New Issue
Block a user