Switched source generators to global:: type names

このコミットが含まれているのは:
Sergio Pedri committed 2021-10-30 15:11:44 +02:00
1 親 4d07edcd7c
コミット 06b12f5a6c
9ファイル変更
+75 -109

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

+17 -17
ファイルの表示
@@ -22,7 +22,7 @@ public sealed partial class IShaderGenerator
{
// This code produces a method declaration as follows:
//
// readonly void IShader.LoadDispatchMetadata<TMetadataLoader>(ref TMetadataLoader loader, out IntPtr result)
// readonly void global::ComputeSharp.__Internals.IShader.LoadDispatchMetadata<TMetadataLoader>(ref TMetadataLoader loader, out global::System.IntPtr result)
// {
// <BODY>
// }
@@ -30,7 +30,7 @@ public sealed partial class IShaderGenerator
MethodDeclaration(
PredefinedType(Token(SyntaxKind.VoidKeyword)),
Identifier("LoadDispatchMetadata"))
.WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName(nameof(IShader))))
.WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName($"global::ComputeSharp.__Internals.{nameof(IShader)}")))
.AddModifiers(Token(SyntaxKind.ReadOnlyKeyword))
.AddTypeParameterListParameters(TypeParameter(Identifier("TMetadataLoader")))
.AddParameterListParameters(
@@ -39,7 +39,7 @@ public sealed partial class IShaderGenerator
.WithType(IdentifierName("TMetadataLoader")),
Parameter(Identifier("result"))
.AddModifiers(Token(SyntaxKind.OutKeyword))
.WithType(IdentifierName(typeof(IntPtr).Name)))
.WithType(IdentifierName($"global::System.{typeof(IntPtr).Name}")))
.WithBody(Block(GetDispatchMetadataLoadingStatements(implicitTextureType, discoveredResources, root32BitConstantsCount, isSamplerUsed)));
}
@@ -57,11 +57,11 @@ public sealed partial class IShaderGenerator
int root32BitConstantsCount,
bool isSamplerUsed)
{
// Span<byte> span0 = stackalloc byte[5];
// global::System.Span<byte> span0 = stackalloc byte[5];
yield return
LocalDeclarationStatement(
VariableDeclaration(
GenericName(Identifier("Span"))
GenericName(Identifier("global::System.Span"))
.AddTypeArgumentListArguments(PredefinedType(Token(SyntaxKind.ByteKeyword))))
.AddVariables(
VariableDeclarator(Identifier("span0"))
@@ -75,17 +75,17 @@ public sealed partial class IShaderGenerator
// Compute the total number of resources (discovered ones and the implicit target texture, if present)
int totalResourcesCount = discoveredResources.Count + (implicitTextureType is not null ? 1 : 0);
// Span<ResourceDescriptor> span1 = stackalloc ResourceDescriptor[<ADJUSTED_COUNT>];
// Span<global::ComputeSharp.__Internals.ResourceDescriptor> span1 = stackalloc global::ComputeSharp.__Internals.ResourceDescriptor[<ADJUSTED_COUNT>];
yield return
LocalDeclarationStatement(
VariableDeclaration(
GenericName(Identifier("Span"))
.AddTypeArgumentListArguments(IdentifierName("ResourceDescriptor")))
GenericName(Identifier("global::System.Span"))
.AddTypeArgumentListArguments(IdentifierName("global::ComputeSharp.__Internals.ResourceDescriptor")))
.AddVariables(
VariableDeclarator(Identifier("span1"))
.WithInitializer(EqualsValueClause(
StackAllocArrayCreationExpression(
ArrayType(IdentifierName("ResourceDescriptor"))
ArrayType(IdentifierName("global::ComputeSharp.__Internals.ResourceDescriptor"))
.AddRankSpecifiers(
ArrayRankSpecifier(SingletonSeparatedList<ExpressionSyntax>(
LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(totalResourcesCount))))))))));
@@ -104,10 +104,10 @@ public sealed partial class IShaderGenerator
SyntaxKind.NumericLiteralExpression,
Literal(0)))))))));
// ref ResourceDescriptor r1 = ref span1[0];
// ref global::ComputeSharp.__Internals.ResourceDescriptor r1 = ref span1[0];
yield return
LocalDeclarationStatement(
VariableDeclaration(RefType(IdentifierName("ResourceDescriptor")))
VariableDeclaration(RefType(IdentifierName("global::ComputeSharp.__Internals.ResourceDescriptor")))
.AddVariables(
VariableDeclarator(Identifier("r1"))
.WithInitializer(EqualsValueClause(
@@ -119,8 +119,8 @@ public sealed partial class IShaderGenerator
Literal(0)))))))));
// Serialized shader metadata
yield return ParseStatement($"Unsafe.WriteUnaligned<int>(ref Unsafe.Add(ref r0, 0), {root32BitConstantsCount});");
yield return ParseStatement($"Unsafe.WriteUnaligned<bool>(ref Unsafe.Add(ref r0, 4), {isSamplerUsed.ToString().ToLowerInvariant()});");
yield return ParseStatement($"global::System.Runtime.CompilerServices.Unsafe.WriteUnaligned<int>(ref global::System.Runtime.CompilerServices.Unsafe.Add(ref r0, 0), {root32BitConstantsCount});");
yield return ParseStatement($"global::System.Runtime.CompilerServices.Unsafe.WriteUnaligned<bool>(ref global::System.Runtime.CompilerServices.Unsafe.Add(ref r0, 4), {isSamplerUsed.ToString().ToLowerInvariant()});");
int
constantBufferOffset = 1,
@@ -131,7 +131,7 @@ public sealed partial class IShaderGenerator
// Add the implicit texture descriptor, if needed
if (implicitTextureType is not null)
{
yield return ParseStatement($"ResourceDescriptor.Create(1, {readWriteResourceOffset++}, out Unsafe.Add(ref r1, {resourceOffset++}));");
yield return ParseStatement($"global::ComputeSharp.__Internals.ResourceDescriptor.Create(1, {readWriteResourceOffset++}, out global::System.Runtime.CompilerServices.Unsafe.Add(ref r1, {resourceOffset++}));");
}
// Populate the sequence of resource descriptors
@@ -139,15 +139,15 @@ public sealed partial class IShaderGenerator
{
if (HlslKnownTypes.IsConstantBufferType(resource))
{
yield return ParseStatement($"ResourceDescriptor.Create(2, {constantBufferOffset++}, out Unsafe.Add(ref r1, {resourceOffset++}));");
yield return ParseStatement($"global::ComputeSharp.__Internals.ResourceDescriptor.Create(2, {constantBufferOffset++}, out global::System.Runtime.CompilerServices.Unsafe.Add(ref r1, {resourceOffset++}));");
}
else if (HlslKnownTypes.IsReadOnlyTypedResourceType(resource))
{
yield return ParseStatement($"ResourceDescriptor.Create(0, {readOnlyResourceOffset++}, out Unsafe.Add(ref r1, {resourceOffset++}));");
yield return ParseStatement($"global::ComputeSharp.__Internals.ResourceDescriptor.Create(0, {readOnlyResourceOffset++}, out global::System.Runtime.CompilerServices.Unsafe.Add(ref r1, {resourceOffset++}));");
}
else
{
yield return ParseStatement($"ResourceDescriptor.Create(1, {readWriteResourceOffset++}, out Unsafe.Add(ref r1, {resourceOffset++}));");
yield return ParseStatement($"global::ComputeSharp.__Internals.ResourceDescriptor.Create(1, {readWriteResourceOffset++}, out global::System.Runtime.CompilerServices.Unsafe.Add(ref r1, {resourceOffset++}));");
}
}