Merge pull request #766 from Sergio0694/dev/maintenance
Update code style to fix build errors
このコミットが含まれているのは:
9ファイル変更
+38
-87
検索条件に一致するファイルはありません
@@ -84,8 +84,8 @@ public sealed partial class MainViewModel : ObservableObject
|
||||
/// <summary>
|
||||
/// Gets the collection of available compute shader.
|
||||
/// </summary>
|
||||
public IReadOnlyList<ShaderRunnerViewModel> ComputeShaderOptions { get; } = new ShaderRunnerViewModel[]
|
||||
{
|
||||
public IReadOnlyList<ShaderRunnerViewModel> ComputeShaderOptions { get; } =
|
||||
[
|
||||
new(
|
||||
nameof(ColorfulInfinity),
|
||||
new ShaderRunner<ColorfulInfinity>(static time => new((float)time.TotalSeconds)),
|
||||
@@ -123,7 +123,7 @@ public sealed partial class MainViewModel : ObservableObject
|
||||
nameof(TerracedHills),
|
||||
new ShaderRunner<TerracedHills>(static time => new((float)time.TotalSeconds)),
|
||||
new PixelShaderEffect.For<SwapChain.Shaders.D2D1.TerracedHills>(static (time, width, height) => new((float)time.TotalSeconds, new int2(width, height)))),
|
||||
};
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the resolution scale can currently be expliclty set.
|
||||
|
||||
@@ -26,21 +26,13 @@ internal unsafe partial struct PixelShaderEffect
|
||||
/// <summary>
|
||||
/// A base type with global values for pixel shader effects.
|
||||
/// </summary>
|
||||
public abstract class Globals
|
||||
/// <param name="effectFactory">The <see cref="FactoryDelegate"/> wrapper for the shader factory.</param>
|
||||
public abstract class Globals(FactoryDelegate effectFactory)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="FactoryDelegate"/> wrapper for the shader factory.
|
||||
/// </summary>
|
||||
private readonly FactoryDelegate effectFactory;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Globals"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="effectFactory">The <see cref="FactoryDelegate"/> wrapper for the shader factory.</param>
|
||||
protected Globals(FactoryDelegate effectFactory)
|
||||
{
|
||||
this.effectFactory = effectFactory;
|
||||
}
|
||||
private readonly FactoryDelegate effectFactory = effectFactory;
|
||||
|
||||
/// <inheritdoc cref="ID2D1PixelShaderDescriptor{T}.EffectId"/>
|
||||
public abstract ref readonly Guid EffectId { get; }
|
||||
|
||||
@@ -20,67 +20,54 @@ namespace ComputeSharp.SourceGeneration.SyntaxRewriters;
|
||||
/// A base <see cref="CSharpSyntaxRewriter"/> type that processes C# source to convert to HLSL compliant code.
|
||||
/// This class contains only the shared logic for all derived HLSL source rewriters.
|
||||
/// </summary>
|
||||
internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
|
||||
/// <param name="semanticModel">The <see cref="Microsoft.CodeAnalysis.SemanticModel"/> instance for the target syntax tree.</param>
|
||||
/// <param name="discoveredTypes">The set of discovered custom types.</param>
|
||||
/// <param name="constantDefinitions">The collection of discovered constant definitions.</param>
|
||||
/// <param name="staticFieldDefinitions">The collection of discovered static field definitions.</param>
|
||||
/// <param name="diagnostics">The collection of produced <see cref="DiagnosticInfo"/> instances.</param>
|
||||
/// <param name="token">The <see cref="System.Threading.CancellationToken"/> value for the current operation.</param>
|
||||
internal abstract partial class HlslSourceRewriter(
|
||||
SemanticModelProvider semanticModel,
|
||||
ICollection<INamedTypeSymbol> discoveredTypes,
|
||||
IDictionary<IFieldSymbol, string> constantDefinitions,
|
||||
IDictionary<IFieldSymbol, HlslStaticField> staticFieldDefinitions,
|
||||
ImmutableArrayBuilder<DiagnosticInfo> diagnostics,
|
||||
CancellationToken token) : CSharpSyntaxRewriter
|
||||
{
|
||||
/// <summary>
|
||||
/// An array with the <c>'.'</c> and <c>'E'</c> characters.
|
||||
/// </summary>
|
||||
private static readonly char[] FloatLiteralSpecialCharacters = ['.', 'E'];
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="HlslSourceRewriter"/> instance with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="semanticModel">The <see cref="Microsoft.CodeAnalysis.SemanticModel"/> instance for the target syntax tree.</param>
|
||||
/// <param name="discoveredTypes">The set of discovered custom types.</param>
|
||||
/// <param name="constantDefinitions">The collection of discovered constant definitions.</param>
|
||||
/// <param name="staticFieldDefinitions">The collection of discovered static field definitions.</param>
|
||||
/// <param name="diagnostics">The collection of produced <see cref="DiagnosticInfo"/> instances.</param>
|
||||
/// <param name="token">The <see cref="System.Threading.CancellationToken"/> value for the current operation.</param>
|
||||
protected HlslSourceRewriter(
|
||||
SemanticModelProvider semanticModel,
|
||||
ICollection<INamedTypeSymbol> discoveredTypes,
|
||||
IDictionary<IFieldSymbol, string> constantDefinitions,
|
||||
IDictionary<IFieldSymbol, HlslStaticField> staticFieldDefinitions,
|
||||
ImmutableArrayBuilder<DiagnosticInfo> diagnostics,
|
||||
CancellationToken token)
|
||||
{
|
||||
SemanticModel = semanticModel;
|
||||
DiscoveredTypes = discoveredTypes;
|
||||
ConstantDefinitions = constantDefinitions;
|
||||
StaticFieldDefinitions = staticFieldDefinitions;
|
||||
Diagnostics = diagnostics;
|
||||
CancellationToken = token;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SemanticModelProvider"/> instance with semantic info on the target syntax tree.
|
||||
/// </summary>
|
||||
protected SemanticModelProvider SemanticModel { get; }
|
||||
protected SemanticModelProvider SemanticModel { get; } = semanticModel;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of discovered custom types.
|
||||
/// </summary>
|
||||
protected ICollection<INamedTypeSymbol> DiscoveredTypes { get; }
|
||||
protected ICollection<INamedTypeSymbol> DiscoveredTypes { get; } = discoveredTypes;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of discovered constant definitions.
|
||||
/// </summary>
|
||||
protected IDictionary<IFieldSymbol, string> ConstantDefinitions { get; }
|
||||
protected IDictionary<IFieldSymbol, string> ConstantDefinitions { get; } = constantDefinitions;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of discovered static field definitions.
|
||||
/// </summary>
|
||||
protected IDictionary<IFieldSymbol, HlslStaticField> StaticFieldDefinitions { get; }
|
||||
protected IDictionary<IFieldSymbol, HlslStaticField> StaticFieldDefinitions { get; } = staticFieldDefinitions;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of produced <see cref="DiagnosticInfo"/> instances.
|
||||
/// </summary>
|
||||
protected ImmutableArrayBuilder<DiagnosticInfo> Diagnostics { get; }
|
||||
protected ImmutableArrayBuilder<DiagnosticInfo> Diagnostics { get; } = diagnostics;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="System.Threading.CancellationToken"/> value for the current operation.
|
||||
/// </summary>
|
||||
protected CancellationToken CancellationToken { get; }
|
||||
protected CancellationToken CancellationToken { get; } = token;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public sealed override SyntaxNode VisitCastExpression(CastExpressionSyntax node)
|
||||
|
||||
@@ -16,6 +16,8 @@ using Microsoft.CodeAnalysis.Operations;
|
||||
using static ComputeSharp.SourceGeneration.Diagnostics.DiagnosticDescriptors;
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
|
||||
#pragma warning disable IDE0051, IDE0052
|
||||
|
||||
namespace ComputeSharp.SourceGeneration.SyntaxRewriters;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -190,19 +190,13 @@ internal readonly struct EquatableArray<T>(ImmutableArray<T> array) : IEquatable
|
||||
/// Implicitly converts an <see cref="ImmutableArray{T}"/> to <see cref="EquatableArray{T}"/>.
|
||||
/// </summary>
|
||||
/// <returns>An <see cref="EquatableArray{T}"/> instance from a given <see cref="ImmutableArray{T}"/>.</returns>
|
||||
public static implicit operator EquatableArray<T>(ImmutableArray<T> array)
|
||||
{
|
||||
return FromImmutableArray(array);
|
||||
}
|
||||
public static implicit operator EquatableArray<T>(ImmutableArray<T> array) => FromImmutableArray(array);
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts an <see cref="EquatableArray{T}"/> to <see cref="ImmutableArray{T}"/>.
|
||||
/// </summary>
|
||||
/// <returns>An <see cref="ImmutableArray{T}"/> instance from a given <see cref="EquatableArray{T}"/>.</returns>
|
||||
public static implicit operator ImmutableArray<T>(EquatableArray<T> array)
|
||||
{
|
||||
return array.AsImmutableArray();
|
||||
}
|
||||
public static implicit operator ImmutableArray<T>(EquatableArray<T> array) => array.AsImmutableArray();
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether two <see cref="EquatableArray{T}"/> values are the same.
|
||||
@@ -210,10 +204,7 @@ internal readonly struct EquatableArray<T>(ImmutableArray<T> array) : IEquatable
|
||||
/// <param name="left">The first <see cref="EquatableArray{T}"/> value.</param>
|
||||
/// <param name="right">The second <see cref="EquatableArray{T}"/> value.</param>
|
||||
/// <returns>Whether <paramref name="left"/> and <paramref name="right"/> are equal.</returns>
|
||||
public static bool operator ==(EquatableArray<T> left, EquatableArray<T> right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
public static bool operator ==(EquatableArray<T> left, EquatableArray<T> right) => left.Equals(right);
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether two <see cref="EquatableArray{T}"/> values are not the same.
|
||||
@@ -221,8 +212,5 @@ internal readonly struct EquatableArray<T>(ImmutableArray<T> array) : IEquatable
|
||||
/// <param name="left">The first <see cref="EquatableArray{T}"/> value.</param>
|
||||
/// <param name="right">The second <see cref="EquatableArray{T}"/> value.</param>
|
||||
/// <returns>Whether <paramref name="left"/> and <paramref name="right"/> are not equal.</returns>
|
||||
public static bool operator !=(EquatableArray<T> left, EquatableArray<T> right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
public static bool operator !=(EquatableArray<T> left, EquatableArray<T> right) => !left.Equals(right);
|
||||
}
|
||||
@@ -18,7 +18,7 @@ internal struct ImmutableHashSetBuilder<T> : IDisposable
|
||||
/// <summary>
|
||||
/// The shared <see cref="ObjectPool{T}"/> instance to share <see cref="HashSet{T}"/> objects.
|
||||
/// </summary>
|
||||
private static readonly ObjectPool<HashSet<T>> SharedObjectPool = new(static () => new HashSet<T>());
|
||||
private static readonly ObjectPool<HashSet<T>> SharedObjectPool = new(static () => []);
|
||||
|
||||
/// <summary>
|
||||
/// The rented <see cref="HashSet{T}"/> instance to use.
|
||||
|
||||
@@ -79,10 +79,7 @@ public readonly struct Luid : IEquatable<Luid>, ISpanFormattable
|
||||
/// <param name="b">The second <see cref="Luid"/> value to compare.</param>
|
||||
/// <returns>Whether <paramref name="a"/> and <paramref name="b"/> are the same.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(Luid a, Luid b)
|
||||
{
|
||||
return a.Equals(b);
|
||||
}
|
||||
public static bool operator ==(Luid a, Luid b) => a.Equals(b);
|
||||
|
||||
/// <summary>
|
||||
/// Check whether two <see cref="Luid"/> values are different.
|
||||
@@ -91,8 +88,5 @@ public readonly struct Luid : IEquatable<Luid>, ISpanFormattable
|
||||
/// <param name="b">The second <see cref="Luid"/> value to compare.</param>
|
||||
/// <returns>Whether <paramref name="a"/> and <paramref name="b"/> are different.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(Luid a, Luid b)
|
||||
{
|
||||
return !a.Equals(b);
|
||||
}
|
||||
public static bool operator !=(Luid a, Luid b) => !a.Equals(b);
|
||||
}
|
||||
@@ -361,10 +361,7 @@ public readonly unsafe ref struct TextureView2D<T>
|
||||
/// <param name="left">The first <see cref="TextureView2D{T}"/> instance to compare.</param>
|
||||
/// <param name="right">The second <see cref="TextureView2D{T}"/> instance to compare.</param>
|
||||
/// <returns>Whether or not <paramref name="left"/> and <paramref name="right"/> are equal.</returns>
|
||||
public static bool operator ==(TextureView2D<T> left, TextureView2D<T> right)
|
||||
{
|
||||
return left.pointer == right.pointer;
|
||||
}
|
||||
public static bool operator ==(TextureView2D<T> left, TextureView2D<T> right) => left.pointer == right.pointer;
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether two <see cref="TextureView2D{T}"/> instances are not equal.
|
||||
@@ -372,8 +369,5 @@ public readonly unsafe ref struct TextureView2D<T>
|
||||
/// <param name="left">The first <see cref="TextureView2D{T}"/> instance to compare.</param>
|
||||
/// <param name="right">The second <see cref="TextureView2D{T}"/> instance to compare.</param>
|
||||
/// <returns>Whether or not <paramref name="left"/> and <paramref name="right"/> are not equal.</returns>
|
||||
public static bool operator !=(TextureView2D<T> left, TextureView2D<T> right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
public static bool operator !=(TextureView2D<T> left, TextureView2D<T> right) => !(left == right);
|
||||
}
|
||||
@@ -418,10 +418,7 @@ public readonly unsafe ref struct TextureView3D<T>
|
||||
/// <param name="left">The first <see cref="TextureView3D{T}"/> instance to compare.</param>
|
||||
/// <param name="right">The second <see cref="TextureView3D{T}"/> instance to compare.</param>
|
||||
/// <returns>Whether or not <paramref name="left"/> and <paramref name="right"/> are equal.</returns>
|
||||
public static bool operator ==(TextureView3D<T> left, TextureView3D<T> right)
|
||||
{
|
||||
return left.pointer == right.pointer;
|
||||
}
|
||||
public static bool operator ==(TextureView3D<T> left, TextureView3D<T> right) => left.pointer == right.pointer;
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether two <see cref="TextureView3D{T}"/> instances are not equal.
|
||||
@@ -429,8 +426,5 @@ public readonly unsafe ref struct TextureView3D<T>
|
||||
/// <param name="left">The first <see cref="TextureView3D{T}"/> instance to compare.</param>
|
||||
/// <param name="right">The second <see cref="TextureView3D{T}"/> instance to compare.</param>
|
||||
/// <returns>Whether or not <paramref name="left"/> and <paramref name="right"/> are not equal.</returns>
|
||||
public static bool operator !=(TextureView3D<T> left, TextureView3D<T> right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
public static bool operator !=(TextureView3D<T> left, TextureView3D<T> right) => !(left == right);
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする