2024-06-04 17:20:07 +00:00
|
|
|
using System;
|
2022-12-14 03:01:40 +00:00
|
|
|
using System.Runtime.InteropServices;
|
2024-06-05 19:34:24 +00:00
|
|
|
using RefreshCS;
|
2021-01-20 03:33:27 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
namespace MoonWorks.Graphics;
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Command buffers are used to apply render state and issue draw calls.
|
|
|
|
/// NOTE: it is not recommended to hold references to command buffers long term.
|
|
|
|
/// </summary>
|
|
|
|
public class CommandBuffer
|
|
|
|
{
|
|
|
|
public GraphicsDevice Device { get; }
|
|
|
|
public IntPtr Handle { get; internal set; }
|
2022-02-23 05:14:32 +00:00
|
|
|
|
2024-02-23 23:53:49 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
bool swapchainTextureAcquired;
|
2024-02-23 23:53:49 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
ComputePipeline currentComputePipeline;
|
2024-02-23 23:53:49 +00:00
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
bool renderPassActive;
|
2024-06-04 17:20:07 +00:00
|
|
|
bool copyPassActive;
|
|
|
|
bool computePassActive;
|
2024-02-23 23:53:49 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
internal bool Submitted;
|
2024-02-23 23:53:49 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
// called from CommandBufferPool
|
|
|
|
internal CommandBuffer(GraphicsDevice device)
|
|
|
|
{
|
|
|
|
Device = device;
|
|
|
|
Handle = IntPtr.Zero;
|
2024-02-23 23:53:49 +00:00
|
|
|
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
ResetStateTracking();
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
internal void SetHandle(nint handle)
|
|
|
|
{
|
|
|
|
Handle = handle;
|
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
|
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
internal void ResetStateTracking()
|
|
|
|
{
|
|
|
|
swapchainTextureAcquired = false;
|
|
|
|
|
|
|
|
currentComputePipeline = null;
|
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPassActive = false;
|
2024-06-04 17:20:07 +00:00
|
|
|
copyPassActive = false;
|
|
|
|
computePassActive = false;
|
|
|
|
|
|
|
|
Submitted = false;
|
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
2022-04-13 03:06:14 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Acquires a swapchain texture.
|
|
|
|
/// This texture will be presented to the given window when the command buffer is submitted.
|
|
|
|
/// Can return null if the swapchain is unavailable. The user should ALWAYS handle the case where this occurs.
|
|
|
|
/// If null is returned, presentation will not occur.
|
|
|
|
/// It is an error to acquire two swapchain textures from the same window in one command buffer.
|
|
|
|
/// It is an error to dispose the swapchain texture. If you do this your game WILL crash. DO NOT DO THIS.
|
|
|
|
/// </summary>
|
|
|
|
public Texture AcquireSwapchainTexture(
|
|
|
|
Window window
|
|
|
|
) {
|
2022-02-25 05:34:36 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
if (!window.Claimed)
|
|
|
|
{
|
|
|
|
throw new System.InvalidOperationException("Cannot acquire swapchain texture, window has not been claimed!");
|
2022-11-17 20:35:21 +00:00
|
|
|
}
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
if (swapchainTextureAcquired)
|
|
|
|
{
|
|
|
|
throw new System.InvalidOperationException("Cannot acquire two swapchain textures on the same command buffer!");
|
2022-11-17 20:35:21 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var texturePtr = Refresh.Refresh_AcquireSwapchainTexture(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
|
|
|
window.Handle,
|
|
|
|
out var width,
|
|
|
|
out var height
|
|
|
|
);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
if (texturePtr == IntPtr.Zero)
|
|
|
|
{
|
|
|
|
return null;
|
2022-02-23 05:14:32 +00:00
|
|
|
}
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
// Override the texture properties to avoid allocating a new texture instance!
|
|
|
|
window.SwapchainTexture.Handle = texturePtr;
|
|
|
|
window.SwapchainTexture.Width = width;
|
|
|
|
window.SwapchainTexture.Height = height;
|
|
|
|
window.SwapchainTexture.Format = window.SwapchainFormat;
|
2022-11-17 20:35:21 +00:00
|
|
|
|
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
swapchainTextureAcquired = true;
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
return window.SwapchainTexture;
|
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Begins a render pass.
|
|
|
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
|
|
|
/// It is an error to call this during any kind of pass.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="colorAttachmentInfo">The color attachment to use in the render pass.</param>
|
2024-06-04 23:04:19 +00:00
|
|
|
public unsafe RenderPass BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
in ColorAttachmentInfo colorAttachmentInfo
|
|
|
|
) {
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
|
|
|
AssertNotInPass("Cannot begin a render pass inside another pass!");
|
|
|
|
AssertTextureNotNull(colorAttachmentInfo);
|
|
|
|
AssertColorTarget(colorAttachmentInfo);
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[1];
|
|
|
|
refreshColorAttachmentInfos[0] = colorAttachmentInfo.ToRefresh();
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
refreshColorAttachmentInfos,
|
2024-06-04 17:20:07 +00:00
|
|
|
1,
|
2024-06-05 19:34:24 +00:00
|
|
|
(Refresh.DepthStencilAttachmentInfo*) nint.Zero
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
var renderPass = Device.RenderPassPool.Obtain();
|
|
|
|
renderPass.SetHandle(renderPassHandle);
|
|
|
|
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
renderPassActive = true;
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPass.colorAttachmentCount = 1;
|
|
|
|
renderPass.colorAttachmentSampleCount = colorAttachmentInfo.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.colorFormatOne = colorAttachmentInfo.TextureSlice.Texture.Format;
|
|
|
|
renderPass.hasDepthStencilAttachment = false;
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
2024-06-04 23:04:19 +00:00
|
|
|
|
|
|
|
return renderPass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Begins a render pass.
|
|
|
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
|
|
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
2024-06-04 23:04:19 +00:00
|
|
|
public unsafe RenderPass BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
in ColorAttachmentInfo colorAttachmentInfoOne,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoTwo
|
|
|
|
) {
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
2024-06-04 23:04:19 +00:00
|
|
|
AssertNotInPass("Cannot begin a render pass inside another pass!");
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
|
|
|
AssertColorTarget(colorAttachmentInfoOne);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
|
|
|
AssertColorTarget(colorAttachmentInfoTwo);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoTwo.TextureSlice.Texture);
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[2];
|
|
|
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
refreshColorAttachmentInfos,
|
2024-06-04 17:20:07 +00:00
|
|
|
2,
|
2024-06-05 19:34:24 +00:00
|
|
|
(Refresh.DepthStencilAttachmentInfo*) nint.Zero
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
var renderPass = Device.RenderPassPool.Obtain();
|
|
|
|
renderPass.SetHandle(renderPassHandle);
|
|
|
|
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
renderPassActive = true;
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPass.colorAttachmentCount = 2;
|
|
|
|
renderPass.colorAttachmentSampleCount = colorAttachmentInfoOne.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.colorFormatOne = colorAttachmentInfoOne.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatTwo = colorAttachmentInfoTwo.TextureSlice.Texture.Format;
|
|
|
|
renderPass.hasDepthStencilAttachment = false;
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
2024-06-04 23:04:19 +00:00
|
|
|
|
|
|
|
return renderPass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Begins a render pass.
|
|
|
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
|
|
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoThree">The third color attachment to use in the render pass.</param>
|
2024-06-04 23:04:19 +00:00
|
|
|
public unsafe RenderPass BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
in ColorAttachmentInfo colorAttachmentInfoOne,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoTwo,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoThree
|
|
|
|
) {
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
2024-06-04 23:04:19 +00:00
|
|
|
AssertNotInPass("Cannot begin a render pass inside another pass!");
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
|
|
|
AssertColorTarget(colorAttachmentInfoOne);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
|
|
|
AssertColorTarget(colorAttachmentInfoTwo);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertTextureNotNull(colorAttachmentInfoThree);
|
|
|
|
AssertColorTarget(colorAttachmentInfoThree);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoTwo.TextureSlice.Texture);
|
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoThree.TextureSlice.Texture);
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[3];
|
|
|
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
|
2022-09-07 20:07:17 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
refreshColorAttachmentInfos,
|
2024-06-04 17:20:07 +00:00
|
|
|
3,
|
2024-06-05 19:34:24 +00:00
|
|
|
(Refresh.DepthStencilAttachmentInfo*) nint.Zero
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
var renderPass = Device.RenderPassPool.Obtain();
|
|
|
|
renderPass.SetHandle(renderPassHandle);
|
|
|
|
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
renderPassActive = true;
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPass.colorAttachmentCount = 3;
|
|
|
|
renderPass.colorAttachmentSampleCount = colorAttachmentInfoOne.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.colorFormatOne = colorAttachmentInfoOne.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatTwo = colorAttachmentInfoTwo.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatThree = colorAttachmentInfoThree.TextureSlice.Texture.Format;
|
|
|
|
renderPass.hasDepthStencilAttachment = false;
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
2024-06-04 23:04:19 +00:00
|
|
|
|
|
|
|
return renderPass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-02-23 05:14:32 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Begins a render pass.
|
|
|
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
|
|
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoThree">The third color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoFour">The four color attachment to use in the render pass.</param>
|
2024-06-04 23:04:19 +00:00
|
|
|
public unsafe RenderPass BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
in ColorAttachmentInfo colorAttachmentInfoOne,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoTwo,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoThree,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoFour
|
|
|
|
) {
|
|
|
|
#if DEBUG
|
|
|
|
AssertNotSubmitted();
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
|
|
|
AssertColorTarget(colorAttachmentInfoOne);
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
|
|
|
AssertColorTarget(colorAttachmentInfoTwo);
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoThree);
|
|
|
|
AssertColorTarget(colorAttachmentInfoThree);
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoFour);
|
|
|
|
AssertColorTarget(colorAttachmentInfoFour);
|
|
|
|
|
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoTwo.TextureSlice.Texture);
|
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoThree.TextureSlice.Texture);
|
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoFour.TextureSlice.Texture);
|
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[4];
|
|
|
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[3] = colorAttachmentInfoFour.ToRefresh();
|
2024-06-04 17:20:07 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
refreshColorAttachmentInfos,
|
2024-06-04 17:20:07 +00:00
|
|
|
4,
|
2024-06-05 19:34:24 +00:00
|
|
|
(Refresh.DepthStencilAttachmentInfo*) nint.Zero
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
var renderPass = Device.RenderPassPool.Obtain();
|
|
|
|
renderPass.SetHandle(renderPassHandle);
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
#if DEBUG
|
|
|
|
renderPassActive = true;
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPass.colorAttachmentCount = 3;
|
|
|
|
renderPass.colorAttachmentSampleCount = colorAttachmentInfoOne.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.colorFormatOne = colorAttachmentInfoOne.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatTwo = colorAttachmentInfoTwo.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatThree = colorAttachmentInfoThree.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatFour = colorAttachmentInfoFour.TextureSlice.Texture.Format;
|
|
|
|
renderPass.hasDepthStencilAttachment = false;
|
2024-01-18 20:27:34 +00:00
|
|
|
#endif
|
2024-06-04 23:04:19 +00:00
|
|
|
|
|
|
|
return renderPass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2024-01-18 20:27:34 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Begins a render pass.
|
|
|
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
|
|
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
2024-06-04 23:04:19 +00:00
|
|
|
public unsafe RenderPass BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
in DepthStencilAttachmentInfo depthStencilAttachmentInfo
|
|
|
|
) {
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
|
|
|
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:34:24 +00:00
|
|
|
(Refresh.ColorAttachmentInfo*) nint.Zero,
|
2024-06-04 17:20:07 +00:00
|
|
|
0,
|
2024-06-05 19:37:02 +00:00
|
|
|
&refreshDepthStencilAttachmentInfo
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-02-23 05:14:32 +00:00
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
var renderPass = Device.RenderPassPool.Obtain();
|
|
|
|
renderPass.SetHandle(renderPassHandle);
|
|
|
|
|
2022-09-07 20:07:17 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
renderPassActive = true;
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPass.hasDepthStencilAttachment = true;
|
|
|
|
renderPass.depthStencilAttachmentSampleCount = depthStencilAttachmentInfo.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.depthStencilFormat = depthStencilAttachmentInfo.TextureSlice.Texture.Format;
|
2024-02-23 23:53:49 +00:00
|
|
|
#endif
|
2024-06-04 23:04:19 +00:00
|
|
|
|
|
|
|
return renderPass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-09-07 20:07:17 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Begins a render pass.
|
|
|
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
|
|
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfo">The color attachment to use in the render pass.</param>
|
2024-06-04 23:04:19 +00:00
|
|
|
public unsafe RenderPass BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
in DepthStencilAttachmentInfo depthStencilAttachmentInfo,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfo
|
|
|
|
) {
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
|
|
|
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
2024-02-23 23:53:49 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertTextureNotNull(colorAttachmentInfo);
|
|
|
|
AssertColorTarget(colorAttachmentInfo);
|
|
|
|
AssertSameSampleCount(colorAttachmentInfo.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture);
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[1];
|
|
|
|
refreshColorAttachmentInfos[0] = colorAttachmentInfo.ToRefresh();
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
2022-09-07 20:07:17 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
refreshColorAttachmentInfos,
|
2024-06-04 17:20:07 +00:00
|
|
|
1,
|
2024-06-05 19:37:02 +00:00
|
|
|
&refreshDepthStencilAttachmentInfo
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-02-23 05:14:32 +00:00
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
var renderPass = Device.RenderPassPool.Obtain();
|
|
|
|
renderPass.SetHandle(renderPassHandle);
|
|
|
|
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
renderPassActive = true;
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPass.hasDepthStencilAttachment = true;
|
|
|
|
renderPass.colorAttachmentCount = 1;
|
|
|
|
renderPass.colorAttachmentSampleCount = colorAttachmentInfo.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.colorFormatOne = colorAttachmentInfo.TextureSlice.Texture.Format;
|
|
|
|
renderPass.depthStencilAttachmentSampleCount = depthStencilAttachmentInfo.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.depthStencilFormat = depthStencilAttachmentInfo.TextureSlice.Texture.Format;
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
2024-06-04 23:04:19 +00:00
|
|
|
|
|
|
|
return renderPass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Begins a render pass.
|
|
|
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
|
|
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
2024-06-04 23:04:19 +00:00
|
|
|
public unsafe RenderPass BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
in DepthStencilAttachmentInfo depthStencilAttachmentInfo,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoOne,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoTwo
|
|
|
|
) {
|
2022-09-07 20:07:17 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
|
|
|
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
|
|
|
AssertColorTarget(colorAttachmentInfoOne);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
|
|
|
AssertColorTarget(colorAttachmentInfoTwo);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoTwo.TextureSlice.Texture);
|
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture);
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[2];
|
|
|
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
2022-09-07 20:07:17 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
refreshColorAttachmentInfos,
|
2024-06-04 17:20:07 +00:00
|
|
|
2,
|
2024-06-05 19:37:02 +00:00
|
|
|
&refreshDepthStencilAttachmentInfo
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2024-02-23 23:53:49 +00:00
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
var renderPass = Device.RenderPassPool.Obtain();
|
|
|
|
renderPass.SetHandle(renderPassHandle);
|
|
|
|
|
2022-09-07 20:07:17 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
renderPassActive = true;
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPass.hasDepthStencilAttachment = true;
|
|
|
|
renderPass.colorAttachmentCount = 2;
|
|
|
|
renderPass.colorFormatOne = colorAttachmentInfoOne.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatTwo = colorAttachmentInfoTwo.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorAttachmentSampleCount = colorAttachmentInfoOne.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.depthStencilAttachmentSampleCount = depthStencilAttachmentInfo.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.depthStencilFormat = depthStencilAttachmentInfo.TextureSlice.Texture.Format;
|
2022-09-07 20:07:17 +00:00
|
|
|
#endif
|
2024-06-04 23:04:19 +00:00
|
|
|
|
|
|
|
return renderPass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-09-07 20:07:17 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Begins a render pass.
|
|
|
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
|
|
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoThree">The third color attachment to use in the render pass.</param>
|
2024-06-04 23:04:19 +00:00
|
|
|
public unsafe RenderPass BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
in DepthStencilAttachmentInfo depthStencilAttachmentInfo,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoOne,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoTwo,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoThree
|
|
|
|
) {
|
|
|
|
#if DEBUG
|
|
|
|
AssertNotSubmitted();
|
|
|
|
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
|
|
|
AssertColorTarget(colorAttachmentInfoOne);
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
|
|
|
AssertColorTarget(colorAttachmentInfoTwo);
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoThree);
|
|
|
|
AssertColorTarget(colorAttachmentInfoThree);
|
|
|
|
|
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoTwo.TextureSlice.Texture);
|
2024-06-04 23:04:19 +00:00
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoThree.TextureSlice.Texture);
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture);
|
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[3];
|
|
|
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
|
2024-06-04 17:20:07 +00:00
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
2024-06-04 17:20:07 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
refreshColorAttachmentInfos,
|
2024-06-04 17:20:07 +00:00
|
|
|
3,
|
2024-06-05 19:37:02 +00:00
|
|
|
&refreshDepthStencilAttachmentInfo
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
var renderPass = Device.RenderPassPool.Obtain();
|
|
|
|
renderPass.SetHandle(renderPassHandle);
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
#if DEBUG
|
|
|
|
renderPassActive = true;
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPass.hasDepthStencilAttachment = true;
|
|
|
|
renderPass.colorAttachmentCount = 3;
|
|
|
|
renderPass.colorAttachmentSampleCount = colorAttachmentInfoOne.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.colorFormatOne = colorAttachmentInfoOne.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatTwo = colorAttachmentInfoTwo.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatThree = colorAttachmentInfoThree.TextureSlice.Texture.Format;
|
|
|
|
renderPass.depthStencilAttachmentSampleCount = depthStencilAttachmentInfo.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.depthStencilFormat = depthStencilAttachmentInfo.TextureSlice.Texture.Format;
|
2024-02-23 23:53:49 +00:00
|
|
|
#endif
|
2024-06-04 23:04:19 +00:00
|
|
|
|
|
|
|
return renderPass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-09 18:49:53 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Begins a render pass.
|
|
|
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
|
|
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoThree">The third color attachment to use in the render pass.</param>
|
|
|
|
/// <param name="colorAttachmentInfoFour">The four color attachment to use in the render pass.</param>
|
2024-06-04 23:04:19 +00:00
|
|
|
public unsafe RenderPass BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
in DepthStencilAttachmentInfo depthStencilAttachmentInfo,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoOne,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoTwo,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoThree,
|
|
|
|
in ColorAttachmentInfo colorAttachmentInfoFour
|
|
|
|
) {
|
|
|
|
#if DEBUG
|
|
|
|
AssertNotSubmitted();
|
|
|
|
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
|
|
|
AssertColorTarget(colorAttachmentInfoOne);
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
|
|
|
AssertColorTarget(colorAttachmentInfoTwo);
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoThree);
|
|
|
|
AssertColorTarget(colorAttachmentInfoThree);
|
|
|
|
|
|
|
|
AssertTextureNotNull(colorAttachmentInfoFour);
|
|
|
|
AssertColorTarget(colorAttachmentInfoFour);
|
|
|
|
|
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoTwo.TextureSlice.Texture);
|
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoThree.TextureSlice.Texture);
|
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, colorAttachmentInfoFour.TextureSlice.Texture);
|
|
|
|
AssertSameSampleCount(colorAttachmentInfoOne.TextureSlice.Texture, depthStencilAttachmentInfo.TextureSlice.Texture);
|
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[4];
|
|
|
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
|
|
|
|
refreshColorAttachmentInfos[3] = colorAttachmentInfoFour.ToRefresh();
|
2024-06-04 17:20:07 +00:00
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
2024-06-04 17:20:07 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var renderPassHandle = Refresh.Refresh_BeginRenderPass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
refreshColorAttachmentInfos,
|
2024-06-04 17:20:07 +00:00
|
|
|
4,
|
2024-06-05 19:37:02 +00:00
|
|
|
&refreshDepthStencilAttachmentInfo
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-02-23 05:14:32 +00:00
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
var renderPass = Device.RenderPassPool.Obtain();
|
|
|
|
renderPass.SetHandle(renderPassHandle);
|
2024-02-23 23:53:49 +00:00
|
|
|
|
2022-11-08 19:29:05 +00:00
|
|
|
#if DEBUG
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPassActive = true;
|
|
|
|
renderPass.hasDepthStencilAttachment = true;
|
|
|
|
renderPass.colorAttachmentCount = 4;
|
|
|
|
renderPass.colorAttachmentSampleCount = colorAttachmentInfoOne.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.colorFormatOne = colorAttachmentInfoOne.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatTwo = colorAttachmentInfoTwo.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatThree = colorAttachmentInfoThree.TextureSlice.Texture.Format;
|
|
|
|
renderPass.colorFormatFour = colorAttachmentInfoFour.TextureSlice.Texture.Format;
|
|
|
|
renderPass.depthStencilAttachmentSampleCount = depthStencilAttachmentInfo.TextureSlice.Texture.SampleCount;
|
|
|
|
renderPass.depthStencilFormat = depthStencilAttachmentInfo.TextureSlice.Texture.Format;
|
2024-02-23 23:53:49 +00:00
|
|
|
#endif
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 23:04:19 +00:00
|
|
|
return renderPass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-16 01:53:30 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Ends the current render pass.
|
|
|
|
/// This must be called before beginning another render pass or submitting the command buffer.
|
|
|
|
/// </summary>
|
2024-06-04 23:04:19 +00:00
|
|
|
public void EndRenderPass(RenderPass renderPass)
|
2024-06-04 17:20:07 +00:00
|
|
|
{
|
2022-09-07 20:07:17 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
2024-06-04 23:04:19 +00:00
|
|
|
AssertRenderPassActive();
|
|
|
|
|
|
|
|
renderPassActive = false;
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
2022-09-07 20:07:17 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
Refresh.Refresh_EndRenderPass(
|
2024-06-04 23:04:19 +00:00
|
|
|
renderPass.Handle
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-09-07 20:07:17 +00:00
|
|
|
|
2024-06-05 02:35:17 +00:00
|
|
|
renderPass.SetHandle(nint.Zero);
|
2024-06-04 23:04:19 +00:00
|
|
|
Device.RenderPassPool.Return(renderPass);
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Blits a texture to another texture with the specified filter.
|
|
|
|
///
|
|
|
|
/// This operation cannot be performed inside any pass.
|
|
|
|
/// </summary>
|
2024-06-04 23:04:19 +00:00
|
|
|
/// <param name="cycle">If true, the destination texture will cycle if bound.</param>
|
2024-06-04 17:20:07 +00:00
|
|
|
public void Blit(
|
2024-06-04 23:04:19 +00:00
|
|
|
in TextureRegion source,
|
|
|
|
in TextureRegion destination,
|
2024-06-04 17:20:07 +00:00
|
|
|
Filter filter,
|
2024-06-04 23:04:19 +00:00
|
|
|
bool cycle
|
2024-06-04 17:20:07 +00:00
|
|
|
) {
|
2024-06-05 19:34:24 +00:00
|
|
|
Refresh.Refresh_Blit(
|
2024-06-04 23:04:19 +00:00
|
|
|
Handle,
|
2024-06-05 19:34:24 +00:00
|
|
|
source.ToRefresh(),
|
|
|
|
destination.ToRefresh(),
|
|
|
|
(Refresh.Filter) filter,
|
2024-06-04 23:04:19 +00:00
|
|
|
Conversions.BoolToInt(cycle)
|
|
|
|
);
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2024-02-23 23:53:49 +00:00
|
|
|
|
2024-06-05 00:24:25 +00:00
|
|
|
public unsafe ComputePass BeginComputePass(
|
|
|
|
in StorageTextureReadWriteBinding readWriteTextureBinding
|
|
|
|
) {
|
2024-02-23 23:53:49 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
|
|
|
AssertNotInPass("Cannot begin compute pass while in another pass!");
|
|
|
|
computePassActive = true;
|
2024-02-23 23:53:49 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshTextureBinding = readWriteTextureBinding.ToRefresh();
|
2022-02-23 05:14:32 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var computePassHandle = Refresh.Refresh_BeginComputePass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
&refreshTextureBinding,
|
2024-06-05 00:24:25 +00:00
|
|
|
1,
|
2024-06-05 19:34:24 +00:00
|
|
|
(Refresh.StorageBufferReadWriteBinding*) nint.Size,
|
2024-06-05 00:24:25 +00:00
|
|
|
0
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-05 00:24:25 +00:00
|
|
|
var computePass = Device.ComputePassPool.Obtain();
|
|
|
|
computePass.SetHandle(computePassHandle);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
|
|
|
#if DEBUG
|
2024-06-05 00:24:25 +00:00
|
|
|
computePass.active = true;
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 00:24:25 +00:00
|
|
|
return computePass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-05 00:24:25 +00:00
|
|
|
public unsafe ComputePass BeginComputePass(
|
|
|
|
in StorageBufferReadWriteBinding readWriteBufferBinding
|
2024-06-04 17:20:07 +00:00
|
|
|
) {
|
|
|
|
#if DEBUG
|
|
|
|
AssertNotSubmitted();
|
2024-06-05 00:24:25 +00:00
|
|
|
AssertNotInPass("Cannot begin compute pass while in another pass!");
|
|
|
|
computePassActive = true;
|
2024-06-04 17:20:07 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshBufferBinding = readWriteBufferBinding.ToRefresh();
|
2024-06-04 17:20:07 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var computePassHandle = Refresh.Refresh_BeginComputePass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:34:24 +00:00
|
|
|
(Refresh.StorageTextureReadWriteBinding*) nint.Zero,
|
2024-06-05 00:24:25 +00:00
|
|
|
0,
|
2024-06-05 19:37:02 +00:00
|
|
|
&refreshBufferBinding,
|
2024-06-05 00:24:25 +00:00
|
|
|
1
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-05 00:24:25 +00:00
|
|
|
var computePass = Device.ComputePassPool.Obtain();
|
|
|
|
computePass.SetHandle(computePassHandle);
|
2024-06-04 17:20:07 +00:00
|
|
|
|
|
|
|
#if DEBUG
|
2024-06-05 00:24:25 +00:00
|
|
|
computePass.active = true;
|
2024-06-04 17:20:07 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 00:24:25 +00:00
|
|
|
return computePass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-05 00:24:25 +00:00
|
|
|
public unsafe ComputePass BeginComputePass(
|
|
|
|
in StorageTextureReadWriteBinding readWriteTextureBinding,
|
|
|
|
in StorageBufferReadWriteBinding readWriteBufferBinding
|
2024-06-04 17:20:07 +00:00
|
|
|
) {
|
2022-11-17 20:35:21 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
2024-06-05 00:24:25 +00:00
|
|
|
AssertNotInPass("Cannot begin compute pass while in another pass!");
|
|
|
|
computePassActive = true;
|
2022-11-17 20:35:21 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshTextureBinding = readWriteTextureBinding.ToRefresh();
|
|
|
|
var refreshBufferBinding = readWriteBufferBinding.ToRefresh();
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var computePassHandle = Refresh.Refresh_BeginComputePass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
&refreshTextureBinding,
|
2024-06-05 00:24:25 +00:00
|
|
|
1,
|
2024-06-05 19:37:02 +00:00
|
|
|
&refreshBufferBinding,
|
2024-06-05 00:24:25 +00:00
|
|
|
1
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-11-08 19:29:05 +00:00
|
|
|
|
2024-06-05 00:24:25 +00:00
|
|
|
var computePass = Device.ComputePassPool.Obtain();
|
|
|
|
computePass.SetHandle(computePassHandle);
|
2023-02-24 00:59:34 +00:00
|
|
|
|
2024-02-23 23:53:49 +00:00
|
|
|
#if DEBUG
|
2024-06-05 00:24:25 +00:00
|
|
|
computePass.active = true;
|
2022-09-07 20:07:17 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 00:24:25 +00:00
|
|
|
return computePass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2023-02-24 00:59:34 +00:00
|
|
|
|
2024-06-05 02:35:17 +00:00
|
|
|
public unsafe ComputePass BeginComputePass(
|
|
|
|
Span<StorageTextureReadWriteBinding> readWriteTextureBindings,
|
|
|
|
Span<StorageBufferReadWriteBinding> readWriteBufferBindings
|
|
|
|
) {
|
2024-06-04 17:20:07 +00:00
|
|
|
#if DEBUG
|
|
|
|
AssertNotSubmitted();
|
2024-06-05 02:35:17 +00:00
|
|
|
AssertNotInPass("Cannot begin compute pass while in another pass!");
|
|
|
|
computePassActive = true;
|
2024-01-18 20:27:34 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshTextureBindings = NativeMemory.Alloc(
|
2024-06-05 02:35:17 +00:00
|
|
|
(nuint) (readWriteTextureBindings.Length * Marshal.SizeOf<StorageTextureReadWriteBinding>())
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-02-23 05:14:32 +00:00
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
var refreshBufferBindings = NativeMemory.Alloc(
|
2024-06-05 02:35:17 +00:00
|
|
|
(nuint) (readWriteBufferBindings.Length * Marshal.SizeOf<StorageBufferReadWriteBinding>())
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2024-03-01 23:03:14 +00:00
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var computePassHandle = Refresh.Refresh_BeginComputePass(
|
2024-06-04 17:20:07 +00:00
|
|
|
Handle,
|
2024-06-05 19:37:02 +00:00
|
|
|
(Refresh.StorageTextureReadWriteBinding*) refreshTextureBindings,
|
2024-06-05 02:35:17 +00:00
|
|
|
(uint) readWriteTextureBindings.Length,
|
2024-06-05 19:37:02 +00:00
|
|
|
(Refresh.StorageBufferReadWriteBinding*) refreshBufferBindings,
|
2024-06-05 02:35:17 +00:00
|
|
|
(uint) readWriteBufferBindings.Length
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2022-02-23 05:14:32 +00:00
|
|
|
|
2024-06-05 02:35:17 +00:00
|
|
|
var computePass = Device.ComputePassPool.Obtain();
|
|
|
|
computePass.SetHandle(computePassHandle);
|
2023-08-07 17:12:46 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
#if DEBUG
|
2024-06-05 02:35:17 +00:00
|
|
|
computePass.active = true;
|
2024-06-04 17:20:07 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:37:02 +00:00
|
|
|
NativeMemory.Free(refreshTextureBindings);
|
|
|
|
NativeMemory.Free(refreshBufferBindings);
|
2022-09-07 20:07:17 +00:00
|
|
|
|
2024-06-05 02:35:17 +00:00
|
|
|
return computePass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-02-23 05:14:32 +00:00
|
|
|
|
2024-06-05 02:35:17 +00:00
|
|
|
public void EndComputePass(ComputePass computePass)
|
2024-06-04 17:20:07 +00:00
|
|
|
{
|
|
|
|
#if DEBUG
|
|
|
|
AssertNotSubmitted();
|
2024-06-05 02:35:17 +00:00
|
|
|
AssertInComputePass("Cannot end compute pass while not in a compute pass!");
|
|
|
|
computePassActive = false;
|
|
|
|
computePass.active = false;
|
2024-06-04 17:20:07 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
Refresh.Refresh_EndComputePass(
|
2024-06-05 02:35:17 +00:00
|
|
|
computePass.Handle
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2024-02-23 23:40:01 +00:00
|
|
|
|
2024-06-05 02:35:17 +00:00
|
|
|
computePass.SetHandle(nint.Zero);
|
|
|
|
Device.ComputePassPool.Return(computePass);
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-09-07 20:07:17 +00:00
|
|
|
|
2024-06-05 02:35:17 +00:00
|
|
|
// Copy Pass
|
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
/// <summary>
|
2024-06-05 02:35:17 +00:00
|
|
|
/// Begins a copy pass.
|
|
|
|
/// All copy commands must be made within a copy pass.
|
|
|
|
/// It is an error to call this during any kind of pass.
|
2024-06-04 17:20:07 +00:00
|
|
|
/// </summary>
|
2024-06-05 02:35:17 +00:00
|
|
|
public CopyPass BeginCopyPass()
|
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
#if DEBUG
|
|
|
|
AssertNotSubmitted();
|
2024-06-05 02:35:17 +00:00
|
|
|
AssertNotInPass("Cannot begin copy pass while in another pass!");
|
|
|
|
copyPassActive = true;
|
2024-06-04 17:20:07 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
var copyPassHandle = Refresh.Refresh_BeginCopyPass(Handle);
|
2022-02-23 05:14:32 +00:00
|
|
|
|
2024-06-05 02:35:17 +00:00
|
|
|
var copyPass = Device.CopyPassPool.Obtain();
|
|
|
|
copyPass.SetHandle(copyPassHandle);
|
|
|
|
|
|
|
|
return copyPass;
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2023-04-05 19:40:34 +00:00
|
|
|
|
2024-06-05 02:35:17 +00:00
|
|
|
public void EndCopyPass(CopyPass copyPass)
|
2024-06-04 17:20:07 +00:00
|
|
|
{
|
2022-09-07 20:07:17 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
AssertNotSubmitted();
|
|
|
|
AssertInCopyPass("Cannot end copy pass while not in a copy pass!");
|
|
|
|
copyPassActive = false;
|
2022-09-07 20:07:17 +00:00
|
|
|
#endif
|
|
|
|
|
2024-06-05 19:34:24 +00:00
|
|
|
Refresh.Refresh_EndCopyPass(
|
2024-06-05 02:35:17 +00:00
|
|
|
copyPass.Handle
|
2024-06-04 17:20:07 +00:00
|
|
|
);
|
2024-06-05 02:35:17 +00:00
|
|
|
|
|
|
|
copyPass.SetHandle(nint.Zero);
|
|
|
|
Device.CopyPassPool.Return(copyPass);
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2024-02-23 08:06:04 +00:00
|
|
|
|
2022-09-07 20:07:17 +00:00
|
|
|
#if DEBUG
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertRenderPassActive(string message = "No active render pass!")
|
|
|
|
{
|
|
|
|
if (!renderPassActive)
|
|
|
|
{
|
|
|
|
throw new System.InvalidOperationException(message);
|
2022-02-23 05:14:32 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-09-07 20:07:17 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertComputePipelineBound(string message = "No compute pipeline is bound!")
|
|
|
|
{
|
|
|
|
if (currentComputePipeline == null)
|
2022-11-17 20:35:21 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.InvalidOperationException(message);
|
2022-11-17 20:35:21 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-17 20:35:21 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertTextureNotNull(ColorAttachmentInfo colorAttachmentInfo)
|
|
|
|
{
|
|
|
|
if (colorAttachmentInfo.TextureSlice.Texture == null || colorAttachmentInfo.TextureSlice.Texture.Handle == IntPtr.Zero)
|
2022-11-08 19:29:05 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.ArgumentException("Render pass color attachment Texture cannot be null!");
|
2022-11-17 20:35:21 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-08 19:29:05 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertColorTarget(ColorAttachmentInfo colorAttachmentInfo)
|
|
|
|
{
|
|
|
|
if ((colorAttachmentInfo.TextureSlice.Texture.UsageFlags & TextureUsageFlags.ColorTarget) == 0)
|
2022-11-17 20:35:21 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.ArgumentException("Render pass color attachment UsageFlags must include TextureUsageFlags.ColorTarget!");
|
2022-11-17 20:35:21 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-08 19:29:05 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertSameSampleCount(Texture a, Texture b)
|
|
|
|
{
|
|
|
|
if (a.SampleCount != b.SampleCount)
|
2022-11-17 20:35:21 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.ArgumentException("All attachments in a render pass must have the same SampleCount!");
|
2022-11-17 20:35:21 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-08 19:29:05 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertValidDepthAttachment(DepthStencilAttachmentInfo depthStencilAttachmentInfo)
|
|
|
|
{
|
|
|
|
if (depthStencilAttachmentInfo.TextureSlice.Texture == null ||
|
|
|
|
depthStencilAttachmentInfo.TextureSlice.Texture.Handle == IntPtr.Zero)
|
2022-11-17 20:35:21 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.ArgumentException("Render pass depth stencil attachment Texture cannot be null!");
|
2022-11-17 20:35:21 +00:00
|
|
|
}
|
2022-11-09 18:49:53 +00:00
|
|
|
|
2024-06-05 02:35:17 +00:00
|
|
|
if ((depthStencilAttachmentInfo.TextureSlice.Texture.UsageFlags & TextureUsageFlags.DepthStencil) == 0)
|
2022-11-17 20:35:21 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.ArgumentException("Render pass depth stencil attachment UsageFlags must include TextureUsageFlags.DepthStencilTarget!");
|
2022-11-08 19:29:05 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2022-11-08 19:29:05 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertNonEmptyCopy(uint dataLengthInBytes)
|
|
|
|
{
|
|
|
|
if (dataLengthInBytes == 0)
|
2023-08-07 17:12:46 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.InvalidOperationException("SetBufferData must have a length greater than 0 bytes!");
|
2023-08-07 17:12:46 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2024-01-16 06:19:59 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertBufferBoundsCheck(uint bufferLengthInBytes, uint offsetInBytes, uint copyLengthInBytes)
|
|
|
|
{
|
|
|
|
if (copyLengthInBytes > bufferLengthInBytes + offsetInBytes)
|
2024-01-16 06:19:59 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.InvalidOperationException($"SetBufferData overflow! buffer length {bufferLengthInBytes}, offset {offsetInBytes}, copy length {copyLengthInBytes}");
|
2024-01-16 06:19:59 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2024-01-16 06:19:59 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertTextureBoundsCheck(uint textureSizeInBytes, uint dataLengthInBytes)
|
|
|
|
{
|
|
|
|
if (dataLengthInBytes > textureSizeInBytes)
|
2024-01-16 06:19:59 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.InvalidOperationException($"SetTextureData overflow! texture size {textureSizeInBytes}, data size {dataLengthInBytes}");
|
2024-01-16 06:19:59 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2024-01-18 20:27:34 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertNotInPass(string message)
|
|
|
|
{
|
|
|
|
if (renderPassActive || copyPassActive || computePassActive)
|
2024-02-23 08:06:04 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.InvalidOperationException(message);
|
2024-02-23 08:06:04 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2024-02-23 08:06:04 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertInCopyPass(string message)
|
|
|
|
{
|
|
|
|
if (!copyPassActive)
|
2024-02-23 08:06:04 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.InvalidOperationException(message);
|
2024-02-23 08:06:04 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2024-02-23 08:06:04 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertInComputePass(string message)
|
|
|
|
{
|
|
|
|
if (!computePassActive)
|
2024-02-23 18:43:39 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.InvalidOperationException(message);
|
2024-02-23 18:43:39 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
}
|
2024-02-23 18:43:39 +00:00
|
|
|
|
2024-06-04 17:20:07 +00:00
|
|
|
private void AssertNotSubmitted()
|
|
|
|
{
|
|
|
|
if (Submitted)
|
2024-01-18 20:27:34 +00:00
|
|
|
{
|
2024-06-04 17:20:07 +00:00
|
|
|
throw new System.InvalidOperationException("Cannot add commands to a submitted command buffer!");
|
2024-01-18 20:27:34 +00:00
|
|
|
}
|
2022-02-23 05:14:32 +00:00
|
|
|
}
|
2024-06-04 17:20:07 +00:00
|
|
|
#endif
|
2021-01-20 03:33:27 +00:00
|
|
|
}
|