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)
{
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;

View File

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

View File

@ -210,13 +210,12 @@ namespace MoonWorks.Graphics
/// <summary>
/// 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,
/// 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. <br/>
/// This may prevent stalls when frequently reusing a texture slice in rendering. <br/>
///
/// SafeOverwrite:
/// Overwrites the data safely using a GPU memory barrier.
@ -342,13 +341,12 @@ namespace MoonWorks.Graphics
/// <summary>
/// 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,
/// 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. <br/>
/// This may prevent stalls when frequently reusing a texture slice in rendering. <br/>
///
/// SafeOverwrite:
/// 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);
TransferBuffer.SetData(dataSpan, TransferOptions.Discard);
TransferBuffer.SetData(dataSpan, TransferOptions.Cycle);
}
private void RecordUploadCommands(CommandBuffer commandBuffer)

View File

@ -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);