Enabled generated global usings for HLSL primitives
このコミットが含まれているのは:
1 親
b094a81e32
コミット
5cb9f08f1f
3ファイル変更
+140
検索条件に一致するファイルはありません
@@ -77,4 +77,12 @@
|
||||
<AdditionalFiles Include="AnalyzerReleases.Unshipped.md" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="EmbeddedResources\GlobalUsingDirectives.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="EmbeddedResources\GlobalUsingDirectives.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,95 @@
|
||||
global using bool2 = global::ComputeSharp.Bool2;
|
||||
global using bool3 = global::ComputeSharp.Bool3;
|
||||
global using bool4 = global::ComputeSharp.Bool4;
|
||||
global using bool1x1 = global::ComputeSharp.Bool1x1;
|
||||
global using bool1x2 = global::ComputeSharp.Bool1x2;
|
||||
global using bool1x3 = global::ComputeSharp.Bool1x3;
|
||||
global using bool1x4 = global::ComputeSharp.Bool1x4;
|
||||
global using bool2x1 = global::ComputeSharp.Bool2x1;
|
||||
global using bool2x2 = global::ComputeSharp.Bool2x2;
|
||||
global using bool2x3 = global::ComputeSharp.Bool2x3;
|
||||
global using bool2x4 = global::ComputeSharp.Bool2x4;
|
||||
global using bool3x1 = global::ComputeSharp.Bool3x1;
|
||||
global using bool3x2 = global::ComputeSharp.Bool3x2;
|
||||
global using bool3x3 = global::ComputeSharp.Bool3x3;
|
||||
global using bool3x4 = global::ComputeSharp.Bool3x4;
|
||||
global using bool4x1 = global::ComputeSharp.Bool4x1;
|
||||
global using bool4x2 = global::ComputeSharp.Bool4x2;
|
||||
global using bool4x3 = global::ComputeSharp.Bool4x3;
|
||||
global using bool4x4 = global::ComputeSharp.Bool4x4;
|
||||
global using double2 = global::ComputeSharp.Double2;
|
||||
global using double3 = global::ComputeSharp.Double3;
|
||||
global using double4 = global::ComputeSharp.Double4;
|
||||
global using double1x1 = global::ComputeSharp.Double1x1;
|
||||
global using double1x2 = global::ComputeSharp.Double1x2;
|
||||
global using double1x3 = global::ComputeSharp.Double1x3;
|
||||
global using double1x4 = global::ComputeSharp.Double1x4;
|
||||
global using double2x1 = global::ComputeSharp.Double2x1;
|
||||
global using double2x2 = global::ComputeSharp.Double2x2;
|
||||
global using double2x3 = global::ComputeSharp.Double2x3;
|
||||
global using double2x4 = global::ComputeSharp.Double2x4;
|
||||
global using double3x1 = global::ComputeSharp.Double3x1;
|
||||
global using double3x2 = global::ComputeSharp.Double3x2;
|
||||
global using double3x3 = global::ComputeSharp.Double3x3;
|
||||
global using double3x4 = global::ComputeSharp.Double3x4;
|
||||
global using double4x1 = global::ComputeSharp.Double4x1;
|
||||
global using double4x2 = global::ComputeSharp.Double4x2;
|
||||
global using double4x3 = global::ComputeSharp.Double4x3;
|
||||
global using double4x4 = global::ComputeSharp.Double4x4;
|
||||
global using float2 = global::ComputeSharp.Float2;
|
||||
global using float3 = global::ComputeSharp.Float3;
|
||||
global using float4 = global::ComputeSharp.Float4;
|
||||
global using float1x1 = global::ComputeSharp.Float1x1;
|
||||
global using float1x2 = global::ComputeSharp.Float1x2;
|
||||
global using float1x3 = global::ComputeSharp.Float1x3;
|
||||
global using float1x4 = global::ComputeSharp.Float1x4;
|
||||
global using float2x1 = global::ComputeSharp.Float2x1;
|
||||
global using float2x2 = global::ComputeSharp.Float2x2;
|
||||
global using float2x3 = global::ComputeSharp.Float2x3;
|
||||
global using float2x4 = global::ComputeSharp.Float2x4;
|
||||
global using float3x1 = global::ComputeSharp.Float3x1;
|
||||
global using float3x2 = global::ComputeSharp.Float3x2;
|
||||
global using float3x3 = global::ComputeSharp.Float3x3;
|
||||
global using float3x4 = global::ComputeSharp.Float3x4;
|
||||
global using float4x1 = global::ComputeSharp.Float4x1;
|
||||
global using float4x2 = global::ComputeSharp.Float4x2;
|
||||
global using float4x3 = global::ComputeSharp.Float4x3;
|
||||
global using float4x4 = global::ComputeSharp.Float4x4;
|
||||
global using int2 = global::ComputeSharp.Int2;
|
||||
global using int3 = global::ComputeSharp.Int3;
|
||||
global using int4 = global::ComputeSharp.Int4;
|
||||
global using int1x1 = global::ComputeSharp.Int1x1;
|
||||
global using int1x2 = global::ComputeSharp.Int1x2;
|
||||
global using int1x3 = global::ComputeSharp.Int1x3;
|
||||
global using int1x4 = global::ComputeSharp.Int1x4;
|
||||
global using int2x1 = global::ComputeSharp.Int2x1;
|
||||
global using int2x2 = global::ComputeSharp.Int2x2;
|
||||
global using int2x3 = global::ComputeSharp.Int2x3;
|
||||
global using int2x4 = global::ComputeSharp.Int2x4;
|
||||
global using int3x1 = global::ComputeSharp.Int3x1;
|
||||
global using int3x2 = global::ComputeSharp.Int3x2;
|
||||
global using int3x3 = global::ComputeSharp.Int3x3;
|
||||
global using int3x4 = global::ComputeSharp.Int3x4;
|
||||
global using int4x1 = global::ComputeSharp.Int4x1;
|
||||
global using int4x2 = global::ComputeSharp.Int4x2;
|
||||
global using int4x3 = global::ComputeSharp.Int4x3;
|
||||
global using int4x4 = global::ComputeSharp.Int4x4;
|
||||
global using uint2 = global::ComputeSharp.UInt2;
|
||||
global using uint3 = global::ComputeSharp.UInt3;
|
||||
global using uint4 = global::ComputeSharp.UInt4;
|
||||
global using uint1x1 = global::ComputeSharp.UInt1x1;
|
||||
global using uint1x2 = global::ComputeSharp.UInt1x2;
|
||||
global using uint1x3 = global::ComputeSharp.UInt1x3;
|
||||
global using uint1x4 = global::ComputeSharp.UInt1x4;
|
||||
global using uint2x1 = global::ComputeSharp.UInt2x1;
|
||||
global using uint2x2 = global::ComputeSharp.UInt2x2;
|
||||
global using uint2x3 = global::ComputeSharp.UInt2x3;
|
||||
global using uint2x4 = global::ComputeSharp.UInt2x4;
|
||||
global using uint3x1 = global::ComputeSharp.UInt3x1;
|
||||
global using uint3x2 = global::ComputeSharp.UInt3x2;
|
||||
global using uint3x3 = global::ComputeSharp.UInt3x3;
|
||||
global using uint3x4 = global::ComputeSharp.UInt3x4;
|
||||
global using uint4x1 = global::ComputeSharp.UInt4x1;
|
||||
global using uint4x2 = global::ComputeSharp.UInt4x2;
|
||||
global using uint4x3 = global::ComputeSharp.UInt4x3;
|
||||
global using uint4x4 = global::ComputeSharp.UInt4x4;
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.Text;
|
||||
|
||||
namespace ComputeSharp.SourceGenerators
|
||||
{
|
||||
/// <summary>
|
||||
/// A source generator to create global using directives for the HLSL primitive types.
|
||||
/// </summary>
|
||||
[Generator]
|
||||
public sealed class GlobalUsingDirectivesGenerator : ISourceGenerator
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void Initialize(GeneratorInitializationContext context)
|
||||
{
|
||||
context.RegisterForPostInitialization(static context =>
|
||||
{
|
||||
const string filename = "ComputeSharp.SourceGenerators.EmbeddedResources.GlobalUsingDirectives.cs";
|
||||
|
||||
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(filename);
|
||||
using StreamReader reader = new(stream);
|
||||
|
||||
string globalUsingDirectives = reader.ReadToEnd();
|
||||
|
||||
context.AddSource("GlobalUsingDirectives.cs", SourceText.From(globalUsingDirectives, Encoding.UTF8));
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute(GeneratorExecutionContext context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする