another refresh2 update
parent
178a5ea3cf
commit
e0f4c19dc2
|
@ -1 +1 @@
|
|||
Subproject commit 2e346d84016fb7b26dbe7c5b6c485109571c30f4
|
||||
Subproject commit 031ad4c04781fe4a0d98a177333ebf7764d2fe91
|
|
@ -1949,7 +1949,8 @@ namespace MoonWorks.Graphics
|
|||
public void UploadToTexture(
|
||||
TransferBuffer transferBuffer,
|
||||
in TextureSlice textureSlice,
|
||||
in BufferImageCopy copyParams
|
||||
in BufferImageCopy copyParams,
|
||||
CopyOptions option
|
||||
)
|
||||
{
|
||||
#if DEBUG
|
||||
|
@ -1963,7 +1964,8 @@ namespace MoonWorks.Graphics
|
|||
Handle,
|
||||
transferBuffer.Handle,
|
||||
textureSlice.ToRefreshTextureSlice(),
|
||||
copyParams.ToRefresh()
|
||||
copyParams.ToRefresh(),
|
||||
(Refresh.CopyOptions) option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1972,12 +1974,14 @@ namespace MoonWorks.Graphics
|
|||
/// </summary>
|
||||
public void UploadToTexture(
|
||||
TransferBuffer transferBuffer,
|
||||
Texture texture
|
||||
Texture texture,
|
||||
CopyOptions option
|
||||
) {
|
||||
UploadToTexture(
|
||||
transferBuffer,
|
||||
new TextureSlice(texture),
|
||||
new BufferImageCopy(0, 0, 0)
|
||||
new BufferImageCopy(0, 0, 0),
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1993,7 +1997,8 @@ namespace MoonWorks.Graphics
|
|||
public void UploadToBuffer(
|
||||
TransferBuffer transferBuffer,
|
||||
GpuBuffer gpuBuffer,
|
||||
in BufferCopy copyParams
|
||||
in BufferCopy copyParams,
|
||||
CopyOptions option
|
||||
) {
|
||||
#if DEBUG
|
||||
AssertNotSubmitted();
|
||||
|
@ -2007,7 +2012,8 @@ namespace MoonWorks.Graphics
|
|||
Handle,
|
||||
transferBuffer.Handle,
|
||||
gpuBuffer.Handle,
|
||||
copyParams.ToRefresh()
|
||||
copyParams.ToRefresh(),
|
||||
(Refresh.CopyOptions) option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2016,12 +2022,14 @@ namespace MoonWorks.Graphics
|
|||
/// </summary>
|
||||
public void UploadToBuffer(
|
||||
TransferBuffer transferBuffer,
|
||||
GpuBuffer gpuBuffer
|
||||
GpuBuffer gpuBuffer,
|
||||
CopyOptions option
|
||||
) {
|
||||
UploadToBuffer(
|
||||
transferBuffer,
|
||||
gpuBuffer,
|
||||
new BufferCopy(0, 0, transferBuffer.Size)
|
||||
new BufferCopy(0, 0, transferBuffer.Size),
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2033,7 +2041,8 @@ namespace MoonWorks.Graphics
|
|||
GpuBuffer gpuBuffer,
|
||||
uint sourceStartElement,
|
||||
uint destinationStartElement,
|
||||
uint numElements
|
||||
uint numElements,
|
||||
CopyOptions option
|
||||
) where T : unmanaged
|
||||
{
|
||||
var elementSize = Marshal.SizeOf<T>();
|
||||
|
@ -2048,7 +2057,8 @@ namespace MoonWorks.Graphics
|
|||
srcOffsetInBytes,
|
||||
dstOffsetInBytes,
|
||||
dataLengthInBytes
|
||||
)
|
||||
),
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2062,7 +2072,8 @@ namespace MoonWorks.Graphics
|
|||
public void DownloadFromTexture(
|
||||
in TextureSlice textureSlice,
|
||||
TransferBuffer transferBuffer,
|
||||
in BufferImageCopy copyParams
|
||||
in BufferImageCopy copyParams,
|
||||
TransferOptions option
|
||||
) {
|
||||
#if DEBUG
|
||||
AssertNotSubmitted();
|
||||
|
@ -2075,7 +2086,8 @@ namespace MoonWorks.Graphics
|
|||
Handle,
|
||||
textureSlice.ToRefreshTextureSlice(),
|
||||
transferBuffer.Handle,
|
||||
copyParams.ToRefresh()
|
||||
copyParams.ToRefresh(),
|
||||
(Refresh.TransferOptions) option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2084,12 +2096,14 @@ namespace MoonWorks.Graphics
|
|||
/// </summary>
|
||||
public void DownloadFromTexture(
|
||||
Texture texture,
|
||||
TransferBuffer transferBuffer
|
||||
TransferBuffer transferBuffer,
|
||||
TransferOptions option
|
||||
) {
|
||||
DownloadFromTexture(
|
||||
new TextureSlice(texture),
|
||||
transferBuffer,
|
||||
new BufferImageCopy(0, 0, 0)
|
||||
new BufferImageCopy(0, 0, 0),
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2103,7 +2117,8 @@ namespace MoonWorks.Graphics
|
|||
public void DownloadFromBuffer(
|
||||
GpuBuffer gpuBuffer,
|
||||
TransferBuffer transferBuffer,
|
||||
in BufferCopy copyParams
|
||||
in BufferCopy copyParams,
|
||||
TransferOptions option
|
||||
) {
|
||||
#if DEBUG
|
||||
AssertNotSubmitted();
|
||||
|
@ -2116,7 +2131,8 @@ namespace MoonWorks.Graphics
|
|||
Handle,
|
||||
gpuBuffer.Handle,
|
||||
transferBuffer.Handle,
|
||||
copyParams.ToRefresh()
|
||||
copyParams.ToRefresh(),
|
||||
(Refresh.TransferOptions) option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2129,12 +2145,14 @@ namespace MoonWorks.Graphics
|
|||
/// </summary>
|
||||
public void DownloadFromBuffer(
|
||||
GpuBuffer gpuBuffer,
|
||||
TransferBuffer transferBuffer
|
||||
TransferBuffer transferBuffer,
|
||||
TransferOptions option
|
||||
) {
|
||||
DownloadFromBuffer(
|
||||
gpuBuffer,
|
||||
transferBuffer,
|
||||
new BufferCopy(0, 0, gpuBuffer.Size)
|
||||
new BufferCopy(0, 0, gpuBuffer.Size),
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2147,7 +2165,8 @@ namespace MoonWorks.Graphics
|
|||
/// </summary>
|
||||
public void CopyTextureToTexture(
|
||||
in TextureSlice source,
|
||||
in TextureSlice destination
|
||||
in TextureSlice destination,
|
||||
CopyOptions option
|
||||
) {
|
||||
#if DEBUG
|
||||
AssertNotSubmitted();
|
||||
|
@ -2159,7 +2178,8 @@ namespace MoonWorks.Graphics
|
|||
Device.Handle,
|
||||
Handle,
|
||||
source.ToRefreshTextureSlice(),
|
||||
destination.ToRefreshTextureSlice()
|
||||
destination.ToRefreshTextureSlice(),
|
||||
(Refresh.CopyOptions) option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2169,11 +2189,13 @@ namespace MoonWorks.Graphics
|
|||
/// </summary>
|
||||
public void CopyTextureToTexture(
|
||||
Texture source,
|
||||
Texture destination
|
||||
Texture destination,
|
||||
CopyOptions option
|
||||
) {
|
||||
CopyTextureToTexture(
|
||||
new TextureSlice(source),
|
||||
new TextureSlice(destination)
|
||||
new TextureSlice(destination),
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2186,7 +2208,8 @@ namespace MoonWorks.Graphics
|
|||
public void CopyTextureToBuffer(
|
||||
in TextureSlice textureSlice,
|
||||
GpuBuffer buffer,
|
||||
in BufferImageCopy copyParams
|
||||
in BufferImageCopy copyParams,
|
||||
CopyOptions option
|
||||
) {
|
||||
#if DEBUG
|
||||
AssertNotSubmitted();
|
||||
|
@ -2199,7 +2222,8 @@ namespace MoonWorks.Graphics
|
|||
Handle,
|
||||
textureSlice.ToRefreshTextureSlice(),
|
||||
buffer.Handle,
|
||||
copyParams.ToRefresh()
|
||||
copyParams.ToRefresh(),
|
||||
(Refresh.CopyOptions) option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2208,12 +2232,14 @@ namespace MoonWorks.Graphics
|
|||
/// </summary>
|
||||
public void CopyTextureToBuffer(
|
||||
Texture texture,
|
||||
GpuBuffer buffer
|
||||
GpuBuffer buffer,
|
||||
CopyOptions option
|
||||
) {
|
||||
CopyTextureToBuffer(
|
||||
new TextureSlice(texture),
|
||||
buffer,
|
||||
new BufferImageCopy(0, 0, 0)
|
||||
new BufferImageCopy(0, 0, 0),
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2226,7 +2252,8 @@ namespace MoonWorks.Graphics
|
|||
public void CopyBufferToTexture(
|
||||
GpuBuffer gpuBuffer,
|
||||
in TextureSlice textureSlice,
|
||||
in BufferImageCopy copyParams
|
||||
in BufferImageCopy copyParams,
|
||||
CopyOptions option
|
||||
) {
|
||||
#if DEBUG
|
||||
AssertNotSubmitted();
|
||||
|
@ -2239,7 +2266,8 @@ namespace MoonWorks.Graphics
|
|||
Handle,
|
||||
gpuBuffer.Handle,
|
||||
textureSlice.ToRefreshTextureSlice(),
|
||||
copyParams.ToRefresh()
|
||||
copyParams.ToRefresh(),
|
||||
(Refresh.CopyOptions) option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2248,12 +2276,14 @@ namespace MoonWorks.Graphics
|
|||
/// </summary>
|
||||
public void CopyBufferToTexture(
|
||||
GpuBuffer buffer,
|
||||
Texture texture
|
||||
Texture texture,
|
||||
CopyOptions option
|
||||
) {
|
||||
CopyBufferToTexture(
|
||||
buffer,
|
||||
new TextureSlice(texture),
|
||||
new BufferImageCopy(0, 0, 0)
|
||||
new BufferImageCopy(0, 0, 0),
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2266,7 +2296,8 @@ namespace MoonWorks.Graphics
|
|||
public void CopyBufferToBuffer(
|
||||
GpuBuffer source,
|
||||
GpuBuffer destination,
|
||||
in BufferCopy copyParams
|
||||
in BufferCopy copyParams,
|
||||
CopyOptions option
|
||||
) {
|
||||
#if DEBUG
|
||||
AssertNotSubmitted();
|
||||
|
@ -2280,7 +2311,8 @@ namespace MoonWorks.Graphics
|
|||
Handle,
|
||||
source.Handle,
|
||||
destination.Handle,
|
||||
copyParams.ToRefresh()
|
||||
copyParams.ToRefresh(),
|
||||
(Refresh.CopyOptions) option
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2289,12 +2321,14 @@ namespace MoonWorks.Graphics
|
|||
/// </summary>
|
||||
public void CopyBufferToBuffer(
|
||||
GpuBuffer source,
|
||||
GpuBuffer destination
|
||||
GpuBuffer destination,
|
||||
CopyOptions option
|
||||
) {
|
||||
CopyBufferToBuffer(
|
||||
source,
|
||||
destination,
|
||||
new BufferCopy(0, 0, source.Size)
|
||||
new BufferCopy(0, 0, source.Size),
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,13 +56,14 @@ namespace MoonWorks.Graphics.Font
|
|||
imagePath,
|
||||
transferBuffer,
|
||||
0,
|
||||
SetDataOptions.Overwrite
|
||||
TransferOptions.Overwrite
|
||||
);
|
||||
|
||||
commandBuffer.BeginCopyPass();
|
||||
commandBuffer.UploadToTexture(
|
||||
transferBuffer,
|
||||
texture
|
||||
texture,
|
||||
CopyOptions.SafeOverwrite
|
||||
);
|
||||
commandBuffer.EndCopyPass();
|
||||
|
||||
|
|
|
@ -124,11 +124,11 @@ namespace MoonWorks.Graphics.Font
|
|||
|
||||
if (vertexDataLengthInBytes > 0 && indexDataLengthInBytes > 0)
|
||||
{
|
||||
TransferBuffer.SetData(vertexSpan, SetDataOptions.Discard);
|
||||
TransferBuffer.SetData(indexSpan, (uint) vertexSpan.Length, SetDataOptions.Overwrite);
|
||||
TransferBuffer.SetData(vertexSpan, TransferOptions.Discard);
|
||||
TransferBuffer.SetData(indexSpan, (uint) vertexSpan.Length, TransferOptions.Overwrite);
|
||||
|
||||
commandBuffer.UploadToBuffer(TransferBuffer, VertexBuffer, new BufferCopy(0, 0, (uint) vertexSpan.Length));
|
||||
commandBuffer.UploadToBuffer(TransferBuffer, IndexBuffer, new BufferCopy((uint) vertexSpan.Length, 0, (uint) indexSpan.Length));
|
||||
commandBuffer.UploadToBuffer(TransferBuffer, VertexBuffer, new BufferCopy(0, 0, (uint) vertexSpan.Length), CopyOptions.SafeDiscard);
|
||||
commandBuffer.UploadToBuffer(TransferBuffer, IndexBuffer, new BufferCopy((uint) vertexSpan.Length, 0, (uint) indexSpan.Length), CopyOptions.SafeDiscard);
|
||||
}
|
||||
|
||||
PrimitiveCount = vertexCount / 2;
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace MoonWorks.Graphics
|
|||
Span<byte> data,
|
||||
TransferBuffer transferBuffer,
|
||||
uint bufferOffsetInBytes,
|
||||
SetDataOptions option
|
||||
TransferOptions option
|
||||
) {
|
||||
var pixelData = GetPixelDataFromBytes(data, out var w, out var h, out var sizeInBytes);
|
||||
var length = transferBuffer.SetData(new Span<byte>((void*) pixelData, (int) sizeInBytes), bufferOffsetInBytes, option);
|
||||
|
@ -167,7 +167,7 @@ namespace MoonWorks.Graphics
|
|||
Stream stream,
|
||||
TransferBuffer transferBuffer,
|
||||
uint bufferOffsetInBytes,
|
||||
SetDataOptions option
|
||||
TransferOptions option
|
||||
) {
|
||||
var pixelData = GetPixelDataFromStream(stream, out var w, out var h, out var sizeInBytes);
|
||||
var length = transferBuffer.SetData(new Span<byte>((void*) pixelData, (int) sizeInBytes), bufferOffsetInBytes, option);
|
||||
|
@ -182,7 +182,7 @@ namespace MoonWorks.Graphics
|
|||
string path,
|
||||
TransferBuffer transferBuffer,
|
||||
uint bufferOffsetInBytes,
|
||||
SetDataOptions option
|
||||
TransferOptions option
|
||||
) {
|
||||
var pixelData = GetPixelDataFromFile(path, out var w, out var h, out var sizeInBytes);
|
||||
var length = transferBuffer.SetData(new Span<byte>((void*) pixelData, (int) sizeInBytes), bufferOffsetInBytes, option);
|
||||
|
|
|
@ -297,12 +297,18 @@ namespace MoonWorks.Graphics
|
|||
IntOpaqueWhite
|
||||
}
|
||||
|
||||
public enum SetDataOptions
|
||||
public enum TransferOptions
|
||||
{
|
||||
Discard,
|
||||
Overwrite
|
||||
}
|
||||
|
||||
public enum CopyOptions
|
||||
{
|
||||
SafeDiscard,
|
||||
SafeOverwrite
|
||||
}
|
||||
|
||||
public enum Backend
|
||||
{
|
||||
DontCare,
|
||||
|
|
|
@ -21,8 +21,8 @@ namespace MoonWorks.Graphics
|
|||
uint dataOffset = 0;
|
||||
uint dataSize = 1024;
|
||||
|
||||
List<(GpuBuffer, BufferCopy)> BufferUploads = new List<(GpuBuffer, BufferCopy)>();
|
||||
List<(TextureSlice, uint)> TextureUploads = new List<(TextureSlice, uint)>();
|
||||
List<(GpuBuffer, BufferCopy, CopyOptions)> BufferUploads = new List<(GpuBuffer, BufferCopy, CopyOptions)>();
|
||||
List<(TextureSlice, uint, CopyOptions)> TextureUploads = new List<(TextureSlice, uint, CopyOptions)>();
|
||||
|
||||
public ResourceUploader(GraphicsDevice device) : base(device)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ namespace MoonWorks.Graphics
|
|||
var lengthInBytes = (uint) (Marshal.SizeOf<T>() * data.Length);
|
||||
var gpuBuffer = new GpuBuffer(Device, usageFlags, lengthInBytes);
|
||||
|
||||
SetBufferData(gpuBuffer, 0, data);
|
||||
SetBufferData(gpuBuffer, 0, data, CopyOptions.SafeOverwrite);
|
||||
|
||||
return gpuBuffer;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace MoonWorks.Graphics
|
|||
/// <summary>
|
||||
/// Prepares upload of data into a GpuBuffer.
|
||||
/// </summary>
|
||||
public void SetBufferData<T>(GpuBuffer buffer, uint bufferOffsetInElements, Span<T> data) where T : unmanaged
|
||||
public void SetBufferData<T>(GpuBuffer buffer, uint bufferOffsetInElements, Span<T> data, CopyOptions option) where T : unmanaged
|
||||
{
|
||||
uint elementSize = (uint) Marshal.SizeOf<T>();
|
||||
uint offsetInBytes = elementSize * bufferOffsetInElements;
|
||||
|
@ -60,7 +60,7 @@ namespace MoonWorks.Graphics
|
|||
}
|
||||
|
||||
var bufferCopyParams = new BufferCopy(resourceOffset, offsetInBytes, lengthInBytes);
|
||||
BufferUploads.Add((buffer, bufferCopyParams));
|
||||
BufferUploads.Add((buffer, bufferCopyParams, option));
|
||||
}
|
||||
|
||||
// Textures
|
||||
|
@ -68,7 +68,7 @@ namespace MoonWorks.Graphics
|
|||
public Texture CreateTexture2D(Span<byte> pixelData, uint width, uint height)
|
||||
{
|
||||
var texture = Texture.CreateTexture2D(Device, width, height, TextureFormat.R8G8B8A8, TextureUsageFlags.Sampler);
|
||||
SetTextureData(texture, pixelData);
|
||||
SetTextureData(texture, pixelData, CopyOptions.SafeOverwrite);
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ namespace MoonWorks.Graphics
|
|||
Depth = 1
|
||||
};
|
||||
|
||||
SetTextureData(textureSlice, byteSpan);
|
||||
SetTextureData(textureSlice, byteSpan, CopyOptions.SafeOverwrite);
|
||||
|
||||
NativeMemory.Free(byteBuffer);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ namespace MoonWorks.Graphics
|
|||
var pixelData = ImageUtils.GetPixelDataFromBytes(compressedImageData, out var _, out var _, out var sizeInBytes);
|
||||
var pixelSpan = new Span<byte>((void*) pixelData, (int) sizeInBytes);
|
||||
|
||||
SetTextureData(textureSlice, pixelSpan);
|
||||
SetTextureData(textureSlice, pixelSpan, CopyOptions.SafeOverwrite);
|
||||
|
||||
ImageUtils.FreePixelData(pixelData);
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ namespace MoonWorks.Graphics
|
|||
/// <summary>
|
||||
/// Prepares upload of pixel data into a TextureSlice.
|
||||
/// </summary>
|
||||
public void SetTextureData<T>(TextureSlice textureSlice, Span<T> data) where T : unmanaged
|
||||
public void SetTextureData<T>(TextureSlice textureSlice, Span<T> data, CopyOptions option) where T : unmanaged
|
||||
{
|
||||
var elementSize = Marshal.SizeOf<T>();
|
||||
var dataLengthInBytes = (uint) (elementSize * data.Length);
|
||||
|
@ -214,7 +214,7 @@ namespace MoonWorks.Graphics
|
|||
resourceOffset = CopyDataAligned(dataPtr, dataLengthInBytes, Texture.TexelSize(textureSlice.Texture.Format));
|
||||
}
|
||||
|
||||
TextureUploads.Add((textureSlice, resourceOffset));
|
||||
TextureUploads.Add((textureSlice, resourceOffset, option));
|
||||
}
|
||||
|
||||
// Upload
|
||||
|
@ -257,23 +257,24 @@ namespace MoonWorks.Graphics
|
|||
}
|
||||
|
||||
var dataSpan = new Span<byte>(data, (int) dataSize);
|
||||
TransferBuffer.SetData(dataSpan, SetDataOptions.Discard);
|
||||
TransferBuffer.SetData(dataSpan, TransferOptions.Discard);
|
||||
}
|
||||
|
||||
private void RecordUploadCommands(CommandBuffer commandBuffer)
|
||||
{
|
||||
commandBuffer.BeginCopyPass();
|
||||
|
||||
foreach (var (gpuBuffer, bufferCopyParams) in BufferUploads)
|
||||
foreach (var (gpuBuffer, bufferCopyParams, option) in BufferUploads)
|
||||
{
|
||||
commandBuffer.UploadToBuffer(
|
||||
TransferBuffer,
|
||||
gpuBuffer,
|
||||
bufferCopyParams
|
||||
bufferCopyParams,
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
foreach (var (textureSlice, offset) in TextureUploads)
|
||||
foreach (var (textureSlice, offset, option) in TextureUploads)
|
||||
{
|
||||
commandBuffer.UploadToTexture(
|
||||
TransferBuffer,
|
||||
|
@ -282,7 +283,8 @@ namespace MoonWorks.Graphics
|
|||
offset,
|
||||
0,
|
||||
0
|
||||
)
|
||||
),
|
||||
option
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace MoonWorks.Graphics
|
|||
public unsafe uint SetData<T>(
|
||||
Span<T> data,
|
||||
uint bufferOffsetInBytes,
|
||||
SetDataOptions setDataOption
|
||||
TransferOptions setDataOption
|
||||
) where T : unmanaged
|
||||
{
|
||||
var elementSize = Marshal.SizeOf<T>();
|
||||
|
@ -73,7 +73,7 @@ namespace MoonWorks.Graphics
|
|||
|
||||
fixed (T* dataPtr = data)
|
||||
{
|
||||
Refresh.Refresh_SetData(
|
||||
Refresh.Refresh_SetTransferData(
|
||||
Device.Handle,
|
||||
(nint) dataPtr,
|
||||
Handle,
|
||||
|
@ -83,7 +83,7 @@ namespace MoonWorks.Graphics
|
|||
dstOffset = bufferOffsetInBytes,
|
||||
size = dataLengthInBytes
|
||||
},
|
||||
(Refresh.SetDataOptions) setDataOption
|
||||
(Refresh.TransferOptions) setDataOption
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ namespace MoonWorks.Graphics
|
|||
/// </summary>
|
||||
public unsafe uint SetData<T>(
|
||||
Span<T> data,
|
||||
SetDataOptions setDataOption
|
||||
TransferOptions setDataOption
|
||||
) where T : unmanaged
|
||||
{
|
||||
return SetData(data, 0, setDataOption);
|
||||
|
@ -125,7 +125,7 @@ namespace MoonWorks.Graphics
|
|||
|
||||
fixed (T* dataPtr = data)
|
||||
{
|
||||
Refresh.Refresh_GetData(
|
||||
Refresh.Refresh_GetTransferData(
|
||||
Device.Handle,
|
||||
Handle,
|
||||
(nint) dataPtr,
|
||||
|
|
|
@ -243,9 +243,9 @@ namespace MoonWorks.Video
|
|||
TransferBuffer?.Dispose();
|
||||
TransferBuffer = new TransferBuffer(Device, (uint) (ySpan.Length + uSpan.Length + vSpan.Length));
|
||||
}
|
||||
TransferBuffer.SetData(ySpan, 0, SetDataOptions.Discard);
|
||||
TransferBuffer.SetData(uSpan, (uint) ySpan.Length, SetDataOptions.Overwrite);
|
||||
TransferBuffer.SetData(vSpan, (uint) (ySpan.Length + uSpan.Length), SetDataOptions.Overwrite);
|
||||
TransferBuffer.SetData(ySpan, 0, TransferOptions.Discard);
|
||||
TransferBuffer.SetData(uSpan, (uint) ySpan.Length, TransferOptions.Overwrite);
|
||||
TransferBuffer.SetData(vSpan, (uint) (ySpan.Length + uSpan.Length), TransferOptions.Overwrite);
|
||||
|
||||
commandBuffer.BeginCopyPass();
|
||||
|
||||
|
@ -257,7 +257,8 @@ namespace MoonWorks.Video
|
|||
BufferOffset = 0,
|
||||
BufferStride = CurrentStream.yStride,
|
||||
BufferImageHeight = yTexture.Height
|
||||
}
|
||||
},
|
||||
CopyOptions.SafeDiscard
|
||||
);
|
||||
|
||||
commandBuffer.UploadToTexture(
|
||||
|
@ -267,7 +268,8 @@ namespace MoonWorks.Video
|
|||
BufferOffset = (uint) ySpan.Length,
|
||||
BufferStride = CurrentStream.uvStride,
|
||||
BufferImageHeight = uTexture.Height
|
||||
}
|
||||
},
|
||||
CopyOptions.SafeDiscard
|
||||
);
|
||||
|
||||
commandBuffer.UploadToTexture(
|
||||
|
@ -278,7 +280,8 @@ namespace MoonWorks.Video
|
|||
BufferOffset = (uint) (ySpan.Length + uSpan.Length),
|
||||
BufferStride = CurrentStream.uvStride,
|
||||
BufferImageHeight = vTexture.Height
|
||||
}
|
||||
},
|
||||
CopyOptions.SafeDiscard
|
||||
);
|
||||
|
||||
commandBuffer.EndCopyPass();
|
||||
|
|
Loading…
Reference in New Issue