diff --git a/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs b/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs
index bc82219c..ed47e719 100644
--- a/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs
+++ b/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs
@@ -125,6 +125,24 @@ namespace ComputeSharp
return buffer;
}
+ ///
+ /// Allocates a new readonly buffer with the specified parameters.
+ ///
+ /// The type of items to store in the buffer.
+ /// The instance to use to allocate the buffer.
+ /// The input with the data to copy on the allocated buffer.
+ /// A read write instance with the contents of the input .
+ [Pure]
+ public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, UploadBuffer source)
+ where T : unmanaged
+ {
+ ReadOnlyBuffer readWriteBuffer = new(device, source.Length, AllocationMode.Default);
+
+ readWriteBuffer.SetData(source, 0, source.Length, 0);
+
+ return readWriteBuffer;
+ }
+
///
/// Allocates a new readonly buffer with the specified parameters.
///
@@ -574,6 +592,24 @@ namespace ComputeSharp
return buffer;
}
+ ///
+ /// Allocates a new read write buffer with the specified parameters.
+ ///
+ /// The type of items to store in the buffer.
+ /// The instance to use to allocate the buffer.
+ /// The input with the data to copy on the allocated buffer.
+ /// A read write instance with the contents of the input .
+ [Pure]
+ public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, UploadBuffer source)
+ where T : unmanaged
+ {
+ ReadWriteBuffer readWriteBuffer = new(device, source.Length, AllocationMode.Default);
+
+ readWriteBuffer.SetData(source, 0, source.Length, 0);
+
+ return readWriteBuffer;
+ }
+
///
/// Allocates a new read write buffer with the specified parameters.
///
@@ -1038,24 +1074,6 @@ namespace ComputeSharp
return new(device, length, allocationMode);
}
- ///
- /// Allocates a new readonly buffer with the specified parameters.
- ///
- /// The type of items to store in the buffer.
- /// The instance to use to allocate the buffer.
- /// The input with the data to copy on the allocated buffer.
- /// A read write instance with the contents of the input array.
- [Pure]
- public static ReadBackBuffer AllocateReadBackBuffer(this GraphicsDevice device, StructuredBuffer source)
- where T : unmanaged
- {
- ReadBackBuffer buffer = new(device, source.Length, AllocationMode.Default);
-
- source.GetData(buffer, 0, buffer.Length, 0);
-
- return buffer;
- }
-
///
/// Allocates a new readonly buffer with the specified parameters.
///
@@ -1074,6 +1092,24 @@ namespace ComputeSharp
return buffer;
}
+ ///
+ /// Allocates a new readonly buffer with the specified parameters.
+ ///
+ /// The type of items to store in the buffer.
+ /// The instance to use to allocate the buffer.
+ /// The input with the data to copy on the allocated buffer.
+ /// A read write instance with the contents of the input array.
+ [Pure]
+ public static ReadBackBuffer AllocateReadBackBuffer(this GraphicsDevice device, StructuredBuffer source)
+ where T : unmanaged
+ {
+ ReadBackBuffer buffer = new(device, source.Length, AllocationMode.Default);
+
+ source.GetData(buffer, 0, buffer.Length, 0);
+
+ return buffer;
+ }
+
///
/// Compiles and runs the input shader on a target instance, with the specified parameters.
///