Share known properties with D2D1 generator, add D2D1 mappings
このコミットが含まれているのは:
1 親
ecb8991807
コミット
eda4bd43ff
3ファイル変更
+187
-107
検索条件に一致するファイルはありません
@@ -209,6 +209,39 @@ internal static partial class HlslKnownProperties
|
||||
select $"{typeof(MatrixIndex).FullName}.{name}").ToImmutableHashSet();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The mapping of supported known indexers to HLSL resource type names.
|
||||
/// </summary>
|
||||
private static readonly IReadOnlyDictionary<string, string> KnownResourceIndexers = BuildKnownResourceIndexers();
|
||||
|
||||
/// <summary>
|
||||
/// Builds the mapping of supported known indexers to HLSL resource type names.
|
||||
/// </summary>
|
||||
/// <returns>The mapping of supported known indexers to HLSL resource type names.</returns>
|
||||
private static partial IReadOnlyDictionary<string, string> BuildKnownResourceIndexers();
|
||||
|
||||
/// <summary>
|
||||
/// The mapping of supported known samplers to HLSL resource type names.
|
||||
/// </summary>
|
||||
private static readonly IReadOnlyDictionary<string, string?> KnownResourceSamplers = BuildKnownResourceSamplers();
|
||||
|
||||
/// <summary>
|
||||
/// Builds the mapping of supported known samplers to HLSL resource type names.
|
||||
/// </summary>
|
||||
/// <returns>The mapping of supported known samplers to HLSL resource type names.</returns>
|
||||
private static partial IReadOnlyDictionary<string, string?> BuildKnownResourceSamplers();
|
||||
|
||||
/// <summary>
|
||||
/// The mapping of supported known size accessors for HLSL resource types.
|
||||
/// </summary>
|
||||
private static readonly IReadOnlyDictionary<string, (int Rank, int Axis)> KnownSizeAccessors = BuildKnownSizeAccessors();
|
||||
|
||||
/// <summary>
|
||||
/// Builds the mapping of supported known size accessors for HLSL resource types.
|
||||
/// </summary>
|
||||
/// <returns>The mapping of supported known size accessors for HLSL resource types.</returns>
|
||||
private static partial IReadOnlyDictionary<string, (int Rank, int Axis)> BuildKnownSizeAccessors();
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether or not a given property fullname matches a matrix swizzled indexer.
|
||||
/// </summary>
|
||||
@@ -239,4 +272,47 @@ internal static partial class HlslKnownProperties
|
||||
{
|
||||
return KnownProperties.TryGetValue(name, out mapped);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get the mapped HLSL-compatible indexer resource type name for the input indexer name.
|
||||
/// </summary>
|
||||
/// <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>
|
||||
public static bool TryGetMappedResourceIndexerTypeName(string name, out string? mapped)
|
||||
{
|
||||
return KnownResourceIndexers.TryGetValue(name, out mapped);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get the mapped HLSL-compatible sampler resource type name for the input indexer name.
|
||||
/// </summary>
|
||||
/// <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>
|
||||
public static bool TryGetMappedResourceSamplerAccessType(string name, out string? mapped)
|
||||
{
|
||||
return KnownResourceSamplers.TryGetValue(name, out mapped);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get the mapped rank and axis for a given indexer name.
|
||||
/// </summary>
|
||||
/// <param name="name">The input fully qualified indexer name.</param>
|
||||
/// <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>
|
||||
public static bool TryGetAccessorRankAndAxis(string name, out int rank, out int axis)
|
||||
{
|
||||
if (KnownSizeAccessors.TryGetValue(name, out var info))
|
||||
{
|
||||
(rank, axis) = info;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
(rank, axis) = default((int, int));
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする