16ファイル変更
+125
-43
検索条件に一致するファイルはありません
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.SwapChain.Backend;
|
||||
using ComputeSharp.SwapChain.Shaders;
|
||||
@@ -12,25 +11,25 @@ class Program
|
||||
/// <summary>
|
||||
/// A texture for <c>\Textures\RustyMetal.png</c>.
|
||||
/// </summary>
|
||||
private static readonly IReadOnlyNormalizedTexture2D<float4> RustyMetal = LoadTexture();
|
||||
private static readonly Lazy<IReadOnlyNormalizedTexture2D<float4>> RustyMetal = new(static () => LoadTexture());
|
||||
|
||||
/// <summary>
|
||||
/// The mapping of available samples to choose from.
|
||||
/// </summary>
|
||||
private static readonly Win32Application[] Samples = new Win32Application[]
|
||||
private static readonly (string ShaderName, Win32Application Application)[] Samples = new (string, Win32Application)[]
|
||||
{
|
||||
new SwapChainApplication<HelloWorld>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<FourColorGradient>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<ColorfulInfinity>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<FractalTiling>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<TwoTiledTruchet>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<MengerJourney>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<Octagrams>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<ProteanClouds>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<ExtrudedTruchetPattern>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<PyramidPattern>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<TriangleGridContouring>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<ContouredLayers>(static time => new((float)time.TotalSeconds, RustyMetal))
|
||||
(nameof(HelloWorld), new SwapChainApplication<HelloWorld>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(FourColorGradient), new SwapChainApplication<FourColorGradient>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(ColorfulInfinity), new SwapChainApplication<ColorfulInfinity>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(FractalTiling), new SwapChainApplication<FractalTiling>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(TwoTiledTruchet), new SwapChainApplication<TwoTiledTruchet>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(MengerJourney), new SwapChainApplication<MengerJourney>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(Octagrams), new SwapChainApplication<Octagrams>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(ProteanClouds), new SwapChainApplication<ProteanClouds>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(ExtrudedTruchetPattern), new SwapChainApplication<ExtrudedTruchetPattern>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(PyramidPattern), new SwapChainApplication<PyramidPattern>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(TriangleGridContouring), new SwapChainApplication<TriangleGridContouring>(static time => new((float)time.TotalSeconds))),
|
||||
(nameof(ContouredLayers), new SwapChainApplication<ContouredLayers>(static time => new((float)time.TotalSeconds, RustyMetal.Value)))
|
||||
};
|
||||
|
||||
static void Main()
|
||||
@@ -45,7 +44,7 @@ class Program
|
||||
|
||||
for (int i = 0; i < Samples.Length; i++)
|
||||
{
|
||||
Console.WriteLine($"{i}: {Samples[i].GetType().GenericTypeArguments[0].Name}");
|
||||
Console.WriteLine($"{i}: {Samples[i].ShaderName}");
|
||||
}
|
||||
|
||||
Console.WriteLine($"{Samples.Length}+: Exit (Use Escape, 'Q', or Alt + F4 to exit a sample once chosen)");
|
||||
@@ -60,9 +59,9 @@ class Program
|
||||
if (index >= 0 && index < Samples.Length)
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"Starting {Samples[index].GetType().GenericTypeArguments[0].Name}...");
|
||||
Console.WriteLine($"Starting {Samples[index].ShaderName}...");
|
||||
|
||||
Win32ApplicationRunner.Run(Samples[index]);
|
||||
Win32ApplicationRunner.Run(Samples[index].Application);
|
||||
}
|
||||
}
|
||||
while (index >= 0 && index < Samples.Length);
|
||||
@@ -75,7 +74,7 @@ class Program
|
||||
/// <returns>A texture with the data from the image at the specified name.</returns>
|
||||
private static ReadOnlyTexture2D<Rgba32, float4> LoadTexture([CallerMemberName] string name = null!)
|
||||
{
|
||||
string filename = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Textures", $"{name}.png");
|
||||
string filename = Path.Combine(AppContext.BaseDirectory, "Textures", $"{name}.png");
|
||||
|
||||
return GraphicsDevice.GetDefault().LoadReadOnlyTexture2D<Rgba32, float4>(filename);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Collections.Generic\DictionaryExtensions.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Collections.Generic\QueueExtensions.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics.CodeAnalysis\MemberNotNullAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics.CodeAnalysis\RequiresUnreferencedCodeAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\Enum.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\GC.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)System\IntPtrExtensions.cs" />
|
||||
|
||||
+4
-1
@@ -1,4 +1,7 @@
|
||||
namespace System.Diagnostics.CodeAnalysis;
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
namespace System.Diagnostics.CodeAnalysis;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies that the method or property will ensure that the listed field and property members have not-null values.
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
namespace System.Diagnostics.CodeAnalysis
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the specified method requires dynamic access to code that is not referenced
|
||||
/// statically, for example through <see cref="System.Reflection"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This allows tools to understand which methods are unsafe to call when removing unreferenced
|
||||
/// code from an application.
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)]
|
||||
internal sealed class RequiresUnreferencedCodeAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequiresUnreferencedCodeAttribute"/> class
|
||||
/// with the specified message.
|
||||
/// </summary>
|
||||
/// <param name="message">
|
||||
/// A message that contains information about the usage of unreferenced code.
|
||||
/// </param>
|
||||
public RequiresUnreferencedCodeAttribute(string message)
|
||||
{
|
||||
Message = message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a message that contains information about the usage of unreferenced code.
|
||||
/// </summary>
|
||||
public string Message { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an optional URL that contains more information about the method,
|
||||
/// why it requires unreferenced code, and what options a consumer has to deal with it.
|
||||
/// </summary>
|
||||
public string? Url { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
using System.ComponentModel;
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace System.Runtime.CompilerServices;
|
||||
|
||||
|
||||
+6
-3
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
namespace ComputeSharp.NetStandard.System.Runtime.InteropServices;
|
||||
using System;
|
||||
|
||||
namespace ComputeSharp.NetStandard.System.Runtime.InteropServices; // This cannot be in System.Runtime.InteropServices, or Roslyn will recognize it
|
||||
|
||||
/// <summary>
|
||||
/// Any method marked with <see cref="UnmanagedCallersOnlyAttribute" /> can be directly called from native code.
|
||||
@@ -9,6 +12,6 @@ namespace ComputeSharp.NetStandard.System.Runtime.InteropServices;
|
||||
/// This polyfill is deliberately in the wrong namespace to avoid the C# compiler failing to build below .NET 5.
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
|
||||
public sealed class UnmanagedCallersOnlyAttribute : Attribute
|
||||
internal sealed class UnmanagedCallersOnlyAttribute : Attribute
|
||||
{
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
namespace System.Runtime.Versioning;
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
namespace System.Runtime.Versioning;
|
||||
|
||||
/// <summary>
|
||||
/// Base type for all platform-specific API attributes.
|
||||
|
||||
+18
-14
@@ -1,4 +1,7 @@
|
||||
namespace System.Runtime.Versioning;
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
namespace System.Runtime.Versioning;
|
||||
|
||||
/// <summary>
|
||||
/// Records the operating system (and minimum version) that supports an API. Multiple
|
||||
@@ -9,19 +12,20 @@
|
||||
/// or use guards to prevent calls to APIs on unsupported operating systems.
|
||||
/// A given platform should only be specified once.
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Assembly |
|
||||
AttributeTargets.Class |
|
||||
AttributeTargets.Constructor |
|
||||
AttributeTargets.Enum |
|
||||
AttributeTargets.Event |
|
||||
AttributeTargets.Field |
|
||||
AttributeTargets.Interface |
|
||||
AttributeTargets.Method |
|
||||
AttributeTargets.Module |
|
||||
AttributeTargets.Property |
|
||||
AttributeTargets.Struct,
|
||||
AllowMultiple = true,
|
||||
Inherited = false)]
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Assembly |
|
||||
AttributeTargets.Class |
|
||||
AttributeTargets.Constructor |
|
||||
AttributeTargets.Enum |
|
||||
AttributeTargets.Event |
|
||||
AttributeTargets.Field |
|
||||
AttributeTargets.Interface |
|
||||
AttributeTargets.Method |
|
||||
AttributeTargets.Module |
|
||||
AttributeTargets.Property |
|
||||
AttributeTargets.Struct,
|
||||
AllowMultiple = true,
|
||||
Inherited = false)]
|
||||
internal sealed class SupportedOSPlatformAttribute : OSPlatformAttribute
|
||||
{
|
||||
public SupportedOSPlatformAttribute(string platformName)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Graphics.Helpers;
|
||||
@@ -17,6 +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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -32,6 +34,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, T[] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -48,6 +51,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -67,6 +71,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, Buffer<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -88,6 +93,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -103,6 +109,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, T[] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -119,6 +126,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -138,6 +146,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, Buffer<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -575,6 +584,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -590,6 +600,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, T[] source)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -606,6 +617,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -625,6 +637,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>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, Buffer<T> source)
|
||||
where T : unmanaged
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ComputeSharp.Graphics.Helpers;
|
||||
@@ -7,6 +8,7 @@ namespace ComputeSharp.Graphics.Helpers;
|
||||
/// A class providing info on specific types.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The input type to extract info for.</typeparam>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the input type (recursively).")]
|
||||
internal static class TypeInfo<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
@@ -20,6 +22,7 @@ internal static class TypeInfo<T>
|
||||
/// </summary>
|
||||
/// <param name="type">The current type to check.</param>
|
||||
/// <returns>Whether or not <paramref name="type"/> is <see cref="double"/> or contains a <see cref="double"/> field.</returns>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the input type (recursively).")]
|
||||
private static bool ChecksIsDoubleOrContainsDoubles(Type type)
|
||||
{
|
||||
if (type == typeof(double)) return true;
|
||||
|
||||
@@ -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;
|
||||
@@ -63,6 +63,7 @@ public unsafe abstract class Buffer<T> : NativeObject, IGraphicsResource
|
||||
/// <param name="elementSizeInBytes">The size in bytes of each buffer item (including padding, if any).</param>
|
||||
/// <param name="resourceType">The resource type for the current buffer.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
private protected Buffer(GraphicsDevice device, int length, uint elementSizeInBytes, ResourceType resourceType, AllocationMode allocationMode)
|
||||
{
|
||||
if (resourceType == ResourceType.Constant)
|
||||
|
||||
@@ -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;
|
||||
@@ -24,6 +25,7 @@ public abstract class StructuredBuffer<T> : Buffer<T>
|
||||
/// <param name="length">The number of items to store in the current buffer.</param>
|
||||
/// <param name="resourceType">The buffer type for the current buffer.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
private protected unsafe StructuredBuffer(GraphicsDevice device, int length, ResourceType resourceType, AllocationMode allocationMode)
|
||||
: base(device, length, (uint)sizeof(T), resourceType, allocationMode)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.CompilerServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Core.Helpers;
|
||||
@@ -33,6 +34,7 @@ public sealed class ConstantBuffer<T> : Buffer<T>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> associated with the current instance.</param>
|
||||
/// <param name="length">The number of items to store in the current buffer.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
internal ConstantBuffer(GraphicsDevice device, int length, AllocationMode allocationMode)
|
||||
: base(device, length, (uint)GetPaddedSize(), ResourceType.Constant, allocationMode)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ComputeSharp.Exceptions;
|
||||
using ComputeSharp.Graphics.Resources.Enums;
|
||||
using ComputeSharp.Resources;
|
||||
@@ -21,6 +22,7 @@ public sealed class ReadOnlyBuffer<T> : StructuredBuffer<T>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> associated with the current instance.</param>
|
||||
/// <param name="length">The number of items to store in the current buffer.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
internal ReadOnlyBuffer(GraphicsDevice device, int length, AllocationMode allocationMode)
|
||||
: base(device, length, ResourceType.ReadOnly, allocationMode)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ComputeSharp.Exceptions;
|
||||
using ComputeSharp.Graphics.Resources.Enums;
|
||||
using ComputeSharp.Resources;
|
||||
@@ -21,6 +22,7 @@ public sealed class ReadWriteBuffer<T> : StructuredBuffer<T>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> associated with the current instance.</param>
|
||||
/// <param name="length">The number of items to store in the current buffer.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the resource element type (recursively).")]
|
||||
internal ReadWriteBuffer(GraphicsDevice device, int length, AllocationMode allocationMode)
|
||||
: base(device, length, ResourceType.ReadWrite, allocationMode)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする