More minor code style tweaks (remove extra blank lines, etc.)
このコミットが含まれているのは:
1 親
8be9203a1c
コミット
f2ed8a2d3b
22ファイル変更
+39
-38
検索条件に一致するファイルはありません
+1
@@ -124,6 +124,7 @@ partial class ID2D1ShaderGenerator
|
||||
ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.Add(ref {rowLocalName}, {j})"),
|
||||
ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.As<byte, {rowTypeName}>(ref global::System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref r0, (nint){matrix.Offsets[j]}))"))));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -149,6 +149,7 @@ partial class ID2D1ShaderGenerator
|
||||
ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.As<byte, {rowTypeName}>(ref global::System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref r0, (nint){matrix.Offsets[j]}))"),
|
||||
ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.Add(ref {rowLocalName}, {j})"))));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -49,6 +49,7 @@ partial class ID2D1ShaderGenerator
|
||||
|
||||
inputDescriptionsBuilder.Add(new InputDescription((uint)index, filter, levelOfDetailCount));
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
|
||||
#pragma warning disable IDE0025
|
||||
|
||||
namespace ComputeSharp.D2D1.Shaders.Translation;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using ComputeSharp.Core.Extensions;
|
||||
|
||||
#pragma warning disable IDE0052
|
||||
|
||||
namespace ComputeSharp.__Internals;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -26,26 +26,6 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
|
||||
/// </summary>
|
||||
private static readonly char[] FloatLiteralSpecialCharacters = { '.', 'E' };
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="SemanticModelProvider"/> instance with semantic info on the target syntax tree.
|
||||
/// </summary>
|
||||
protected readonly SemanticModelProvider SemanticModel;
|
||||
|
||||
/// <summary>
|
||||
/// The collection of discovered custom types.
|
||||
/// </summary>
|
||||
protected readonly ICollection<INamedTypeSymbol> DiscoveredTypes;
|
||||
|
||||
/// <summary>
|
||||
/// The collection of discovered constant definitions.
|
||||
/// </summary>
|
||||
protected readonly IDictionary<IFieldSymbol, string> ConstantDefinitions;
|
||||
|
||||
/// <summary>
|
||||
/// The collection of produced <see cref="DiagnosticInfo"/> instances.
|
||||
/// </summary>
|
||||
protected readonly ImmutableArrayBuilder<DiagnosticInfo> Diagnostics;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="HlslSourceRewriter"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
@@ -65,6 +45,26 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
|
||||
Diagnostics = diagnostics;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SemanticModelProvider"/> instance with semantic info on the target syntax tree.
|
||||
/// </summary>
|
||||
protected SemanticModelProvider SemanticModel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of discovered custom types.
|
||||
/// </summary>
|
||||
protected ICollection<INamedTypeSymbol> DiscoveredTypes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of discovered constant definitions.
|
||||
/// </summary>
|
||||
protected IDictionary<IFieldSymbol, string> ConstantDefinitions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of produced <see cref="DiagnosticInfo"/> instances.
|
||||
/// </summary>
|
||||
protected ImmutableArrayBuilder<DiagnosticInfo> Diagnostics { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override SyntaxNode VisitCastExpression(CastExpressionSyntax node)
|
||||
{
|
||||
|
||||
@@ -560,8 +560,6 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
|
||||
return updatedNode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Rewrites a sampled texture access.
|
||||
/// </summary>
|
||||
|
||||
+1
@@ -234,6 +234,7 @@ partial class IShaderGenerator
|
||||
ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.As<uint, {rowTypeName}>(ref global::System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref r0, (nint){matrix.Offsets[j]}))"),
|
||||
ParseExpression($"global::System.Runtime.CompilerServices.Unsafe.Add(ref {rowLocalName}, {j})"))));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -44,7 +44,7 @@ partial class IShaderGenerator
|
||||
.WithType(IdentifierName("TLoader")),
|
||||
Parameter(Identifier("result"))
|
||||
.AddModifiers(Token(SyntaxKind.OutKeyword))
|
||||
.WithType(IdentifierName($"global::System.{typeof(IntPtr).Name}")))
|
||||
.WithType(IdentifierName($"global::System.{nameof(IntPtr)}")))
|
||||
.WithBody(Block(GetDispatchMetadataLoadingStatements(metadataInfo)));
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@ partial class IShaderGenerator
|
||||
statements.Add(ParseStatement($"global::System.Runtime.CompilerServices.Unsafe.WriteUnaligned<int>(ref global::System.Runtime.CompilerServices.Unsafe.Add(ref r0, 0), {metadataInfo.Root32BitConstantCount});"));
|
||||
statements.Add(ParseStatement($"global::System.Runtime.CompilerServices.Unsafe.WriteUnaligned<bool>(ref global::System.Runtime.CompilerServices.Unsafe.Add(ref r0, 4), {metadataInfo.IsSamplerUsed.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()});"));
|
||||
|
||||
|
||||
// Populate the sequence of resource descriptors
|
||||
foreach (ResourceDescriptor descriptor in metadataInfo.ResourceDescriptors)
|
||||
{
|
||||
|
||||
@@ -92,7 +92,7 @@ partial class HlslKnownProperties
|
||||
// Programmatically load mappings for the normalized thread ids
|
||||
foreach (PropertyInfo? property in typeof(ThreadIds.Normalized).GetProperties(BindingFlags.Static | BindingFlags.Public))
|
||||
{
|
||||
string key = $"{typeof(ThreadIds).FullName}{Type.Delimiter}{typeof(ThreadIds.Normalized).Name}{Type.Delimiter}{property.Name}";
|
||||
string key = $"{typeof(ThreadIds).FullName}{Type.Delimiter}{nameof(ThreadIds.Normalized)}{Type.Delimiter}{property.Name}";
|
||||
|
||||
// The normalized value must be in the [0, 1] range, inclusive. As such, the expression is rewritten to be:
|
||||
// 1D: (float)ThreadIds.<XYZ> / (float)(max(1, __<xyz> - 1));
|
||||
@@ -105,11 +105,11 @@ partial class HlslKnownProperties
|
||||
switch (property.Name)
|
||||
{
|
||||
case string name when name.Length == 1:
|
||||
knownProperties.Add(key, $"(float){typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[0])} / (float)(max(1, __{char.ToLowerInvariant(name[0])} - 1))");
|
||||
knownProperties.Add(key, $"(float){nameof(ThreadIds)}.{char.ToLowerInvariant(name[0])} / (float)(max(1, __{char.ToLowerInvariant(name[0])} - 1))");
|
||||
break;
|
||||
case string name when name.Length == 2:
|
||||
{
|
||||
string numerator = $"float2({typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[0])}, {typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[1])})";
|
||||
string numerator = $"float2({nameof(ThreadIds)}.{char.ToLowerInvariant(name[0])}, {nameof(ThreadIds)}.{char.ToLowerInvariant(name[1])})";
|
||||
string denominator = $"float2(max(1, int2(__{char.ToLowerInvariant(name[0])}, __{char.ToLowerInvariant(name[1])}) - 1))";
|
||||
|
||||
knownProperties.Add(key, $"{numerator} / {denominator}");
|
||||
@@ -117,7 +117,7 @@ partial class HlslKnownProperties
|
||||
}
|
||||
case string name when name.Length == 3:
|
||||
{
|
||||
string numerator = $"float3({typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[0])}, {typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[1])}, {typeof(ThreadIds).Name}.{char.ToLowerInvariant(name[2])})";
|
||||
string numerator = $"float3({nameof(ThreadIds)}.{char.ToLowerInvariant(name[0])}, {nameof(ThreadIds)}.{char.ToLowerInvariant(name[1])}, {nameof(ThreadIds)}.{char.ToLowerInvariant(name[2])})";
|
||||
string denominator = $"float3(max(1, int3(__{char.ToLowerInvariant(name[0])}, __{char.ToLowerInvariant(name[1])}, __{char.ToLowerInvariant(name[2])}) - 1))";
|
||||
|
||||
knownProperties.Add(key, $"{numerator} / {denominator}");
|
||||
|
||||
@@ -170,6 +170,7 @@ public abstract unsafe class TransferBuffer<T> : NativeObject, IGraphicsResource
|
||||
/// <inheritdoc/>
|
||||
public override Memory<T> Memory
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => CreateMemory(this.buffer.Length);
|
||||
}
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする