Campari/src/RenderPass.cs

46 lines
1.8 KiB
C#
Raw Normal View History

2021-01-14 09:26:54 +00:00
using System;
using RefreshCS;
namespace Campari
{
public class RenderPass : GraphicsResource
{
protected override Action<IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyRenderPass;
2021-01-15 01:25:15 +00:00
public unsafe RenderPass(
2021-01-16 02:13:53 +00:00
GraphicsDevice device,
2021-01-15 01:25:15 +00:00
params Refresh.ColorTargetDescription[] colorTargetDescriptions
) : base(device)
2021-01-14 09:26:54 +00:00
{
fixed (Refresh.ColorTargetDescription* ptr = colorTargetDescriptions)
{
Refresh.RenderPassCreateInfo renderPassCreateInfo;
renderPassCreateInfo.colorTargetCount = (uint) colorTargetDescriptions.Length;
renderPassCreateInfo.colorTargetDescriptions = (IntPtr) ptr;
renderPassCreateInfo.depthStencilTargetDescription = IntPtr.Zero;
Handle = Refresh.Refresh_CreateRenderPass(device.Handle, ref renderPassCreateInfo);
}
}
public unsafe RenderPass(
2021-01-16 02:13:53 +00:00
GraphicsDevice device,
2021-01-14 09:26:54 +00:00
Refresh.DepthStencilTargetDescription depthStencilTargetDescription,
params Refresh.ColorTargetDescription[] colorTargetDescriptions
2021-01-14 10:50:02 +00:00
) : base(device)
2021-01-14 09:26:54 +00:00
{
Refresh.DepthStencilTargetDescription* depthStencilPtr = &depthStencilTargetDescription;
fixed (Refresh.ColorTargetDescription* colorPtr = colorTargetDescriptions)
{
Refresh.RenderPassCreateInfo renderPassCreateInfo;
renderPassCreateInfo.colorTargetCount = (uint)colorTargetDescriptions.Length;
renderPassCreateInfo.colorTargetDescriptions = (IntPtr)colorPtr;
renderPassCreateInfo.depthStencilTargetDescription = (IntPtr) depthStencilPtr;
Handle = Refresh.Refresh_CreateRenderPass(device.Handle, ref renderPassCreateInfo);
}
}
}
}