Renamed WarpIds type to GridIds

このコミットが含まれているのは:
Sergio Pedri committed 2021-03-08 00:17:27 +01:00
1 親 ebc32be071
コミット c5aed333af
9ファイル変更
+58 -58

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

+1 -1
ファイルの表示
@@ -20,7 +20,7 @@
<Compile Include="..\ComputeSharp\Core\Dispatch\GroupIds.cs" Link="Core\Dispatch\GroupIds.cs" />
<Compile Include="..\ComputeSharp\Core\Dispatch\GroupSize.cs" Link="Core\Dispatch\GroupSize.cs" />
<Compile Include="..\ComputeSharp\Core\Dispatch\ThreadIds.cs" Link="Core\Dispatch\ThreadIds.cs" />
<Compile Include="..\ComputeSharp\Core\Dispatch\WarpIds.cs" Link="Core\Dispatch\WarpIds.cs" />
<Compile Include="..\ComputeSharp\Core\Dispatch\GridIds.cs" Link="Core\Dispatch\GridIds.cs" />
<Compile Include="..\ComputeSharp\Core\Exceptions\InvalidExecutionContextException.cs" Link="Core\Exceptions\InvalidExecutionContextException.cs" />
<Compile Include="..\ComputeSharp\Core\Exceptions\MissingMethodSourceException.cs" Link="Core\Exceptions\MissingMethodSourceException.cs" />
<Compile Include="..\ComputeSharp\Core\Extensions\MethodInfoExtensions.cs" Link="Core\Extensions\MethodInfoExtensions.cs" />
+5 -5
ファイルの表示
@@ -127,16 +127,16 @@ namespace ComputeSharp.SourceGenerators.Diagnostics
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
/// <summary>
/// Gets a <see cref="DiagnosticDescriptor"/> for an invalid <see cref="WarpIds"/> usage.
/// Gets a <see cref="DiagnosticDescriptor"/> for an invalid <see cref="GridIds"/> usage.
/// </summary>
public static readonly DiagnosticDescriptor InvalidWarpIdsUsage = new(
public static readonly DiagnosticDescriptor InvalidGridIdsUsage = new(
id: "CMPS0009",
title: "Invalid WarpIds usage",
messageFormat: "The WarpIds type can only be used within the main body of a compute shader",
title: "Invalid GridIds usage",
messageFormat: "The GridIds type can only be used within the main body of a compute shader",
category: typeof(IComputeShader).FullName,
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true,
description: "The WarpIds type can only be used within the main body of a compute shader.",
description: "The GridIds type can only be used within the main body of a compute shader.",
helpLinkUri: "https://github.com/Sergio0694/ComputeSharp");
/// <summary>
+1 -1
ファイルの表示
@@ -39,7 +39,7 @@ namespace ComputeSharp.SourceGenerators.Mappings
knownKeywords.Add(nameof(ThreadIds));
knownKeywords.Add(nameof(GroupIds));
knownKeywords.Add(nameof(GroupSize));
knownKeywords.Add(nameof(WarpIds));
knownKeywords.Add(nameof(GridIds));
// HLSL intrinsics method names
foreach (var method in typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static))
+1 -1
ファイルの表示
@@ -21,7 +21,7 @@ namespace ComputeSharp.SourceGenerators.Mappings
{
typeof(ThreadIds),
typeof(GroupIds),
typeof(WarpIds)
typeof(GridIds)
};
/// <summary>
+1 -1
ファイルの表示
@@ -86,7 +86,7 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
_ when typeName == typeof(ThreadIds).FullName => InvalidThreadIdsUsage,
_ when typeName == typeof(GroupIds).FullName => InvalidGroupIdsUsage,
_ when typeName == typeof(GroupSize).FullName => InvalidGroupSizeUsage,
_ when typeName == typeof(WarpIds).FullName => InvalidWarpIdsUsage,
_ when typeName == typeof(GridIds).FullName => InvalidGridIdsUsage,
_ => null
};
+2 -2
ファイルの表示
@@ -48,9 +48,9 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
updatedNode = updatedNode.AddParameters(Parameter(Identifier($"uint __{nameof(GroupIds)}__get_Index : SV_GroupIndex")));
}
if (this.shaderSourceRewriter.IsWarpIdsUsed)
if (this.shaderSourceRewriter.IsGridIdsUsed)
{
updatedNode = updatedNode.AddParameters(Parameter(Identifier($"uint3 {nameof(WarpIds)} : SV_GroupID")));
updatedNode = updatedNode.AddParameters(Parameter(Identifier($"uint3 {nameof(GridIds)} : SV_GroupID")));
}
return updatedNode;
+4 -4
ファイルの表示
@@ -118,9 +118,9 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
public bool IsGroupIdsIndexUsed { get; private set; }
/// <summary>
/// Gets whether or not the shader uses <see cref="WarpIds"/> at least once.
/// Gets whether or not the shader uses <see cref="GridIds"/> at least once.
/// </summary>
public bool IsWarpIdsUsed { get; set; }
public bool IsGridIdsUsed { get; set; }
/// <inheritdoc cref="CSharpSyntaxRewriter.Visit(SyntaxNode?)"/>
public MethodDeclarationSyntax? Visit(MethodDeclarationSyntax? node)
@@ -277,7 +277,7 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
if (mapping == $"__{nameof(GroupIds)}__get_Index") IsGroupIdsIndexUsed = true;
else if (typeName == typeof(GroupIds).FullName) IsGroupIdsUsed = true;
else if (typeName == typeof(WarpIds).FullName) IsWarpIdsUsed = true;
else if (typeName == typeof(GridIds).FullName) IsGridIdsUsed = true;
// Check that the dispatch info types are only used from the main shader body
if (!this.isEntryPoint || this.localFunctionDepth > 0)
@@ -287,7 +287,7 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
_ when typeName == typeof(ThreadIds).FullName => InvalidThreadIdsUsage,
_ when typeName == typeof(GroupIds).FullName => InvalidGroupIdsUsage,
_ when typeName == typeof(GroupSize).FullName => InvalidGroupSizeUsage,
_ when typeName == typeof(WarpIds).FullName => InvalidWarpIdsUsage,
_ when typeName == typeof(GridIds).FullName => InvalidGridIdsUsage,
_ => null
};
+41 -41
ファイルの表示
@@ -3,203 +3,203 @@
namespace ComputeSharp
{
/// <summary>
/// A <see langword="class"/> that indicates the ids of a given dispatch warp (a group of threads).
/// A <see langword="class"/> that indicates the ids of the current thread group within the dispatch grid.
/// </summary>
public static class WarpIds
public static class GridIds
{
/// <summary>
/// Gets the X id of the current thread with respect to the dispatch group.
/// </summary>
public static int X => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(X)}");
public static int X => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(X)}");
/// <summary>
/// Gets the Y id of the current thread with respect to the dispatch group.
/// </summary>
public static int Y => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(Y)}");
public static int Y => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(Y)}");
/// <summary>
/// Gets the Z id of the current thread with respect to the dispatch group.
/// </summary>
public static int Z => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(Z)}");
public static int Z => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(Z)}");
/// <summary>
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="X"/>.
/// </summary>
public static Int2 XX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XX)}");
public static Int2 XX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XX)}");
/// <summary>
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Y"/>.
/// </summary>
public static Int2 XY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XY)}");
public static Int2 XY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XY)}");
/// <summary>
/// Gets a <see cref="Int2"/> value with the components <see cref="X"/>, <see cref="Z"/>.
/// </summary>
public static Int2 XZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XZ)}");
public static Int2 XZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XZ)}");
/// <summary>
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="X"/>.
/// </summary>
public static Int2 YX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YX)}");
public static Int2 YX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YX)}");
/// <summary>
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
public static Int2 YY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YY)}");
public static Int2 YY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YY)}");
/// <summary>
/// Gets a <see cref="Int2"/> value with the components <see cref="Y"/>, <see cref="Z"/>.
/// </summary>
public static Int2 YZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YZ)}");
public static Int2 YZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YZ)}");
/// <summary>
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="X"/>.
/// </summary>
public static Int2 ZX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZX)}");
public static Int2 ZX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZX)}");
/// <summary>
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Y"/>.
/// </summary>
public static Int2 ZY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZY)}");
public static Int2 ZY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZY)}");
/// <summary>
/// Gets a <see cref="Int2"/> value with the components <see cref="Z"/>, <see cref="Z"/>.
/// </summary>
public static Int2 ZZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZZ)}");
public static Int2 ZZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZZ)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
public static Int3 XXX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XXX)}");
public static Int3 XXX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XXX)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
public static Int3 XXY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XXY)}");
public static Int3 XXY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XXY)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="X"/>, <see cref="Z"/>.
/// </summary>
public static Int3 XXZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XXZ)}");
public static Int3 XXZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XXZ)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
public static Int3 XYX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XYX)}");
public static Int3 XYX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XYX)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
public static Int3 XYY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XYY)}");
public static Int3 XYY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XYY)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Y"/>, <see cref="Z"/>.
/// </summary>
public static Int3 XYZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XYZ)}");
public static Int3 XYZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XYZ)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="X"/>.
/// </summary>
public static Int3 XZX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XZX)}");
public static Int3 XZX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XZX)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Y"/>.
/// </summary>
public static Int3 XZY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XZY)}");
public static Int3 XZY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XZY)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="X"/>, <see cref="Z"/>, <see cref="Z"/>.
/// </summary>
public static Int3 XZZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(XZZ)}");
public static Int3 XZZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(XZZ)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
public static Int3 YXX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YXX)}");
public static Int3 YXX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YXX)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
public static Int3 YXY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YXY)}");
public static Int3 YXY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YXY)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="X"/>, <see cref="Z"/>.
/// </summary>
public static Int3 YXZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YXZ)}");
public static Int3 YXZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YXZ)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
public static Int3 YYX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YYX)}");
public static Int3 YYX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YYX)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
public static Int3 YYY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YYY)}");
public static Int3 YYY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YYY)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Y"/>, <see cref="Z"/>.
/// </summary>
public static Int3 YYZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YYZ)}");
public static Int3 YYZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YYZ)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="X"/>.
/// </summary>
public static Int3 YZX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YZX)}");
public static Int3 YZX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YZX)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Y"/>.
/// </summary>
public static Int3 YZY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YZY)}");
public static Int3 YZY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YZY)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Y"/>, <see cref="Z"/>, <see cref="Z"/>.
/// </summary>
public static Int3 YZZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(YZZ)}");
public static Int3 YZZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(YZZ)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="X"/>.
/// </summary>
public static Int3 ZXX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZXX)}");
public static Int3 ZXX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZXX)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Y"/>.
/// </summary>
public static Int3 ZXY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZXY)}");
public static Int3 ZXY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZXY)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="X"/>, <see cref="Z"/>.
/// </summary>
public static Int3 ZXZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZXZ)}");
public static Int3 ZXZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZXZ)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="X"/>.
/// </summary>
public static Int3 ZYX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZYX)}");
public static Int3 ZYX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZYX)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Y"/>.
/// </summary>
public static Int3 ZYY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZYY)}");
public static Int3 ZYY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZYY)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Y"/>, <see cref="Z"/>.
/// </summary>
public static Int3 ZYZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZYZ)}");
public static Int3 ZYZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZYZ)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="X"/>.
/// </summary>
public static Int3 ZZX => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZZX)}");
public static Int3 ZZX => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZZX)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Y"/>.
/// </summary>
public static Int3 ZZY => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZZY)}");
public static Int3 ZZY => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZZY)}");
/// <summary>
/// Gets a <see cref="Int3"/> value with the components <see cref="Z"/>, <see cref="Z"/>, <see cref="Z"/>.
/// </summary>
public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(WarpIds)}.{nameof(ZZZ)}");
public static Int3 ZZZ => throw new InvalidExecutionContextException($"{typeof(GridIds)}.{nameof(ZZZ)}");
}
}
+2 -2
ファイルの表示
@@ -141,7 +141,7 @@ namespace ComputeSharp.Tests.Internals
[DataRow(nameof(ThreadIds), "CMPS0006")]
[DataRow(nameof(GroupIds), "CMPS0007")]
[DataRow(nameof(GroupSize), "CMPS0008")]
[DataRow(nameof(WarpIds), "CMPS0009")]
[DataRow(nameof(GridIds), "CMPS0009")]
public void InvalidDispatchInfoUsage_LocalFunction(string typeName, string diagnosticsId)
{
string source = $@"
@@ -175,7 +175,7 @@ namespace ComputeSharp.Tests.Internals
[DataRow(nameof(ThreadIds), "CMPS0006")]
[DataRow(nameof(GroupIds), "CMPS0007")]
[DataRow(nameof(GroupSize), "CMPS0008")]
[DataRow(nameof(WarpIds), "CMPS0009")]
[DataRow(nameof(GridIds), "CMPS0009")]
public void InvalidDispatchInfoUsage_StaticMethod(string typeName, string diagnosticsId)
{
string source = $@"