2024-03-01 23:03:14 +00:00
|
|
|
using RefreshCS;
|
|
|
|
|
|
|
|
namespace MoonWorks.Graphics
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Binding specification to be used when binding buffers for compute shaders.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="GpuBuffer">The GpuBuffer to bind.</param>
|
|
|
|
/// <param name="WriteOption">
|
|
|
|
/// Specifies data dependency behavior when this buffer is written to in the shader. <br/>
|
|
|
|
///
|
2024-03-07 22:29:13 +00:00
|
|
|
/// Cycle:
|
2024-03-01 23:03:14 +00:00
|
|
|
/// If this buffer has been used in commands that have not finished,
|
2024-03-07 22:29:13 +00:00
|
|
|
/// the implementation may choose to prevent a dependency on those commands
|
2024-03-01 23:03:14 +00:00
|
|
|
/// at the cost of increased memory usage.
|
|
|
|
/// You may NOT assume that any of the previous data is retained.
|
2024-03-07 22:29:13 +00:00
|
|
|
/// This may prevent stalls when frequently updating a resource. <br />
|
2024-03-01 23:03:14 +00:00
|
|
|
///
|
|
|
|
/// SafeOverwrite:
|
|
|
|
/// Overwrites the data safely using a GPU memory barrier.
|
|
|
|
/// </param>
|
|
|
|
public readonly record struct ComputeBufferBinding(
|
|
|
|
GpuBuffer GpuBuffer,
|
|
|
|
WriteOptions WriteOption
|
|
|
|
) {
|
|
|
|
public Refresh.ComputeBufferBinding ToRefresh()
|
|
|
|
{
|
|
|
|
return new Refresh.ComputeBufferBinding
|
|
|
|
{
|
|
|
|
gpuBuffer = GpuBuffer.Handle,
|
|
|
|
writeOption = (Refresh.WriteOptions) WriteOption
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|