feat(graphics): improve rendering pipeline and docs

- Refactor D3D12 backend and RenderGraph module
- Update graphics RHI and core rendering components
- Add Random.hlsl shader include
- Regenerate API documentation and update user guides
This commit is contained in:
2026-03-27 22:23:44 +09:00
parent 0a2eb619eb
commit d8a7b07624
495 changed files with 51961 additions and 892 deletions

View File

@@ -50,7 +50,7 @@ internal sealed class SwapChainRecord
}
}
internal class SwapChainManager
internal class SwapChainManager : IDisposable
{
public const int MAX_SWAP_CHAINS = 8;
private readonly IGraphicsEngine _graphicsEngine;
@@ -115,4 +115,59 @@ internal class SwapChainManager
Interlocked.CompareExchange(ref _swapChains[index], null, record);
}
}
public void TransitionToPresent(ICommandBuffer commandBuffer)
{
for (int i = 0; i < MAX_SWAP_CHAINS; i++)
{
var record = Volatile.Read(ref _swapChains[i]);
if (record == null)
{
continue;
}
commandBuffer.Barrier(BarrierDesc.Texture(record.SwapChain.GetCurrentBackBuffer().AsResource(),
null, BarrierSync.None,
null, BarrierAccess.NoAccess,
null, BarrierLayout.Present));
}
}
public void Present(int index, ICommandBuffer commandBuffer)
{
var record = Volatile.Read(ref _swapChains[index]);
if (record == null)
{
return;
}
record.SwapChain.Present();
}
public void PresentAll(ICommandBuffer commandBuffer)
{
for (int i = 0; i < MAX_SWAP_CHAINS; i++)
{
var record = Volatile.Read(ref _swapChains[i]);
if (record == null)
{
continue;
}
record?.SwapChain.Present();
}
}
public void Dispose()
{
for (int i = 0; i < MAX_SWAP_CHAINS; i++)
{
var record = Volatile.Read(ref _swapChains[i]);
if (record != null)
{
record.SwapChain.Dispose();
Interlocked.CompareExchange(ref _swapChains[i], null, record);
}
}
}
}