Merge pull request #353 from Sergio0694/dev/csharp-11

Upgrade codebase to C# 11
このコミットが含まれているのは:
Sergio Pedri authored and GitHub committed 2022-09-16 12:39:56 -07:00
コミット ba2cf2f9ee
71ファイル変更
+10927 -4308

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

-3
ファイルの表示
@@ -104,21 +104,18 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.Dynamic.NuGet", "ComputeSharp.Dynamic.NuGet", "{CBA545B4-31EF-4E9F-A1A8-2A1290B54046}"
ProjectSection(SolutionItems) = preProject
tests\ComputeSharp.Dynamic.NuGet\ComputeSharp.Dynamic.NuGet.csproj = tests\ComputeSharp.Dynamic.NuGet\ComputeSharp.Dynamic.NuGet.csproj
tests\ComputeSharp.Dynamic.NuGet\nuget.config = tests\ComputeSharp.Dynamic.NuGet\nuget.config
tests\ComputeSharp.Dynamic.NuGet\Program.cs = tests\ComputeSharp.Dynamic.NuGet\Program.cs
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.Pix.NuGet", "ComputeSharp.Pix.NuGet", "{C0B903AA-F32C-4760-B4B6-199AC4FE1C5A}"
ProjectSection(SolutionItems) = preProject
tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj = tests\ComputeSharp.Pix.NuGet\ComputeSharp.Pix.NuGet.csproj
tests\ComputeSharp.Pix.NuGet\nuget.config = tests\ComputeSharp.Pix.NuGet\nuget.config
tests\ComputeSharp.Pix.NuGet\Program.cs = tests\ComputeSharp.Pix.NuGet\Program.cs
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.NuGet", "ComputeSharp.NuGet", "{E3403F19-A0D8-4317-8A54-322C7A13F2A2}"
ProjectSection(SolutionItems) = preProject
tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj = tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj
tests\ComputeSharp.NuGet\nuget.config = tests\ComputeSharp.NuGet\nuget.config
tests\ComputeSharp.NuGet\Program.cs = tests\ComputeSharp.NuGet\Program.cs
EndProjectSection
EndProject
+9 -1
ファイルの表示
@@ -1,12 +1,20 @@
<Project>
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>10.0</LangVersion>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);MSB3270</NoWarn>
<RestoreSources>
https://api.nuget.org/v3/index.json;
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json;
</RestoreSources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.4.0-2.22423.18" PrivateAssets="all" />
</ItemGroup>
<!-- Centralized location for all generated artifacts -->
<PropertyGroup>
<PackageOutputPath>$(MSBuildThisFileDirectory)artifacts/</PackageOutputPath>
+1
ファイルの表示
@@ -15,6 +15,7 @@
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\Properties\Polyfills\UnscopedRefAttribute.cs" Link="ComputeSharp.Core\Properties\Polyfills\UnscopedRefAttribute.cs.cs" />
<Compile Include="..\ComputeSharp.Core\Attributes\AutoConstructorAttribute.cs" Link="ComputeSharp.Core\Attributes\AutoConstructorAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Attributes\Internals\AutoConstructorBehaviorAttribute.cs" Link="ComputeSharp.Core\Attributes\Internals\AutoConstructorBehaviorAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Attributes\Internals\AutoConstructorBehavior.cs" Link="ComputeSharp.Core\Attributes\Internals\AutoConstructorBehavior.cs" />
+72 -11
ファイルの表示
@@ -1,8 +1,8 @@
using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#if !NET6_0_OR_GREATER
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
#endif
#nullable enable
@@ -30,7 +30,8 @@ public unsafe partial struct Bool2
/// </summary>
/// <param name="i">The index of the component to access.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref bool this[int i] => ref *(bool*)UndefinedData;
[UnscopedRef]
public ref bool this[int i] => ref *(bool*)UndefinedData;
/// <summary>
/// Gets a <see cref="Bool2"/> value with all components set to <see langword="false"/>.
@@ -55,357 +56,417 @@ public unsafe partial struct Bool2
/// <summary>
/// Gets a reference to the <see cref="bool"/> value representing the <c>X</c> component.
/// </summary>
public readonly ref bool X => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.As<int, bool>(ref Unsafe.AsRef(in this.x)), 1));
[UnscopedRef]
public ref bool X => ref Unsafe.As<int, bool>(ref this.x);
/// <summary>
/// Gets a reference to the <see cref="bool"/> value representing the <c>Y</c> component.
/// </summary>
public readonly ref bool Y => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.As<int, bool>(ref Unsafe.AsRef(in this.y)), 1));
[UnscopedRef]
public ref bool Y => ref Unsafe.As<int, bool>(ref this.y);
/// <summary>
/// Gets a readonly reference to the <see cref="Bool2"/> value with the components <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool2 XX => ref *(Bool2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Bool2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Bool2 XY => ref *(Bool2*)UndefinedData;
[UnscopedRef]
public ref Bool2 XY => ref *(Bool2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Bool2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Bool2 YX => ref *(Bool2*)UndefinedData;
[UnscopedRef]
public ref Bool2 YX => ref *(Bool2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool2 YY => ref *(Bool2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 XXX => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 XXY => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 XYX => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 XYY => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 YXX => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 YXY => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 YYX => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 YYY => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 XXXX => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 XXXY => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 XXYX => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 XXYY => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 XYXX => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 XYXY => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 XYYX => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 XYYY => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 YXXX => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 YXXY => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 YXYX => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 YXYY => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 YYXX => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 YYXY => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 YYYX => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 YYYY => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="bool"/> value representing the <c>R</c> component.
/// </summary>
public readonly ref bool R => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.As<int, bool>(ref Unsafe.AsRef(in this.x)), 1));
[UnscopedRef]
public ref bool R => ref Unsafe.As<int, bool>(ref this.x);
/// <summary>
/// Gets a reference to the <see cref="bool"/> value representing the <c>G</c> component.
/// </summary>
public readonly ref bool G => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.As<int, bool>(ref Unsafe.AsRef(in this.y)), 1));
[UnscopedRef]
public ref bool G => ref Unsafe.As<int, bool>(ref this.y);
/// <summary>
/// Gets a readonly reference to the <see cref="Bool2"/> value with the components <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool2 RR => ref *(Bool2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Bool2"/> value with the components <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Bool2 RG => ref *(Bool2*)UndefinedData;
[UnscopedRef]
public ref Bool2 RG => ref *(Bool2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Bool2"/> value with the components <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Bool2 GR => ref *(Bool2*)UndefinedData;
[UnscopedRef]
public ref Bool2 GR => ref *(Bool2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool2"/> value with the components <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool2 GG => ref *(Bool2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 RRR => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 RRG => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 RGR => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 RGG => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 GRR => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 GRG => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 GGR => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool3 GGG => ref *(Bool3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 RRRR => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 RRRG => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 RRGR => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 RRGG => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 RGRR => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 RGRG => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 RGGR => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 RGGG => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 GRRR => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 GRRG => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 GRGR => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 GRGG => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 GGRR => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 GGRG => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 GGGR => ref *(Bool4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Bool4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Bool4 GGGG => ref *(Bool4*)UndefinedData;
#if !SOURCE_GENERATOR
ファイル差分が大きすぎるため表示されません。 差分を読み込み
ファイル差分が大きすぎるため表示されません。 差分を読み込み
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+71 -10
ファイルの表示
@@ -1,10 +1,10 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#if !NET6_0_OR_GREATER
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
#endif
#nullable enable
@@ -35,7 +35,8 @@ public unsafe partial struct Double2
/// </summary>
/// <param name="i">The index of the component to access.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref double this[int i] => ref *(double*)UndefinedData;
[UnscopedRef]
public ref double this[int i] => ref *(double*)UndefinedData;
/// <summary>
/// Gets a <see cref="Double2"/> value with all components set to 0.
@@ -60,357 +61,417 @@ public unsafe partial struct Double2
/// <summary>
/// Gets a reference to the <see cref="double"/> value representing the <c>X</c> component.
/// </summary>
public readonly ref double X => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
[UnscopedRef]
public ref double X => ref this.x;
/// <summary>
/// Gets a reference to the <see cref="double"/> value representing the <c>Y</c> component.
/// </summary>
public readonly ref double Y => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
[UnscopedRef]
public ref double Y => ref this.y;
/// <summary>
/// Gets a readonly reference to the <see cref="Double2"/> value with the components <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double2 XX => ref *(Double2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Double2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Double2 XY => ref *(Double2*)UndefinedData;
[UnscopedRef]
public ref Double2 XY => ref *(Double2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Double2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Double2 YX => ref *(Double2*)UndefinedData;
[UnscopedRef]
public ref Double2 YX => ref *(Double2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double2 YY => ref *(Double2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 XXX => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 XXY => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 XYX => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 XYY => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 YXX => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 YXY => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 YYX => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 YYY => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 XXXX => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 XXXY => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 XXYX => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 XXYY => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 XYXX => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 XYXY => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 XYYX => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 XYYY => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 YXXX => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 YXXY => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 YXYX => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 YXYY => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 YYXX => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 YYXY => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 YYYX => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 YYYY => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="double"/> value representing the <c>R</c> component.
/// </summary>
public readonly ref double R => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
[UnscopedRef]
public ref double R => ref this.x;
/// <summary>
/// Gets a reference to the <see cref="double"/> value representing the <c>G</c> component.
/// </summary>
public readonly ref double G => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
[UnscopedRef]
public ref double G => ref this.y;
/// <summary>
/// Gets a readonly reference to the <see cref="Double2"/> value with the components <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double2 RR => ref *(Double2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Double2"/> value with the components <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Double2 RG => ref *(Double2*)UndefinedData;
[UnscopedRef]
public ref Double2 RG => ref *(Double2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Double2"/> value with the components <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Double2 GR => ref *(Double2*)UndefinedData;
[UnscopedRef]
public ref Double2 GR => ref *(Double2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double2"/> value with the components <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double2 GG => ref *(Double2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 RRR => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 RRG => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 RGR => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 RGG => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 GRR => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 GRG => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 GGR => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double3 GGG => ref *(Double3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 RRRR => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 RRRG => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 RRGR => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 RRGG => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 RGRR => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 RGRG => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 RGGR => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 RGGG => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 GRRR => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 GRRG => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 GRGR => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 GRGG => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 GGRR => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 GGRG => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 GGGR => ref *(Double4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Double4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Double4 GGGG => ref *(Double4*)UndefinedData;
#if !SOURCE_GENERATOR
ファイル差分が大きすぎるため表示されません。 差分を読み込み
ファイル差分が大きすぎるため表示されません。 差分を読み込み
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+72 -11
ファイルの表示
@@ -1,11 +1,11 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using ComputeSharp.Core.Intrinsics.Attributes;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.Core.Intrinsics.Attributes;
#if !NET6_0_OR_GREATER
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
#endif
#nullable enable
@@ -36,7 +36,8 @@ public unsafe partial struct Float2
/// </summary>
/// <param name="i">The index of the component to access.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref float this[int i] => ref *(float*)UndefinedData;
[UnscopedRef]
public ref float this[int i] => ref *(float*)UndefinedData;
/// <summary>
/// Gets a <see cref="Float2"/> value with all components set to 0.
@@ -61,357 +62,417 @@ public unsafe partial struct Float2
/// <summary>
/// Gets a reference to the <see cref="float"/> value representing the <c>X</c> component.
/// </summary>
public readonly ref float X => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
[UnscopedRef]
public ref float X => ref this.x;
/// <summary>
/// Gets a reference to the <see cref="float"/> value representing the <c>Y</c> component.
/// </summary>
public readonly ref float Y => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
[UnscopedRef]
public ref float Y => ref this.y;
/// <summary>
/// Gets a readonly reference to the <see cref="Float2"/> value with the components <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float2 XX => ref *(Float2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Float2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Float2 XY => ref *(Float2*)UndefinedData;
[UnscopedRef]
public ref Float2 XY => ref *(Float2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Float2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Float2 YX => ref *(Float2*)UndefinedData;
[UnscopedRef]
public ref Float2 YX => ref *(Float2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float2 YY => ref *(Float2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 XXX => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 XXY => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 XYX => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 XYY => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 YXX => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 YXY => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 YYX => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 YYY => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 XXXX => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 XXXY => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 XXYX => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 XXYY => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 XYXX => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 XYXY => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 XYYX => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 XYYY => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 YXXX => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 YXXY => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 YXYX => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 YXYY => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 YYXX => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 YYXY => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 YYYX => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 YYYY => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="float"/> value representing the <c>R</c> component.
/// </summary>
public readonly ref float R => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
[UnscopedRef]
public ref float R => ref this.x;
/// <summary>
/// Gets a reference to the <see cref="float"/> value representing the <c>G</c> component.
/// </summary>
public readonly ref float G => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
[UnscopedRef]
public ref float G => ref this.y;
/// <summary>
/// Gets a readonly reference to the <see cref="Float2"/> value with the components <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float2 RR => ref *(Float2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Float2"/> value with the components <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Float2 RG => ref *(Float2*)UndefinedData;
[UnscopedRef]
public ref Float2 RG => ref *(Float2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Float2"/> value with the components <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Float2 GR => ref *(Float2*)UndefinedData;
[UnscopedRef]
public ref Float2 GR => ref *(Float2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float2"/> value with the components <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float2 GG => ref *(Float2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 RRR => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 RRG => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 RGR => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 RGG => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 GRR => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 GRG => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 GGR => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float3 GGG => ref *(Float3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 RRRR => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 RRRG => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 RRGR => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 RRGG => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 RGRR => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 RGRG => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 RGGR => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 RGGG => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 GRRR => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 GRRG => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 GRGR => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 GRGG => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 GGRR => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 GGRG => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 GGGR => ref *(Float4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Float4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Float4 GGGG => ref *(Float4*)UndefinedData;
#if !SOURCE_GENERATOR
ファイル差分が大きすぎるため表示されません。 差分を読み込み
ファイル差分が大きすぎるため表示されません。 差分を読み込み
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+72 -13
ファイルの表示
@@ -1,11 +1,11 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using ComputeSharp.Core.Intrinsics.Attributes;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.Core.Intrinsics.Attributes;
#if !NET6_0_OR_GREATER
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
#endif
#nullable enable
@@ -36,7 +36,8 @@ public unsafe partial struct Int2
/// </summary>
/// <param name="i">The index of the component to access.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref int this[int i] => ref *(int*)UndefinedData;
[UnscopedRef]
public ref int this[int i] => ref *(int*)UndefinedData;
/// <summary>
/// Gets a <see cref="Int2"/> value with all components set to 0.
@@ -61,357 +62,417 @@ public unsafe partial struct Int2
/// <summary>
/// Gets a reference to the <see cref="int"/> value representing the <c>X</c> component.
/// </summary>
public readonly ref int X => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
[UnscopedRef]
public ref int X => ref this.x;
/// <summary>
/// Gets a reference to the <see cref="int"/> value representing the <c>Y</c> component.
/// </summary>
public readonly ref int Y => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
[UnscopedRef]
public ref int Y => ref this.y;
/// <summary>
/// Gets a readonly reference to the <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int2 XX => ref *(Int2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Int2 XY => ref *(Int2*)UndefinedData;
[UnscopedRef]
public ref Int2 XY => ref *(Int2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Int2 YX => ref *(Int2*)UndefinedData;
[UnscopedRef]
public ref Int2 YX => ref *(Int2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int2 YY => ref *(Int2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 XXX => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 XXY => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 XYX => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 XYY => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 YXX => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 YXY => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 YYX => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 YYY => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 XXXX => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 XXXY => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 XXYX => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 XXYY => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 XYXX => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 XYXY => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 XYYX => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 XYYY => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 YXXX => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 YXXY => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 YXYX => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 YXYY => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 YYXX => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 YYXY => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 YYYX => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 YYYY => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="int"/> value representing the <c>R</c> component.
/// </summary>
public readonly ref int R => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
[UnscopedRef]
public ref int R => ref this.x;
/// <summary>
/// Gets a reference to the <see cref="int"/> value representing the <c>G</c> component.
/// </summary>
public readonly ref int G => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
[UnscopedRef]
public ref int G => ref this.y;
/// <summary>
/// Gets a readonly reference to the <see cref="Int2"/> value with the components <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int2 RR => ref *(Int2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Int2"/> value with the components <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Int2 RG => ref *(Int2*)UndefinedData;
[UnscopedRef]
public ref Int2 RG => ref *(Int2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="Int2"/> value with the components <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref Int2 GR => ref *(Int2*)UndefinedData;
[UnscopedRef]
public ref Int2 GR => ref *(Int2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int2"/> value with the components <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int2 GG => ref *(Int2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 RRR => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 RRG => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 RGR => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 RGG => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 GRR => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 GRG => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 GGR => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int3 GGG => ref *(Int3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 RRRR => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 RRRG => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 RRGR => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 RRGG => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 RGRR => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 RGRG => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 RGGR => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 RGGG => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 GRRR => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 GRRG => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 GRGR => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 GRGG => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 GGRR => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 GGRG => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 GGGR => ref *(Int4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="Int4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly Int4 GGGG => ref *(Int4*)UndefinedData;
#if !SOURCE_GENERATOR
@@ -640,7 +701,6 @@ public unsafe partial struct Int2
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static Int2 operator ~(Int2 xy) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="Int2"/> value.
/// </summary>
@@ -676,7 +736,6 @@ public unsafe partial struct Int2
/// <returns>The result of shifting <paramref name="xy"/> left by <paramref name="amount"/>.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static Int2 operator <<(Int2 xy, UInt2 amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="Int2"/> value.
ファイル差分が大きすぎるため表示されません。 差分を読み込み
ファイル差分が大きすぎるため表示されません。 差分を読み込み
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+29 -13
ファイルの表示
@@ -9,6 +9,7 @@
void GenerateAllMatrixProperties(string typeName, int elementSize)
{
#>
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
<#
@@ -19,7 +20,6 @@ using System.Runtime.InteropServices;
#>
#if !NET6_0_OR_GREATER
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
#endif
#pragma warning disable CS0660, CS0661
@@ -150,16 +150,24 @@ public unsafe partial struct <#=fullTypeName#>
/// Gets a reference to a specific row in the current <see cref="<#=fullTypeName#>"/> instance.
/// </summary>
/// <param name="row">The row to access.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref <#=rowTypeName#> this[int row] => ref *(<#=rowTypeName#>*)UndefinedData;
/// <remarks>
/// <para>Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use.</para>
/// <para>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</para>
/// </remarks>
[UnscopedRef]
public ref <#=rowTypeName#> this[int row] => ref *(<#=rowTypeName#>*)UndefinedData;
/// <summary>
/// Gets a swizzled reference to a specific sequence of items in the current <see cref="<#=fullTypeName#>"/> instance.
/// </summary>
/// <param name="xy0">The identifier of the first item to index.</param>
/// <param name="xy1">The identifier of the second item to index.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref <#=typeName#>2 this[MatrixIndex xy0, MatrixIndex xy1] => ref *(<#=typeName#>2*)UndefinedData;
/// <remarks>
/// <para>Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use.</para>
/// <para>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</para>
/// </remarks>
[UnscopedRef]
public ref <#=typeName#>2 this[MatrixIndex xy0, MatrixIndex xy1] => ref *(<#=typeName#>2*)UndefinedData;
/// <summary>
/// Gets a swizzled reference to a specific sequence of items in the current <see cref="<#=fullTypeName#>"/> instance.
@@ -167,8 +175,12 @@ public unsafe partial struct <#=fullTypeName#>
/// <param name="xy0">The identifier of the first item to index.</param>
/// <param name="xy1">The identifier of the second item to index.</param>
/// <param name="xy2">The identifier of the third item to index.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref <#=typeName#>3 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2] => ref *(<#=typeName#>3*)UndefinedData;
/// <remarks>
/// <para>Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use.</para>
/// <para>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</para>
/// </remarks>
[UnscopedRef]
public ref <#=typeName#>3 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2] => ref *(<#=typeName#>3*)UndefinedData;
/// <summary>
/// Gets a swizzled reference to a specific sequence of items in the current <see cref="<#=fullTypeName#>"/> instance.
@@ -177,8 +189,12 @@ public unsafe partial struct <#=fullTypeName#>
/// <param name="xy1">The identifier of the second item to index.</param>
/// <param name="xy2">The identifier of the third item to index.</param>
/// <param name="xy3">The identifier of the fourth item to index.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref <#=typeName#>4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => ref *(<#=typeName#>4*)UndefinedData;
/// <remarks>
/// <para>Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use.</para>
/// <para>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</para>
/// </remarks>s
[UnscopedRef]
public ref <#=typeName#>4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => ref *(<#=typeName#>4*)UndefinedData;
<#
for (int i = 1; i <= rows; i++)
for (int j = 1; j <= columns; j++)
@@ -192,13 +208,15 @@ public unsafe partial struct <#=fullTypeName#>
if (isBoolType)
{
#>
public readonly ref <#=elementTypeName#> M<#=i#><#=j#> => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.As<int, bool>(ref Unsafe.AsRef(in this.m<#=i#><#=j#>)), 1));
[UnscopedRef]
public ref <#=elementTypeName#> M<#=i#><#=j#> => ref Unsafe.As<int, bool>(ref this.m<#=i#><#=j#>);
<#
}
else
{
#>
public readonly ref <#=elementTypeName#> M<#=i#><#=j#> => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.m<#=i#><#=j#>), 1));
[UnscopedRef]
public ref <#=elementTypeName#> M<#=i#><#=j#> => ref this.m<#=i#><#=j#>;
<#
}
#>
@@ -410,7 +428,6 @@ public unsafe partial struct <#=fullTypeName#>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static <#=fullTypeName#> operator ~(<#=fullTypeName#> matrix) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="<#=fullTypeName#>"/> value.
/// </summary>
@@ -446,7 +463,6 @@ public unsafe partial struct <#=fullTypeName#>
/// <returns>The result of shifting <paramref name="matrix"/> left by <paramref name="amount"/>.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static <#=fullTypeName#> operator <<(<#=fullTypeName#> matrix, UInt<#=rows#>x<#=columns#> amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="<#=fullTypeName#>"/> value.
+71 -12
ファイルの表示
@@ -1,10 +1,10 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#if !NET6_0_OR_GREATER
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
#endif
#nullable enable
@@ -35,7 +35,8 @@ public unsafe partial struct UInt2
/// </summary>
/// <param name="i">The index of the component to access.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref uint this[int i] => ref *(uint*)UndefinedData;
[UnscopedRef]
public ref uint this[int i] => ref *(uint*)UndefinedData;
/// <summary>
/// Gets a <see cref="UInt2"/> value with all components set to 0.
@@ -60,357 +61,417 @@ public unsafe partial struct UInt2
/// <summary>
/// Gets a reference to the <see cref="uint"/> value representing the <c>X</c> component.
/// </summary>
public readonly ref uint X => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
[UnscopedRef]
public ref uint X => ref this.x;
/// <summary>
/// Gets a reference to the <see cref="uint"/> value representing the <c>Y</c> component.
/// </summary>
public readonly ref uint Y => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
[UnscopedRef]
public ref uint Y => ref this.y;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt2"/> value with the components <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt2 XX => ref *(UInt2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="UInt2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref UInt2 XY => ref *(UInt2*)UndefinedData;
[UnscopedRef]
public ref UInt2 XY => ref *(UInt2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="UInt2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref UInt2 YX => ref *(UInt2*)UndefinedData;
[UnscopedRef]
public ref UInt2 YX => ref *(UInt2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt2 YY => ref *(UInt2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 XXX => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 XXY => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 XYX => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 XYY => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 YXX => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 YXY => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 YYX => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 YYY => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 XXXX => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 XXXY => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 XXYX => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 XXYY => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 XYXX => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 XYXY => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 XYYX => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 XYYY => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 YXXX => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 YXXY => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 YXYX => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 YXYY => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 YYXX => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 YYXY => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 YYYX => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 YYYY => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="uint"/> value representing the <c>R</c> component.
/// </summary>
public readonly ref uint R => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.x), 1));
[UnscopedRef]
public ref uint R => ref this.x;
/// <summary>
/// Gets a reference to the <see cref="uint"/> value representing the <c>G</c> component.
/// </summary>
public readonly ref uint G => ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.y), 1));
[UnscopedRef]
public ref uint G => ref this.y;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt2"/> value with the components <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt2 RR => ref *(UInt2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="UInt2"/> value with the components <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref UInt2 RG => ref *(UInt2*)UndefinedData;
[UnscopedRef]
public ref UInt2 RG => ref *(UInt2*)UndefinedData;
/// <summary>
/// Gets a reference to the <see cref="UInt2"/> value with the components <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref UInt2 GR => ref *(UInt2*)UndefinedData;
[UnscopedRef]
public ref UInt2 GR => ref *(UInt2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt2"/> value with the components <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt2 GG => ref *(UInt2*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 RRR => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 RRG => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 RGR => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 RGG => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 GRR => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 GRG => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 GGR => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt3"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt3 GGG => ref *(UInt3*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 RRRR => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 RRRG => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 RRGR => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 RRGG => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 RGRR => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 RGRG => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 RGGR => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="R"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 RGGG => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 GRRR => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 GRRG => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 GRGR => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="R"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 GRGG => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 GGRR => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="R"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 GGRG => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="R"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 GGGR => ref *(UInt4*)UndefinedData;
/// <summary>
/// Gets a readonly reference to the <see cref="UInt4"/> value with the components <see cref="G"/>, <see cref="G"/>, <see cref="G"/>, <see cref="G"/>.
/// </summary>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
[UnscopedRef]
public readonly ref readonly UInt4 GGGG => ref *(UInt4*)UndefinedData;
#if !SOURCE_GENERATOR
@@ -543,7 +604,6 @@ public unsafe partial struct UInt2
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static UInt2 operator ~(UInt2 xy) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="UInt2"/> value.
/// </summary>
@@ -579,7 +639,6 @@ public unsafe partial struct UInt2
/// <returns>The result of shifting <paramref name="xy"/> left by <paramref name="amount"/>.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static UInt2 operator <<(UInt2 xy, UInt2 amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="UInt2"/> value.
ファイル差分が大きすぎるため表示されません。 差分を読み込み
ファイル差分が大きすぎるため表示されません。 差分を読み込み
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+22 -13
ファイルの表示
@@ -53,10 +53,22 @@ void GenerateVectorProperties(string typeName, int elementSize)
int i = int.Parse(Regex.Match(typeName, @"\d+$").Value);
string formattable = elementTypeName == "Bool" ? "" : "ISpanFormattable";
List<string> namespaces = new List<string>
{
"System.Diagnostics.CodeAnalysis",
"System.Runtime.CompilerServices",
"System.Runtime.InteropServices"
};
if (elementTypeName != "Bool")
{
WriteLine("using System;");
WriteLine("using System.Globalization;");
namespaces.Add("System");
namespaces.Add("System.Globalization");
}
foreach (string name in namespaces.OrderBy(name => name))
{
WriteLine($"using {name};");
}
if (elementTypeName == "Float" || elementTypeName == "Int")
@@ -64,11 +76,8 @@ void GenerateVectorProperties(string typeName, int elementSize)
WriteLine("using ComputeSharp.Core.Intrinsics.Attributes;");
}
#>
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#if !NET6_0_OR_GREATER
using RuntimeHelpers = ComputeSharp.Core.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
using MemoryMarshal = ComputeSharp.Core.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
#endif
#nullable enable
@@ -113,7 +122,8 @@ public unsafe partial struct <#=typeName#>
/// </summary>
/// <param name="i">The index of the component to access.</param>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public readonly ref <#=hlslElementTypeName#> this[int i] => ref *(<#=hlslElementTypeName#>*)UndefinedData;
[UnscopedRef]
public ref <#=hlslElementTypeName#> this[int i] => ref *(<#=hlslElementTypeName#>*)UndefinedData;
<#
// Generate the true/false and zero/one properties
@@ -194,7 +204,7 @@ public unsafe partial struct <#=typeName#>
string propertyType = propertyName.Length == 1 ? hlslElementTypeName : $"{elementTypeName}{propertyName.Length}";
bool isReadonly = propertyName.Distinct().Count() < propertyName.Length;
string refType = isReadonly ? "ref readonly" : "ref";
string refType = isReadonly ? "readonly ref readonly" : "ref";
// XML docs
WriteLine("/// <summary>");
@@ -206,16 +216,16 @@ public unsafe partial struct <#=typeName#>
char fieldName = "xyzw"["xyzwrgba".IndexOf(propertyName.ToLower()) % 4];
// Property
Write($"public readonly {refType} {propertyType} {propertyName} ");
WriteLine("[UnscopedRef]");
if (isBoolType)
{
// For bool types, also reinterpret cast from int to bool (the backing field is int to ensure all 4 bytes are initialized)
WriteLine($"=> ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.As<int, bool>(ref Unsafe.AsRef(in this.{fieldName})), 1));");
WriteLine($"public {refType} {propertyType} {propertyName} => ref Unsafe.As<int, bool>(ref this.{fieldName});");
}
else
{
WriteLine($"=> ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in this.{fieldName}), 1));");
WriteLine($"public {refType} {propertyType} {propertyName} => ref this.{fieldName};");
}
}
else
@@ -229,7 +239,8 @@ public unsafe partial struct <#=typeName#>
WriteLine("/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>");
// Property
Write($"public readonly {refType} {propertyType} {propertyName} ");
WriteLine("[UnscopedRef]");
Write($"public {refType} {propertyType} {propertyName} ");
WriteLine($"=> ref *({propertyType}*)UndefinedData;");
}
}
@@ -492,7 +503,6 @@ public unsafe partial struct <#=typeName#>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static <#=typeName#> operator ~(<#=typeName#> <#=argumentName#>) => default;
#if NEEDS_CSHARP_11
/// <summary>
/// Shifts right a <see cref="<#=typeName#>"/> value.
/// </summary>
@@ -528,7 +538,6 @@ public unsafe partial struct <#=typeName#>
/// <returns>The result of shifting <paramref name="<#=argumentName#>"/> left by <paramref name="amount"/>.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static <#=typeName#> operator <<(<#=typeName#> <#=argumentName#>, UInt<#=i#> amount) => default;
#endif
/// <summary>
/// Bitwise ands a <see cref="<#=typeName#>"/> value.
+36
ファイルの表示
@@ -0,0 +1,36 @@
// 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>
/// Used to indicate a byref escapes and is not scoped.
/// </summary>
/// <remarks>
/// <para>
/// There are several cases where the C# compiler treats a <see langword="ref"/> as implicitly
/// <see langword="scoped"/> - where the compiler does not allow the <see langword="ref"/> to escape the method.
/// </para>
/// <para>
/// For example:
/// <list type="number">
/// <item><see langword="this"/> for <see langword="struct"/> instance methods.</item>
/// <item><see langword="ref"/> parameters that refer to <see langword="ref"/> <see langword="struct"/> types.</item>
/// <item><see langword="out"/> parameters.</item>
/// </list>
/// </para>
/// <para>
/// This attribute is used in those instances where the <see langword="ref"/> should be allowed to escape.
/// </para>
/// <para>
/// Applying this attribute, in any form, has impact on consumers of the applicable API. It is necessary for
/// API authors to understand the lifetime implications of applying this attribute and how it may impact their users.
/// </para>
/// </remarks>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter,
AllowMultiple = false,
Inherited = false)]
internal sealed class UnscopedRefAttribute : Attribute
{
}
+2 -1
ファイルの表示
@@ -15,6 +15,7 @@
<ItemGroup>
<!-- ComputeSharp.Core APIs -->
<Compile Include="..\ComputeSharp.Core\Properties\Polyfills\UnscopedRefAttribute.cs" Link="ComputeSharp.Core\Properties\Polyfills\UnscopedRefAttribute.cs.cs" />
<Compile Include="..\ComputeSharp.Core\Attributes\AutoConstructorAttribute.cs" Link="ComputeSharp.Core\Attributes\AutoConstructorAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Exceptions\InvalidExecutionContextException.cs" Link="ComputeSharp.Core\Exceptions\InvalidExecutionContextException.cs" />
<Compile Include="..\ComputeSharp.Core\Intrinsics\Attributes\HlslIntrinsicNameAttribute.cs" Link="ComputeSharp.Core\Intrinsics\Attributes\HlslIntrinsicNameAttribute.cs" />
@@ -91,7 +92,7 @@
<Compile Include="..\ComputeSharp.D2D1\Shaders\Exceptions\FxcCompilationException.cs" Link="ComputeSharp.D2D1\Shaders\Exceptions\FxcCompilationException.cs" />
<Compile Include="..\ComputeSharp.D2D1\Shaders\Translation\D3DCompiler.cs" Link="ComputeSharp.D2D1\Shaders\Translation\D3DCompiler.cs" />
<Compile Include="..\ComputeSharp.D2D1\Shaders\Translation\D3DCompiler.ID3DInclude.cs" Link="ComputeSharp.D2D1\Shaders\Translation\D3DCompiler.ID3DInclude.cs" />
<EmbeddedResource Include="..\ComputeSharp.D2D1\Shaders\Translation\Headers\d2d1effecthelpers.hlsli" Link="ComputeSharp.D2D1\Shaders\Translation\Headers\d2d1effecthelpers.hlsli" />
<Compile Include="..\ComputeSharp.D2D1\Shaders\Translation\Headers\d2d1effecthelpers.hlsli.cs" Link="ComputeSharp.D2D1\Shaders\Translation\Headers\d2d1effecthelpers.hlsli.cs" />
</ItemGroup>
<ItemGroup>
-6
ファイルの表示
@@ -4,12 +4,6 @@
<OutputPath>bin\Release</OutputPath>
<DocumentationFile>ComputeSharp.D2D1.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Remove="Shaders\Translation\Headers\d2d1effecthelpers.hlsli" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Shaders\Translation\Headers\d2d1effecthelpers.hlsli" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ComputeSharp.Core\ComputeSharp.Core.csproj" />
+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.Runtime.CompilerServices;
/// <summary>
/// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
/// </summary>
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
internal sealed class CompilerFeatureRequiredAttribute : Attribute
{
/// <summary>
/// Initializes the <see cref="CompilerFeatureRequiredAttribute"/> with the identifier of the syntax used.
/// </summary>
/// <param name="featureName">The name of the compiler feature.</param>
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}
/// <summary>
/// The name of the compiler feature.
/// </summary>
public string FeatureName { get; }
/// <summary>
/// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand <see cref="FeatureName"/>.
/// </summary>
public bool IsOptional { get; init; }
/// <summary>
/// The <see cref="FeatureName"/> used for the ref structs C# feature.
/// </summary>
public const string RefStructs = nameof(RefStructs);
/// <summary>
/// The <see cref="FeatureName"/> used for the required members C# feature.
/// </summary>
public const string RequiredMembers = nameof(RequiredMembers);
}
+18
ファイルの表示
@@ -0,0 +1,18 @@
// 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.CompilerServices;
/// <summary>
/// Specifies that a type has required members or that a member is required.
/// </summary>
[AttributeUsage(
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Field |
AttributeTargets.Property,
AllowMultiple = false,
Inherited = false)]
internal sealed class RequiredMemberAttribute : Attribute
{
}
+139
ファイルの表示
@@ -0,0 +1,139 @@
using System;
#if NET6_0_OR_GREATER
using System.Buffers.Text;
#endif
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
#if !NET6_0_OR_GREATER
using ComputeSharp.D2D1.NetStandard.System.Text;
#endif
namespace ComputeSharp.D2D1.Shaders.Interop.Buffers;
/// <summary>
/// Helpers for the <see cref="ArrayPoolBufferWriter{T}"/> type.
/// </summary>
internal static class ArrayPoolBinaryWriterExtensions
{
/// <summary>
/// Writes the raw value of type <typeparamref name="T"/> into the buffer.
/// </summary>
/// <typeparam name="T">The type of value to write.</typeparam>
/// <param name="writer">The target <see cref="ArrayPoolBufferWriter{T}"/> instance to write data to.</param>
/// <param name="value">The value to write.</param>
/// <remarks>This method will just blit the data of <paramref name="value"/> into the target buffer.</remarks>
public static unsafe void WriteRaw<T>(this in ArrayPoolBufferWriter<byte> writer, scoped in T value)
where T : unmanaged
{
Span<byte> span = writer.GetSpan(sizeof(T));
Unsafe.WriteUnaligned(ref MemoryMarshal.GetReference(span), value);
writer.Advance(sizeof(T));
}
/// <summary>
/// Writes the raw value of type <typeparamref name="T"/> into the buffer.
/// </summary>
/// <typeparam name="T">The type of value to write.</typeparam>
/// <param name="writer">The target <see cref="ArrayPoolBufferWriter{T}"/> instance to write data to.</param>
/// <param name="value">The value to write.</param>
public static unsafe void WriteRaw<T>(this in ArrayPoolBufferWriter<T> writer, scoped in T value)
where T : unmanaged
{
Span<T> span = writer.GetSpan(1);
MemoryMarshal.GetReference(span) = value;
writer.Advance(1);
}
/// <summary>
/// Writes the raw data from the input <see cref="ReadOnlySpan{T}"/> into the buffer.
/// </summary>
/// <typeparam name="T">The type of values in the target writer.</typeparam>
/// <param name="writer">The target <see cref="ArrayPoolBufferWriter{T}"/> instance to write data to.</param>
/// <param name="data">The data to write.</param>
public static void WriteRaw<T>(this in ArrayPoolBufferWriter<T> writer, scoped ReadOnlySpan<T> data)
where T : unmanaged
{
Span<T> span = writer.GetSpan(data.Length);
data.CopyTo(span);
writer.Advance(data.Length);
}
#if !NET6_0_OR_GREATER
/// <summary>
/// Writes the raw data from the input <see cref="ReadOnlySpan{T}"/> into the buffer.
/// </summary>
/// <param name="writer">The target <see cref="ArrayPoolBufferWriter{T}"/> instance to write data to.</param>
/// <param name="data">The data to write.</param>
public static void WriteRaw(this in ArrayPoolBufferWriter<char> writer, string data)
{
Span<char> span = writer.GetSpan(data.Length);
data.AsSpan().CopyTo(span);
writer.Advance(data.Length);
}
#endif
/// <summary>
/// Writes an <see langword="int"/> value as UTF8 bytes into the buffer.
/// </summary>
/// <param name="writer">The target <see cref="ArrayPoolBufferWriter{T}"/> instance to write data to.</param>
/// <param name="value">The value to write.</param>
public static void WriteAsUtf8(this in ArrayPoolBufferWriter<byte> writer, int value)
{
#if NET6_0_OR_GREATER
// Get a span of at least 10 elements (10 is the length of int.MaxValue as text)
Span<byte> span = writer.GetSpan(10);
_ = Utf8Formatter.TryFormat(value, span, out int bytesWritten);
writer.Advance(bytesWritten);
#else
// Just accept the allocation on .NET Standard 2.0
writer.WriteAsUtf8(value.ToString());
#endif
}
/// <summary>
/// Writes text as UTF8 bytes into the buffer.
/// </summary>
/// <param name="writer">The target <see cref="ArrayPoolBufferWriter{T}"/> instance to write data to.</param>
/// <param name="text">The text to write.</param>
public static void WriteAsUtf8(this in ArrayPoolBufferWriter<byte> writer, string text)
{
int maximumByteSize = Encoding.UTF8.GetMaxByteCount(text.Length);
Span<byte> span = writer.GetSpan(maximumByteSize);
int writtenBytes = Encoding.UTF8.GetBytes(text.AsSpan(), span);
writer.Advance(writtenBytes);
}
/// <summary>
/// Writes an <see langword="int"/> value as Unicode bytes into the buffer.
/// </summary>
/// <param name="writer">The target <see cref="ArrayPoolBufferWriter{T}"/> instance to write data to.</param>
/// <param name="value">The value to write.</param>
public static void WriteAsUnicode(this in ArrayPoolBufferWriter<char> writer, int value)
{
#if NET6_0_OR_GREATER
// Get a span of at least 10 elements (10 is the length of int.MaxValue as text)
Span<char> span = writer.GetSpan(10);
_ = value.TryFormat(span, out int charsWritten);
writer.Advance(charsWritten);
#else
// Just accept the allocation on .NET Standard 2.0
writer.WriteRaw(value.ToString().AsSpan());
#endif
}
}
@@ -5,29 +5,32 @@ using System.Diagnostics.CodeAnalysis;
using System.Numerics;
#endif
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
#if !NET6_0_OR_GREATER
using ComputeSharp.D2D1.NetStandard.System.Text;
using BitOperations = ComputeSharp.D2D1.NetStandard.System.Buffers.BitOperations;
#endif
namespace ComputeSharp.D2D1.Shaders.Interop.Buffers;
/// <summary>
/// Represents a heap-based, array-backed output sink into which binary data can be written.
/// </summary>
internal ref struct ArrayPoolBinaryWriter
/// <inheritdoc cref="ArrayPoolBufferWriter{T}"/>
internal static class ArrayPoolBinaryWriter
{
/// <summary>
/// The default buffer size to use to expand empty arrays.
/// </summary>
public const int DefaultInitialBufferSize = 256;
}
/// <summary>
/// Represents a heap-based, array-backed output sink into which data can be written.
/// </summary>
/// <typeparam name="T">The type of values to write.</typeparam>
internal ref struct ArrayPoolBufferWriter<T>
where T : unmanaged
{
/// <summary>
/// The underlying <see cref="byte"/> array.
/// The underlying <typeparamref name="T"/> array.
/// </summary>
private byte[]? array;
private T[]? array;
/// <summary>
/// The starting offset within <see cref="array"/>.
@@ -35,23 +38,24 @@ internal ref struct ArrayPoolBinaryWriter
private int index;
/// <summary>
/// Initializes a new instance of the <see cref="ArrayPoolBinaryWriter"/> class.
/// Initializes a new instance of the <see cref="ArrayPoolBufferWriter{T}"/> class.
/// </summary>
public ArrayPoolBinaryWriter(int capacity)
public ArrayPoolBufferWriter(int capacity)
{
this.array = ArrayPool<byte>.Shared.Rent(capacity);
this.array = ArrayPool<T>.Shared.Rent(capacity);
this.index = 0;
}
/// <summary>
/// Gets the data written to the underlying buffer so far, as a <see cref="ReadOnlySpan{T}"/>.
/// </summary>
public ReadOnlySpan<byte> WrittenSpan
[UnscopedRef]
public readonly ReadOnlySpan<T> WrittenSpan
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
byte[]? array = this.array;
T[]? array = this.array;
if (array is null)
{
@@ -62,44 +66,17 @@ internal ref struct ArrayPoolBinaryWriter
}
}
/// <summary>
/// Writes a value of type <typeparamref name="T"/> into the buffer.
/// </summary>
/// <typeparam name="T">The type of value to write.</typeparam>
/// <param name="value">The value to write.</param>
public unsafe void Write<T>(in T value)
where T : unmanaged
{
Span<byte> span = GetSpan(sizeof(T));
MemoryMarshal.Write(span, ref Unsafe.AsRef(in value));
Advance(sizeof(T));
}
/// <summary>
/// Writes text as UTF8 bytes into the buffer.
/// </summary>
/// <param name="text">The text to write.</param>
public unsafe void WriteAsUtf8(string text)
{
int maximumByteSize = Encoding.UTF8.GetMaxByteCount(text.Length);
Span<byte> span = GetSpan(maximumByteSize);
int writtenBytes = Encoding.UTF8.GetBytes(text.AsSpan(), span);
Advance(writtenBytes);
}
/// <summary>
/// Advances the current writer.
/// </summary>
/// <param name="count">The amount to advance.</param>
/// <remarks>Must be called after <see cref="GetSpan"/>.</remarks>
private void Advance(int count)
/// <remarks>
/// <para>Must be called after <see cref="GetSpan"/>.</para>
/// <para>This and the methods below are <see langword="readonly"/> to enable mutating extensions.</para>
/// </remarks>
internal readonly void Advance(int count)
{
byte[]? array = this.array;
T[]? array = this.array;
if (array is null)
{
@@ -116,7 +93,7 @@ internal ref struct ArrayPoolBinaryWriter
ThrowArgumentExceptionForAdvancedTooFar();
}
this.index += count;
Unsafe.AsRef(in this.index) += count;
}
/// <summary>
@@ -124,7 +101,8 @@ internal ref struct ArrayPoolBinaryWriter
/// </summary>
/// <param name="sizeHint">The capacity to request.</param>
/// <returns>A <see cref="Span{T}"/> to write data to.</returns>
private Span<byte> GetSpan(int sizeHint = 0)
[UnscopedRef]
internal readonly Span<T> GetSpan(int sizeHint = 0)
{
CheckBufferAndEnsureCapacity(sizeHint);
@@ -136,9 +114,9 @@ internal ref struct ArrayPoolBinaryWriter
/// </summary>
/// <param name="sizeHint">The minimum number of items to ensure space for in <see cref="array"/>.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void CheckBufferAndEnsureCapacity(int sizeHint)
private readonly void CheckBufferAndEnsureCapacity(int sizeHint)
{
byte[]? array = this.array;
T[]? array = this.array;
if (array is null)
{
@@ -166,7 +144,7 @@ internal ref struct ArrayPoolBinaryWriter
/// </summary>
/// <param name="sizeHint">The minimum number of items to ensure space for in <see cref="array"/>.</param>
[MethodImpl(MethodImplOptions.NoInlining)]
private void ResizeBuffer(int sizeHint)
private readonly unsafe void ResizeBuffer(int sizeHint)
{
uint minimumSize = (uint)this.index + (uint)sizeHint;
@@ -180,19 +158,19 @@ internal ref struct ArrayPoolBinaryWriter
minimumSize = BitOperations.RoundUpToPowerOf2(minimumSize);
}
byte[] newArray = ArrayPool<byte>.Shared.Rent((int)minimumSize);
T[] newArray = ArrayPool<T>.Shared.Rent((int)minimumSize);
Buffer.BlockCopy(this.array!, 0, newArray, 0, this.index);
Buffer.BlockCopy(this.array!, 0, newArray, 0, this.index * sizeof(T));
ArrayPool<byte>.Shared.Return(this.array!);
ArrayPool<T>.Shared.Return(this.array!);
this.array = newArray;
Unsafe.AsRef(in this.array) = newArray;
}
/// <inheritdoc/>
public void Dispose()
{
byte[]? array = this.array;
T[]? array = this.array;
if (array is null)
{
@@ -201,7 +179,7 @@ internal ref struct ArrayPoolBinaryWriter
this.array = null;
ArrayPool<byte>.Shared.Return(array);
ArrayPool<T>.Shared.Return(array);
}
/// <summary>
+233 -211
ファイルの表示
@@ -1,7 +1,5 @@
using System;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Text;
using ComputeSharp.D2D1.Extensions;
using ComputeSharp.D2D1.Helpers;
using ComputeSharp.D2D1.Interop.Effects;
@@ -84,80 +82,96 @@ public static unsafe class D2D1PixelShaderEffect
PixelShaderEffect.For<T>.Initialize(mapperFactory);
// Setup the input string
StringBuilder effectInputsBuilder = new();
using ArrayPoolBufferWriter<char> writer = new(ArrayPoolBinaryWriter.DefaultInitialBufferSize);
// Build the XML text
writer.WriteRaw("""
<?xml version='1.0'?>
<Effect>
<Property name='DisplayName' type='string' value='
""");
writer.WriteRaw(typeof(T).FullName!);
writer.WriteRaw("""
'/>
<Property name='Author' type='string' value='ComputeSharp.D2D1'/>
<Property name='Category' type='string' value='Stylize'/>
<Property name='Description' type='string' value='A custom D2D1 effect using a pixel shader'/>
<Inputs>
""");
// Add the input nodes
for (int i = 0; i < PixelShaderEffect.For<T>.InputCount; i++)
{
effectInputsBuilder.Append("<Input name='Source");
effectInputsBuilder.Append(i);
effectInputsBuilder.Append("'/>");
writer.WriteRaw(" <Input name='Source");
writer.WriteAsUnicode(i);
writer.WriteRaw("""
'/>
""");
}
// Prepare the XML with a variable number of inputs
string xml = @$"<?xml version='1.0'?>
<Effect>
<Property name='DisplayName' type='string' value='{typeof(T).FullName}'/>
<Property name='Author' type='string' value='ComputeSharp.D2D1'/>
<Property name='Category' type='string' value='Stylize'/>
<Property name='Description' type='string' value='A custom D2D1 effect using a pixel shader'/>
<Inputs>
{effectInputsBuilder}
</Inputs>
<Property name='ConstantBuffer' type='blob'>
<Property name='DisplayName' type='string' value='ConstantBuffer'/>
</Property>
<Property name='ResourceTextureManager0' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager0'/>
</Property>
<Property name='ResourceTextureManager1' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager1'/>
</Property>
<Property name='ResourceTextureManager2' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager2'/>
</Property>
<Property name='ResourceTextureManager3' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager3'/>
</Property>
<Property name='ResourceTextureManager4' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager4'/>
</Property>
<Property name='ResourceTextureManager5' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager5'/>
</Property>
<Property name='ResourceTextureManager6' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager6'/>
</Property>
<Property name='ResourceTextureManager7' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager7'/>
</Property>
<Property name='ResourceTextureManager8' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager8'/>
</Property>
<Property name='ResourceTextureManager9' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager9'/>
</Property>
<Property name='ResourceTextureManager10' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager10'/>
</Property>
<Property name='ResourceTextureManager11' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager11'/>
</Property>
<Property name='ResourceTextureManager12' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager12'/>
</Property>
<Property name='ResourceTextureManager13' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager13'/>
</Property>
<Property name='ResourceTextureManager14' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager14'/>
</Property>
<Property name='ResourceTextureManager15' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager15'/>
</Property>
</Effect>";
// Write the last part of the XML (including the buffer property)
writer.WriteRaw("""
</Inputs>
<Property name='ConstantBuffer' type='blob'>
<Property name='DisplayName' type='string' value='ConstantBuffer'/>
</Property>
<Property name='ResourceTextureManager0' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager0'/>
</Property>
<Property name='ResourceTextureManager1' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager1'/>
</Property>
<Property name='ResourceTextureManager2' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager2'/>
</Property>
<Property name='ResourceTextureManager3' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager3'/>
</Property>
<Property name='ResourceTextureManager4' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager4'/>
</Property>
<Property name='ResourceTextureManager5' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager5'/>
</Property>
<Property name='ResourceTextureManager6' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager6'/>
</Property>
<Property name='ResourceTextureManager7' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager7'/>
</Property>
<Property name='ResourceTextureManager8' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager8'/>
</Property>
<Property name='ResourceTextureManager9' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager9'/>
</Property>
<Property name='ResourceTextureManager10' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager10'/>
</Property>
<Property name='ResourceTextureManager11' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager11'/>
</Property>
<Property name='ResourceTextureManager12' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager12'/>
</Property>
<Property name='ResourceTextureManager13' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager13'/>
</Property>
<Property name='ResourceTextureManager14' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager14'/>
</Property>
<Property name='ResourceTextureManager15' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager15'/>
</Property>
</Effect>
""");
fixed (char* pXml = xml)
// Null terminator for the text
writer.WriteRaw('\0');
fixed (char* pXml = writer.WrittenSpan)
fixed (char* pBufferPropertyName = "ConstantBuffer")
fixed (char* pResourceTextureManager0PropertyName = "ResourceTextureManager0")
fixed (char* pResourceTextureManager1PropertyName = "ResourceTextureManager1")
@@ -328,167 +342,175 @@ public static unsafe class D2D1PixelShaderEffect
PixelShaderEffect.For<T>.Initialize(mapperFactory);
using ArrayPoolBinaryWriter writer = new(ArrayPoolBinaryWriter.DefaultInitialBufferSize);
using ArrayPoolBufferWriter<byte> writer = new(ArrayPoolBinaryWriter.DefaultInitialBufferSize);
// Blob id
writer.Write(D2D1EffectRegistrationData.V1.BlobId);
writer.WriteRaw(D2D1EffectRegistrationData.V1.BlobId);
// Effect id and number of inputs
writer.Write(PixelShaderEffect.For<T>.Id);
writer.Write(PixelShaderEffect.For<T>.InputCount);
writer.WriteRaw(PixelShaderEffect.For<T>.Id);
writer.WriteRaw(PixelShaderEffect.For<T>.InputCount);
// Build the XML text
writer.WriteAsUtf8(@"<?xml version='1.0'?>
<Effect>
<Property name='DisplayName' type='string' value='");
writer.WriteRaw("""
<?xml version='1.0'?>
<Effect>
<Property name='DisplayName' type='string' value='
"""u8);
writer.WriteAsUtf8(typeof(T).FullName!);
writer.WriteAsUtf8(@"'/>
<Property name='Author' type='string' value='ComputeSharp.D2D1'/>
<Property name='Category' type='string' value='Stylize'/>
<Property name='Description' type='string' value='A custom D2D1 effect using a pixel shader'/>
<Inputs>
");
writer.WriteRaw("""
'/>
<Property name='Author' type='string' value='ComputeSharp.D2D1'/>
<Property name='Category' type='string' value='Stylize'/>
<Property name='Description' type='string' value='A custom D2D1 effect using a pixel shader'/>
<Inputs>
"""u8);
// Add the input nodes
for (int i = 0; i < PixelShaderEffect.For<T>.InputCount; i++)
{
writer.WriteAsUtf8("<Input name='Source");
writer.WriteAsUtf8(i.ToString(CultureInfo.InvariantCulture));
writer.WriteAsUtf8($"'/>");
writer.WriteRaw(" <Input name='Source"u8);
writer.WriteAsUtf8(i);
writer.WriteRaw("""
'/>
"""u8);
}
// Write the last part of the XML (including the buffer property)
writer.WriteAsUtf8(@"
</Inputs>
<Property name='ConstantBuffer' type='blob'>
<Property name='DisplayName' type='string' value='ConstantBuffer'/>
</Property>
<Property name='ResourceTextureManager0' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager0'/>
</Property>
<Property name='ResourceTextureManager1' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager1'/>
</Property>
<Property name='ResourceTextureManager2' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager2'/>
</Property>
<Property name='ResourceTextureManager3' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager3'/>
</Property>
<Property name='ResourceTextureManager4' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager4'/>
</Property>
<Property name='ResourceTextureManager5' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager5'/>
</Property>
<Property name='ResourceTextureManager6' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager6'/>
</Property>
<Property name='ResourceTextureManager7' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager7'/>
</Property>
<Property name='ResourceTextureManager8' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager8'/>
</Property>
<Property name='ResourceTextureManager9' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager9'/>
</Property>
<Property name='ResourceTextureManager10' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager10'/>
</Property>
<Property name='ResourceTextureManager11' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager11'/>
</Property>
<Property name='ResourceTextureManager12' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager12'/>
</Property>
<Property name='ResourceTextureManager13' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager13'/>
</Property>
<Property name='ResourceTextureManager14' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager14'/>
</Property>
<Property name='ResourceTextureManager15' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager15'/>
</Property>
</Effect>");
writer.WriteRaw("""
</Inputs>
<Property name='ConstantBuffer' type='blob'>
<Property name='DisplayName' type='string' value='ConstantBuffer'/>
</Property>
<Property name='ResourceTextureManager0' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager0'/>
</Property>
<Property name='ResourceTextureManager1' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager1'/>
</Property>
<Property name='ResourceTextureManager2' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager2'/>
</Property>
<Property name='ResourceTextureManager3' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager3'/>
</Property>
<Property name='ResourceTextureManager4' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager4'/>
</Property>
<Property name='ResourceTextureManager5' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager5'/>
</Property>
<Property name='ResourceTextureManager6' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager6'/>
</Property>
<Property name='ResourceTextureManager7' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager7'/>
</Property>
<Property name='ResourceTextureManager8' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager8'/>
</Property>
<Property name='ResourceTextureManager9' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager9'/>
</Property>
<Property name='ResourceTextureManager10' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager10'/>
</Property>
<Property name='ResourceTextureManager11' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager11'/>
</Property>
<Property name='ResourceTextureManager12' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager12'/>
</Property>
<Property name='ResourceTextureManager13' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager13'/>
</Property>
<Property name='ResourceTextureManager14' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager14'/>
</Property>
<Property name='ResourceTextureManager15' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager15'/>
</Property>
</Effect>
"""u8);
// Null terminator for the text
writer.Write((byte)'\0');
writer.WriteRaw((byte)'\0');
// Bindings
writer.Write(17);
writer.WriteAsUtf8("ConstantBuffer");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetConstantBuffer);
writer.Write((nint)PixelShaderEffect.SetConstantBuffer);
writer.WriteAsUtf8("ResourceTextureManager0");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager0);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager0);
writer.WriteAsUtf8("ResourceTextureManager1");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager1);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager1);
writer.WriteAsUtf8("ResourceTextureManager2");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager2);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager2);
writer.WriteAsUtf8("ResourceTextureManager3");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager3);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager3);
writer.WriteAsUtf8("ResourceTextureManager4");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager4);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager4);
writer.WriteAsUtf8("ResourceTextureManager5");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager5);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager5);
writer.WriteAsUtf8("ResourceTextureManager6");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager6);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager6);
writer.WriteAsUtf8("ResourceTextureManager7");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager7);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager7);
writer.WriteAsUtf8("ResourceTextureManager8");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager8);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager8);
writer.WriteAsUtf8("ResourceTextureManager9");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager9);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager9);
writer.WriteAsUtf8("ResourceTextureManager10");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager10);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager10);
writer.WriteAsUtf8("ResourceTextureManager11");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager11);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager11);
writer.WriteAsUtf8("ResourceTextureManager12");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager12);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager12);
writer.WriteAsUtf8("ResourceTextureManager13");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager13);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager13);
writer.WriteAsUtf8("ResourceTextureManager14");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager14);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager14);
writer.WriteAsUtf8("ResourceTextureManager15");
writer.Write((byte)'\0');
writer.Write((nint)PixelShaderEffect.GetResourceTextureManager15);
writer.Write((nint)PixelShaderEffect.SetResourceTextureManager15);
writer.WriteRaw(17);
writer.WriteRaw("ConstantBuffer"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetConstantBuffer);
writer.WriteRaw((nint)PixelShaderEffect.SetConstantBuffer);
writer.WriteRaw("ResourceTextureManager0"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager0);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager0);
writer.WriteRaw("ResourceTextureManager1"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager1);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager1);
writer.WriteRaw("ResourceTextureManager2"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager2);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager2);
writer.WriteRaw("ResourceTextureManager3"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager3);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager3);
writer.WriteRaw("ResourceTextureManager4"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager4);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager4);
writer.WriteRaw("ResourceTextureManager5"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager5);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager5);
writer.WriteRaw("ResourceTextureManager6"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager6);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager6);
writer.WriteRaw("ResourceTextureManager7"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager7);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager7);
writer.WriteRaw("ResourceTextureManager8"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager8);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager8);
writer.WriteRaw("ResourceTextureManager9"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager9);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager9);
writer.WriteRaw("ResourceTextureManager10"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager10);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager10);
writer.WriteRaw("ResourceTextureManager11"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager11);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager11);
writer.WriteRaw("ResourceTextureManager12"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager12);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager12);
writer.WriteRaw("ResourceTextureManager13"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager13);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager13);
writer.WriteRaw("ResourceTextureManager14"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager14);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager14);
writer.WriteRaw("ResourceTextureManager15"u8);
writer.WriteRaw((byte)'\0');
writer.WriteRaw((nint)PixelShaderEffect.GetResourceTextureManager15);
writer.WriteRaw((nint)PixelShaderEffect.SetResourceTextureManager15);
// Effect factory
writer.Write((nint)PixelShaderEffect.For<T>.Factory);
writer.WriteRaw((nint)PixelShaderEffect.For<T>.Factory);
effectId = PixelShaderEffect.For<T>.Id;
@@ -20,5 +20,5 @@ internal abstract class D2D1TransformMapperFactory<T, TParameters, TTransformMap
/// <summary>
/// The <see cref="D2D1TransformMapperParametersAccessor{T, TParameters}"/> instance to use to retrieve parameters for the transform mapper.
/// </summary>
public D2D1TransformMapperParametersAccessor<T, TParameters>? ParametersAccessor { get; init; }
public required D2D1TransformMapperParametersAccessor<T, TParameters> ParametersAccessor { get; init; }
}
+2 -2
ファイルの表示
@@ -106,12 +106,12 @@ internal sealed class D2D1AffineTransformMapperFactory
/// <summary>
/// Gets the <see cref="D2D1TransformMapperFactory{T}.Accessor{TResult}"/> instance to get the dynamic affine transform matrix.
/// </summary>
public D2D1TransformMapperFactory<T>.Accessor<Matrix3x2>? Accessor { get; init; }
public required D2D1TransformMapperFactory<T>.Accessor<Matrix3x2> Accessor { get; init; }
/// <inheritdoc/>
public override Matrix3x2 Get(in T shader)
{
return Accessor!(in shader);
return Accessor(in shader);
}
}
+2 -2
ファイルの表示
@@ -68,7 +68,7 @@ internal sealed class D2D1InflateTransformMapperFactory<T> : D2D1TransformMapper
/// <summary>
/// Gets the <see cref="D2D1TransformMapperFactory{T}.Accessor{TResult}"/> instance to get the dynamic inflate amount.
/// </summary>
public D2D1TransformMapperFactory<T>.Accessor<int>? Accessor { get; init; }
public required D2D1TransformMapperFactory<T>.Accessor<int> Accessor { get; init; }
/// <inheritdoc/>
public override (int, int, int, int) Get(in T shader)
@@ -87,7 +87,7 @@ internal sealed class D2D1InflateTransformMapperFactory<T> : D2D1TransformMapper
/// <summary>
/// Gets the <see cref="D2D1TransformMapperFactory{T}.Accessor{TResult}"/> instance to get the dynamic inflate LTRB amount.
/// </summary>
public D2D1TransformMapperFactory<T>.Accessor<(int, int, int, int)>? Accessor { get; init; }
public required D2D1TransformMapperFactory<T>.Accessor<(int, int, int, int)> Accessor { get; init; }
/// <inheritdoc/>
public override (int, int, int, int) Get(in T shader)
+3 -50
ファイルの表示
@@ -1,6 +1,4 @@
using System;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -46,16 +44,6 @@ partial class D3DCompiler
/// </summary>
private static readonly void** Vtbl = InitVtbl();
/// <summary>
/// A pointer to a buffer with the contents of <c>d2d1effecthelpers.hlsli</c>.
/// </summary>
private static void* d2D1EffectHelpersData;
/// <summary>
/// The size of the buffer in <see cref="d2D1EffectHelpersData"/>.
/// </summary>
private static int d2D1EffectHelpersSize;
/// <summary>
/// Builds the custom method table pointer for <see cref="ID3DIncludeForD2DHelpers"/>.
/// </summary>
@@ -99,14 +87,8 @@ partial class D3DCompiler
{
if (new string(pFileName) == "d2d1effecthelpers.hlsli")
{
// Load the header if needed
if (d2D1EffectHelpersData is null)
{
d2D1EffectHelpersData = LoadD2D1EffectHelpersHeader(out d2D1EffectHelpersSize);
}
*ppData = d2D1EffectHelpersData;
*pBytes = (uint)d2D1EffectHelpersSize;
*ppData = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(D2D1EffectHelpers.TextUtf8));
*pBytes = (uint)D2D1EffectHelpers.TextUtf8.Length;
return S.S_OK;
}
@@ -120,34 +102,5 @@ partial class D3DCompiler
{
return S.S_OK;
}
/// <summary>
/// Loads the <c>d2d1effecthelpers.hlsli</c> header into a persistent buffer.
/// </summary>
/// <param name="size">The size of the header.</param>
/// <returns>A pointer to a buffer with the contents of <c>d2d1effecthelpers.hlsli</c>.</returns>
private static void* LoadD2D1EffectHelpersHeader(out int size)
{
#if SOURCE_GENERATOR
const string headerFilename = "ComputeSharp.D2D1.SourceGenerators.ComputeSharp.D2D1.Shaders.Translation.Headers.d2d1effecthelpers.hlsli";
#else
const string headerFilename = "ComputeSharp.D2D1.Shaders.Translation.Headers.d2d1effecthelpers.hlsli";
#endif
using Stream source = Assembly.GetExecutingAssembly().GetManifestResourceStream(headerFilename)!;
using MemoryStream destination = new();
source.CopyTo(destination);
byte[] buffer = destination.GetBuffer();
size = (int)destination.Position;
void* pointer = NativeMemory.Alloc((nuint)size);
buffer.AsSpan(0, size).CopyTo(new Span<byte>(pointer, size));
return pointer;
}
}
}
+15 -65
ファイルの表示
@@ -214,77 +214,27 @@ internal static unsafe partial class D3DCompiler
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"D2D_FUNCTION"</c> ASCII text.
/// </summary>
public static ReadOnlySpan<byte> D2D_FUNCTION => new[] { (byte)'D', (byte)'2', (byte)'D', (byte)'_', (byte)'F', (byte)'U', (byte)'N', (byte)'C', (byte)'T', (byte)'I', (byte)'O', (byte)'N', (byte)'\0' };
public static ReadOnlySpan<byte> D2D_FUNCTION => "D2D_FUNCTION"u8;
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"D2D_FULL_SHADER"</c> ASCII text.
/// </summary>
public static ReadOnlySpan<byte> D2D_FULL_SHADER => new[] { (byte)'D', (byte)'2', (byte)'D', (byte)'_', (byte)'F', (byte)'U', (byte)'L', (byte)'L', (byte)'_', (byte)'S', (byte)'H', (byte)'A', (byte)'D', (byte)'E', (byte)'R', (byte)'\0' };
public static ReadOnlySpan<byte> D2D_FULL_SHADER => "D2D_FULL_SHADER"u8;
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>'\0'</c> ASCII character.
/// </summary>
public static ReadOnlySpan<byte> NullTerminator => new[] { (byte)'\0' };
public static ReadOnlySpan<byte> NullTerminator => ""u8;
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"D2D_ENTRY"</c> ASCII text.
/// </summary>
public static ReadOnlySpan<byte> D2D_ENTRY => new[] { (byte)'D', (byte)'2', (byte)'D', (byte)'_', (byte)'E', (byte)'N', (byte)'T', (byte)'R', (byte)'Y', (byte)'\0' };
public static ReadOnlySpan<byte> D2D_ENTRY => "D2D_ENTRY"u8;
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"Execute"</c> ASCII text.
/// </summary>
public static ReadOnlySpan<byte> Execute => new[] { (byte)'E', (byte)'x', (byte)'e', (byte)'c', (byte)'u', (byte)'t', (byte)'e', (byte)'\0' };
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"lib_4_0_level_9_1"</c> ASCII text.
/// </summary>
private static ReadOnlySpan<byte> lib_4_0_level_9_1 => new[] { (byte)'l', (byte)'i', (byte)'b', (byte)'_', (byte)'4', (byte)'_', (byte)'0', (byte)'_', (byte)'l', (byte)'e', (byte)'v', (byte)'e', (byte)'l', (byte)'_', (byte)'9', (byte)'_', (byte)'1', (byte)'\0' };
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"lib_4_0_level_9_3"</c> ASCII text.
/// </summary>
private static ReadOnlySpan<byte> lib_4_0_level_9_3 => new[] { (byte)'l', (byte)'i', (byte)'b', (byte)'_', (byte)'4', (byte)'_', (byte)'0', (byte)'_', (byte)'l', (byte)'e', (byte)'v', (byte)'e', (byte)'l', (byte)'_', (byte)'9', (byte)'_', (byte)'3', (byte)'\0' };
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"lib_4_0"</c> ASCII text.
/// </summary>
private static ReadOnlySpan<byte> lib_4_0 => new[] { (byte)'l', (byte)'i', (byte)'b', (byte)'_', (byte)'4', (byte)'_', (byte)'0', (byte)'\0' };
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"lib_4_1"</c> ASCII text.
/// </summary>
private static ReadOnlySpan<byte> lib_4_1 => new[] { (byte)'l', (byte)'i', (byte)'b', (byte)'_', (byte)'4', (byte)'_', (byte)'1', (byte)'\0' };
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"lib_5_0"</c> ASCII text.
/// </summary>
private static ReadOnlySpan<byte> lib_5_0 => new[] { (byte)'l', (byte)'i', (byte)'b', (byte)'_', (byte)'5', (byte)'_', (byte)'0', (byte)'\0' };
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"ps_4_0_level_9_1"</c> ASCII text.
/// </summary>
private static ReadOnlySpan<byte> ps_4_0_level_9_1 => new[] { (byte)'p', (byte)'s', (byte)'_', (byte)'4', (byte)'_', (byte)'0', (byte)'_', (byte)'l', (byte)'e', (byte)'v', (byte)'e', (byte)'l', (byte)'_', (byte)'9', (byte)'_', (byte)'1', (byte)'\0' };
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"ps_4_0_level_9_3"</c> ASCII text.
/// </summary>
private static ReadOnlySpan<byte> ps_4_0_level_9_3 => new[] { (byte)'p', (byte)'s', (byte)'_', (byte)'4', (byte)'_', (byte)'0', (byte)'_', (byte)'l', (byte)'e', (byte)'v', (byte)'e', (byte)'l', (byte)'_', (byte)'9', (byte)'_', (byte)'3', (byte)'\0' };
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"ps_4_0"</c> ASCII text.
/// </summary>
private static ReadOnlySpan<byte> ps_4_0 => new[] { (byte)'p', (byte)'s', (byte)'_', (byte)'4', (byte)'_', (byte)'0', (byte)'\0' };
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"ps_4_1"</c> ASCII text.
/// </summary>
private static ReadOnlySpan<byte> ps_4_1 => new[] { (byte)'p', (byte)'s', (byte)'_', (byte)'4', (byte)'_', (byte)'1', (byte)'\0' };
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> with the <c>"ps_5_0"</c> ASCII text.
/// </summary>
private static ReadOnlySpan<byte> ps_5_0 => new[] { (byte)'p', (byte)'s', (byte)'_', (byte)'5', (byte)'_', (byte)'0', (byte)'\0' };
public static ReadOnlySpan<byte> Execute => "Execute"u8;
/// <summary>
/// Gets a <see cref="ReadOnlySpan{T}"/> for a given shader profile, for a library.
@@ -295,11 +245,11 @@ internal static unsafe partial class D3DCompiler
{
return shaderProfile switch
{
D2D1ShaderProfile.PixelShader40Level91 => lib_4_0_level_9_1,
D2D1ShaderProfile.PixelShader40Level93 => lib_4_0_level_9_3,
D2D1ShaderProfile.PixelShader40 => lib_4_0,
D2D1ShaderProfile.PixelShader41 => lib_4_1,
_ => lib_5_0
D2D1ShaderProfile.PixelShader40Level91 => "lib_4_0_level_9_1"u8,
D2D1ShaderProfile.PixelShader40Level93 => "lib_4_0_level_9_3"u8,
D2D1ShaderProfile.PixelShader40 => "lib_4_0"u8,
D2D1ShaderProfile.PixelShader41 => "lib_4_1"u8,
_ => "lib_5_0"u8
};
}
@@ -312,11 +262,11 @@ internal static unsafe partial class D3DCompiler
{
return shaderProfile switch
{
D2D1ShaderProfile.PixelShader40Level91 => ps_4_0_level_9_1,
D2D1ShaderProfile.PixelShader40Level93 => ps_4_0_level_9_3,
D2D1ShaderProfile.PixelShader40 => ps_4_0,
D2D1ShaderProfile.PixelShader41 => ps_4_1,
_ => ps_5_0
D2D1ShaderProfile.PixelShader40Level91 => "ps_4_0_level_9_1"u8,
D2D1ShaderProfile.PixelShader40Level93 => "ps_4_0_level_9_3"u8,
D2D1ShaderProfile.PixelShader40 => "ps_4_0"u8,
D2D1ShaderProfile.PixelShader41 => "ps_4_1"u8,
_ => "ps_5_0"u8
};
}
}
-316
ファイルの表示
@@ -1,316 +0,0 @@
//---------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This file is automatically generated. Please do not edit it directly.
//
//---------------------------------------------------------------------------
// File contents:
// - Helpers methods for authoring D2D Effect shader code.
// These are located at the end of the file (D2DGetInput, etc.).
// - The top portion contains definitions and initialization required by the helpers.
// These elements are prefaced with "__D2D" and can be safely ignored.
//
// To use these helpers, the following values must be defined before inclusion:
// D2D_INPUT_COUNT - The number of texture inputs to the effect.
// D2D_INPUT[N]_SIMPLE or D2D_INPUT[N]_COMPLEX - How the effect will sample each input. (If unspecificed, defaults to _COMPLEX.)
// D2D_ENTRY - The name of the entry point being compiled. This will usually be defined on the command line at compilation time.
//
// The following values can be optionally defined:
// D2D_FUNCTION - Compile the entry point as an export function. This will usually be defined on the command line at compilation time.
// D2D_FULL_SHADER - Compile the entry point as a full shader. This will usually be defined on the command line at compilation time.
// D2D_FULL_SHADER_ONLY - Only compile the in-scope entry points to full shaders, never to export functions.
//
#define __D2D_DEFINE_PS_GLOBALS(inputIndex) \
Texture2D<float4> InputTexture##inputIndex : register(t##inputIndex); \
SamplerState InputSampler##inputIndex : register(s##inputIndex); \
// Define a texture and sampler pair for each D2D effect input.
#if (D2D_INPUT_COUNT >= 1)
__D2D_DEFINE_PS_GLOBALS(0)
#endif
#if (D2D_INPUT_COUNT >= 2)
__D2D_DEFINE_PS_GLOBALS(1)
#endif
#if (D2D_INPUT_COUNT >= 3)
__D2D_DEFINE_PS_GLOBALS(2)
#endif
#if (D2D_INPUT_COUNT >= 4)
__D2D_DEFINE_PS_GLOBALS(3)
#endif
#if (D2D_INPUT_COUNT >= 5)
__D2D_DEFINE_PS_GLOBALS(4)
#endif
#if (D2D_INPUT_COUNT >= 6)
__D2D_DEFINE_PS_GLOBALS(5)
#endif
#if (D2D_INPUT_COUNT >= 7)
__D2D_DEFINE_PS_GLOBALS(6)
#endif
#if (D2D_INPUT_COUNT >= 8)
__D2D_DEFINE_PS_GLOBALS(7)
#endif
#define __D2D_MAXIMUM_INPUT_COUNT 8
// Validate that all required shader information has been defined.
#ifndef D2D_INPUT_COUNT
#error D2D_INPUT_COUNT is undefined.
#endif
#if (D2D_INPUT_COUNT > __D2D_MAXIMUM_INPUT_COUNT)
#error D2D_INPUT_COUNT exceeds the maximum input count.
#endif
// Define global statics to hold the values needed by intrinsic methods.
// These values are initialized by the entry point wrapper before calling into the
// effect's shader implementation.
#if !defined(D2D_FUNCTION) || defined(D2D_REQUIRES_SCENE_POSITION)
static float4 __d2dstatic_scenePos = float4(0, 0, 0, 0);
#endif
#define __D2D_DEFINE_INPUT_STATICS(inputIndex) \
static float4 __d2dstatic_input##inputIndex = float4(0, 0, 0, 0); \
static float4 __d2dstatic_uv##inputIndex = float4(0, 0, 0, 0); \
#if (D2D_INPUT_COUNT >= 1)
__D2D_DEFINE_INPUT_STATICS(0)
#endif
#if (D2D_INPUT_COUNT >= 2)
__D2D_DEFINE_INPUT_STATICS(1)
#endif
#if (D2D_INPUT_COUNT >= 3)
__D2D_DEFINE_INPUT_STATICS(2)
#endif
#if (D2D_INPUT_COUNT >= 4)
__D2D_DEFINE_INPUT_STATICS(3)
#endif
#if (D2D_INPUT_COUNT >= 5)
__D2D_DEFINE_INPUT_STATICS(4)
#endif
#if (D2D_INPUT_COUNT >= 6)
__D2D_DEFINE_INPUT_STATICS(5)
#endif
#if (D2D_INPUT_COUNT >= 7)
__D2D_DEFINE_INPUT_STATICS(6)
#endif
#if (D2D_INPUT_COUNT >= 8)
__D2D_DEFINE_INPUT_STATICS(7)
#endif
// Define the scene position parameter according to whether the shader requires it,
// and whether it is the only parameter.
// The scene position input always needs to be defined for full shaders.
#if (!defined(D2D_FUNCTION) || defined(D2D_REQUIRES_SCENE_POSITION))
#if (D2D_INPUT_COUNT == 0)
#define __D2D_SCENE_POS float4 __d2dinput_scenePos : SCENE_POSITION
#define __D2D_INIT_STATIC_SCENE_POS __d2dstatic_scenePos = __d2dinput_scenePos
#else
#define __D2D_SCENE_POS float4 __d2dinput_scenePos : SCENE_POSITION,
#define __D2D_INIT_STATIC_SCENE_POS __d2dstatic_scenePos = __d2dinput_scenePos;
#endif
#else
#define __D2D_SCENE_POS
#define __D2D_INIT_STATIC_SCENE_POS
#endif
// When compiling a function version, simple and complex inputs have different definitions.
// When compiling a full shader, they have the same definition.
// Access to input parameters also differs between functions and full shaders.
#if defined(D2D_FUNCTION)
#define __D2D_SIMPLE_INPUT(index) float4 __d2dinput_color##index : INPUT##index
#define __D2D_INIT_SIMPLE_STATIC(index) __d2dstatic_input##index = __d2dinput_color##index
#else
#define __D2D_SIMPLE_INPUT(index) float4 __d2dinput_uv##index : TEXCOORD##index
#define __D2D_INIT_SIMPLE_STATIC(index) __d2dstatic_uv##index = __d2dinput_uv##index
#endif
#define __D2D_COMPLEX_INPUT(index) float4 __d2dinput_uv##index : TEXCOORD##index
#define __D2D_INIT_COMPLEX_STATIC(index) __d2dstatic_uv##index = __d2dinput_uv##index
#define __D2D_SAMPLE_INPUT(index) InputTexture##index.Sample(InputSampler##index, __d2dstatic_uv##index.xy)
// Define each input as either simple or complex.
#if defined(D2D_INPUT0_SIMPLE)
#define __D2D_INPUT0 __D2D_SIMPLE_INPUT(0)
#define __D2D_INIT_STATIC0 __D2D_INIT_SIMPLE_STATIC(0)
#define __D2D_GET_INPUT0 __d2dstatic_input0
#else
#define __D2D_INPUT0 __D2D_COMPLEX_INPUT(0)
#define __D2D_INIT_STATIC0 __D2D_INIT_COMPLEX_STATIC(0)
#define __D2D_GET_INPUT0 __D2D_SAMPLE_INPUT(0)
#endif
#if defined(D2D_INPUT1_SIMPLE)
#define __D2D_INPUT1 __D2D_SIMPLE_INPUT(1)
#define __D2D_INIT_STATIC1 __D2D_INIT_SIMPLE_STATIC(1)
#define __D2D_GET_INPUT1 __d2dstatic_input1
#else
#define __D2D_INPUT1 __D2D_COMPLEX_INPUT(1)
#define __D2D_INIT_STATIC1 __D2D_INIT_COMPLEX_STATIC(1)
#define __D2D_GET_INPUT1 __D2D_SAMPLE_INPUT(1)
#endif
#if defined(D2D_INPUT2_SIMPLE)
#define __D2D_INPUT2 __D2D_SIMPLE_INPUT(2)
#define __D2D_INIT_STATIC2 __D2D_INIT_SIMPLE_STATIC(2)
#define __D2D_GET_INPUT2 __d2dstatic_input2
#else
#define __D2D_INPUT2 __D2D_COMPLEX_INPUT(2)
#define __D2D_INIT_STATIC2 __D2D_INIT_COMPLEX_STATIC(2)
#define __D2D_GET_INPUT2 __D2D_SAMPLE_INPUT(2)
#endif
#if defined(D2D_INPUT3_SIMPLE)
#define __D2D_INPUT3 __D2D_SIMPLE_INPUT(3)
#define __D2D_INIT_STATIC3 __D2D_INIT_SIMPLE_STATIC(3)
#define __D2D_GET_INPUT3 __d2dstatic_input3
#else
#define __D2D_INPUT3 __D2D_COMPLEX_INPUT(3)
#define __D2D_INIT_STATIC3 __D2D_INIT_COMPLEX_STATIC(3)
#define __D2D_GET_INPUT3 __D2D_SAMPLE_INPUT(3)
#endif
#if defined(D2D_INPUT4_SIMPLE)
#define __D2D_INPUT4 __D2D_SIMPLE_INPUT(4)
#define __D2D_INIT_STATIC4 __D2D_INIT_SIMPLE_STATIC(4)
#define __D2D_GET_INPUT4 __d2dstatic_input4
#else
#define __D2D_INPUT4 __D2D_COMPLEX_INPUT(4)
#define __D2D_INIT_STATIC4 __D2D_INIT_COMPLEX_STATIC(4)
#define __D2D_GET_INPUT4 __D2D_SAMPLE_INPUT(4)
#endif
#if defined(D2D_INPUT5_SIMPLE)
#define __D2D_INPUT5 __D2D_SIMPLE_INPUT(5)
#define __D2D_INIT_STATIC5 __D2D_INIT_SIMPLE_STATIC(5)
#define __D2D_GET_INPUT5 __d2dstatic_input5
#else
#define __D2D_INPUT5 __D2D_COMPLEX_INPUT(5)
#define __D2D_INIT_STATIC5 __D2D_INIT_COMPLEX_STATIC(5)
#define __D2D_GET_INPUT5 __D2D_SAMPLE_INPUT(5)
#endif
#if defined(D2D_INPUT6_SIMPLE)
#define __D2D_INPUT6 __D2D_SIMPLE_INPUT(6)
#define __D2D_INIT_STATIC6 __D2D_INIT_SIMPLE_STATIC(6)
#define __D2D_GET_INPUT6 __d2dstatic_input6
#else
#define __D2D_INPUT6 __D2D_COMPLEX_INPUT(6)
#define __D2D_INIT_STATIC6 __D2D_INIT_COMPLEX_STATIC(6)
#define __D2D_GET_INPUT6 __D2D_SAMPLE_INPUT(6)
#endif
#if defined(D2D_INPUT7_SIMPLE)
#define __D2D_INPUT7 __D2D_SIMPLE_INPUT(7)
#define __D2D_INIT_STATIC7 __D2D_INIT_SIMPLE_STATIC(7)
#define __D2D_GET_INPUT7 __d2dstatic_input7
#else
#define __D2D_INPUT7 __D2D_COMPLEX_INPUT(7)
#define __D2D_INIT_STATIC7 __D2D_INIT_COMPLEX_STATIC(7)
#define __D2D_GET_INPUT7 __D2D_SAMPLE_INPUT(7)
#endif
#if defined(D2D_INPUT8_SIMPLE)
#define __D2D_INPUT8 __D2D_SIMPLE_INPUT(8)
#define __D2D_INIT_STATIC8 __D2D_INIT_SIMPLE_STATIC(8)
#define __D2D_GET_INPUT8 __d2dstatic_input8
#else
#define __D2D_INPUT8 __D2D_COMPLEX_INPUT(8)
#define __D2D_INIT_STATIC8 __D2D_INIT_COMPLEX_STATIC(8)
#define __D2D_GET_INPUT8 __D2D_SAMPLE_INPUT(8)
#endif
// Define the export function inputs based on the defined input count and types.
#if (D2D_INPUT_COUNT == 0)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS
#elif (D2D_INPUT_COUNT == 1)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0
#elif (D2D_INPUT_COUNT == 2)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1
#elif (D2D_INPUT_COUNT == 3)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2
#elif (D2D_INPUT_COUNT == 4)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2, __D2D_INPUT3
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2; __D2D_INIT_STATIC3
#elif (D2D_INPUT_COUNT == 5)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2, __D2D_INPUT3, __D2D_INPUT4
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2; __D2D_INIT_STATIC3; __D2D_INIT_STATIC4
#elif (D2D_INPUT_COUNT == 6)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2, __D2D_INPUT3, __D2D_INPUT4, __D2D_INPUT5
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2; __D2D_INIT_STATIC3; __D2D_INIT_STATIC4; __D2D_INIT_STATIC5
#elif (D2D_INPUT_COUNT == 7)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2, __D2D_INPUT3, __D2D_INPUT4, __D2D_INPUT5, __D2D_INPUT6
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2; __D2D_INIT_STATIC3; __D2D_INIT_STATIC4; __D2D_INIT_STATIC5; __D2D_INIT_STATIC6
#elif (D2D_INPUT_COUNT == 8)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2, __D2D_INPUT3, __D2D_INPUT4, __D2D_INPUT5, __D2D_INPUT6, __D2D_INPUT7
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2; __D2D_INIT_STATIC3; __D2D_INIT_STATIC4; __D2D_INIT_STATIC5; __D2D_INIT_STATIC6; __D2D_INIT_STATIC7
#endif
#if !defined(CONCAT)
#define CONCAT(str1, str2) str1##str2
#endif
// Rename the entry point target function so that the actual entry point can use the name.
// This expansion is the same for both full shaders and functions.
#define D2D_PS_ENTRY(name) float4 CONCAT(name, _Impl)()
// If neither D2D_FUNCTION or D2D_FULL_SHADER is defined, behave as if D2D_FULL_SHADER is defined.
#if defined(D2D_FUNCTION) && !defined(D2D_FULL_SHADER_ONLY)
// Replaces simple samples with either static variable or an actual sample,
// depending on whether the input is declared as simple or complex.
#define D2DGetInput(index) __D2D_GET_INPUT##index
#if !defined(D2D_CUSTOM_ENTRY)
// Declare function prototype for the target function so that it can be referenced before definition.
// D2D_ENTRY is a macro whose actual name resolves to the effect's target "entry point" function.
float4 CONCAT(D2D_ENTRY, _Impl)();
// This is the actual entry point definition, which forwards the call to the target function.
export float4 D2D_func_entry(__D2D_FUNCTION_INPUTS)
{
__D2D_INIT_STATICS;
return CONCAT(D2D_ENTRY, _Impl)();
}
#endif
#else // !defined(D2D_FUNCTION)
// Replaces simple samples with actual samples.
#define D2DGetInput(index) __D2D_SAMPLE_INPUT(index)
#if !defined(D2D_CUSTOM_ENTRY)
// Declare function prototype for the target function so that it can be referenced before definition.
// D2D_ENTRY is a macro whose actual name resolves to the effect's target "entry point" function.
float4 CONCAT(D2D_ENTRY, _Impl)();
// This is the actual entry point definition, which forwards the call to the target function.
float4 D2D_ENTRY (float4 pos : SV_POSITION, __D2D_FUNCTION_INPUTS) : SV_TARGET
{
__D2D_INIT_STATICS;
return CONCAT(D2D_ENTRY, _Impl)();
}
#endif
#endif // D2D_FUNCTION
//===============================================================
// Along with D2DGetInput defined above, the following macros and
// methods define D2D intrinsics for use in effect shader code.
//===============================================================
#if !defined(D2D_FUNCTION) || defined(D2D_REQUIRES_SCENE_POSITION)
inline float4 D2DGetScenePosition()
{
return __d2dstatic_scenePos;
}
#endif
#define D2DGetInputCoordinate(index) __d2dstatic_uv##index
#define D2DSampleInput(index, position) InputTexture##index.Sample(InputSampler##index, position)
#define D2DSampleInputAtOffset(index, offset) InputTexture##index.Sample(InputSampler##index, __d2dstatic_uv##index.xy + offset * __d2dstatic_uv##index.zw)
#define D2DSampleInputAtPosition(index, pos) InputTexture##index.Sample(InputSampler##index, __d2dstatic_uv##index.xy + __d2dstatic_uv##index.zw * (pos - __d2dstatic_scenePos.xy))
+337
ファイルの表示
@@ -0,0 +1,337 @@
using System;
namespace ComputeSharp.D2D1.Shaders.Translation;
/// <summary>
/// A helper class with the contents of the <c>d2d1effecthelpers.hlsli</c> header.
/// </summary>
internal static class D2D1EffectHelpers
{
/// <summary>
/// Gets the contents of the <c>d2d1effecthelpers.hlsli</c> header, as UTF8 text.
/// </summary>
public static ReadOnlySpan<byte> TextUtf8
{
get
{
return """
//---------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This file is automatically generated. Please do not edit it directly.
//
//---------------------------------------------------------------------------
// File contents:
// - Helpers methods for authoring D2D Effect shader code.
// These are located at the end of the file (D2DGetInput, etc.).
// - The top portion contains definitions and initialization required by the helpers.
// These elements are prefaced with "__D2D" and can be safely ignored.
//
// To use these helpers, the following values must be defined before inclusion:
// D2D_INPUT_COUNT - The number of texture inputs to the effect.
// D2D_INPUT[N]_SIMPLE or D2D_INPUT[N]_COMPLEX - How the effect will sample each input. (If unspecificed, defaults to _COMPLEX.)
// D2D_ENTRY - The name of the entry point being compiled. This will usually be defined on the command line at compilation time.
//
// The following values can be optionally defined:
// D2D_FUNCTION - Compile the entry point as an export function. This will usually be defined on the command line at compilation time.
// D2D_FULL_SHADER - Compile the entry point as a full shader. This will usually be defined on the command line at compilation time.
// D2D_FULL_SHADER_ONLY - Only compile the in-scope entry points to full shaders, never to export functions.
//
#define __D2D_DEFINE_PS_GLOBALS(inputIndex) \
Texture2D<float4> InputTexture##inputIndex : register(t##inputIndex); \
SamplerState InputSampler##inputIndex : register(s##inputIndex); \
// Define a texture and sampler pair for each D2D effect input.
#if (D2D_INPUT_COUNT >= 1)
__D2D_DEFINE_PS_GLOBALS(0)
#endif
#if (D2D_INPUT_COUNT >= 2)
__D2D_DEFINE_PS_GLOBALS(1)
#endif
#if (D2D_INPUT_COUNT >= 3)
__D2D_DEFINE_PS_GLOBALS(2)
#endif
#if (D2D_INPUT_COUNT >= 4)
__D2D_DEFINE_PS_GLOBALS(3)
#endif
#if (D2D_INPUT_COUNT >= 5)
__D2D_DEFINE_PS_GLOBALS(4)
#endif
#if (D2D_INPUT_COUNT >= 6)
__D2D_DEFINE_PS_GLOBALS(5)
#endif
#if (D2D_INPUT_COUNT >= 7)
__D2D_DEFINE_PS_GLOBALS(6)
#endif
#if (D2D_INPUT_COUNT >= 8)
__D2D_DEFINE_PS_GLOBALS(7)
#endif
#define __D2D_MAXIMUM_INPUT_COUNT 8
// Validate that all required shader information has been defined.
#ifndef D2D_INPUT_COUNT
#error D2D_INPUT_COUNT is undefined.
#endif
#if (D2D_INPUT_COUNT > __D2D_MAXIMUM_INPUT_COUNT)
#error D2D_INPUT_COUNT exceeds the maximum input count.
#endif
// Define global statics to hold the values needed by intrinsic methods.
// These values are initialized by the entry point wrapper before calling into the
// effect's shader implementation.
#if !defined(D2D_FUNCTION) || defined(D2D_REQUIRES_SCENE_POSITION)
static float4 __d2dstatic_scenePos = float4(0, 0, 0, 0);
#endif
#define __D2D_DEFINE_INPUT_STATICS(inputIndex) \
static float4 __d2dstatic_input##inputIndex = float4(0, 0, 0, 0); \
static float4 __d2dstatic_uv##inputIndex = float4(0, 0, 0, 0); \
#if (D2D_INPUT_COUNT >= 1)
__D2D_DEFINE_INPUT_STATICS(0)
#endif
#if (D2D_INPUT_COUNT >= 2)
__D2D_DEFINE_INPUT_STATICS(1)
#endif
#if (D2D_INPUT_COUNT >= 3)
__D2D_DEFINE_INPUT_STATICS(2)
#endif
#if (D2D_INPUT_COUNT >= 4)
__D2D_DEFINE_INPUT_STATICS(3)
#endif
#if (D2D_INPUT_COUNT >= 5)
__D2D_DEFINE_INPUT_STATICS(4)
#endif
#if (D2D_INPUT_COUNT >= 6)
__D2D_DEFINE_INPUT_STATICS(5)
#endif
#if (D2D_INPUT_COUNT >= 7)
__D2D_DEFINE_INPUT_STATICS(6)
#endif
#if (D2D_INPUT_COUNT >= 8)
__D2D_DEFINE_INPUT_STATICS(7)
#endif
// Define the scene position parameter according to whether the shader requires it,
// and whether it is the only parameter.
// The scene position input always needs to be defined for full shaders.
#if (!defined(D2D_FUNCTION) || defined(D2D_REQUIRES_SCENE_POSITION))
#if (D2D_INPUT_COUNT == 0)
#define __D2D_SCENE_POS float4 __d2dinput_scenePos : SCENE_POSITION
#define __D2D_INIT_STATIC_SCENE_POS __d2dstatic_scenePos = __d2dinput_scenePos
#else
#define __D2D_SCENE_POS float4 __d2dinput_scenePos : SCENE_POSITION,
#define __D2D_INIT_STATIC_SCENE_POS __d2dstatic_scenePos = __d2dinput_scenePos;
#endif
#else
#define __D2D_SCENE_POS
#define __D2D_INIT_STATIC_SCENE_POS
#endif
// When compiling a function version, simple and complex inputs have different definitions.
// When compiling a full shader, they have the same definition.
// Access to input parameters also differs between functions and full shaders.
#if defined(D2D_FUNCTION)
#define __D2D_SIMPLE_INPUT(index) float4 __d2dinput_color##index : INPUT##index
#define __D2D_INIT_SIMPLE_STATIC(index) __d2dstatic_input##index = __d2dinput_color##index
#else
#define __D2D_SIMPLE_INPUT(index) float4 __d2dinput_uv##index : TEXCOORD##index
#define __D2D_INIT_SIMPLE_STATIC(index) __d2dstatic_uv##index = __d2dinput_uv##index
#endif
#define __D2D_COMPLEX_INPUT(index) float4 __d2dinput_uv##index : TEXCOORD##index
#define __D2D_INIT_COMPLEX_STATIC(index) __d2dstatic_uv##index = __d2dinput_uv##index
#define __D2D_SAMPLE_INPUT(index) InputTexture##index.Sample(InputSampler##index, __d2dstatic_uv##index.xy)
// Define each input as either simple or complex.
#if defined(D2D_INPUT0_SIMPLE)
#define __D2D_INPUT0 __D2D_SIMPLE_INPUT(0)
#define __D2D_INIT_STATIC0 __D2D_INIT_SIMPLE_STATIC(0)
#define __D2D_GET_INPUT0 __d2dstatic_input0
#else
#define __D2D_INPUT0 __D2D_COMPLEX_INPUT(0)
#define __D2D_INIT_STATIC0 __D2D_INIT_COMPLEX_STATIC(0)
#define __D2D_GET_INPUT0 __D2D_SAMPLE_INPUT(0)
#endif
#if defined(D2D_INPUT1_SIMPLE)
#define __D2D_INPUT1 __D2D_SIMPLE_INPUT(1)
#define __D2D_INIT_STATIC1 __D2D_INIT_SIMPLE_STATIC(1)
#define __D2D_GET_INPUT1 __d2dstatic_input1
#else
#define __D2D_INPUT1 __D2D_COMPLEX_INPUT(1)
#define __D2D_INIT_STATIC1 __D2D_INIT_COMPLEX_STATIC(1)
#define __D2D_GET_INPUT1 __D2D_SAMPLE_INPUT(1)
#endif
#if defined(D2D_INPUT2_SIMPLE)
#define __D2D_INPUT2 __D2D_SIMPLE_INPUT(2)
#define __D2D_INIT_STATIC2 __D2D_INIT_SIMPLE_STATIC(2)
#define __D2D_GET_INPUT2 __d2dstatic_input2
#else
#define __D2D_INPUT2 __D2D_COMPLEX_INPUT(2)
#define __D2D_INIT_STATIC2 __D2D_INIT_COMPLEX_STATIC(2)
#define __D2D_GET_INPUT2 __D2D_SAMPLE_INPUT(2)
#endif
#if defined(D2D_INPUT3_SIMPLE)
#define __D2D_INPUT3 __D2D_SIMPLE_INPUT(3)
#define __D2D_INIT_STATIC3 __D2D_INIT_SIMPLE_STATIC(3)
#define __D2D_GET_INPUT3 __d2dstatic_input3
#else
#define __D2D_INPUT3 __D2D_COMPLEX_INPUT(3)
#define __D2D_INIT_STATIC3 __D2D_INIT_COMPLEX_STATIC(3)
#define __D2D_GET_INPUT3 __D2D_SAMPLE_INPUT(3)
#endif
#if defined(D2D_INPUT4_SIMPLE)
#define __D2D_INPUT4 __D2D_SIMPLE_INPUT(4)
#define __D2D_INIT_STATIC4 __D2D_INIT_SIMPLE_STATIC(4)
#define __D2D_GET_INPUT4 __d2dstatic_input4
#else
#define __D2D_INPUT4 __D2D_COMPLEX_INPUT(4)
#define __D2D_INIT_STATIC4 __D2D_INIT_COMPLEX_STATIC(4)
#define __D2D_GET_INPUT4 __D2D_SAMPLE_INPUT(4)
#endif
#if defined(D2D_INPUT5_SIMPLE)
#define __D2D_INPUT5 __D2D_SIMPLE_INPUT(5)
#define __D2D_INIT_STATIC5 __D2D_INIT_SIMPLE_STATIC(5)
#define __D2D_GET_INPUT5 __d2dstatic_input5
#else
#define __D2D_INPUT5 __D2D_COMPLEX_INPUT(5)
#define __D2D_INIT_STATIC5 __D2D_INIT_COMPLEX_STATIC(5)
#define __D2D_GET_INPUT5 __D2D_SAMPLE_INPUT(5)
#endif
#if defined(D2D_INPUT6_SIMPLE)
#define __D2D_INPUT6 __D2D_SIMPLE_INPUT(6)
#define __D2D_INIT_STATIC6 __D2D_INIT_SIMPLE_STATIC(6)
#define __D2D_GET_INPUT6 __d2dstatic_input6
#else
#define __D2D_INPUT6 __D2D_COMPLEX_INPUT(6)
#define __D2D_INIT_STATIC6 __D2D_INIT_COMPLEX_STATIC(6)
#define __D2D_GET_INPUT6 __D2D_SAMPLE_INPUT(6)
#endif
#if defined(D2D_INPUT7_SIMPLE)
#define __D2D_INPUT7 __D2D_SIMPLE_INPUT(7)
#define __D2D_INIT_STATIC7 __D2D_INIT_SIMPLE_STATIC(7)
#define __D2D_GET_INPUT7 __d2dstatic_input7
#else
#define __D2D_INPUT7 __D2D_COMPLEX_INPUT(7)
#define __D2D_INIT_STATIC7 __D2D_INIT_COMPLEX_STATIC(7)
#define __D2D_GET_INPUT7 __D2D_SAMPLE_INPUT(7)
#endif
#if defined(D2D_INPUT8_SIMPLE)
#define __D2D_INPUT8 __D2D_SIMPLE_INPUT(8)
#define __D2D_INIT_STATIC8 __D2D_INIT_SIMPLE_STATIC(8)
#define __D2D_GET_INPUT8 __d2dstatic_input8
#else
#define __D2D_INPUT8 __D2D_COMPLEX_INPUT(8)
#define __D2D_INIT_STATIC8 __D2D_INIT_COMPLEX_STATIC(8)
#define __D2D_GET_INPUT8 __D2D_SAMPLE_INPUT(8)
#endif
// Define the export function inputs based on the defined input count and types.
#if (D2D_INPUT_COUNT == 0)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS
#elif (D2D_INPUT_COUNT == 1)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0
#elif (D2D_INPUT_COUNT == 2)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1
#elif (D2D_INPUT_COUNT == 3)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2
#elif (D2D_INPUT_COUNT == 4)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2, __D2D_INPUT3
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2; __D2D_INIT_STATIC3
#elif (D2D_INPUT_COUNT == 5)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2, __D2D_INPUT3, __D2D_INPUT4
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2; __D2D_INIT_STATIC3; __D2D_INIT_STATIC4
#elif (D2D_INPUT_COUNT == 6)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2, __D2D_INPUT3, __D2D_INPUT4, __D2D_INPUT5
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2; __D2D_INIT_STATIC3; __D2D_INIT_STATIC4; __D2D_INIT_STATIC5
#elif (D2D_INPUT_COUNT == 7)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2, __D2D_INPUT3, __D2D_INPUT4, __D2D_INPUT5, __D2D_INPUT6
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2; __D2D_INIT_STATIC3; __D2D_INIT_STATIC4; __D2D_INIT_STATIC5; __D2D_INIT_STATIC6
#elif (D2D_INPUT_COUNT == 8)
#define __D2D_FUNCTION_INPUTS __D2D_SCENE_POS __D2D_INPUT0, __D2D_INPUT1, __D2D_INPUT2, __D2D_INPUT3, __D2D_INPUT4, __D2D_INPUT5, __D2D_INPUT6, __D2D_INPUT7
#define __D2D_INIT_STATICS __D2D_INIT_STATIC_SCENE_POS __D2D_INIT_STATIC0; __D2D_INIT_STATIC1; __D2D_INIT_STATIC2; __D2D_INIT_STATIC3; __D2D_INIT_STATIC4; __D2D_INIT_STATIC5; __D2D_INIT_STATIC6; __D2D_INIT_STATIC7
#endif
#if !defined(CONCAT)
#define CONCAT(str1, str2) str1##str2
#endif
// Rename the entry point target function so that the actual entry point can use the name.
// This expansion is the same for both full shaders and functions.
#define D2D_PS_ENTRY(name) float4 CONCAT(name, _Impl)()
// If neither D2D_FUNCTION or D2D_FULL_SHADER is defined, behave as if D2D_FULL_SHADER is defined.
#if defined(D2D_FUNCTION) && !defined(D2D_FULL_SHADER_ONLY)
// Replaces simple samples with either static variable or an actual sample,
// depending on whether the input is declared as simple or complex.
#define D2DGetInput(index) __D2D_GET_INPUT##index
#if !defined(D2D_CUSTOM_ENTRY)
// Declare function prototype for the target function so that it can be referenced before definition.
// D2D_ENTRY is a macro whose actual name resolves to the effect's target "entry point" function.
float4 CONCAT(D2D_ENTRY, _Impl)();
// This is the actual entry point definition, which forwards the call to the target function.
export float4 D2D_func_entry(__D2D_FUNCTION_INPUTS)
{
__D2D_INIT_STATICS;
return CONCAT(D2D_ENTRY, _Impl)();
}
#endif
#else // !defined(D2D_FUNCTION)
// Replaces simple samples with actual samples.
#define D2DGetInput(index) __D2D_SAMPLE_INPUT(index)
#if !defined(D2D_CUSTOM_ENTRY)
// Declare function prototype for the target function so that it can be referenced before definition.
// D2D_ENTRY is a macro whose actual name resolves to the effect's target "entry point" function.
float4 CONCAT(D2D_ENTRY, _Impl)();
// This is the actual entry point definition, which forwards the call to the target function.
float4 D2D_ENTRY (float4 pos : SV_POSITION, __D2D_FUNCTION_INPUTS) : SV_TARGET
{
__D2D_INIT_STATICS;
return CONCAT(D2D_ENTRY, _Impl)();
}
#endif
#endif // D2D_FUNCTION
//===============================================================
// Along with D2DGetInput defined above, the following macros and
// methods define D2D intrinsics for use in effect shader code.
//===============================================================
#if !defined(D2D_FUNCTION) || defined(D2D_REQUIRES_SCENE_POSITION)
inline float4 D2DGetScenePosition()
{
return __d2dstatic_scenePos;
}
#endif
#define D2DGetInputCoordinate(index) __d2dstatic_uv##index
#define D2DSampleInput(index, position) InputTexture##index.Sample(InputSampler##index, position)
#define D2DSampleInputAtOffset(index, offset) InputTexture##index.Sample(InputSampler##index, __d2dstatic_uv##index.xy + offset * __d2dstatic_uv##index.zw)
#define D2DSampleInputAtPosition(index, pos) InputTexture##index.Sample(InputSampler##index, __d2dstatic_uv##index.xy + __d2dstatic_uv##index.zw * (pos - __d2dstatic_scenePos.xy))
"""u8;
}
}
}
+13 -13
ファイルの表示
@@ -20,7 +20,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void BeginEvent(this in ComputeContext context, Color color, string message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
int argb = color.ToArgb();
uint pixColor = Pix.PIX_COLOR((byte)((argb & 0x00FF0000) >> 16), (byte)((argb & 0x0000FF00) >> 8), (byte)(argb & 0x000000FF));
@@ -37,7 +37,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void BeginEvent(this in ComputeContext context, byte index, string message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
uint pixColor = Pix.PIX_COLOR_INDEX(index);
@@ -52,7 +52,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void BeginEvent(this in ComputeContext context, string message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
commandList.D3D12GraphicsCommandList->BeginEvent(0, message);
}
@@ -78,7 +78,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void BeginEventUnsafe(this in ComputeContext context, Color color, ReadOnlySpan<byte> message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
int argb = color.ToArgb();
uint pixColor = Pix.PIX_COLOR((byte)((argb & 0x00FF0000) >> 16), (byte)((argb & 0x0000FF00) >> 8), (byte)(argb & 0x000000FF));
@@ -107,7 +107,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void BeginEventUnsafe(this in ComputeContext context, byte index, ReadOnlySpan<byte> message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
uint pixColor = Pix.PIX_COLOR_INDEX(index);
@@ -134,7 +134,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void BeginEventUnsafe(this in ComputeContext context, ReadOnlySpan<byte> message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
commandList.D3D12GraphicsCommandList->BeginEventUnsafe(0, message);
}
@@ -146,7 +146,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void EndEvent(this in ComputeContext context)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
Pix.PIXEndEventOnCommandList(commandList.D3D12GraphicsCommandList);
}
@@ -160,7 +160,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void Log(this in ComputeContext context, Color color, string message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
int argb = color.ToArgb();
uint pixColor = Pix.PIX_COLOR((byte)((argb & 0x00FF0000) >> 16), (byte)((argb & 0x0000FF00) >> 8), (byte)(argb & 0x000000FF));
@@ -177,7 +177,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void Log(this in ComputeContext context, byte index, string message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
uint pixColor = Pix.PIX_COLOR_INDEX(index);
@@ -192,7 +192,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void Log(this in ComputeContext context, string message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
commandList.D3D12GraphicsCommandList->SetPixMarker(0, message);
}
@@ -218,7 +218,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void LogUnsafe(this in ComputeContext context, Color color, ReadOnlySpan<byte> message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
int argb = color.ToArgb();
uint pixColor = Pix.PIX_COLOR((byte)((argb & 0x00FF0000) >> 16), (byte)((argb & 0x0000FF00) >> 8), (byte)(argb & 0x000000FF));
@@ -247,7 +247,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void LogUnsafe(this in ComputeContext context, byte index, ReadOnlySpan<byte> message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
uint pixColor = Pix.PIX_COLOR_INDEX(index);
@@ -274,7 +274,7 @@ public static class ComputeContextExtensions
[Conditional("USE_PIX")]
public static unsafe void LogUnsafe(this in ComputeContext context, ReadOnlySpan<byte> message)
{
ref CommandList commandList = ref ComputeContext.GetCommandList(in context, pipelineState: null);
ref CommandList commandList = ref context.GetCommandList(pipelineState: null);
commandList.D3D12GraphicsCommandList->SetPixMarkerUnsafe(0, message);
}
+1
ファイルの表示
@@ -17,6 +17,7 @@
<!-- ComputeSharp.Core.SourceGenerator APIs -->
<!-- ComputeSharp.Core APIs -->
<Compile Include="..\ComputeSharp.Core\Properties\Polyfills\UnscopedRefAttribute.cs" Link="ComputeSharp.Core\Properties\Polyfills\UnscopedRefAttribute.cs.cs" />
<Compile Include="..\ComputeSharp.Core\Attributes\AutoConstructorAttribute.cs" Link="ComputeSharp.Core\Attributes\AutoConstructorAttribute.cs" />
<Compile Include="..\ComputeSharp.Core\Exceptions\InvalidExecutionContextException.cs" Link="ComputeSharp.Core\Exceptions\InvalidExecutionContextException.cs" />
<Compile Include="..\ComputeSharp.Core\Intrinsics\Attributes\HlslIntrinsicNameAttribute.cs" Link="ComputeSharp.Core\Intrinsics\Attributes\HlslIntrinsicNameAttribute.cs" />
+2
ファイルの表示
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using ComputeSharp.Core.Extensions;
@@ -125,6 +126,7 @@ internal unsafe struct CommandList : IDisposable
/// </summary>
/// <returns>A double pointer to the current <see cref="ID3D12CommandList"/> object to execute.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[UnscopedRef]
public readonly ref ID3D12CommandList* GetD3D12CommandListPinnableAddressOf()
{
// This method should return a ref ID3D12CommandList*, so it can't just call this.d3D12GraphicsCommandList.GetPinnableReference().
+16 -16
ファイルの表示
@@ -75,7 +75,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
{
ThrowInvalidOperationExceptionIfDeviceIsNull();
ref CommandList commandList = ref GetCommandList(in this);
ref CommandList commandList = ref GetCommandList();
commandList.D3D12GraphicsCommandList->UnorderedAccessViewBarrier(d3D12Resource);
}
@@ -95,7 +95,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
{
ThrowInvalidOperationExceptionIfDeviceIsNull();
ref CommandList commandList = ref GetCommandList(in this, pipelineState: null);
ref CommandList commandList = ref GetCommandList(pipelineState: null);
commandList.D3D12GraphicsCommandList->ClearUnorderedAccessView(d3D12Resource, d3D12GpuDescriptorHandle, d3D12CpuDescriptorHandle, isNormalized);
}
@@ -115,7 +115,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
{
ThrowInvalidOperationExceptionIfDeviceIsNull();
ref CommandList commandList = ref GetCommandList(in this, pipelineState: null);
ref CommandList commandList = ref GetCommandList(pipelineState: null);
commandList.D3D12GraphicsCommandList->FillUnorderedAccessView(d3D12Resource, d3D12GpuDescriptorHandle, d3D12CpuDescriptorHandle, value);
}
@@ -200,7 +200,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
PipelineData pipelineData = PipelineDataLoader<T>.GetPipelineData(this.device, threadsX, threadsY, threadsZ, ref shader);
ref CommandList commandList = ref GetCommandList(in this, pipelineData.D3D12PipelineState);
ref CommandList commandList = ref GetCommandList(pipelineData.D3D12PipelineState);
commandList.D3D12GraphicsCommandList->SetComputeRootSignature(pipelineData.D3D12RootSignature);
@@ -237,7 +237,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
PipelineData pipelineData = PipelineDataLoader<T>.GetPipelineData(this.device, threadsX, threadsY, threadsZ, ref shader);
ref CommandList commandList = ref GetCommandList(in this, pipelineData.D3D12PipelineState);
ref CommandList commandList = ref GetCommandList(pipelineData.D3D12PipelineState);
commandList.D3D12GraphicsCommandList->SetComputeRootSignature(pipelineData.D3D12RootSignature);
@@ -266,7 +266,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
{
ThrowInvalidOperationExceptionIfDeviceIsNull();
ref CommandList commandList = ref GetCommandList(in this, pipelineState: null);
ref CommandList commandList = ref GetCommandList(pipelineState: null);
commandList.D3D12GraphicsCommandList->TransitionBarrier(d3D12Resource, d3D12ResourceStatesBefore, d3D12ResourceStatesAfter);
}
@@ -332,16 +332,16 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
/// <summary>
/// Gets the current <see cref="CommandList"/> instance.
/// </summary>
/// <param name="this">The current <see cref="ComputeContext"/> instance.</param>
/// <returns>A reference to the <see cref="CommandList"/> instance to use.</returns>
/// <exception cref="InvalidOperationException">Thrown if the <see cref="CommandList"/> has not been initialized yet.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe ref CommandList GetCommandList(in ComputeContext @this)
[UnscopedRef]
private readonly unsafe ref CommandList GetCommandList()
{
// This method has to take the context by readonly reference to allow callers to be marked as readonly.
// This is needed to skip the hidden copies done by Roslyn, which would break the dispatching, as the
// original context would not see the changes done by the following queued dispatches.
ref CommandList commandList = ref Unsafe.AsRef(in @this).commandList;
ref CommandList commandList = ref Unsafe.AsRef(in this.commandList);
if (!commandList.IsAllocated)
{
@@ -354,29 +354,29 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
/// <summary>
/// Gets the current <see cref="CommandList"/> instance, and initializes it as needed.
/// </summary>
/// <param name="this">The current <see cref="ComputeContext"/> instance.</param>
/// <param name="pipelineState">The input <see cref="ID3D12PipelineState"/> to load.</param>
/// <returns>A reference to the <see cref="CommandList"/> instance to use.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe ref CommandList GetCommandList(in ComputeContext @this, ID3D12PipelineState* pipelineState)
[UnscopedRef]
internal readonly unsafe ref CommandList GetCommandList(ID3D12PipelineState* pipelineState)
{
ref ComputeContext context = ref Unsafe.AsRef(in @this);
ref CommandList commandList = ref Unsafe.AsRef(in this.commandList);
if (context.commandList.IsAllocated)
if (commandList.IsAllocated)
{
// Skip setting the pipeline state if the new state is null. This is the case when the upcoming
// operation is not a shader dispatch, but just a resource clear. In this case there is no state.
if (pipelineState is not null)
{
context.commandList.D3D12GraphicsCommandList->SetPipelineState(pipelineState);
commandList.D3D12GraphicsCommandList->SetPipelineState(pipelineState);
}
}
else
{
context.commandList = new CommandList(context.device!, pipelineState);
commandList = new CommandList(this.device!, pipelineState);
}
return ref context.commandList;
return ref commandList;
}
/// <summary>
+5 -1
ファイルの表示
@@ -2,6 +2,7 @@
using System.Buffers;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
namespace ComputeSharp.__Internals;
@@ -39,7 +40,10 @@ public ref struct ArrayPoolStringBuilder
return builder;
}
/// <inheritdoc/>
/// <summary>
/// Gets the data written to the underlying buffer so far, as a <see cref="ReadOnlySpan{T}"/>.
/// </summary>
[UnscopedRef]
public ReadOnlySpan<char> WrittenSpan
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
+3 -4
ファイルの表示
@@ -9,6 +9,7 @@ using System.Diagnostics;
using System.Runtime.CompilerServices;
using static TerraFX.Interop.Windows.Windows;
using static TerraFX.Interop.Windows.S;
using System.Diagnostics.CodeAnalysis;
namespace TerraFX.Interop.Windows
{
@@ -248,12 +249,10 @@ namespace TerraFX.Interop.Windows
/// <returns>The raw pointer to the current <see cref="ComPtr{T}"/> instance.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[EditorBrowsable(EditorBrowsableState.Never)]
[UnscopedRef]
public readonly ref T* GetPinnableReference()
{
fixed (T** ptr = &ptr_)
{
return ref *ptr;
}
return ref Unsafe.AsRef(in this).ptr_;
}
/// <summary>Releases the current COM object in use and gets the address of the <see cref="ComPtr{T}"/> instance as a raw <typeparamref name="T"/> double pointer. This method is only valid when the current <see cref="ComPtr{T}"/> instance is on the stack or pinned.</summary>
-9
ファイルの表示
@@ -26,15 +26,6 @@ namespace TerraFX.Interop.DirectX
}
}
public ref D3D12_DEPTH_STENCIL_VALUE DepthStencil
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.DepthStencil, 1));
}
}
[StructLayout(LayoutKind.Explicit)]
internal unsafe partial struct _Anonymous_e__Union
{
-29
ファイルの表示
@@ -3,9 +3,7 @@
// Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using MemoryMarshal = ComputeSharp.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
namespace TerraFX.Interop.DirectX
{
@@ -18,33 +16,6 @@ namespace TerraFX.Interop.DirectX
[NativeTypeName("D3D12_RESOURCE_BARRIER::(anonymous union at C:/Program Files (x86)/Windows Kits/10/Include/10.0.20348.0/um/d3d12.h:2883:5)")]
public _Anonymous_e__Union Anonymous;
public ref D3D12_RESOURCE_TRANSITION_BARRIER Transition
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Transition, 1));
}
}
public ref D3D12_RESOURCE_ALIASING_BARRIER Aliasing
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Aliasing, 1));
}
}
public ref D3D12_RESOURCE_UAV_BARRIER UAV
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.UAV, 1));
}
}
[StructLayout(LayoutKind.Explicit)]
internal partial struct _Anonymous_e__Union
{
-29
ファイルの表示
@@ -3,9 +3,7 @@
// Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using MemoryMarshal = ComputeSharp.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
namespace TerraFX.Interop.DirectX
{
@@ -18,33 +16,6 @@ namespace TerraFX.Interop.DirectX
public D3D12_SHADER_VISIBILITY ShaderVisibility;
public ref D3D12_ROOT_DESCRIPTOR_TABLE DescriptorTable
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.DescriptorTable, 1));
}
}
public ref D3D12_ROOT_CONSTANTS Constants
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Constants, 1));
}
}
public ref D3D12_ROOT_DESCRIPTOR Descriptor
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Descriptor, 1));
}
}
[StructLayout(LayoutKind.Explicit)]
internal partial struct _Anonymous_e__Union
{
-29
ファイルの表示
@@ -3,9 +3,7 @@
// Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using MemoryMarshal = ComputeSharp.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
namespace TerraFX.Interop.DirectX
{
@@ -18,33 +16,6 @@ namespace TerraFX.Interop.DirectX
public D3D12_SHADER_VISIBILITY ShaderVisibility;
public ref D3D12_ROOT_DESCRIPTOR_TABLE1 DescriptorTable
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.DescriptorTable, 1));
}
}
public ref D3D12_ROOT_CONSTANTS Constants
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Constants, 1));
}
}
public ref D3D12_ROOT_DESCRIPTOR1 Descriptor
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Descriptor, 1));
}
}
[StructLayout(LayoutKind.Explicit)]
internal partial struct _Anonymous_e__Union
{
+5 -84
ファイルの表示
@@ -3,9 +3,9 @@
// Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using MemoryMarshal = ComputeSharp.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
namespace TerraFX.Interop.DirectX
{
@@ -20,102 +20,23 @@ namespace TerraFX.Interop.DirectX
[NativeTypeName("D3D12_SHADER_RESOURCE_VIEW_DESC::(anonymous union at C:/Program Files (x86)/Windows Kits/10/Include/10.0.20348.0/um/d3d12.h:3094:5)")]
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref D3D12_BUFFER_SRV Buffer
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Buffer, 1));
}
}
public ref D3D12_TEX1D_SRV Texture1D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture1D, 1));
}
}
public ref D3D12_TEX1D_ARRAY_SRV Texture1DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture1DArray, 1));
return ref Anonymous.Buffer;
}
}
[UnscopedRef]
public ref D3D12_TEX2D_SRV Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture2D, 1));
}
}
public ref D3D12_TEX2D_ARRAY_SRV Texture2DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture2DArray, 1));
}
}
public ref D3D12_TEX2DMS_SRV Texture2DMS
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture2DMS, 1));
}
}
public ref D3D12_TEX2DMS_ARRAY_SRV Texture2DMSArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture2DMSArray, 1));
}
}
public ref D3D12_TEX3D_SRV Texture3D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture3D, 1));
}
}
public ref D3D12_TEXCUBE_SRV TextureCube
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.TextureCube, 1));
}
}
public ref D3D12_TEXCUBE_ARRAY_SRV TextureCubeArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.TextureCubeArray, 1));
}
}
public ref D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV RaytracingAccelerationStructure
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.RaytracingAccelerationStructure, 1));
return ref Anonymous.Texture2D;
}
}
-20
ファイルの表示
@@ -3,9 +3,7 @@
// Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using MemoryMarshal = ComputeSharp.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
namespace TerraFX.Interop.DirectX
{
@@ -18,24 +16,6 @@ namespace TerraFX.Interop.DirectX
[NativeTypeName("D3D12_TEXTURE_COPY_LOCATION::(anonymous union at C:/Program Files (x86)/Windows Kits/10/Include/10.0.20348.0/um/d3d12.h:2917:5)")]
public _Anonymous_e__Union Anonymous;
public ref D3D12_PLACED_SUBRESOURCE_FOOTPRINT PlacedFootprint
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.PlacedFootprint, 1));
}
}
public ref uint SubresourceIndex
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.SubresourceIndex, 1));
}
}
[StructLayout(LayoutKind.Explicit)]
internal partial struct _Anonymous_e__Union
{
+5 -39
ファイルの表示
@@ -3,9 +3,9 @@
// Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using MemoryMarshal = ComputeSharp.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
namespace TerraFX.Interop.DirectX
{
@@ -18,57 +18,23 @@ namespace TerraFX.Interop.DirectX
[NativeTypeName("D3D12_UNORDERED_ACCESS_VIEW_DESC::(anonymous union at C:/Program Files (x86)/Windows Kits/10/Include/10.0.20348.0/um/d3d12.h:3309:5)")]
public _Anonymous_e__Union Anonymous;
[UnscopedRef]
public ref D3D12_BUFFER_UAV Buffer
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Buffer, 1));
}
}
public ref D3D12_TEX1D_UAV Texture1D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture1D, 1));
}
}
public ref D3D12_TEX1D_ARRAY_UAV Texture1DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture1DArray, 1));
}
}
public ref D3D12_TEX2D_UAV Texture2D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture2D, 1));
}
}
public ref D3D12_TEX2D_ARRAY_UAV Texture2DArray
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture2DArray, 1));
return ref Anonymous.Buffer;
}
}
[UnscopedRef]
public ref D3D12_TEX3D_UAV Texture3D
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Texture3D, 1));
return ref Anonymous.Texture3D;
}
}
-20
ファイルの表示
@@ -3,9 +3,7 @@
// Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using MemoryMarshal = ComputeSharp.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
namespace TerraFX.Interop.DirectX
{
@@ -16,24 +14,6 @@ namespace TerraFX.Interop.DirectX
[NativeTypeName("D3D12_VERSIONED_ROOT_SIGNATURE_DESC::(anonymous union at C:/Program Files (x86)/Windows Kits/10/Include/10.0.20348.0/um/d3d12.h:3711:5)")]
public _Anonymous_e__Union Anonymous;
public ref D3D12_ROOT_SIGNATURE_DESC Desc_1_0
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Desc_1_0, 1));
}
}
public ref D3D12_ROOT_SIGNATURE_DESC1 Desc_1_1
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.Desc_1_1, 1));
}
}
[StructLayout(LayoutKind.Explicit)]
internal partial struct _Anonymous_e__Union
{
-20
ファイルの表示
@@ -3,9 +3,7 @@
// Ported from um/winnt.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using MemoryMarshal = ComputeSharp.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
namespace TerraFX.Interop.Windows
{
@@ -24,24 +22,6 @@ namespace TerraFX.Interop.Windows
[NativeTypeName("LONGLONG")]
public long QuadPart;
public ref uint LowPart
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.LowPart, 1));
}
}
public ref int HighPart
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.HighPart, 1));
}
}
internal partial struct _Anonymous_e__Struct
{
[NativeTypeName("DWORD")]
-20
ファイルの表示
@@ -3,9 +3,7 @@
// Ported from um/winnt.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using MemoryMarshal = ComputeSharp.NetStandard.System.Runtime.InteropServices.MemoryMarshal;
namespace TerraFX.Interop.Windows
{
@@ -24,24 +22,6 @@ namespace TerraFX.Interop.Windows
[NativeTypeName("ULONGLONG")]
public ulong QuadPart;
public ref uint LowPart
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.LowPart, 1));
}
}
public ref uint HighPart
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
return ref MemoryMarshal.GetReference(MemoryMarshal.CreateSpan(ref Anonymous.HighPart, 1));
}
}
internal partial struct _Anonymous_e__Struct
{
[NativeTypeName("DWORD")]
+64 -61
ファイルの表示
@@ -42,67 +42,70 @@ public partial class D2D1EffectRegistrationDataTests
Assert.IsTrue(propertyBinding.GetFunction is not null);
}
Assert.AreEqual(@"<?xml version='1.0'?>
<Effect>
<Property name='DisplayName' type='string' value='ComputeSharp.D2D1.Tests.D2D1EffectRegistrationDataTests+TestRegistrationBlobShader'/>
<Property name='Author' type='string' value='ComputeSharp.D2D1'/>
<Property name='Category' type='string' value='Stylize'/>
<Property name='Description' type='string' value='A custom D2D1 effect using a pixel shader'/>
<Inputs>
<Input name='Source0'/><Input name='Source1'/>
</Inputs>
<Property name='ConstantBuffer' type='blob'>
<Property name='DisplayName' type='string' value='ConstantBuffer'/>
</Property>
<Property name='ResourceTextureManager0' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager0'/>
</Property>
<Property name='ResourceTextureManager1' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager1'/>
</Property>
<Property name='ResourceTextureManager2' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager2'/>
</Property>
<Property name='ResourceTextureManager3' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager3'/>
</Property>
<Property name='ResourceTextureManager4' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager4'/>
</Property>
<Property name='ResourceTextureManager5' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager5'/>
</Property>
<Property name='ResourceTextureManager6' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager6'/>
</Property>
<Property name='ResourceTextureManager7' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager7'/>
</Property>
<Property name='ResourceTextureManager8' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager8'/>
</Property>
<Property name='ResourceTextureManager9' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager9'/>
</Property>
<Property name='ResourceTextureManager10' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager10'/>
</Property>
<Property name='ResourceTextureManager11' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager11'/>
</Property>
<Property name='ResourceTextureManager12' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager12'/>
</Property>
<Property name='ResourceTextureManager13' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager13'/>
</Property>
<Property name='ResourceTextureManager14' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager14'/>
</Property>
<Property name='ResourceTextureManager15' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager15'/>
</Property>
</Effect>", data.PropertyXml);
Assert.AreEqual("""
<?xml version='1.0'?>
<Effect>
<Property name='DisplayName' type='string' value='ComputeSharp.D2D1.Tests.D2D1EffectRegistrationDataTests+TestRegistrationBlobShader'/>
<Property name='Author' type='string' value='ComputeSharp.D2D1'/>
<Property name='Category' type='string' value='Stylize'/>
<Property name='Description' type='string' value='A custom D2D1 effect using a pixel shader'/>
<Inputs>
<Input name='Source0'/>
<Input name='Source1'/>
</Inputs>
<Property name='ConstantBuffer' type='blob'>
<Property name='DisplayName' type='string' value='ConstantBuffer'/>
</Property>
<Property name='ResourceTextureManager0' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager0'/>
</Property>
<Property name='ResourceTextureManager1' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager1'/>
</Property>
<Property name='ResourceTextureManager2' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager2'/>
</Property>
<Property name='ResourceTextureManager3' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager3'/>
</Property>
<Property name='ResourceTextureManager4' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager4'/>
</Property>
<Property name='ResourceTextureManager5' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager5'/>
</Property>
<Property name='ResourceTextureManager6' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager6'/>
</Property>
<Property name='ResourceTextureManager7' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager7'/>
</Property>
<Property name='ResourceTextureManager8' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager8'/>
</Property>
<Property name='ResourceTextureManager9' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager9'/>
</Property>
<Property name='ResourceTextureManager10' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager10'/>
</Property>
<Property name='ResourceTextureManager11' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager11'/>
</Property>
<Property name='ResourceTextureManager12' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager12'/>
</Property>
<Property name='ResourceTextureManager13' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager13'/>
</Property>
<Property name='ResourceTextureManager14' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager14'/>
</Property>
<Property name='ResourceTextureManager15' type='iunknown'>
<Property name='DisplayName' type='string' value='ResourceTextureManager15'/>
</Property>
</Effect>
""", data.PropertyXml);
}
[D2DInputCount(2)]
+47 -16
ファイルの表示
@@ -12,18 +12,19 @@ public partial class D2D1ShaderCompilerTests
[TestMethod]
public unsafe void CompileInvertEffectWithDefaultOptions()
{
const string source = @"
const string source = """
#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_SIMPLE
#include ""d2d1effecthelpers.hlsli""
#include "d2d1effecthelpers.hlsli"
D2D_PS_ENTRY(PSMain)
{
float4 color = D2DGetInput(0);
float3 rgb = saturate(1.0 - color.rgb);
return float4(rgb, 1);
}";
}
""";
ReadOnlyMemory<byte> bytecode = D2D1ShaderCompiler.Compile(
source,
@@ -35,20 +36,47 @@ public partial class D2D1ShaderCompilerTests
}
[TestMethod]
public unsafe void CompileInvertEffectWithDefaultOptionsAndLinking()
public unsafe void CompileInvertEffectWithDefaultOptions_Utf8()
{
const string source = @"
ReadOnlySpan<byte> sourceUtf8 = """
#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_SIMPLE
#include ""d2d1effecthelpers.hlsli""
#include "d2d1effecthelpers.hlsli"
D2D_PS_ENTRY(PSMain)
{
float4 color = D2DGetInput(0);
float3 rgb = saturate(1.0 - color.rgb);
return float4(rgb, 1);
}";
}
"""u8;
ReadOnlyMemory<byte> bytecode = D2D1ShaderCompiler.Compile(
sourceUtf8,
"PSMain"u8,
D2D1ShaderProfile.PixelShader40Level93,
D2D1CompileOptions.Default);
Assert.IsTrue(bytecode.Length > 0);
}
[TestMethod]
public unsafe void CompileInvertEffectWithDefaultOptionsAndLinking()
{
const string source = """
#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_SIMPLE
#include "d2d1effecthelpers.hlsli"
D2D_PS_ENTRY(PSMain)
{
float4 color = D2DGetInput(0);
float3 rgb = saturate(1.0 - color.rgb);
return float4(rgb, 1);
}
""";
ReadOnlyMemory<byte> bytecode = D2D1ShaderCompiler.Compile(
source,
@@ -63,18 +91,19 @@ public partial class D2D1ShaderCompilerTests
[ExpectedException(typeof(FxcCompilationException))]
public unsafe void CompileInvertEffectWithInvalidEntryPoint()
{
const string source = @"
const string source = """
#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_SIMPLE
#include ""d2d1effecthelpers.hlsli""
#include "d2d1effecthelpers.hlsli"
D2D_PS_ENTRY(PSMain)
{
float4 color = D2DGetInput(0);
float3 rgb = saturate(1.0 - color.rgb);
return float4(rgb, 1);
}";
}
""";
ReadOnlyMemory<byte> bytecode = D2D1ShaderCompiler.Compile(
source,
@@ -89,18 +118,19 @@ public partial class D2D1ShaderCompilerTests
[ExpectedException(typeof(FxcCompilationException))]
public unsafe void CompileInvertEffectWithErrors()
{
const string source = @"
const string source = """
#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_SIMPLE
#include ""d2d1effecthelpers.hlsli""
#include "d2d1effecthelpers.hlsli"
D2D_PS_ENTRY(PSMain)
{
float4 color = D2DGetInput(99);
float3 rgb2 = saturate(1.0 - color.rgb);
return float4(rgb, 1, 4.0);
}";
}
""";
ReadOnlyMemory<byte> bytecode = D2D1ShaderCompiler.Compile(
source,
@@ -114,12 +144,12 @@ public partial class D2D1ShaderCompilerTests
[TestMethod]
public unsafe void CompilePixelateEffectWithDefaultOptions()
{
const string source = @"
const string source = """
#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_COMPLEX
#define D2D_REQUIRES_SCENE_POSITION
#include ""d2d1effecthelpers.hlsli""
#include "d2d1effecthelpers.hlsli"
struct ComputeSharp_D2D1_Tests_Effects_PixelateEffect_Shader_Constants
{
@@ -147,7 +177,8 @@ public partial class D2D1ShaderCompilerTests
float4 sample3 = D2DSampleInputAtPosition(0, int2(x1, y1));
float4 color = (sample0 + sample1 + sample2 + sample3) / 4;
return color;
}";
}
""";
ReadOnlyMemory<byte> bytecode = D2D1ShaderCompiler.Compile(
source,
+3 -3
ファイルの表示
@@ -7,11 +7,11 @@ namespace ComputeSharp.D2D1.Tests;
[TestCategory("D2DPixelShaderSource")]
public partial class D2DPixelShaderSourceTests
{
[D2DPixelShaderSource(@"
[D2DPixelShaderSource("""
#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_SIMPLE
#include ""d2d1effecthelpers.hlsli""
#include "d2d1effecthelpers.hlsli"
D2D_PS_ENTRY(Execute)
{
@@ -19,7 +19,7 @@ public partial class D2DPixelShaderSourceTests
float3 rgb = saturate(1.0 - color.rgb);
return float4(rgb, 1);
}
")]
""")]
[D2DShaderProfile(D2D1ShaderProfile.PixelShader50)]
[D2DCompileOptions(D2D1CompileOptions.OptimizationLevel0)]
private static partial ReadOnlySpan<byte> InvertEffect();
+5
ファイルの表示
@@ -4,6 +4,11 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
<Platforms>AnyCPU;x64;ARM64</Platforms>
<RestoreSources>
https://api.nuget.org/v3/index.json;
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json;
..\..\artifacts;
</RestoreSources>
</PropertyGroup>
<ItemGroup>
-8
ファイルの表示
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- This source is for the local NuGet packages, which are all generated in the centralized artifacts root folder -->
<add key="artifacts" value="..\..\artifacts" />
</packageSources>
</configuration>
+5
ファイルの表示
@@ -4,6 +4,11 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
<Platforms>AnyCPU;x64;ARM64</Platforms>
<RestoreSources>
https://api.nuget.org/v3/index.json;
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json;
..\..\artifacts;
</RestoreSources>
</PropertyGroup>
<ItemGroup>
-8
ファイルの表示
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- This source is for the local NuGet packages, which are all generated in the centralized artifacts root folder -->
<add key="artifacts" value="..\..\artifacts" />
</packageSources>
</configuration>
+5
ファイルの表示
@@ -4,6 +4,11 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1;net6.0</TargetFrameworks>
<Platforms>AnyCPU;x64;ARM64</Platforms>
<RestoreSources>
https://api.nuget.org/v3/index.json;
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json;
..\..\artifacts;
</RestoreSources>
</PropertyGroup>
<ItemGroup>
-8
ファイルの表示
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- This source is for the local NuGet packages, which are all generated in the centralized artifacts root folder -->
<add key="artifacts" value="..\..\artifacts" />
</packageSources>
</configuration>
+1
ファイルの表示
@@ -30,6 +30,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\ComputeSharp.Core\Properties\Polyfills\UnscopedRefAttribute.cs" Link="Properties\Polyfills\UnscopedRefAttribute.cs" />
<Compile Include="..\ComputeSharp.Tests\Attributes\AdditionalDataAttribute.cs" Link="Attributes\AdditionalDataAttribute.cs" />
<Compile Include="..\ComputeSharp.Tests\Attributes\AdditionalResourceAttribute.cs" Link="Attributes\AdditionalResourceAttribute.cs" />
<Compile Include="..\ComputeSharp.Tests\Attributes\AllDevicesAttribute.cs" Link="Attributes\AllDevicesAttribute.cs" />
+17 -16
ファイルの表示
@@ -11,24 +11,25 @@ namespace ComputeSharp.Tests.Internals;
[TestCategory("ShaderCompiler")]
public class ShaderCompilerTests
{
private const string ShaderSource = @"
cbuffer _ : register(b0)
{
uint __x;
uint __y;
uint __z;
}
RWStructuredBuffer<float> buffer : register(u0);
[NumThreads(32, 1, 1)]
void Execute(uint3 ids : SV_DispatchThreadId)
{
if (ids.x < __x && ids.y < __y && ids.z < __z)
private const string ShaderSource = """
cbuffer _ : register(b0)
{
buffer[ids.x] *= 2;
uint __x;
uint __y;
uint __z;
}
}";
RWStructuredBuffer<float> buffer : register(u0);
[NumThreads(32, 1, 1)]
void Execute(uint3 ids : SV_DispatchThreadId)
{
if (ids.x < __x && ids.y < __y && ids.z < __z)
{
buffer[ids.x] *= 2;
}
}
""";
[TestMethod]
public void CompileTest_Ok()
+45 -43
ファイルの表示
@@ -16,57 +16,59 @@ public class AutoConstructorGeneratorTests
[TestMethod]
public void GenerateConstructor()
{
string source = @"
using System.Numerics;
using ComputeSharp;
const string source = """
using System.Numerics;
using ComputeSharp;
namespace ComputeSharp
{
public class ReadWriteBuffer<T> { }
}
namespace MyFancyApp.Sample
{
public partial class IFoo<T> : IFluff
where T : notnull, new()
namespace ComputeSharp
{
public partial class Foo
public class ReadWriteBuffer<T> { }
}
namespace MyFancyApp.Sample
{
public partial class IFoo<T> : IFluff
where T : notnull, new()
{
[AutoConstructor]
public readonly partial struct Test
public partial class Foo
{
private readonly float a;
private readonly Vector2 b;
public readonly ReadWriteBuffer<Vector4> c;
public readonly ReadWriteBuffer<int> d;
[AutoConstructor]
public readonly partial struct Test
{
private readonly float a;
private readonly Vector2 b;
public readonly ReadWriteBuffer<Vector4> c;
public readonly ReadWriteBuffer<int> d;
}
}
}
}
}";
""";
string expected = $@"
// <auto-generated/>
#pragma warning disable
namespace MyFancyApp.Sample;
partial class IFoo<T>
{{
partial class Foo
{{
partial struct Test
{{
[global::System.CodeDom.Compiler.GeneratedCode(""ComputeSharp.Core.SourceGenerators.AutoConstructorGenerator"", ""{typeof(AutoConstructorGenerator).Assembly.GetName().Version}"")]
[global::System.Diagnostics.DebuggerNonUserCode]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public Test(float a, global::System.Numerics.Vector2 b, global::ComputeSharp.ReadWriteBuffer<global::System.Numerics.Vector4> c, global::ComputeSharp.ReadWriteBuffer<int> d)
{{
this.a = a;
this.b = b;
this.c = c;
this.d = d;
}}
}}
}}
}}";
string expected = $$"""
// <auto-generated/>
#pragma warning disable
namespace MyFancyApp.Sample;
partial class IFoo<T>
{
partial class Foo
{
partial struct Test
{
[global::System.CodeDom.Compiler.GeneratedCode("ComputeSharp.Core.SourceGenerators.AutoConstructorGenerator", "{{typeof(AutoConstructorGenerator).Assembly.GetName().Version}}")]
[global::System.Diagnostics.DebuggerNonUserCode]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public Test(float a, global::System.Numerics.Vector2 b, global::ComputeSharp.ReadWriteBuffer<global::System.Numerics.Vector4> c, global::ComputeSharp.ReadWriteBuffer<int> d)
{
this.a = a;
this.b = b;
this.c = c;
this.d = d;
}
}
}
}
""";
VerifyGeneratedMethodLines<AutoConstructorGenerator>(source, 0, expected);
}
ファイル差分が大きすぎるため表示されません。 差分を読み込み
+1
ファイルの表示
@@ -40,6 +40,7 @@
<Compile Include="..\..\samples\ComputeSharp.ImageProcessing\Processors\HlslBokehBlurProcessor{TPixel}.cs" Link="Imaging\Processors\HlslBokehBlurProcessor{TPixel}.cs" />
<Compile Include="..\..\samples\ComputeSharp.ImageProcessing\Processors\HlslGaussianBlurProcessor.cs" Link="Imaging\Processors\HlslGaussianBlurProcessor.cs" />
<Compile Include="..\..\samples\ComputeSharp.ImageProcessing\Processors\HlslGaussianBlurProcessor{TPixel}.cs" Link="Imaging\Processors\HlslGaussianBlurProcessor{TPixel}.cs" />
<Compile Include="..\..\src\ComputeSharp.Core\Properties\Polyfills\UnscopedRefAttribute.cs" Link="Properties\Polyfills\UnscopedRefAttribute.cs" />
</ItemGroup>
<ItemGroup>
+16 -4
ファイルの表示
@@ -135,7 +135,7 @@ public partial class ShaderRewriterTests
[AllDevices]
public void BitwiseHlslOperators(Device device)
{
int[] data = { 186456131, 215486738, unchecked((int)416439712738), unchecked((int)1437124371243), 0, 0, 0, 0 };
int[] data = { 186456131, 215486738, unchecked((int)416439712738), unchecked((int)1437124371243), 0, 0, 0, 0, 0, 0, 0, 0 };
using ReadWriteBuffer<int> buffer = device.Get().AllocateReadWriteBuffer(data);
@@ -151,6 +151,9 @@ public partial class ShaderRewriterTests
int2 e = new(a.X | (int)b.X, a.Y | (int)b.Y);
int2 f = new(a.X ^ (int)b.X, a.Y ^ (int)b.Y);
int2 g = new(a.X >> 5, a.Y >> 12);
int2 h = new(a.X << 22, a.Y << 17);
Assert.AreEqual(results[0], c.X);
Assert.AreEqual(results[1], c.Y);
Assert.AreEqual(results[2], d.X);
@@ -159,6 +162,10 @@ public partial class ShaderRewriterTests
Assert.AreEqual(results[5], e.Y);
Assert.AreEqual(results[6], f.X);
Assert.AreEqual(results[7], f.Y);
Assert.AreEqual(results[8], g.X);
Assert.AreEqual(results[9], g.Y);
Assert.AreEqual(results[10], h.X);
Assert.AreEqual(results[11], h.Y);
}
[AutoConstructor]
@@ -176,9 +183,10 @@ public partial class ShaderRewriterTests
int2 e = a | b;
int2 f = a ^ b;
#if NEEDS_CSHARP_11
// TODO: add bit shifting tests
#endif
int2 sr = new(5, 12);
uint2 sl = new(22, 17);
int2 g = a >> sr;
int2 h = a << sl;
buffer[0] = c.X;
buffer[1] = c.Y;
@@ -188,6 +196,10 @@ public partial class ShaderRewriterTests
buffer[5] = e.Y;
buffer[6] = f.X;
buffer[7] = f.Y;
buffer[8] = g.X;
buffer[9] = g.Y;
buffer[10] = h.X;
buffer[11] = h.Y;
}
}