Remove LoadInputDescriptions<TLoader> API
このコミットが含まれているのは:
1 親
ac7d9648d3
コミット
e37fd8e6d9
8ファイル変更
+13
-82
検索条件に一致するファイルはありません
@@ -80,7 +80,6 @@
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\ID2D1PixelShader.cs" Link="ComputeSharp.D2D1\Interfaces\ID2D1PixelShader.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1BytecodeLoader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1BytecodeLoader.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1DispatchDataLoader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1DispatchDataLoader.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1InputDescriptionsLoader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1InputDescriptionsLoader.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1ResourceTextureDescriptionsLoader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1ResourceTextureDescriptionsLoader.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Interfaces\__Internals\ID2D1Shader.cs" Link="ComputeSharp.D2D1\Interfaces\__Internals\ID2D1Shader.cs" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Intrinsics\D2D.cs" Link="ComputeSharp.D2D1\Intrinsics\D2D.cs" />
|
||||
|
||||
+4
-4
@@ -15,7 +15,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
|
||||
partial class ID2D1ShaderGenerator
|
||||
{
|
||||
/// <inheritoc/>
|
||||
private static partial class LoadInputDescriptions
|
||||
private static partial class InputDescriptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a <see cref="PropertyDeclarationSyntax"/> instance for the <c>InputDescriptions</c> property.
|
||||
@@ -39,7 +39,7 @@ partial class ID2D1ShaderGenerator
|
||||
memoryExpression = MemberAccessExpression(
|
||||
SyntaxKind.SimpleMemberAccessExpression,
|
||||
IdentifierName("Data"),
|
||||
IdentifierName("InputDescriptions"));
|
||||
IdentifierName(nameof(InputDescriptions)));
|
||||
|
||||
additionalTypes = new[] { GetArrayDeclaration(inputDescriptionsInfo) };
|
||||
}
|
||||
@@ -54,7 +54,7 @@ partial class ID2D1ShaderGenerator
|
||||
PropertyDeclaration(
|
||||
GenericName(Identifier("global::System.ReadOnlyMemory"))
|
||||
.AddTypeArgumentListArguments(IdentifierName("global::ComputeSharp.D2D1.Interop.D2D1InputDescription")),
|
||||
Identifier("InputDescriptions"))
|
||||
Identifier(nameof(InputDescriptions)))
|
||||
.WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName($"global::ComputeSharp.D2D1.__Internals.{nameof(ID2D1Shader)}")))
|
||||
.AddModifiers(Token(SyntaxKind.ReadOnlyKeyword))
|
||||
.WithExpressionBody(ArrowExpressionClause(memoryExpression))
|
||||
@@ -118,7 +118,7 @@ partial class ID2D1ShaderGenerator
|
||||
ArrayType(IdentifierName("global::ComputeSharp.D2D1.Interop.D2D1InputDescription"))
|
||||
.AddRankSpecifiers(ArrayRankSpecifier(SingletonSeparatedList<ExpressionSyntax>(OmittedArraySizeExpression()))))
|
||||
.AddVariables(
|
||||
VariableDeclarator(Identifier("InputDescriptions"))
|
||||
VariableDeclarator(Identifier(nameof(InputDescriptions)))
|
||||
.WithInitializer(EqualsValueClause(
|
||||
InitializerExpression(SyntaxKind.ArrayInitializerExpression)
|
||||
.AddExpressions(inputDescriptionExpressions.ToArray())))))
|
||||
+2
-2
@@ -13,9 +13,9 @@ namespace ComputeSharp.D2D1.SourceGenerators;
|
||||
partial class ID2D1ShaderGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// A helper with all logic to generate the <c>LoadInputDescriptions</c> method.
|
||||
/// A helper with all logic to generate the <c>InputDescriptions</c> property.
|
||||
/// </summary>
|
||||
private static partial class LoadInputDescriptions
|
||||
private static partial class InputDescriptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Extracts the input descriptions for the current shader.
|
||||
@@ -131,8 +131,8 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
|
||||
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
// Get the info for LoadInputDescriptions()
|
||||
LoadInputDescriptions.GetInfo(
|
||||
// Get the info for InputDescriptions
|
||||
InputDescriptions.GetInfo(
|
||||
diagnostics,
|
||||
typeSymbol,
|
||||
out ImmutableArray<InputDescription> inputDescriptions);
|
||||
@@ -400,19 +400,19 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
|
||||
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{nameof(GetOutputBuffer)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
|
||||
});
|
||||
|
||||
// Get the LoadInputDescriptions() info (hierarchy and input descriptions)
|
||||
// Get the InputDescriptions info (hierarchy and input descriptions)
|
||||
IncrementalValuesProvider<((HierarchyInfo Hierarchy, InputDescriptionsInfo InputDescriptions) Info, bool CanUseSkipLocalsInit)> inputDescriptionsInfo =
|
||||
shaderInfoWithErrors
|
||||
.Select(static (item, _) => (item.Hierarchy, item.InputDescriptions))
|
||||
.Combine(canUseSkipLocalsInit);
|
||||
|
||||
// Generate the LoadInputDescriptions() methods
|
||||
// Generate the InputDescriptions properties
|
||||
context.RegisterSourceOutput(inputDescriptionsInfo, static (context, item) =>
|
||||
{
|
||||
PropertyDeclarationSyntax inputDescriptionsProperty = LoadInputDescriptions.GetSyntax(item.Info.InputDescriptions, out TypeDeclarationSyntax[] additionalTypes);
|
||||
PropertyDeclarationSyntax inputDescriptionsProperty = InputDescriptions.GetSyntax(item.Info.InputDescriptions, out TypeDeclarationSyntax[] additionalTypes);
|
||||
CompilationUnitSyntax compilationUnit = GetCompilationUnitFromMember(item.Info.Hierarchy, inputDescriptionsProperty, item.CanUseSkipLocalsInit, additionalMemberDeclarations: additionalTypes);
|
||||
|
||||
context.AddSource($"{item.Info.Hierarchy.FullyQualifiedMetadataName}.{nameof(LoadInputDescriptions)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
|
||||
context.AddSource($"{item.Info.Hierarchy.FullyQualifiedMetadataName}.{nameof(InputDescriptions)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
|
||||
});
|
||||
|
||||
// Get the GetPixelOptions() info (hierarchy and pixel options)
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ComputeSharp.D2D1.__Internals;
|
||||
|
||||
/// <summary>
|
||||
/// A base <see langword="interface"/> representing a loader for input descriptions in a D2D1 shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This interface is not intended to be used directly by user code")]
|
||||
public interface ID2D1InputDescriptionsLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads the available input descriptions for the shader.
|
||||
/// </summary>
|
||||
/// <param name="data">The sequence of serialized input descriptions.</param>
|
||||
void LoadInputDescriptions(ReadOnlySpan<byte> data);
|
||||
}
|
||||
@@ -91,16 +91,6 @@ public interface ID2D1Shader
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
ReadOnlyMemory<D2D1InputDescription> InputDescriptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads the input descriptions for the shader, if any.
|
||||
/// </summary>
|
||||
/// <typeparam name="TLoader">The type of input descriptions loader being used.</typeparam>
|
||||
/// <param name="loader">The <typeparamref name="TLoader"/> instance to use to load the input descriptions.</param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
void LoadInputDescriptions<TLoader>(ref TLoader loader)
|
||||
where TLoader : struct, ID2D1InputDescriptionsLoader;
|
||||
|
||||
/// <summary>
|
||||
/// Loads the resource texture descriptions for the shader, if any.
|
||||
/// </summary>
|
||||
|
||||
@@ -279,13 +279,9 @@ public static class D2D1PixelShader
|
||||
public static ReadOnlyMemory<D2D1InputDescription> GetInputDescriptions<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
{
|
||||
D2D1ByteArrayInputDescriptionsLoader inputDescriptionsLoader = default;
|
||||
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
shader.LoadInputDescriptions(ref inputDescriptionsLoader);
|
||||
|
||||
return inputDescriptionsLoader.GetResultingInputDescriptions();
|
||||
return shader.InputDescriptions;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.D2D1.__Internals;
|
||||
using ComputeSharp.D2D1.Interop;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.D2D1.Shaders.Loaders;
|
||||
|
||||
/// <summary>
|
||||
/// An input descriptions loader for D2D1 pixel shaders.
|
||||
/// </summary>
|
||||
internal struct D2D1ByteArrayInputDescriptionsLoader : ID2D1InputDescriptionsLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// The resulting <see cref="D2D1InputDescription"/> array.
|
||||
/// </summary>
|
||||
private D2D1InputDescription[]? inputDescriptions;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the resulting input descriptions.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="D2D1InputDescription"/> array with the available input descriptions.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly D2D1InputDescription[] GetResultingInputDescriptions()
|
||||
{
|
||||
return this.inputDescriptions!;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ID2D1InputDescriptionsLoader.LoadInputDescriptions(ReadOnlySpan<byte> data)
|
||||
{
|
||||
this.inputDescriptions = MemoryMarshal.Cast<byte, D2D1InputDescription>(data).ToArray();
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする