rename Discard to Cycle

what_if_no_video_threads
cosmonaut 2024-03-07 14:24:42 -08:00
parent bde31fbe07
commit f30d8f0197
6 changed files with 18 additions and 20 deletions

@ -1 +1 @@
Subproject commit 55acf6ee1818b0801cffe7217ee07eb1f56016f6 Subproject commit 029f19196a94e13b8ed98d10f47a701221951f2f

View File

@ -124,11 +124,11 @@ namespace MoonWorks.Graphics.Font
if (vertexDataLengthInBytes > 0 && indexDataLengthInBytes > 0) if (vertexDataLengthInBytes > 0 && indexDataLengthInBytes > 0)
{ {
TransferBuffer.SetData(vertexSpan, TransferOptions.Discard); TransferBuffer.SetData(vertexSpan, TransferOptions.Cycle);
TransferBuffer.SetData(indexSpan, (uint) vertexSpan.Length, TransferOptions.Overwrite); TransferBuffer.SetData(indexSpan, (uint) vertexSpan.Length, TransferOptions.Overwrite);
commandBuffer.UploadToBuffer(TransferBuffer, VertexBuffer, new BufferCopy(0, 0, (uint) vertexSpan.Length), WriteOptions.SafeDiscard); commandBuffer.UploadToBuffer(TransferBuffer, VertexBuffer, new BufferCopy(0, 0, (uint) vertexSpan.Length), WriteOptions.Cycle);
commandBuffer.UploadToBuffer(TransferBuffer, IndexBuffer, new BufferCopy((uint) vertexSpan.Length, 0, (uint) indexSpan.Length), WriteOptions.SafeDiscard); commandBuffer.UploadToBuffer(TransferBuffer, IndexBuffer, new BufferCopy((uint) vertexSpan.Length, 0, (uint) indexSpan.Length), WriteOptions.Cycle);
} }
PrimitiveCount = vertexCount / 2; PrimitiveCount = vertexCount / 2;

View File

@ -299,13 +299,13 @@ namespace MoonWorks.Graphics
public enum TransferOptions public enum TransferOptions
{ {
Discard, Cycle,
Overwrite Overwrite
} }
public enum WriteOptions public enum WriteOptions
{ {
SafeDiscard, Cycle,
SafeOverwrite SafeOverwrite
} }

View File

@ -210,13 +210,12 @@ namespace MoonWorks.Graphics
/// <summary> /// <summary>
/// Specifies data dependency behavior. This option is ignored if LoadOp is Load. <br/> /// Specifies data dependency behavior. This option is ignored if LoadOp is Load. <br/>
/// ///
/// SafeDiscard: /// Cycle:
/// If this texture slice has been used in commands that have not completed, /// If this texture slice has been used in commands that have not completed,
/// this option will prevent a dependency on those commands /// the implementation may prevent a dependency on those commands
/// at the cost of increased memory usage. /// at the cost of increased memory usage.
/// You may NOT assume that any of the previous texture (not slice!) data is retained. /// You may NOT assume that any of the previous texture (not slice!) data is retained.
/// If the texture slice was not in use, this is equivalent to SafeOverwrite. /// This may prevent stalls when frequently reusing a texture slice in rendering. <br/>
/// This is a good option to prevent stalls when frequently reusing a texture slice in rendering. <br/>
/// ///
/// SafeOverwrite: /// SafeOverwrite:
/// Overwrites the data safely using a GPU memory barrier. /// Overwrites the data safely using a GPU memory barrier.
@ -342,13 +341,12 @@ namespace MoonWorks.Graphics
/// <summary> /// <summary>
/// Specifies data dependency behavior. This option is ignored if LoadOp or StencilLoadOp is Load. <br/> /// Specifies data dependency behavior. This option is ignored if LoadOp or StencilLoadOp is Load. <br/>
/// ///
/// SafeDiscard: /// Cycle:
/// If this texture slice has been used in commands that have not completed, /// If this texture slice has been used in commands that have not completed,
/// this option will prevent a dependency on those commands /// the implementation may prevent a dependency on those commands
/// at the cost of increased memory usage. /// at the cost of increased memory usage.
/// You may NOT assume that any of the previous texture (not slice!) data is retained. /// You may NOT assume that any of the previous texture (not slice!) data is retained.
/// If the texture slice was not in use, this is equivalent to SafeOverwrite. /// This may prevent stalls when frequently reusing a texture slice in rendering. <br/>
/// This is a good option to prevent stalls when frequently reusing a texture slice in rendering. <br/>
/// ///
/// SafeOverwrite: /// SafeOverwrite:
/// Overwrites the data safely using a GPU memory barrier. /// Overwrites the data safely using a GPU memory barrier.

View File

@ -259,7 +259,7 @@ namespace MoonWorks.Graphics
} }
var dataSpan = new Span<byte>(data, (int) dataSize); var dataSpan = new Span<byte>(data, (int) dataSize);
TransferBuffer.SetData(dataSpan, TransferOptions.Discard); TransferBuffer.SetData(dataSpan, TransferOptions.Cycle);
} }
private void RecordUploadCommands(CommandBuffer commandBuffer) private void RecordUploadCommands(CommandBuffer commandBuffer)

View File

@ -243,7 +243,7 @@ namespace MoonWorks.Video
TransferBuffer?.Dispose(); TransferBuffer?.Dispose();
TransferBuffer = new TransferBuffer(Device, (uint) (ySpan.Length + uSpan.Length + vSpan.Length)); TransferBuffer = new TransferBuffer(Device, (uint) (ySpan.Length + uSpan.Length + vSpan.Length));
} }
TransferBuffer.SetData(ySpan, 0, TransferOptions.Discard); TransferBuffer.SetData(ySpan, 0, TransferOptions.Cycle);
TransferBuffer.SetData(uSpan, (uint) ySpan.Length, TransferOptions.Overwrite); TransferBuffer.SetData(uSpan, (uint) ySpan.Length, TransferOptions.Overwrite);
TransferBuffer.SetData(vSpan, (uint) (ySpan.Length + uSpan.Length), TransferOptions.Overwrite); TransferBuffer.SetData(vSpan, (uint) (ySpan.Length + uSpan.Length), TransferOptions.Overwrite);
@ -258,7 +258,7 @@ namespace MoonWorks.Video
BufferStride = CurrentStream.yStride, BufferStride = CurrentStream.yStride,
BufferImageHeight = yTexture.Height BufferImageHeight = yTexture.Height
}, },
WriteOptions.SafeDiscard WriteOptions.Cycle
); );
commandBuffer.UploadToTexture( commandBuffer.UploadToTexture(
@ -269,7 +269,7 @@ namespace MoonWorks.Video
BufferStride = CurrentStream.uvStride, BufferStride = CurrentStream.uvStride,
BufferImageHeight = uTexture.Height BufferImageHeight = uTexture.Height
}, },
WriteOptions.SafeDiscard WriteOptions.Cycle
); );
commandBuffer.UploadToTexture( commandBuffer.UploadToTexture(
@ -281,13 +281,13 @@ namespace MoonWorks.Video
BufferStride = CurrentStream.uvStride, BufferStride = CurrentStream.uvStride,
BufferImageHeight = vTexture.Height BufferImageHeight = vTexture.Height
}, },
WriteOptions.SafeDiscard WriteOptions.Cycle
); );
commandBuffer.EndCopyPass(); commandBuffer.EndCopyPass();
commandBuffer.BeginRenderPass( commandBuffer.BeginRenderPass(
new ColorAttachmentInfo(RenderTexture, WriteOptions.SafeDiscard, Color.Black) new ColorAttachmentInfo(RenderTexture, WriteOptions.Cycle, Color.Black)
); );
commandBuffer.BindGraphicsPipeline(Device.VideoPipeline); commandBuffer.BindGraphicsPipeline(Device.VideoPipeline);