Remove ComputeSharp.NetStandard project

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-17 21:52:58 +02:00
1 親 2342e95b49
コミット 97ed5e742a
17ファイル変更
-487

検索条件に一致するファイルはありません

-6
ファイルの表示
@@ -46,10 +46,6 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ComputeSharp.Sample.FSharp"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Sample.FSharp.Shaders", "samples\ComputeSharp.Sample.FSharp.Shaders\ComputeSharp.Sample.FSharp.Shaders.csproj", "{1F37A704-3CDF-45BB-8114-ED9137E5F2CF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Polyfills", "Polyfills", "{8DCE343F-BA78-4FE1-B562-B57C603A8BAA}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.NetStandard", "src\ComputeSharp.NetStandard\ComputeSharp.NetStandard.shproj", "{A5997814-D8D2-4541-87AC-C3E53CAA67C0}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.Win32.D3D12", "src\ComputeSharp.Win32.D3D12\ComputeSharp.Win32.D3D12.shproj", "{514FF00E-BBF0-4D55-A47C-EEEB6208ADCE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.WinUI", "src\ComputeSharp.WinUI\ComputeSharp.WinUI.csproj", "{FA18BA9F-76BF-4DE0-8D24-02FC7657E6CB}"
@@ -446,7 +442,6 @@ Global
{C12D7ACE-98ED-4813-8118-6667C34F484F} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
{7C625EC4-F599-4350-A915-F046DF2406D3} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
{1F37A704-3CDF-45BB-8114-ED9137E5F2CF} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
{A5997814-D8D2-4541-87AC-C3E53CAA67C0} = {8DCE343F-BA78-4FE1-B562-B57C603A8BAA}
{514FF00E-BBF0-4D55-A47C-EEEB6208ADCE} = {D991153C-A34D-4042-B76F-822ADB111DD0}
{0071701E-B9C5-4098-BE5F-EF556C4553C6} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
{0800BD51-499D-44C2-9417-FD1F7FDFE9C4} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
@@ -485,7 +480,6 @@ Global
src\ComputeSharp.CodeFixing\ComputeSharp.CodeFixing.projitems*{9b4448b1-200f-4966-8a13-a508691b3003}*SharedItemsImports = 5
src\ComputeSharp.Win32.D2D1\ComputeSharp.Win32.D2D1.projitems*{9da1da9f-f8b2-4b25-be80-c21f773029e3}*SharedItemsImports = 13
samples\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems*{9ea5ae9d-c39a-4f43-b03e-0a848ea2558a}*SharedItemsImports = 5
src\ComputeSharp.NetStandard\ComputeSharp.NetStandard.projitems*{a5997814-d8d2-4541-87ac-c3e53caa67c0}*SharedItemsImports = 13
src\ComputeSharp.SourceGeneration\ComputeSharp.SourceGeneration.projitems*{bfb003d1-788b-48de-8065-39479c162cb0}*SharedItemsImports = 5
samples\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems*{c12d7ace-98ed-4813-8118-6667c34f484f}*SharedItemsImports = 5
src\ComputeSharp.SourceGeneration.Hlsl\ComputeSharp.SourceGeneration.Hlsl.projitems*{e44053bd-a761-47fb-aa78-087a599672ea}*SharedItemsImports = 5
-27
ファイルの表示
@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>a5997814-d8d2-4541-87ac-c3e53caa67c0</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>ComputeSharp.NetStandard</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)System\Buffers\BitOperations.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Collections.Generic\DictionaryExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Collections.Generic\QueueExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Enum.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\GC.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IntPtrExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\FormatExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\StreamExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Math.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\Path.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\MemoryMarshal.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RuntimeHelpers.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\NativeMemory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Text\EncodingExtensions.cs" />
</ItemGroup>
</Project>
-12
ファイルの表示
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>a5997814-d8d2-4541-87ac-c3e53caa67c0</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<Import Project="ComputeSharp.NetStandard.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
-32
ファイルの表示
@@ -1,32 +0,0 @@
using System.Runtime.CompilerServices;
namespace ComputeSharp.NetStandard;
/// <summary>
/// A polyfill type that mirrors some methods from <see cref="BitOperations"/> on .NET 6.
/// </summary>
internal static class BitOperations
{
/// <summary>
/// Rounds the given integral value up to a power of 2.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>
/// The smallest power of 2 which is greater than or equal to <paramref name="value"/>.
/// If <paramref name="value"/> is 0 or the result overflows, returns 0.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint RoundUpToPowerOf2(uint value)
{
// Based on https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
--value;
value |= value >> 1;
value |= value >> 2;
value |= value >> 4;
value |= value >> 8;
value |= value >> 16;
return value + 1;
}
}
-29
ファイルの表示
@@ -1,29 +0,0 @@
namespace System.Collections.Generic;
/// <summary>
/// A helper type with extensions for the <see cref="Dictionary{TKey, TValue}"/> type.
/// </summary>
internal static class DictionaryExtensions
{
/// <summary>
/// Tries to remove an item from a <see cref="Dictionary{TKey, TValue}"/> instance and returns it if present.
/// </summary>
/// <typeparam name="TKey">The type of dictionary keys.</typeparam>
/// <typeparam name="TValue">The type of dictionary values.</typeparam>
/// <param name="dictionary">The input <see cref="Dictionary{TKey, TValue}"/> instance.</param>
/// <param name="key">The lookup key to use.</param>
/// <param name="value">The resulting item, if present.</param>
/// <returns>Whether or not an item was found with the given key.</returns>
public static bool Remove<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, out TValue? value)
where TKey : notnull
{
if (dictionary.TryGetValue(key, out value))
{
_ = dictionary.Remove(key);
return true;
}
return false;
}
}
-28
ファイルの表示
@@ -1,28 +0,0 @@
namespace System.Collections.Generic;
/// <summary>
/// A helper type with extensions for the <see cref="Queue{T}"/> type.
/// </summary>
internal static class QueueExtensions
{
/// <summary>
/// Tries to dequeue an item from the input <see cref="Queue{T}"/> instance.
/// </summary>
/// <typeparam name="T">The type of items in the queue.</typeparam>
/// <param name="queue">The input queue.</param>
/// <param name="result">The resulting item, if any.</param>
/// <returns>Whether or not an item was found.</returns>
public static bool TryDequeue<T>(this Queue<T> queue, out T? result)
{
if (queue.Count > 0)
{
result = queue.Dequeue();
return true;
}
result = default!;
return false;
}
}
-19
ファイルの表示
@@ -1,19 +0,0 @@
namespace ComputeSharp.NetStandard;
/// <summary>
/// A polyfill type that mirrors some methods from <see cref="global::System.Enum"/> on .NET 6.
/// </summary>
internal static class Enum
{
/// <summary>
/// Returns the name of the input enum value.
/// </summary>
/// <typeparam name="T">Specifies the type of the enum element.</typeparam>
/// <param name="value">The input enum value.</param>
/// <returns>The name of <paramref name="value"/>.</returns>
public static string GetName<T>(T value)
where T : unmanaged, global::System.Enum
{
return global::System.Enum.GetName(typeof(T), value)!;
}
}
-23
ファイルの表示
@@ -1,23 +0,0 @@
using System.Runtime.CompilerServices;
namespace System;
/// <summary>
/// A polyfill type with additional formatting extensions.
/// </summary>
internal static class FormatExtensions
{
/// <inheritdoc cref="IFormattable.ToString(string?, IFormatProvider?)"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string ToString<T>(this T value, string? format)
{
throw new NotSupportedException("This API is not supported on this target.");
}
/// <inheritdoc cref="IFormattable.ToString(string?, IFormatProvider?)"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string ToString<T>(this T value, string? format, IFormatProvider? formatProvider)
{
throw new NotSupportedException("This API is not supported on this target.");
}
}
-21
ファイルの表示
@@ -1,21 +0,0 @@
namespace ComputeSharp.NetStandard;
/// <summary>
/// A polyfill type that mirrors some methods from <see cref="global::System.GC"/> on .NET 6.
/// </summary>
internal static class GC
{
/// <summary>
/// Allocate an array while skipping zero-initialization if possible.
/// </summary>
/// <typeparam name="T">Specifies the type of the array element.</typeparam>
/// <param name="length">Specifies the length of the array.</param>
/// <param name="pinned">Specifies whether the allocated array must be pinned.</param>
/// <remarks>
/// If pinned is set to true, <typeparamref name="T"/> must not be a reference type or a type that contains object references.
/// </remarks>
public static T[] AllocateUninitializedArray<T>(int length, bool pinned = false)
{
return new T[length];
}
}
-20
ファイルの表示
@@ -1,20 +0,0 @@
using System;
namespace ComputeSharp.NetStandard;
/// <summary>
/// A polyfill type that mirrors some methods from <see cref="global::System.IO.Path"/> on .NET 6.
/// </summary>
internal static class Path
{
/// <summary>
/// Returns the extension of the given path.
/// </summary>
/// <remarks>
/// The returned value is an empty <see cref="ReadOnlySpan{T}"/> if the given path does not include an extension.
/// </remarks>
public static ReadOnlySpan<char> GetExtension(ReadOnlySpan<char> path)
{
return global::System.IO.Path.GetExtension(path.ToString()).AsSpan();
}
}
-54
ファイルの表示
@@ -1,54 +0,0 @@
using System.Buffers;
namespace System.IO;
/// <summary>
/// A polyfill type with extensions for <see cref="Stream"/>.
/// </summary>
internal static class StreamExtensions
{
/// <summary>
/// Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
/// </summary>
/// <param name="stream">The input <see cref="Stream"/> instance.</param>
/// <param name="span">A region of memory. When this method returns, the contents of this region are replaced by the bytes read from the current source.</param>
/// <returns>The total number of bytes read into the buffer.</returns>
public static int Read(this Stream stream, Span<byte> span)
{
if (span.IsEmpty)
{
return 0;
}
byte[] array = ArrayPool<byte>.Shared.Rent(span.Length);
int bytesRead = stream.Read(array, 0, span.Length);
array.AsSpan(0, bytesRead).CopyTo(span);
ArrayPool<byte>.Shared.Return(array);
return bytesRead;
}
/// <summary>
/// Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
/// </summary>
/// <param name="stream">The input <see cref="Stream"/> instance.</param>
/// <param name="span">A region of memory. This method copies the contents of this region to the current stream.</param>
public static void Write(this Stream stream, ReadOnlySpan<byte> span)
{
if (span.IsEmpty)
{
return;
}
byte[] array = ArrayPool<byte>.Shared.Rent(span.Length);
span.CopyTo(array);
stream.Write(array, 0, span.Length);
ArrayPool<byte>.Shared.Return(array);
}
}
-33
ファイルの表示
@@ -1,33 +0,0 @@
using System.Runtime.CompilerServices;
namespace System;
/// <summary>
/// A polyfill type with extensions for <see cref="IntPtr"/> and <see cref="UIntPtr"/>.
/// </summary>
internal static class IntPtrExtensions
{
/// <inheritdoc cref="IComparable{T}.CompareTo(T)"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe int CompareTo(this nint left, nint right)
{
if (sizeof(nint) == sizeof(int))
{
return ((int)left).CompareTo((int)right);
}
return ((long)left).CompareTo(right);
}
/// <inheritdoc cref="IComparable{T}.CompareTo(T)"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe int CompareTo(this nuint left, nuint right)
{
if (sizeof(nuint) == sizeof(uint))
{
return ((uint)left).CompareTo((uint)right);
}
return ((ulong)left).CompareTo(right);
}
}
-46
ファイルの表示
@@ -1,46 +0,0 @@
using System.Runtime.CompilerServices;
namespace ComputeSharp.NetStandard;
/// <summary>
/// A polyfill type that mirrors some methods from <see cref="global::System.Math"/> on .NET 6.
/// </summary>
internal static class Math
{
/// <summary>
/// Returns <paramref name="value"/> clamped to the inclusive range of <paramref name="min"/> and <paramref name="max"/>.
/// </summary>
/// <param name="value">The value to be clamped.</param>
/// <param name="min">The lower bound of the result.</param>
/// <param name="max">The upper bound of the result.</param>
/// <returns>The input value clamped to the inclusive range of <paramref name="min"/> and <paramref name="max"/>.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Clamp(int value, int min, int max)
{
if (value < min)
{
return min;
}
if (value > max)
{
return max;
}
return value;
}
/// <inheritdoc cref="global::System.Math.Min(int, int)"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Min(int val1, int val2)
{
return global::System.Math.Min(val1, val2);
}
/// <inheritdoc cref="global::System.Math.Max(int, int)"/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Max(int val1, int val2)
{
return global::System.Math.Max(val1, val2);
}
}
-21
ファイルの表示
@@ -1,21 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace ComputeSharp.NetStandard;
/// <summary>
/// A polyfill type that mirrors some methods from <see cref="RuntimeHelpers"/> on .NET 5.
/// </summary>
internal static class RuntimeHelpers
{
/// <summary>
/// Allocates some memory tied to the lifetime of a specific type.
/// </summary>
/// <param name="type">The type to associate the memory to.</param>
/// <param name="size">The size in byte of the memory to allocate.</param>
/// <returns>A pointer to the allocated memory.</returns>
public static IntPtr AllocateTypeAssociatedMemory(Type type, int size)
{
return Marshal.AllocHGlobal(size);
}
}
-42
ファイルの表示
@@ -1,42 +0,0 @@
using System;
using System.Runtime.CompilerServices;
namespace ComputeSharp.NetStandard;
/// <summary>
/// A polyfill type that mirrors some methods from <see cref="MemoryMarshal"/> on .NET 6.
/// </summary>
internal static class MemoryMarshal
{
/// <summary>
/// Returns a reference to the 0th element of <paramref name="array"/>. If the array is empty, returns a reference
/// to where the 0th element would have been stored. Such a reference may be used for pinning but must never be dereferenced.
/// </summary>
/// <exception cref="NullReferenceException"><paramref name="array"/> is <see langword="null"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ref T GetArrayDataReference<T>(T[] array)
{
return ref global::System.Runtime.InteropServices.MemoryMarshal.GetReference(array.AsSpan());
}
/// <summary>
/// Creates a new read-only span for a <see langword="null"/>-terminated UTF-8 string.
/// </summary>
/// <param name="value">The pointer to the <see langword="null"/>-terminated string of bytes.</param>
/// <returns>A read-only span representing the specified <see langword="null"/>-terminated string, or an empty span if the pointer is <see langword="null"/>.</returns>
/// <remarks>The returned span does not include the <see langword="null"/> terminator, nor does it validate the well-formedness of the UTF-8 data.</remarks>
/// <exception cref="ArgumentException">The string is longer than <see cref="int.MaxValue"/>.</exception>
public static unsafe ReadOnlySpan<byte> CreateReadOnlySpanFromNullTerminated(byte* value)
{
for (int i = 0; i < int.MaxValue; i++)
{
// Stop when the null-terminator has been found
if (value[i] == 0)
{
return new(value, i);
}
}
throw new ArgumentException("The string must be null-terminated.");
}
}
-35
ファイルの表示
@@ -1,35 +0,0 @@
namespace System.Runtime.InteropServices;
/// <summary>
/// This class contains methods that are mainly used to manage native memory.
/// </summary>
internal static unsafe class NativeMemory
{
/// <summary>
/// Allocates a block of memory of the specified size, in bytes.
/// </summary>
/// <param name="byteCount">The size, in bytes, of the block to allocate.</param>
/// <returns>A pointer to the allocated block of memory.</returns>
/// <exception cref="OutOfMemoryException">Thrown when allocating <paramref name="byteCount"/> of memory failed.</exception>
/// <remarks>
/// <para>This method allows <paramref name="byteCount" /> to be <c>0</c> and will return a valid pointer that should not be dereferenced and that should be passed to free to avoid memory leaks.</para>
/// <para>This method is a thin wrapper over the C <c>malloc</c> API.</para>
/// </remarks>
public static void* Alloc(nuint byteCount)
{
return (void*)Marshal.AllocHGlobal(checked((int)byteCount));
}
/// <summary>
/// Frees a block of memory.
/// </summary>
/// <param name="ptr">A pointer to the block of memory that should be freed.</param>
/// <remarks>
/// <para>This method does nothing if <paramref name="ptr" /> is <see langword="null"/>.</para>
/// <para>This method is a thin wrapper over the C <c>free</c> API.</para>
/// </remarks>
public static void Free(void* ptr)
{
Marshal.FreeHGlobal((IntPtr)ptr);
}
}
-39
ファイルの表示
@@ -1,39 +0,0 @@
using System.Runtime.InteropServices;
namespace System.Text;
/// <summary>
/// A polyfill type that mirrors some methods from <see cref="Encoding"/> on .NET 5.
/// </summary>
internal static class EncodingExtensions
{
/// <summary>
/// Encodes into a span of bytes a set of characters from the specified read-only span.
/// </summary>
/// <param name="encoding">The input <see cref="Encoding"/> instance to use.</param>
/// <param name="chars">The span containing the set of characters to encode.</param>
/// <param name="bytes">The byte span to hold the encoded bytes.</param>
/// <returns>The number of encoded bytes.</returns>
public static unsafe int GetBytes(this Encoding encoding, ReadOnlySpan<char> chars, Span<byte> bytes)
{
fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
{
return encoding.GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length);
}
}
/// <summary>
/// Decodes a text from a sequence of bytes.
/// </summary>
/// <param name="encoding">The input <see cref="Encoding"/> instance to use.</param>
/// <param name="bytes">The byte span that holds the encoded bytes.</param>
/// <returns>The resulting text.</returns>
public static unsafe string GetString(this Encoding encoding, ReadOnlySpan<byte> bytes)
{
fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
{
return encoding.GetString(bytesPtr, bytes.Length);
}
}
}