Removed ComputeSharp.Core reference from generator

このコミットが含まれているのは:
Sergio Pedri committed 2020-12-19 12:54:34 +01:00
1 親 fa3b6cb1f6
コミット 99529c3688
4ファイル変更
+47 -7

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

+12 -2
ファイルの表示
@@ -5,7 +5,6 @@ using System.Diagnostics.Contracts;
using System.Reflection;
using ComputeSharp.Core.Extensions;
using ComputeSharp.Exceptions;
using Microsoft.Toolkit.Diagnostics;
namespace ComputeSharp
{
@@ -79,7 +78,10 @@ namespace ComputeSharp
[Pure]
internal static ShaderMethodSourceAttribute GetForDelegate(Delegate function)
{
Guard.IsTrue(function.Method.IsStatic, "Captured delegates need to wrap static methods");
if (!function.Method.IsStatic)
{
ThrowArgumentExceptionForNonStaticShader();
}
var attributes = function.Method.DeclaringType!.Assembly.GetCustomAttributes<ShaderMethodSourceAttribute>();
string methodName = function.Method.GetFullName();
@@ -94,5 +96,13 @@ namespace ComputeSharp
return MissingMethodSourceException.Throw(function);
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when a given <see cref="Delegate"/> is not static.
/// </summary>
private static void ThrowArgumentExceptionForNonStaticShader()
{
throw new ArgumentException("Captured delegates in a shader need to wrap a static method.", "function");
}
}
}
+1 -1
ファイルの表示
@@ -19,7 +19,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Toolkit" Version="7.0.0-preview4" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<!--Hide the package references when this assembly is being packed with the source generator-->
<PackageReference Condition="'$(BuildingPackageForSourceGenerator)' == 'true'" Update="@(PackageReference)" PrivateAssets="all" />
+1
ファイルの表示
@@ -6,6 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Toolkit" Version="7.0.0-preview4" />
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.19041-beta2-379749354" />
</ItemGroup>
+33 -4
ファイルの表示
@@ -10,13 +10,42 @@
<PackSymbols>false</PackSymbols>
</PropertyGroup>
<!--The source generator cannot contain package references or project references, so instead we're just
manually linking the source files from ComputeSharp.Core in here. We only need them to extract metadata
and to match members based on full name, so the types being in the generator assembly are not an issue.-->
<ItemGroup>
<Compile Include="..\ComputeSharp.Core\Attributes\AutoConstructorAttribute.cs" Link="Core\Attributes\AutoConstructorAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Attributes\IComputeShaderSourceAttribute.cs" Link="Core\Attributes\IComputeShaderSourceAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Attributes\ShaderMethodAttribute.cs" Link="Core\Attributes\ShaderMethodAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Attributes\ShaderMethodSourceAttribute.cs" Link="Core\Attributes\ShaderMethodSourceAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Exceptions\InvalidExecutionContextException.cs" Link="Core\Exceptions\InvalidExecutionContextException.cs" />
<Compile Include="..\ComputeSharp.Core\Exceptions\MissingMethodSourceException.cs" Link="Core\Exceptions\MissingMethodSourceException.cs" />
<Compile Include="..\ComputeSharp.Core\Extensions\MethodInfoExtensions.cs" Link="Core\Extensions\MethodInfoExtensions.cs" />
<Compile Include="..\ComputeSharp.Core\Interfaces\IComputeShader.cs" Link="Core\Interfaces\IComputeShader.cs" />
<Compile Include="..\ComputeSharp.Core\Intrinsics\Attributes\PreserveMemberNameAttribute.cs" Link="Core\Intrinsics\Attributes\PreserveMemberNameAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Intrinsics\Hlsl.cs" Link="Core\Intrinsics\Hlsl.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool.cs" Link="Core\Primitives\Bool\Bool.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool2.cs" Link="Core\Primitives\Bool\Bool2.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool3.cs" Link="Core\Primitives\Bool\Bool3.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool4.cs" Link="Core\Primitives\Bool\Bool4.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Double\Double2.cs" Link="Core\Primitives\Double\Double2.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Double\Double3.cs" Link="Core\Primitives\Double\Double3.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Double\Double4.cs" Link="Core\Primitives\Double\Double4.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Float\Float2.cs" Link="Core\Primitives\Float\Float2.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Float\Float3.cs" Link="Core\Primitives\Float\Float3.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Float\Float4.cs" Link="Core\Primitives\Float\Float4.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Int\Int2.cs" Link="Core\Primitives\Int\Int2.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Int\Int3.cs" Link="Core\Primitives\Int\Int3.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Int\Int4.cs" Link="Core\Primitives\Int\Int4.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\ThreadIds.cs" Link="Core\Primitives\ThreadIds.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\UInt\UInt2.cs" Link="Core\Primitives\UInt\UInt2.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\UInt\UInt3.cs" Link="Core\Primitives\UInt\UInt3.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\UInt\UInt4.cs" Link="Core\Primitives\UInt\UInt4.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" PrivateAssets="all" Pack="false" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.1" PrivateAssets="all" Pack="false" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ComputeSharp.Core\ComputeSharp.Core.csproj" PrivateAssets="all" />
</ItemGroup>
</Project>