diff --git a/src/ComputeSharp.Graphics/Buffers/Abstract/HlslBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/Abstract/Buffer{T}.cs similarity index 84% rename from src/ComputeSharp.Graphics/Buffers/Abstract/HlslBuffer{T}.cs rename to src/ComputeSharp.Graphics/Buffers/Abstract/Buffer{T}.cs index 1e70dc88..0e17e3be 100644 --- a/src/ComputeSharp.Graphics/Buffers/Abstract/HlslBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/Abstract/Buffer{T}.cs @@ -16,7 +16,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract /// A representing a typed buffer stored on GPU memory. /// /// The type of items stored on the buffer. - public unsafe abstract class HlslBuffer : NativeObject + public unsafe abstract class Buffer : NativeObject where T : unmanaged { /// @@ -50,18 +50,18 @@ namespace ComputeSharp.Graphics.Buffers.Abstract internal readonly int PaddedElementSizeInBytes; /// - /// The buffer type for the current instance. + /// The buffer type for the current instance. /// internal readonly BufferType BufferType; /// - /// Creates a new instance with the specified parameters. + /// Creates a new instance with the specified parameters. /// /// The associated with the current instance. /// The number of items to store in the current buffer. /// The size in bytes for the current buffer. /// The buffer type for the current buffer. - internal HlslBuffer(GraphicsDevice device, int size, int sizeInBytes, BufferType bufferType) + internal Buffer(GraphicsDevice device, int size, int sizeInBytes, BufferType bufferType) { this.d3D12Resource = device.D3D12Device->CreateCommittedResource(bufferType, sizeInBytes); @@ -104,14 +104,14 @@ namespace ComputeSharp.Graphics.Buffers.Abstract internal ID3D12Resource* D3D12Resource => this.d3D12Resource; /// - /// Reads the contents of the current instance and returns an array + /// Reads the contents of the current instance and returns an array /// /// A array with the contents of the current buffer [Pure] public T[] GetData() => GetData(0, Size); /// - /// Reads the contents of the current instance in a given range and returns an array + /// Reads the contents of the current instance in a given range and returns an array /// /// The offset to start reading data from /// The number of items to read @@ -126,13 +126,13 @@ namespace ComputeSharp.Graphics.Buffers.Abstract } /// - /// Reads the contents of the current instance and writes them into a target + /// Reads the contents of the current instance and writes them into a target /// /// The input to write data to public void GetData(Span span) => GetData(span, 0, Size); /// - /// Reads the contents of the specified range from the current instance and writes them into a target + /// Reads the contents of the specified range from the current instance and writes them into a target /// /// The input to write data to /// The offset to start reading data from @@ -140,13 +140,13 @@ namespace ComputeSharp.Graphics.Buffers.Abstract public abstract void GetData(Span span, int offset, int count); /// - /// Writes the contents of a given array to the current instance + /// Writes the contents of a given array to the current instance /// /// The input array to read data from public void SetData(T[] array) => SetData(array.AsSpan()); /// - /// Writes the contents of a given array to a specified area of the current instance + /// Writes the contents of a given array to a specified area of the current instance /// /// The input array to read data from /// The offset to start writing data to @@ -154,13 +154,13 @@ namespace ComputeSharp.Graphics.Buffers.Abstract public void SetData(T[] array, int offset, int count) => SetData(array.AsSpan(), offset, count); /// - /// Writes the contents of a given to the current instance + /// Writes the contents of a given to the current instance /// /// The input to read data from public void SetData(ReadOnlySpan span) => SetData(span, 0, Size); /// - /// Writes the contents of a given to a specified area of the current instance + /// Writes the contents of a given to a specified area of the current instance /// /// The input to read data from /// The offset to start writing data to @@ -168,16 +168,16 @@ namespace ComputeSharp.Graphics.Buffers.Abstract public abstract void SetData(ReadOnlySpan span, int offset, int count); /// - /// Writes the contents of a given to the current instance + /// Writes the contents of a given to the current instance /// - /// The input to read data from - public abstract void SetData(HlslBuffer buffer); + /// The input to read data from + public abstract void SetData(Buffer buffer); /// - /// Writes the contents of a given to the current instance, using a temporary CPU buffer + /// Writes the contents of a given to the current instance, using a temporary CPU buffer /// - /// The input to read data from - protected void SetDataWithCpuBuffer(HlslBuffer buffer) + /// The input to read data from + protected void SetDataWithCpuBuffer(Buffer buffer) { // Create a temporary array T[] array = ArrayPool.Shared.Rent(buffer.Size); diff --git a/src/ComputeSharp.Graphics/Buffers/Abstract/HlslStructuredBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/Abstract/StructuredBuffer{T}.cs similarity index 90% rename from src/ComputeSharp.Graphics/Buffers/Abstract/HlslStructuredBuffer{T}.cs rename to src/ComputeSharp.Graphics/Buffers/Abstract/StructuredBuffer{T}.cs index 5ead35b8..ff87c3c9 100644 --- a/src/ComputeSharp.Graphics/Buffers/Abstract/HlslStructuredBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/Abstract/StructuredBuffer{T}.cs @@ -14,16 +14,16 @@ namespace ComputeSharp.Graphics.Buffers.Abstract /// A representing a typed structured buffer stored on GPU memory /// /// The type of items stored on the buffer - public abstract class HlslStructuredBuffer : HlslBuffer + public abstract class StructuredBuffer : Buffer where T : unmanaged { /// - /// Creates a new instance with the specified parameters + /// Creates a new instance with the specified parameters /// /// The associated with the current instance /// The number of items to store in the current buffer /// The buffer type for the current buffer - internal HlslStructuredBuffer(GraphicsDevice device, int size, BufferType bufferType) + internal StructuredBuffer(GraphicsDevice device, int size, BufferType bufferType) : base(device, size, size * Unsafe.SizeOf(), bufferType) { } @@ -69,7 +69,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract } /// - public override unsafe void SetData(HlslBuffer buffer) + public override unsafe void SetData(Buffer buffer) { if (!buffer.IsPaddingPresent) { diff --git a/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs index ae008323..2264c206 100644 --- a/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/ConstantBuffer{T}.cs @@ -18,7 +18,7 @@ namespace ComputeSharp /// A representing a typed read write buffer stored on GPU memory /// /// The type of items stored on the buffer - public sealed class ConstantBuffer : HlslBuffer + public sealed class ConstantBuffer : Buffer where T : unmanaged { /// @@ -95,7 +95,7 @@ namespace ComputeSharp } /// - public override unsafe void SetData(HlslBuffer buffer) + public override unsafe void SetData(Buffer buffer) { if (buffer is ConstantBuffer) { diff --git a/src/ComputeSharp.Graphics/Buffers/Extensions/BufferExtensions.cs b/src/ComputeSharp.Graphics/Buffers/Extensions/BufferExtensions.cs index e6c0edeb..00945403 100644 --- a/src/ComputeSharp.Graphics/Buffers/Extensions/BufferExtensions.cs +++ b/src/ComputeSharp.Graphics/Buffers/Extensions/BufferExtensions.cs @@ -50,11 +50,11 @@ namespace ComputeSharp /// /// 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 constant instance with the contents of the input . + /// The input with the data to copy on the allocated buffer. + /// A constant instance with the contents of the input . [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, HlslBuffer buffer) + public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, Buffer buffer) where T : unmanaged { ConstantBuffer constantBuffer = new(device, buffer.Size); @@ -118,11 +118,11 @@ namespace ComputeSharp /// /// 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 . + /// The input with the data to copy on the allocated buffer. + /// A read write instance with the contents of the input . [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, HlslBuffer buffer) + public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, Buffer buffer) where T : unmanaged { ReadOnlyBuffer readWriteBuffer = new(device, buffer.Size); @@ -186,11 +186,11 @@ namespace ComputeSharp /// /// 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 . + /// The input with the data to copy on the allocated buffer. + /// A read write instance with the contents of the input . [Pure] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, HlslBuffer buffer) + public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, Buffer buffer) where T : unmanaged { ReadWriteBuffer readWriteBuffer = new (device, buffer.Size); diff --git a/src/ComputeSharp.Graphics/Buffers/ReadOnlyBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/ReadOnlyBuffer{T}.cs index b95259b1..67b39335 100644 --- a/src/ComputeSharp.Graphics/Buffers/ReadOnlyBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/ReadOnlyBuffer{T}.cs @@ -9,7 +9,7 @@ namespace ComputeSharp /// A representing a typed readonly buffer stored on GPU memory /// /// The type of items stored on the buffer - public sealed class ReadOnlyBuffer : HlslStructuredBuffer + public sealed class ReadOnlyBuffer : StructuredBuffer where T : unmanaged { /// diff --git a/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs b/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs index 5da8a8ad..4d7494ba 100644 --- a/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs +++ b/src/ComputeSharp.Graphics/Buffers/ReadWriteBuffer{T}.cs @@ -9,7 +9,7 @@ namespace ComputeSharp /// A representing a typed read write buffer stored on GPU memory /// /// The type of items stored on the buffer - public sealed class ReadWriteBuffer : HlslStructuredBuffer + public sealed class ReadWriteBuffer : StructuredBuffer where T : unmanaged { /// diff --git a/src/ComputeSharp.Shaders/Translation/ShaderLoader{T}.IL.cs b/src/ComputeSharp.Shaders/Translation/ShaderLoader{T}.IL.cs index a64c7682..0b7eda25 100644 --- a/src/ComputeSharp.Shaders/Translation/ShaderLoader{T}.IL.cs +++ b/src/ComputeSharp.Shaders/Translation/ShaderLoader{T}.IL.cs @@ -97,7 +97,7 @@ namespace ComputeSharp.Shaders.Translation // Access Buffer.D3D12GpuDescriptorHandle FieldInfo gpuDescriptorInfo = member.MemberType.GetField( - nameof(HlslBuffer.D3D12GpuDescriptorHandle), + nameof(Buffer.D3D12GpuDescriptorHandle), BindingFlags.NonPublic | BindingFlags.Instance)!; il.EmitReadMember(gpuDescriptorInfo);