From f30d8f01975d9e528fc274673ae9fe643574f81c Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 7 Mar 2024 14:24:42 -0800 Subject: [PATCH] rename Discard to Cycle --- lib/RefreshCS | 2 +- src/Graphics/Font/TextBatch.cs | 6 +++--- src/Graphics/RefreshEnums.cs | 4 ++-- src/Graphics/RefreshStructs.cs | 14 ++++++-------- src/Graphics/ResourceUploader.cs | 2 +- src/Video/VideoPlayer.cs | 10 +++++----- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/RefreshCS b/lib/RefreshCS index 55acf6e..029f191 160000 --- a/lib/RefreshCS +++ b/lib/RefreshCS @@ -1 +1 @@ -Subproject commit 55acf6ee1818b0801cffe7217ee07eb1f56016f6 +Subproject commit 029f19196a94e13b8ed98d10f47a701221951f2f diff --git a/src/Graphics/Font/TextBatch.cs b/src/Graphics/Font/TextBatch.cs index b73d9a3..e4286d6 100644 --- a/src/Graphics/Font/TextBatch.cs +++ b/src/Graphics/Font/TextBatch.cs @@ -124,11 +124,11 @@ namespace MoonWorks.Graphics.Font if (vertexDataLengthInBytes > 0 && indexDataLengthInBytes > 0) { - TransferBuffer.SetData(vertexSpan, TransferOptions.Discard); + TransferBuffer.SetData(vertexSpan, TransferOptions.Cycle); TransferBuffer.SetData(indexSpan, (uint) vertexSpan.Length, TransferOptions.Overwrite); - commandBuffer.UploadToBuffer(TransferBuffer, VertexBuffer, new BufferCopy(0, 0, (uint) vertexSpan.Length), WriteOptions.SafeDiscard); - commandBuffer.UploadToBuffer(TransferBuffer, IndexBuffer, new BufferCopy((uint) vertexSpan.Length, 0, (uint) indexSpan.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.Cycle); } PrimitiveCount = vertexCount / 2; diff --git a/src/Graphics/RefreshEnums.cs b/src/Graphics/RefreshEnums.cs index 56de211..eeb6eaa 100644 --- a/src/Graphics/RefreshEnums.cs +++ b/src/Graphics/RefreshEnums.cs @@ -299,13 +299,13 @@ namespace MoonWorks.Graphics public enum TransferOptions { - Discard, + Cycle, Overwrite } public enum WriteOptions { - SafeDiscard, + Cycle, SafeOverwrite } diff --git a/src/Graphics/RefreshStructs.cs b/src/Graphics/RefreshStructs.cs index 7d376e3..4b30885 100644 --- a/src/Graphics/RefreshStructs.cs +++ b/src/Graphics/RefreshStructs.cs @@ -210,13 +210,12 @@ namespace MoonWorks.Graphics /// /// Specifies data dependency behavior. This option is ignored if LoadOp is Load.
/// - /// SafeDiscard: + /// Cycle: /// 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. /// 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 is a good option to prevent stalls when frequently reusing a texture slice in rendering.
+ /// This may prevent stalls when frequently reusing a texture slice in rendering.
/// /// SafeOverwrite: /// Overwrites the data safely using a GPU memory barrier. @@ -342,13 +341,12 @@ namespace MoonWorks.Graphics /// /// Specifies data dependency behavior. This option is ignored if LoadOp or StencilLoadOp is Load.
/// - /// SafeDiscard: + /// Cycle: /// 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. /// 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 is a good option to prevent stalls when frequently reusing a texture slice in rendering.
+ /// This may prevent stalls when frequently reusing a texture slice in rendering.
/// /// SafeOverwrite: /// Overwrites the data safely using a GPU memory barrier. diff --git a/src/Graphics/ResourceUploader.cs b/src/Graphics/ResourceUploader.cs index e7f0f3f..13d0b73 100644 --- a/src/Graphics/ResourceUploader.cs +++ b/src/Graphics/ResourceUploader.cs @@ -259,7 +259,7 @@ namespace MoonWorks.Graphics } var dataSpan = new Span(data, (int) dataSize); - TransferBuffer.SetData(dataSpan, TransferOptions.Discard); + TransferBuffer.SetData(dataSpan, TransferOptions.Cycle); } private void RecordUploadCommands(CommandBuffer commandBuffer) diff --git a/src/Video/VideoPlayer.cs b/src/Video/VideoPlayer.cs index 749f571..ea2d0f1 100644 --- a/src/Video/VideoPlayer.cs +++ b/src/Video/VideoPlayer.cs @@ -243,7 +243,7 @@ namespace MoonWorks.Video TransferBuffer?.Dispose(); 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(vSpan, (uint) (ySpan.Length + uSpan.Length), TransferOptions.Overwrite); @@ -258,7 +258,7 @@ namespace MoonWorks.Video BufferStride = CurrentStream.yStride, BufferImageHeight = yTexture.Height }, - WriteOptions.SafeDiscard + WriteOptions.Cycle ); commandBuffer.UploadToTexture( @@ -269,7 +269,7 @@ namespace MoonWorks.Video BufferStride = CurrentStream.uvStride, BufferImageHeight = uTexture.Height }, - WriteOptions.SafeDiscard + WriteOptions.Cycle ); commandBuffer.UploadToTexture( @@ -281,13 +281,13 @@ namespace MoonWorks.Video BufferStride = CurrentStream.uvStride, BufferImageHeight = vTexture.Height }, - WriteOptions.SafeDiscard + WriteOptions.Cycle ); commandBuffer.EndCopyPass(); commandBuffer.BeginRenderPass( - new ColorAttachmentInfo(RenderTexture, WriteOptions.SafeDiscard, Color.Black) + new ColorAttachmentInfo(RenderTexture, WriteOptions.Cycle, Color.Black) ); commandBuffer.BindGraphicsPipeline(Device.VideoPipeline);