Remove unnecessary [Pure] attributes
このコミットが含まれているのは:
1 親
30fea918cf
コミット
4d51d8d05b
53ファイル変更
+70
-2093
検索条件に一致するファイルはありません
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ComputeSharp.SourceGenerators.Mappings;
|
||||
@@ -35,7 +34,6 @@ internal static class ISymbolExtensions
|
||||
/// </summary>
|
||||
/// <param name="symbol">The input <see cref="ITypeSymbol"/> instance.</param>
|
||||
/// <returns>The full metadata name for <paramref name="symbol"/>.</returns>
|
||||
[Pure]
|
||||
public static string GetFullMetadataName(this ITypeSymbol symbol)
|
||||
{
|
||||
static StringBuilder BuildFrom(ISymbol? symbol, StringBuilder builder)
|
||||
@@ -61,7 +59,6 @@ internal static class ISymbolExtensions
|
||||
/// <param name="symbol">The input <see cref="IMethodSymbol"/> instance.</param>
|
||||
/// <param name="includeParameters">Whether or not to also include parameter types.</param>
|
||||
/// <returns>The full metadata name for <paramref name="symbol"/>.</returns>
|
||||
[Pure]
|
||||
public static string GetFullMetadataName(this IMethodSymbol symbol, bool includeParameters = false)
|
||||
{
|
||||
if (includeParameters)
|
||||
@@ -79,7 +76,6 @@ internal static class ISymbolExtensions
|
||||
/// </summary>
|
||||
/// <param name="symbol">The input <see cref="IPropertySymbol"/> instance.</param>
|
||||
/// <returns>The full metadata name for <paramref name="symbol"/>.</returns>
|
||||
[Pure]
|
||||
public static string GetFullMetadataName(this IPropertySymbol symbol)
|
||||
{
|
||||
string declaringTypeName = symbol.ContainingType.GetFullMetadataName();
|
||||
@@ -99,7 +95,6 @@ internal static class ISymbolExtensions
|
||||
/// </summary>
|
||||
/// <param name="symbol">The input <see cref="IFieldSymbol"/> instance.</param>
|
||||
/// <returns>The full metadata name for <paramref name="symbol"/>.</returns>
|
||||
[Pure]
|
||||
public static string GetFullMetadataName(this IFieldSymbol symbol)
|
||||
{
|
||||
return $"{symbol.ContainingType.GetFullMetadataName()}.{symbol.Name}";
|
||||
@@ -110,7 +105,6 @@ internal static class ISymbolExtensions
|
||||
/// </summary>
|
||||
/// <param name="symbol">The symbol being processed.</param>
|
||||
/// <returns>A filename in the form "<SYMBOL_FULLNAME>"</returns>
|
||||
[Pure]
|
||||
public static string GetGeneratedFileName(this INamedTypeSymbol symbol)
|
||||
{
|
||||
return symbol.GetFullMetadataName().Replace('`', '-').Replace('+', '.');
|
||||
@@ -122,7 +116,6 @@ internal static class ISymbolExtensions
|
||||
/// <param name="typeSymbol">The input <see cref="ITypeSymbol"/> instance to process.</param>
|
||||
/// <param name="discoveredTypes">The collection of currently discovered types.</param>
|
||||
/// <returns>A <see cref="SyntaxNode"/> instance that represents a type compatible with HLSL.</returns>
|
||||
[Pure]
|
||||
public static TypeSyntax TrackType(this ITypeSymbol typeSymbol, ICollection<INamedTypeSymbol> discoveredTypes)
|
||||
{
|
||||
string typeName = typeSymbol.ToDisplayString(FullyQualifiedWithoutGlobalFormat);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
|
||||
namespace ComputeSharp.SourceGenerators.Extensions;
|
||||
|
||||
/// <summary>
|
||||
@@ -12,7 +11,6 @@ internal static class StringExtensions
|
||||
/// </summary>
|
||||
/// <param name="text">The input <see cref="string"/> instance to convert.</param>
|
||||
/// <returns>An valid HLSL identifier name from <paramref name="text"/>.</returns>
|
||||
[Pure]
|
||||
public static string ToHlslIdentifierName(this string text)
|
||||
{
|
||||
return text.Replace('.', '_').Replace('+', '_');
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using ComputeSharp.SourceGenerators.Mappings;
|
||||
using Microsoft.CodeAnalysis;
|
||||
@@ -23,7 +22,6 @@ internal static class SyntaxNodeExtensions
|
||||
/// <param name="semanticModel">The <see cref="SemanticModel"/> instance with info on the input tree.</param>
|
||||
/// <param name="discoveredTypes">The collection of currently discovered types.</param>
|
||||
/// <returns>A <see cref="SyntaxNode"/> instance that represents a type compatible with HLSL.</returns>
|
||||
[Pure]
|
||||
public static TRoot ReplaceAndTrackType<TRoot>(this TRoot node, SyntaxNode sourceType, SemanticModel semanticModel, ICollection<INamedTypeSymbol> discoveredTypes)
|
||||
where TRoot : TypeSyntax
|
||||
{
|
||||
@@ -40,7 +38,6 @@ internal static class SyntaxNodeExtensions
|
||||
/// <param name="semanticModel">The <see cref="SemanticModel"/> instance with info on the input tree.</param>
|
||||
/// <param name="discoveredTypes">The collection of currently discovered types.</param>
|
||||
/// <returns>A <see cref="SyntaxNode"/> instance that represents a type compatible with HLSL.</returns>
|
||||
[Pure]
|
||||
public static TRoot ReplaceAndTrackType<TRoot>(this TRoot node, TypeSyntax targetType, SyntaxNode sourceType, SemanticModel semanticModel, ICollection<INamedTypeSymbol> discoveredTypes)
|
||||
where TRoot : SyntaxNode
|
||||
{
|
||||
@@ -85,7 +82,6 @@ internal static class SyntaxNodeExtensions
|
||||
/// <param name="semanticModel">The <see cref="SemanticModel"/> instance with info on the input tree.</param>
|
||||
/// <param name="discoveredTypes">The collection of currently discovered types.</param>
|
||||
/// <returns>A <see cref="SyntaxNode"/> instance that represents a type compatible with HLSL.</returns>
|
||||
[Pure]
|
||||
public static TypeSyntax TrackType(this SyntaxNode node, SemanticModel semanticModel, ICollection<INamedTypeSymbol> discoveredTypes)
|
||||
{
|
||||
ITypeSymbol typeSymbol = semanticModel.GetTypeInfo(node).Type!;
|
||||
@@ -106,7 +102,6 @@ internal static class SyntaxNodeExtensions
|
||||
/// </summary>
|
||||
/// <param name="node">The input <see cref="MethodDeclarationSyntax"/> node.</param>
|
||||
/// <returns>A node like the one in input, but always with a block body.</returns>
|
||||
[Pure]
|
||||
public static MethodDeclarationSyntax WithBlockBody(this MethodDeclarationSyntax node)
|
||||
{
|
||||
if (node.ExpressionBody is ArrowExpressionClauseSyntax arrow)
|
||||
@@ -131,7 +126,6 @@ internal static class SyntaxNodeExtensions
|
||||
/// </summary>
|
||||
/// <param name="node">The input <see cref="MethodDeclarationSyntax"/> node.</param>
|
||||
/// <returns>A node like the one in input, but just as a definition.</returns>
|
||||
[Pure]
|
||||
public static MethodDeclarationSyntax AsDefinition(this MethodDeclarationSyntax node)
|
||||
{
|
||||
if (node.ExpressionBody is ArrowExpressionClauseSyntax)
|
||||
@@ -151,7 +145,6 @@ internal static class SyntaxNodeExtensions
|
||||
/// This method is the same as <see cref="WithBlockBody(MethodDeclarationSyntax)"/>, but it is necessary to
|
||||
/// duplicate the code because the two types don't have a common base type or interface that can be leveraged.
|
||||
/// </remarks>
|
||||
[Pure]
|
||||
public static LocalFunctionStatementSyntax WithBlockBody(this LocalFunctionStatementSyntax node)
|
||||
{
|
||||
if (node.ExpressionBody is ArrowExpressionClauseSyntax arrow)
|
||||
@@ -176,7 +169,6 @@ internal static class SyntaxNodeExtensions
|
||||
/// </summary>
|
||||
/// <param name="node">The input <see cref="LocalFunctionStatementSyntax"/> node.</param>
|
||||
/// <returns>A node like the one in input, but just as a definition.</returns>
|
||||
[Pure]
|
||||
public static LocalFunctionStatementSyntax AsDefinition(this LocalFunctionStatementSyntax node)
|
||||
{
|
||||
if (node.ExpressionBody is ArrowExpressionClauseSyntax)
|
||||
@@ -192,7 +184,6 @@ internal static class SyntaxNodeExtensions
|
||||
/// </summary>
|
||||
/// <param name="node">The input <see cref="MethodDeclarationSyntax"/> node.</param>
|
||||
/// <returns>A node just like <paramref name="node"/> but with no accessibility modifiers.</returns>
|
||||
[Pure]
|
||||
public static MethodDeclarationSyntax WithoutAccessibilityModifiers(this MethodDeclarationSyntax node)
|
||||
{
|
||||
return node.WithModifiers(TokenList(node.Modifiers.Where(static modifier => modifier.Kind() switch
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
@@ -23,7 +22,6 @@ internal static class SyntaxFactoryHelper
|
||||
/// </summary>
|
||||
/// <param name="groups">The input sequence of <see cref="string"/> groups.</param>
|
||||
/// <returns>An <see cref="ArrayCreationExpressionSyntax"/> instance with the described contents.</returns>
|
||||
[Pure]
|
||||
public static ArrayCreationExpressionSyntax NestedArrayExpression(IEnumerable<(string A, string B)> groups)
|
||||
{
|
||||
return
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ComputeSharp.SourceGenerators.Diagnostics;
|
||||
@@ -98,7 +97,6 @@ public sealed partial class IShaderGenerator
|
||||
/// <param name="types">The collection of currently discovered types.</param>
|
||||
/// <param name="isComputeShader">Indicates whether or not <paramref name="structDeclarationSymbol"/> represents a compute shader.</param>
|
||||
/// <returns>A sequence of captured fields in <paramref name="structDeclarationSymbol"/>.</returns>
|
||||
[Pure]
|
||||
private static (
|
||||
ImmutableArray<(string MetadataName, string Name, string HlslType)>,
|
||||
ImmutableArray<(string Name, string HlslType)>)
|
||||
@@ -193,7 +191,6 @@ public sealed partial class IShaderGenerator
|
||||
/// <param name="discoveredTypes">The collection of currently discovered types.</param>
|
||||
/// <param name="constantDefinitions">The collection of discovered constant definitions.</param>
|
||||
/// <returns>A sequence of static constant fields in <paramref name="structDeclarationSymbol"/>.</returns>
|
||||
[Pure]
|
||||
private static ImmutableArray<(string Name, string TypeDeclaration, string? Assignment)> GetStaticFields(
|
||||
ImmutableArray<Diagnostic>.Builder diagnostics,
|
||||
SemanticModelProvider semanticModel,
|
||||
@@ -261,7 +258,6 @@ public sealed partial class IShaderGenerator
|
||||
/// <param name="structDeclarationSymbol">The input <see cref="INamedTypeSymbol"/> instance to process.</param>
|
||||
/// <param name="types">The collection of currently discovered types.</param>
|
||||
/// <returns>A sequence of captured members in <paramref name="structDeclarationSymbol"/>.</returns>
|
||||
[Pure]
|
||||
private static ImmutableArray<(string Name, string Type, int? Count)> GetSharedBuffers(
|
||||
ImmutableArray<Diagnostic>.Builder diagnostics,
|
||||
INamedTypeSymbol structDeclarationSymbol,
|
||||
@@ -323,7 +319,6 @@ public sealed partial class IShaderGenerator
|
||||
/// <param name="constantDefinitions">The collection of discovered constant definitions.</param>
|
||||
/// <param name="isComputeShader">Indicates whether or not <paramref name="structDeclarationSymbol"/> represents a compute shader.</param>
|
||||
/// <returns>A sequence of processed methods in <paramref name="structDeclaration"/>, and the entry point.</returns>
|
||||
[Pure]
|
||||
private static (string EntryPoint, ImmutableArray<(string Signature, string Definition)> Methods, bool IsSamplerUser) GetProcessedMethods(
|
||||
ImmutableArray<Diagnostic>.Builder diagnostics,
|
||||
StructDeclarationSyntax structDeclaration,
|
||||
@@ -418,7 +413,6 @@ public sealed partial class IShaderGenerator
|
||||
/// </summary>
|
||||
/// <param name="constantDefinitions">The collection of discovered constant definitions.</param>
|
||||
/// <returns>A sequence of discovered constants to declare in the shader.</returns>
|
||||
[Pure]
|
||||
internal static ImmutableArray<(string Name, string Value)> GetDefinedConstants(IReadOnlyDictionary<IFieldSymbol, string> constantDefinitions)
|
||||
{
|
||||
ImmutableArray<(string, string)>.Builder builder = ImmutableArray.CreateBuilder<(string, string)>(constantDefinitions.Count);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.Contracts;
|
||||
using ComputeSharp.__Internals;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
@@ -45,7 +44,6 @@ public sealed partial class IShaderGenerator
|
||||
/// <param name="delegateFieldNames">The names of all <see cref="System.Delegate"/> instance fields within the current shader type.</param>
|
||||
/// <param name="supportsDynamicShaders">Indicates whether or not dynamic shaders are supported.</param>
|
||||
/// <returns>The <see cref="BlockSyntax"/> instance to hash the input shader.</returns>
|
||||
[Pure]
|
||||
private static BlockSyntax GetShaderHashCodeBody(ImmutableArray<string> delegateFieldNames, bool supportsDynamicShaders)
|
||||
{
|
||||
if (delegateFieldNames.Length == 0 || !supportsDynamicShaders)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
@@ -18,7 +17,6 @@ public sealed partial class IShaderGenerator
|
||||
/// </summary>
|
||||
/// <param name="structDeclarationSymbol">The input <see cref="INamedTypeSymbol"/> instance to process.</param>
|
||||
/// <returns>The names of all <see cref="System.Delegate"/> instance fields within <paramref name="structDeclarationSymbol"/>.</returns>
|
||||
[Pure]
|
||||
public static ImmutableArray<string> GetInfo(INamedTypeSymbol structDeclarationSymbol)
|
||||
{
|
||||
return
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using ComputeSharp.__Internals;
|
||||
using ComputeSharp.SourceGenerators.Models;
|
||||
using Microsoft.CodeAnalysis;
|
||||
@@ -67,7 +66,6 @@ public sealed partial class IShaderGenerator
|
||||
/// <param name="supportsDynamicShaders">Indicates whether or not dynamic shaders are supported.</param>
|
||||
/// <param name="bytecodeLiterals">The resulting bytecode literals to insert into the final source code.</param>
|
||||
/// <returns>The <see cref="BlockSyntax"/> instance trying to retrieve the precompiled shader.</returns>
|
||||
[Pure]
|
||||
private static unsafe BlockSyntax GetShaderBytecodeBody(EmbeddedBytecodeInfo bytecodeInfo, bool supportsDynamicShaders, out string? bytecodeLiterals)
|
||||
{
|
||||
if (bytecodeInfo.Bytecode.IsEmpty)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Immutable;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -103,7 +102,6 @@ public sealed partial class IShaderGenerator
|
||||
/// <param name="hlslSource">The generated HLSL source code (ignoring captured delegates, if present).</param>
|
||||
/// <param name="diagnostic">The resulting diagnostic from the processing operation, if any.</param>
|
||||
/// <returns>The <see cref="ImmutableArray{T}"/> instance with the compiled shader bytecode.</returns>
|
||||
[Pure]
|
||||
public static unsafe ImmutableArray<byte> GetBytecode(
|
||||
ThreadIdsInfo threadIds,
|
||||
string hlslSource,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using ComputeSharp.SourceGenerators.Models;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
@@ -19,7 +18,6 @@ public sealed partial class IShaderGenerator
|
||||
/// <param name="iComputeShaderSymbol">The <see cref="INamedTypeSymbol"/> instance for <see cref="IComputeShader"/>.</param>
|
||||
/// <param name="iPixelShaderSymbol">The <see cref="INamedTypeSymbol"/> instance for <see cref="IPixelShader{TPixel}"/>.</param>
|
||||
/// <returns>Either <see cref="IComputeShader"/> or <see cref="IPixelShader{TPixel}"/>, or <see langword="null"/>.</returns>
|
||||
[Pure]
|
||||
private static Type? GetShaderType(
|
||||
INamedTypeSymbol typeSymbol,
|
||||
INamedTypeSymbol iComputeShaderSymbol,
|
||||
@@ -51,7 +49,6 @@ public sealed partial class IShaderGenerator
|
||||
/// <param name="methodDeclaration">The <see cref="MethodDeclarationSyntax"/> item to insert.</param>
|
||||
/// <param name="canUseSkipLocalsInit">Whether <c>[SkipLocalsInit]</c> can be used.</param>
|
||||
/// <returns>A <see cref="CompilationUnitSyntax"/> object wrapping <paramref name="methodDeclaration"/>.</returns>
|
||||
[Pure]
|
||||
private static CompilationUnitSyntax GetCompilationUnitFromMethod(
|
||||
HierarchyInfo hierarchyInfo,
|
||||
MethodDeclarationSyntax methodDeclaration,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using ComputeSharp.Core.Intrinsics.Attributes;
|
||||
@@ -19,7 +18,6 @@ internal static class HlslKnownKeywords
|
||||
/// <summary>
|
||||
/// Builds the mapping of all known HLSL keywords.
|
||||
/// </summary>
|
||||
[Pure]
|
||||
private static IReadOnlyCollection<string> BuildKnownKeywordsMap()
|
||||
{
|
||||
// HLSL keywords
|
||||
@@ -58,7 +56,6 @@ internal static class HlslKnownKeywords
|
||||
/// <param name="name">The input identifier name.</param>
|
||||
/// <param name="mapped">The mapped identifier name, if a replacement is needed.</param>
|
||||
/// <returns>The HLSL-compatible identifier name that can be used in an HLSL shader.</returns>
|
||||
[Pure]
|
||||
public static bool TryGetMappedName(string name, out string? mapped)
|
||||
{
|
||||
mapped = KnownKeywords.Contains(name) switch
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
@@ -79,7 +78,6 @@ internal static class HlslKnownMembers
|
||||
/// <summary>
|
||||
/// Builds the mapping of supported known members to HLSL names.
|
||||
/// </summary>
|
||||
[Pure]
|
||||
private static IReadOnlyDictionary<string, string> BuildKnownMembersMap()
|
||||
{
|
||||
Dictionary<string, string> knownMembers = new()
|
||||
@@ -325,7 +323,6 @@ internal static class HlslKnownMembers
|
||||
/// <summary>
|
||||
/// Builds the mapping of swizzled matrix indexer properties.
|
||||
/// </summary>
|
||||
[Pure]
|
||||
private static IReadOnlyCollection<string> BuildKnownMatrixIndexers()
|
||||
{
|
||||
return (
|
||||
@@ -347,7 +344,6 @@ internal static class HlslKnownMembers
|
||||
/// <summary>
|
||||
/// Builds the mapping of swizzled matrix indices.
|
||||
/// </summary>
|
||||
[Pure]
|
||||
private static IReadOnlyCollection<string> BuildKnownMatrixIndices()
|
||||
{
|
||||
return (
|
||||
@@ -360,7 +356,6 @@ internal static class HlslKnownMembers
|
||||
/// </summary>
|
||||
/// <param name="name">The input fully qualified member name.</param>
|
||||
/// <returns>Whether or not <paramref name="name"/> is a matrix swizzled indexer.</returns>
|
||||
[Pure]
|
||||
public static bool IsKnownMatrixIndexer(string name)
|
||||
{
|
||||
return KnownMatrixIndexers.Contains(name);
|
||||
@@ -371,7 +366,6 @@ internal static class HlslKnownMembers
|
||||
/// </summary>
|
||||
/// <param name="name">The input fully qualified member name.</param>
|
||||
/// <returns>Whether or not <paramref name="name"/> is a matrix swizzled index.</returns>
|
||||
[Pure]
|
||||
public static bool IsKnownMatrixIndex(string name)
|
||||
{
|
||||
return KnownMatrixIndices.Contains(name);
|
||||
@@ -383,7 +377,6 @@ internal static class HlslKnownMembers
|
||||
/// <param name="name">The input fully qualified member name.</param>
|
||||
/// <param name="mapped">The mapped name, if one is found.</param>
|
||||
/// <returns>The HLSL-compatible member name that can be used in an HLSL shader.</returns>
|
||||
[Pure]
|
||||
public static bool TryGetMappedName(string name, out string? mapped)
|
||||
{
|
||||
return KnownMembers.TryGetValue(name, out mapped);
|
||||
@@ -395,7 +388,6 @@ internal static class HlslKnownMembers
|
||||
/// <param name="name">The input fully qualified indexer name.</param>
|
||||
/// <param name="mapped">The mapped type name, if one is found.</param>
|
||||
/// <returns>The HLSL-compatible type name that can be used in an HLSL shader for the given indexer.</returns>
|
||||
[Pure]
|
||||
public static bool TryGetMappedResourceIndexerTypeName(string name, out string? mapped)
|
||||
{
|
||||
return KnownResourceIndexers.TryGetValue(name, out mapped);
|
||||
@@ -407,7 +399,6 @@ internal static class HlslKnownMembers
|
||||
/// <param name="name">The input fully qualified indexer name.</param>
|
||||
/// <param name="mapped">The mapped type name, if one is found.</param>
|
||||
/// <returns>The HLSL-compatible type name that can be used in an HLSL shader for the given sampler.</returns>
|
||||
[Pure]
|
||||
public static bool TryGetMappedResourceSamplerAccessType(string name, out string? mapped)
|
||||
{
|
||||
return KnownResourceSamplers.TryGetValue(name, out mapped);
|
||||
@@ -420,7 +411,6 @@ internal static class HlslKnownMembers
|
||||
/// <param name="rank">The resulting indexer rank, if found.</param>
|
||||
/// <param name="axis">The resulting indexer axis, if found.</param>
|
||||
/// <returns>Whether or not a rank and axis could be resolved by the input indexer name.</returns>
|
||||
[Pure]
|
||||
public static bool TryGetAccessorRankAndAxis(string name, out int rank, out int axis)
|
||||
{
|
||||
if (KnownSizeAccessors.TryGetValue(name, out var info))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
@@ -21,7 +20,6 @@ internal static class HlslKnownMethods
|
||||
/// <summary>
|
||||
/// Builds the mapping of supported known methods to HLSL names.
|
||||
/// </summary>
|
||||
[Pure]
|
||||
private static IReadOnlyDictionary<string, string> BuildKnownMethodsMap()
|
||||
{
|
||||
Dictionary<string, string> knownMethods = new()
|
||||
@@ -148,7 +146,6 @@ internal static class HlslKnownMethods
|
||||
/// <param name="name">The input fully qualified method name.</param>
|
||||
/// <param name="mapped">The mapped name, if one is found.</param>
|
||||
/// <returns>The HLSL-compatible member name that can be used in an HLSL shader.</returns>
|
||||
[Pure]
|
||||
public static bool TryGetMappedName(string name, out string? mapped)
|
||||
{
|
||||
return KnownMethods.TryGetValue(name, out mapped);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
@@ -20,7 +19,6 @@ internal static class HlslKnownSizes
|
||||
/// <summary>
|
||||
/// Builds the mapping of known type sizes and alignments.
|
||||
/// </summary>
|
||||
[Pure]
|
||||
private static IReadOnlyDictionary<string, (int, int)> BuildKnownSizesMap()
|
||||
{
|
||||
Dictionary<string, (int, int)> knownSizes = new()
|
||||
@@ -53,7 +51,6 @@ internal static class HlslKnownSizes
|
||||
/// </summary>
|
||||
/// <param name="typeName">The type name to get info for.</param>
|
||||
/// <returns>The size and and alignment for the input type.</returns>
|
||||
[Pure]
|
||||
public static (int Size, int Pack) GetTypeInfo(string typeName)
|
||||
{
|
||||
return KnownSizes[typeName];
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -73,7 +72,6 @@ internal static class HlslKnownTypes
|
||||
/// <summary>
|
||||
/// Builds the mapping of known primitive types.
|
||||
/// </summary>
|
||||
[Pure]
|
||||
private static IReadOnlyDictionary<string, string> BuildKnownHlslTypes()
|
||||
{
|
||||
Dictionary<string, string> knownTypes = new()
|
||||
@@ -263,7 +261,6 @@ internal static class HlslKnownTypes
|
||||
/// </summary>
|
||||
/// <param name="typeSymbol">The input type to map.</param>
|
||||
/// <returns>The HLSL-compatible type name that can be used in an HLSL shader.</returns>
|
||||
[Pure]
|
||||
public static string GetMappedName(INamedTypeSymbol typeSymbol)
|
||||
{
|
||||
// Delegate types just return an empty string, as they're not actually
|
||||
@@ -320,7 +317,6 @@ internal static class HlslKnownTypes
|
||||
/// </summary>
|
||||
/// <param name="typeSymbol">The pixel shader type to map.</param>
|
||||
/// <returns>The HLSL-compatible type name that can be used in an HLSL shader.</returns>
|
||||
[Pure]
|
||||
public static string GetMappedNameForPixelShaderType(INamedTypeSymbol typeSymbol)
|
||||
{
|
||||
string genericArgumentName = ((INamedTypeSymbol)typeSymbol.TypeArguments.First()).GetFullMetadataName();
|
||||
@@ -340,7 +336,6 @@ internal static class HlslKnownTypes
|
||||
/// </summary>
|
||||
/// <param name="typeSymbol">The input type to map.</param>
|
||||
/// <returns>The HLSL-compatible type name that can be used in an HLSL shader.</returns>
|
||||
[Pure]
|
||||
public static string GetMappedElementName(IArrayTypeSymbol typeSymbol)
|
||||
{
|
||||
string elementTypeName = ((INamedTypeSymbol)typeSymbol.ElementType).GetFullMetadataName();
|
||||
@@ -402,7 +397,6 @@ internal static class HlslKnownTypes
|
||||
/// </summary>
|
||||
/// <param name="types">The input collection of types to declare.</param>
|
||||
/// <returns>The same list as input, but in a valid HLSL declaration order.</returns>
|
||||
[Pure]
|
||||
private static IEnumerable<INamedTypeSymbol> OrderByDependency(IEnumerable<INamedTypeSymbol> types)
|
||||
{
|
||||
Queue<(INamedTypeSymbol Type, HashSet<INamedTypeSymbol> Fields)> queue = new();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.Contracts;
|
||||
using ComputeSharp.SourceGenerators.Extensions;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using static Microsoft.CodeAnalysis.SymbolDisplayTypeQualificationStyle;
|
||||
@@ -22,7 +21,6 @@ internal sealed record HierarchyInfo(string FilenameHint, string MetadataName, s
|
||||
/// </summary>
|
||||
/// <param name="typeSymbol">The input <see cref="INamedTypeSymbol"/> instance to gather info for.</param>
|
||||
/// <returns>A <see cref="HierarchyInfo"/> instance describing <paramref name="typeSymbol"/>.</returns>
|
||||
[Pure]
|
||||
public static HierarchyInfo From(INamedTypeSymbol typeSymbol)
|
||||
{
|
||||
ImmutableArray<string>.Builder names = ImmutableArray.CreateBuilder<string>();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ComputeSharp.__Internals;
|
||||
@@ -119,7 +118,6 @@ public sealed partial class ShaderMethodSourceGenerator : IIncrementalGenerator
|
||||
/// <param name="constantDefinitions">The collection of discovered constant definitions.</param>
|
||||
/// <param name="diagnostics">The resulting diagnostics from the processing operation.</param>
|
||||
/// <returns>A sequence of processed methods in <paramref name="methodDeclaration"/> (main method and all captured methods).</returns>
|
||||
[Pure]
|
||||
private static (string TargetMethod, ImmutableArray<(string Signature, string Definition)> DependentMethods) GetProcessedMethods(
|
||||
MethodDeclarationSyntax methodDeclaration,
|
||||
SemanticModelProvider semanticModel,
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする