Fix NAOT trimming annotations for ComputeSharp
このコミットが含まれているのは:
1 親
a5f5e76dfa
コミット
9f68fc31da
16ファイル変更
+69
-53
検索条件に一致するファイルはありません
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using ComputeSharp.Interop;
|
||||
using ComputeSharp.Resources;
|
||||
@@ -49,7 +50,7 @@ public sealed class GraphicsDeviceMismatchException : InvalidOperationException
|
||||
/// <typeparam name="T">The type of values in the input buffer.</typeparam>
|
||||
/// <param name="buffer">The input <see cref="Buffer{T}"/> that was used.</param>
|
||||
/// <param name="device">The target <see cref="GraphicsDevice"/> instance that was used.</param>
|
||||
internal static void Throw<T>(Buffer<T> buffer, GraphicsDevice device)
|
||||
internal static void Throw<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(Buffer<T> buffer, GraphicsDevice device)
|
||||
where T : unmanaged
|
||||
{
|
||||
throw Create(buffer, buffer.GraphicsDevice, device);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Resources;
|
||||
@@ -19,7 +20,7 @@ public static class BufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> instance to read data from.</param>
|
||||
/// <returns>A <typeparamref name="T"/> array with the contents of the input buffer.</returns>
|
||||
public static T[] ToArray<T>(this Buffer<T> source)
|
||||
public static T[] ToArray<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -35,7 +36,7 @@ public static class BufferExtensions
|
||||
/// <param name="offset">The offset to start reading data from.</param>
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
/// <returns>A <typeparamref name="T"/> array with the contents of the specified range from the current buffer.</returns>
|
||||
public static T[] ToArray<T>(this Buffer<T> source, int offset, int count)
|
||||
public static T[] ToArray<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> source, int offset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -54,7 +55,7 @@ public static class BufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input array to write data to.</param>
|
||||
public static void CopyTo<T>(this Buffer<T> source, T[] destination)
|
||||
public static void CopyTo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> source, T[] destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -72,7 +73,7 @@ public static class BufferExtensions
|
||||
/// <param name="sourceOffset">The offset to start reading data from.</param>
|
||||
/// <param name="destinationOffset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
public static void CopyTo<T>(this Buffer<T> source, T[] destination, int sourceOffset, int destinationOffset, int count)
|
||||
public static void CopyTo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> source, T[] destination, int sourceOffset, int destinationOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -89,7 +90,7 @@ public static class BufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input <see cref="Span{T}"/> to write data to.</param>
|
||||
public static void CopyTo<T>(this Buffer<T> source, Span<T> destination)
|
||||
public static void CopyTo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> source, Span<T> destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -104,7 +105,7 @@ public static class BufferExtensions
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The input <see cref="Span{T}"/> to write data to.</param>
|
||||
/// <param name="sourceOffset">The offset to start reading data from.</param>
|
||||
public static void CopyTo<T>(this Buffer<T> source, Span<T> destination, int sourceOffset)
|
||||
public static void CopyTo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> source, Span<T> destination, int sourceOffset)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -118,7 +119,7 @@ public static class BufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffers.</typeparam>
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The target <see cref="Buffer{T}"/> instance to write data to.</param>
|
||||
public static void CopyTo<T>(this Buffer<T> source, Buffer<T> destination)
|
||||
public static void CopyTo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> source, Buffer<T> destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -136,7 +137,7 @@ public static class BufferExtensions
|
||||
/// <param name="sourceOffset">The offset to start reading data from.</param>
|
||||
/// <param name="destinationOffset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
public static void CopyTo<T>(this Buffer<T> source, Buffer<T> destination, int sourceOffset, int destinationOffset, int count)
|
||||
public static void CopyTo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> source, Buffer<T> destination, int sourceOffset, int destinationOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -151,7 +152,7 @@ public static class BufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="destination">The target <see cref="Buffer{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <typeparamref name="T"/> array to read data from.</param>
|
||||
public static void CopyFrom<T>(this Buffer<T> destination, T[] source)
|
||||
public static void CopyFrom<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> destination, T[] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(destination);
|
||||
@@ -169,7 +170,7 @@ public static class BufferExtensions
|
||||
/// <param name="sourceOffset">The starting offset within <paramref name="source"/> to read data from.</param>
|
||||
/// <param name="destinationOffset">The offset to start writing data to.</param>
|
||||
/// <param name="count">The number of items to write.</param>
|
||||
public static void CopyFrom<T>(this Buffer<T> destination, T[] source, int sourceOffset, int destinationOffset, int count)
|
||||
public static void CopyFrom<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> destination, T[] source, int sourceOffset, int destinationOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(destination);
|
||||
@@ -186,7 +187,7 @@ public static class BufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="destination">The target <see cref="Buffer{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> to read data from.</param>
|
||||
public static void CopyFrom<T>(this Buffer<T> destination, ReadOnlySpan<T> source)
|
||||
public static void CopyFrom<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> destination, ReadOnlySpan<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(destination);
|
||||
@@ -201,7 +202,7 @@ public static class BufferExtensions
|
||||
/// <param name="destination">The target <see cref="Buffer{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> to read data from.</param>
|
||||
/// <param name="destinationOffset">The offset to start writing data to.</param>
|
||||
public static void CopyFrom<T>(this Buffer<T> destination, ReadOnlySpan<T> source, int destinationOffset)
|
||||
public static void CopyFrom<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> destination, ReadOnlySpan<T> source, int destinationOffset)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(destination);
|
||||
@@ -215,7 +216,7 @@ public static class BufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffers.</typeparam>
|
||||
/// <param name="destination">The input <see cref="Buffer{T}"/> instance to write data data to.</param>
|
||||
/// <param name="source">The source <see cref="Buffer{T}"/> instance to read data from.</param>
|
||||
public static void CopyFrom<T>(this Buffer<T> destination, Buffer<T> source)
|
||||
public static void CopyFrom<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> destination, Buffer<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(destination);
|
||||
@@ -233,7 +234,7 @@ public static class BufferExtensions
|
||||
/// <param name="sourceOffset">The offset to start reading data from.</param>
|
||||
/// <param name="destinationOffset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
public static void CopyFrom<T>(this Buffer<T> destination, Buffer<T> source, int sourceOffset, int destinationOffset, int count)
|
||||
public static void CopyFrom<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this Buffer<T> destination, Buffer<T> source, int sourceOffset, int destinationOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(destination);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Graphics.Helpers;
|
||||
@@ -17,7 +18,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="length">The length of the buffer to allocate.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
/// <returns>A zeroed <see cref="ConstantBuffer{T}"/> instance of size <paramref name="length"/>.</returns>
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -32,7 +33,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the buffer.</param>
|
||||
/// <param name="source">The input <typeparamref name="T"/> array with the data to copy on the allocated buffer.</param>
|
||||
/// <returns>A constant <see cref="ConstantBuffer{T}"/> instance with the contents of the input array.</returns>
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, T[] source)
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, T[] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -48,7 +49,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the buffer.</param>
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> with the data to copy on the allocated buffer.</param>
|
||||
/// <returns>A constant <see cref="ConstantBuffer{T}"/> instance with the contents of the input <see cref="ReadOnlySpan{T}"/>.</returns>
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, ReadOnlySpan<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -67,7 +68,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the buffer.</param>
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> with the data to copy on the allocated buffer.</param>
|
||||
/// <returns>A constant <see cref="ConstantBuffer{T}"/> instance with the contents of the input <see cref="Buffer{T}"/>.</returns>
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, Buffer<T> source)
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, Buffer<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -88,7 +89,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="length">The length of the buffer to allocate.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
/// <returns>A zeroed <see cref="ReadOnlyBuffer{T}"/> instance of size <paramref name="length"/>.</returns>
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -103,7 +104,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the buffer.</param>
|
||||
/// <param name="source">The input <typeparamref name="T"/> array with the data to copy on the allocated buffer.</param>
|
||||
/// <returns>A read write <see cref="ReadOnlyBuffer{T}"/> instance with the contents of the input array.</returns>
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, T[] source)
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, T[] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -119,7 +120,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the buffer.</param>
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> with the data to copy on the allocated buffer.</param>
|
||||
/// <returns>A read write <see cref="ReadOnlyBuffer{T}"/> instance with the contents of the input <see cref="ReadOnlySpan{T}"/>.</returns>
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, ReadOnlySpan<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -138,7 +139,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the buffer.</param>
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> with the data to copy on the allocated buffer.</param>
|
||||
/// <returns>A read write <see cref="ReadOnlyBuffer{T}"/> instance with the contents of the input <see cref="Buffer{T}"/>.</returns>
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, Buffer<T> source)
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, Buffer<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -575,7 +576,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="length">The length of the buffer to allocate.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
/// <returns>A zeroed <see cref="ReadWriteBuffer{T}"/> instance of size <paramref name="length"/>.</returns>
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -590,7 +591,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the buffer.</param>
|
||||
/// <param name="source">The input <typeparamref name="T"/> array with the data to copy on the allocated buffer.</param>
|
||||
/// <returns>A read write <see cref="ReadWriteBuffer{T}"/> instance with the contents of the input array.</returns>
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, T[] source)
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, T[] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -606,7 +607,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the buffer.</param>
|
||||
/// <param name="source">The input <see cref="ReadOnlySpan{T}"/> with the data to copy on the allocated buffer.</param>
|
||||
/// <returns>A read write <see cref="ReadWriteBuffer{T}"/> instance with the contents of the input <see cref="ReadOnlySpan{T}"/>.</returns>
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, ReadOnlySpan<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
@@ -625,7 +626,7 @@ partial class GraphicsDeviceExtensions
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> instance to use to allocate the buffer.</param>
|
||||
/// <param name="source">The input <see cref="Buffer{T}"/> with the data to copy on the allocated buffer.</param>
|
||||
/// <returns>A read write <see cref="ReadWriteBuffer{T}"/> instance with the contents of the input <see cref="Buffer{T}"/>.</returns>
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, Buffer<T> source)
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this GraphicsDevice device, Buffer<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(device);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Resources;
|
||||
|
||||
namespace ComputeSharp;
|
||||
@@ -14,7 +15,7 @@ public static class ReadBackBufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="destination">The target <see cref="StructuredBuffer{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <see cref="UploadBuffer{T}"/> instance to read data from.</param>
|
||||
public static void CopyFrom<T>(this ReadBackBuffer<T> destination, StructuredBuffer<T> source)
|
||||
public static void CopyFrom<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this ReadBackBuffer<T> destination, StructuredBuffer<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(destination);
|
||||
@@ -32,7 +33,7 @@ public static class ReadBackBufferExtensions
|
||||
/// <param name="sourceOffset">The offset to start reading data from.</param>
|
||||
/// <param name="destinationOffset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
public static void CopyFrom<T>(this ReadBackBuffer<T> destination, StructuredBuffer<T> source, int sourceOffset, int destinationOffset, int count)
|
||||
public static void CopyFrom<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this ReadBackBuffer<T> destination, StructuredBuffer<T> source, int sourceOffset, int destinationOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(destination);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Resources;
|
||||
|
||||
namespace ComputeSharp;
|
||||
@@ -14,7 +15,7 @@ public static class StructuredBufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="source">The input <see cref="StructuredBuffer{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The target <see cref="ReadBackBuffer{T}"/> instance to write data to.</param>
|
||||
public static void CopyTo<T>(this StructuredBuffer<T> source, ReadBackBuffer<T> destination)
|
||||
public static void CopyTo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this StructuredBuffer<T> source, ReadBackBuffer<T> destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -32,7 +33,7 @@ public static class StructuredBufferExtensions
|
||||
/// <param name="sourceOffset">The offset to start reading data from.</param>
|
||||
/// <param name="destinationOffset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
public static void CopyTo<T>(this StructuredBuffer<T> source, ReadBackBuffer<T> destination, int sourceOffset, int destinationOffset, int count)
|
||||
public static void CopyTo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this StructuredBuffer<T> source, ReadBackBuffer<T> destination, int sourceOffset, int destinationOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -47,7 +48,7 @@ public static class StructuredBufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="destination">The target <see cref="StructuredBuffer{T}"/> instance to write data to.</param>
|
||||
/// <param name="source">The input <see cref="UploadBuffer{T}"/> instance to read data from.</param>
|
||||
public static void CopyFrom<T>(this StructuredBuffer<T> destination, UploadBuffer<T> source)
|
||||
public static void CopyFrom<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this StructuredBuffer<T> destination, UploadBuffer<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(destination);
|
||||
@@ -65,7 +66,7 @@ public static class StructuredBufferExtensions
|
||||
/// <param name="sourceOffset">The offset to start reading data from.</param>
|
||||
/// <param name="destinationOffset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
public static void CopyFrom<T>(this StructuredBuffer<T> destination, UploadBuffer<T> source, int sourceOffset, int destinationOffset, int count)
|
||||
public static void CopyFrom<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this StructuredBuffer<T> destination, UploadBuffer<T> source, int sourceOffset, int destinationOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(destination);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Resources;
|
||||
|
||||
namespace ComputeSharp;
|
||||
@@ -14,7 +15,7 @@ public static class UploadBufferExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="source">The input <see cref="UploadBuffer{T}"/> instance to read data from.</param>
|
||||
/// <param name="destination">The target <see cref="StructuredBuffer{T}"/> instance to write data to.</param>
|
||||
public static void CopyTo<T>(this UploadBuffer<T> source, StructuredBuffer<T> destination)
|
||||
public static void CopyTo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this UploadBuffer<T> source, StructuredBuffer<T> destination)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
@@ -32,7 +33,7 @@ public static class UploadBufferExtensions
|
||||
/// <param name="sourceOffset">The offset to start reading data from.</param>
|
||||
/// <param name="destinationOffset">The starting offset within <paramref name="destination"/> to write data to.</param>
|
||||
/// <param name="count">The number of items to read.</param>
|
||||
public static void CopyTo<T>(this UploadBuffer<T> source, StructuredBuffer<T> destination, int sourceOffset, int destinationOffset, int count)
|
||||
public static void CopyTo<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this UploadBuffer<T> source, StructuredBuffer<T> destination, int sourceOffset, int destinationOffset, int count)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(source);
|
||||
|
||||
@@ -29,7 +29,9 @@ internal static class TypeInfo<[DynamicallyAccessedMembers(DynamicallyAccessedMe
|
||||
|
||||
foreach (FieldInfo fieldInfo in type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
|
||||
{
|
||||
#pragma warning disable IL2072 // 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicFields', 'DynamicallyAccessedMemberTypes.NonPublicFields'
|
||||
if (ChecksIsDoubleOrContainsDoubles(fieldInfo.FieldType))
|
||||
#pragma warning restore IL2072
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Interop;
|
||||
@@ -62,7 +63,7 @@ public static class GraphicsResourceHelper
|
||||
/// <param name="device">The target <see cref="GraphicsDevice"/> instance in use.</param>
|
||||
/// <returns>The GPU descriptor handle for the buffer.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(Buffer<T> buffer, GraphicsDevice device)
|
||||
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(Buffer<T> buffer, GraphicsDevice device)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(buffer);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ComputeSharp.Core.Extensions;
|
||||
using ComputeSharp.Resources;
|
||||
|
||||
@@ -49,7 +50,7 @@ public static unsafe class InteropServices
|
||||
/// <param name="ppvObject">The address of a pointer to an interface with the IID specified in <paramref name="riid"/>.</param>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="buffer"/> instance has been disposed.</exception>
|
||||
/// <exception cref="Win32Exception">Thrown if the <c>IUnknown::QueryInterface</c> call doesn't return <c>S_OK</c>.</exception>
|
||||
public static void GetID3D12Resource<T>(Buffer<T> buffer, Guid* riid, void** ppvObject)
|
||||
public static void GetID3D12Resource<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(Buffer<T> buffer, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = buffer.GetReferenceTrackingLease();
|
||||
@@ -179,7 +180,7 @@ public static unsafe class InteropServices
|
||||
/// If ppvObject (the address) is nullptr, then this method returns <c>E_POINTER</c>.
|
||||
/// </returns>
|
||||
/// <exception cref="ObjectDisposedException">The <paramref name="buffer"/> instance has been disposed.</exception>
|
||||
public static int TryGetID3D12Resource<T>(Buffer<T> buffer, Guid* riid, void** ppvObject)
|
||||
public static int TryGetID3D12Resource<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(Buffer<T> buffer, Guid* riid, void** ppvObject)
|
||||
where T : unmanaged
|
||||
{
|
||||
using var _0 = buffer.GetReferenceTrackingLease();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Buffers;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Core.Helpers;
|
||||
@@ -25,7 +25,7 @@ namespace ComputeSharp.Resources;
|
||||
/// A <see langword="class"/> representing a typed buffer stored on GPU memory.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
public unsafe abstract class Buffer<T> : NativeObject, IGraphicsResource
|
||||
public unsafe abstract class Buffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T> : NativeObject, IGraphicsResource
|
||||
where T : unmanaged
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Graphics.Commands;
|
||||
using ComputeSharp.Graphics.Extensions;
|
||||
using ComputeSharp.Graphics.Helpers;
|
||||
@@ -14,7 +15,7 @@ namespace ComputeSharp.Resources;
|
||||
/// A <see langword="class"/> representing a typed structured buffer stored on GPU memory.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
public abstract class StructuredBuffer<T> : Buffer<T>
|
||||
public abstract class StructuredBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T> : Buffer<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Core.Helpers;
|
||||
@@ -19,7 +20,7 @@ namespace ComputeSharp;
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
[DebuggerTypeProxy(typeof(BufferDebugView<>))]
|
||||
[DebuggerDisplay("{ToString(),raw}")]
|
||||
public sealed class ConstantBuffer<T> : Buffer<T>
|
||||
public sealed class ConstantBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T> : Buffer<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#if NET6_0_OR_GREATER
|
||||
using GC = System.GC;
|
||||
#else
|
||||
@@ -11,7 +12,7 @@ namespace ComputeSharp.Resources.Debug;
|
||||
/// A debug proxy used to display items in a <see cref="Buffer{T}"/> instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items to display.</typeparam>
|
||||
internal sealed class BufferDebugView<T>
|
||||
internal sealed class BufferDebugView<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ComputeSharp.Exceptions;
|
||||
using ComputeSharp.Graphics.Resources.Enums;
|
||||
using ComputeSharp.Resources;
|
||||
@@ -12,7 +13,7 @@ namespace ComputeSharp;
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
[DebuggerTypeProxy(typeof(BufferDebugView<>))]
|
||||
[DebuggerDisplay("{ToString(),raw}")]
|
||||
public sealed class ReadOnlyBuffer<T> : StructuredBuffer<T>
|
||||
public sealed class ReadOnlyBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T> : StructuredBuffer<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ComputeSharp.Exceptions;
|
||||
using ComputeSharp.Graphics.Resources.Enums;
|
||||
using ComputeSharp.Resources;
|
||||
@@ -12,7 +13,7 @@ namespace ComputeSharp;
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
[DebuggerTypeProxy(typeof(BufferDebugView<>))]
|
||||
[DebuggerDisplay("{ToString(),raw}")]
|
||||
public sealed class ReadWriteBuffer<T> : StructuredBuffer<T>
|
||||
public sealed class ReadWriteBuffer<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T> : StructuredBuffer<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.__Internals;
|
||||
using ComputeSharp.Graphics.Helpers;
|
||||
@@ -20,7 +21,7 @@ public static class ComputeContextExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to insert the resource barrier.</param>
|
||||
/// <param name="buffer">The input <see cref="ReadWriteBuffer{T}"/> instance to insert the barrier for.</param>
|
||||
public static unsafe void Barrier<T>(this in ComputeContext context, ReadWriteBuffer<T> buffer)
|
||||
public static unsafe void Barrier<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this in ComputeContext context, ReadWriteBuffer<T> buffer)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(buffer);
|
||||
@@ -136,7 +137,7 @@ public static class ComputeContextExtensions
|
||||
/// <typeparam name="T">The type of items stored on the buffer.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to clear the resource.</param>
|
||||
/// <param name="buffer">The input <see cref="ReadWriteBuffer{T}"/> instance to clear.</param>
|
||||
public static unsafe void Clear<T>(this in ComputeContext context, ReadWriteBuffer<T> buffer)
|
||||
public static unsafe void Clear<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] T>(this in ComputeContext context, ReadWriteBuffer<T> buffer)
|
||||
where T : unmanaged
|
||||
{
|
||||
Guard.IsNotNull(buffer);
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする