Remove LoadResourceTextureDescriptions<TLoader> API
このコミットが含まれているのは:
1 親
b17b7c70fe
コミット
76ae699797
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\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" />
|
||||
<Compile Include="..\ComputeSharp.D2D1\Shaders\Exceptions\FxcCompilationException.cs" Link="ComputeSharp.D2D1\Shaders\Exceptions\FxcCompilationException.cs" />
|
||||
|
||||
+4
-4
@@ -15,7 +15,7 @@ namespace ComputeSharp.D2D1.SourceGenerators;
|
||||
partial class ID2D1ShaderGenerator
|
||||
{
|
||||
/// <inheritoc/>
|
||||
private static partial class LoadResourceTextureDescriptions
|
||||
private static partial class ResourceTextureDescriptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a <see cref="PropertyDeclarationSyntax"/> instance for the <c>ResourceTextureDescriptions</c> property.
|
||||
@@ -39,7 +39,7 @@ partial class ID2D1ShaderGenerator
|
||||
memoryExpression = MemberAccessExpression(
|
||||
SyntaxKind.SimpleMemberAccessExpression,
|
||||
IdentifierName("Data"),
|
||||
IdentifierName("ResourceTextureDescriptions"));
|
||||
IdentifierName(nameof(ResourceTextureDescriptions)));
|
||||
|
||||
additionalTypes = new[] { GetArrayDeclaration(resourceTextureDescriptionsInfo) };
|
||||
}
|
||||
@@ -51,7 +51,7 @@ partial class ID2D1ShaderGenerator
|
||||
PropertyDeclaration(
|
||||
GenericName(Identifier("global::System.ReadOnlyMemory"))
|
||||
.AddTypeArgumentListArguments(IdentifierName("global::ComputeSharp.D2D1.Interop.D2D1ResourceTextureDescription")),
|
||||
Identifier("ResourceTextureDescriptions"))
|
||||
Identifier(nameof(ResourceTextureDescriptions)))
|
||||
.WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifier(IdentifierName($"global::ComputeSharp.D2D1.__Internals.{nameof(ID2D1Shader)}")))
|
||||
.AddModifiers(Token(SyntaxKind.ReadOnlyKeyword))
|
||||
.WithExpressionBody(ArrowExpressionClause(memoryExpression))
|
||||
@@ -93,7 +93,7 @@ partial class ID2D1ShaderGenerator
|
||||
ArrayType(IdentifierName("global::ComputeSharp.D2D1.Interop.D2D1ResourceTextureDescription"))
|
||||
.AddRankSpecifiers(ArrayRankSpecifier(SingletonSeparatedList<ExpressionSyntax>(OmittedArraySizeExpression()))))
|
||||
.AddVariables(
|
||||
VariableDeclarator(Identifier("ResourceTextureDescriptions"))
|
||||
VariableDeclarator(Identifier(nameof(ResourceTextureDescriptions)))
|
||||
.WithInitializer(EqualsValueClause(
|
||||
InitializerExpression(SyntaxKind.ArrayInitializerExpression)
|
||||
.AddExpressions(resourceTextureDescriptionExpressions.ToArray())))))
|
||||
+2
-2
@@ -14,9 +14,9 @@ namespace ComputeSharp.D2D1.SourceGenerators;
|
||||
partial class ID2D1ShaderGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// A helper with all logic to generate the <c>LoadResourceTextureDescriptions</c> method.
|
||||
/// A helper with all logic to generate the <c>ResourceTextureDescriptions</c> property.
|
||||
/// </summary>
|
||||
private static partial class LoadResourceTextureDescriptions
|
||||
private static partial class ResourceTextureDescriptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Extracts the resource texture descriptions for the current shader.
|
||||
@@ -100,8 +100,8 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
|
||||
out ImmutableArray<int> inputComplexIndices,
|
||||
out ImmutableArray<uint> inputTypes);
|
||||
|
||||
// Get the resource texture info for LoadResourceTextureDescriptions()
|
||||
LoadResourceTextureDescriptions.GetInfo(
|
||||
// Get the resource texture info for ResourceTextureDescriptions
|
||||
ResourceTextureDescriptions.GetInfo(
|
||||
diagnostics,
|
||||
typeSymbol,
|
||||
inputCount,
|
||||
@@ -271,18 +271,18 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
|
||||
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{nameof(InputTypes)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
|
||||
});
|
||||
|
||||
// Get the LoadResourceTextureDescriptions() info (hierarchy and resource texture descriptions)
|
||||
// Get the ResourceTextureDescriptions info (hierarchy and resource texture descriptions)
|
||||
IncrementalValuesProvider<(HierarchyInfo Hierarchy, ResourceTextureDescriptionsInfo ResourceTextureDescriptions)> resourceTextureDescriptionsInfo =
|
||||
shaderInfoWithErrors
|
||||
.Select(static (item, _) => (item.Hierarchy, item.ResourceTextureDescriptions));
|
||||
|
||||
// Generate the LoadResourceTextureDescriptions() methods
|
||||
// Generate the ResourceTextureDescriptions properties
|
||||
context.RegisterSourceOutput(resourceTextureDescriptionsInfo, static (context, item) =>
|
||||
{
|
||||
PropertyDeclarationSyntax resourceTextureDescriptionsProperty = LoadResourceTextureDescriptions.GetSyntax(item.ResourceTextureDescriptions, out TypeDeclarationSyntax[] additionalTypes);
|
||||
PropertyDeclarationSyntax resourceTextureDescriptionsProperty = ResourceTextureDescriptions.GetSyntax(item.ResourceTextureDescriptions, out TypeDeclarationSyntax[] additionalTypes);
|
||||
CompilationUnitSyntax compilationUnit = GetCompilationUnitFromMember(item.Hierarchy, resourceTextureDescriptionsProperty, canUseSkipLocalsInit: false, additionalMemberDeclarations: additionalTypes);
|
||||
|
||||
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{nameof(LoadResourceTextureDescriptions)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
|
||||
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{nameof(ResourceTextureDescriptions)}.g.cs", compilationUnit.GetText(Encoding.UTF8));
|
||||
});
|
||||
|
||||
// Get the info for InitializeFromDispatchData() (hierarchy and dispatch data)
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ComputeSharp.D2D1.__Internals;
|
||||
|
||||
/// <summary>
|
||||
/// A base <see langword="interface"/> representing a loader for resource texture descriptions in a D2D1 shader.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This interface is not intended to be used directly by user code")]
|
||||
public interface ID2D1ResourceTextureDescriptionsLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads the available resource texture descriptions for the shader.
|
||||
/// </summary>
|
||||
/// <param name="data">The sequence of serialized resource texture descriptions.</param>
|
||||
void LoadResourceTextureDescriptions(ReadOnlySpan<byte> data);
|
||||
}
|
||||
@@ -98,16 +98,6 @@ public interface ID2D1Shader
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
ReadOnlyMemory<D2D1ResourceTextureDescription> ResourceTextureDescriptions { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads the resource texture descriptions for the shader, if any.
|
||||
/// </summary>
|
||||
/// <typeparam name="TLoader">The type of resource texture descriptions loader being used.</typeparam>
|
||||
/// <param name="loader">The <typeparamref name="TLoader"/> instance to use to load the resource texture descriptions.</param>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This method is not intended to be used directly by user code")]
|
||||
void LoadResourceTextureDescriptions<TLoader>(ref TLoader loader)
|
||||
where TLoader : struct, ID2D1ResourceTextureDescriptionsLoader;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the output buffer precision and depth for the shader.
|
||||
/// </summary>
|
||||
|
||||
@@ -292,13 +292,9 @@ public static class D2D1PixelShader
|
||||
public static ReadOnlyMemory<D2D1ResourceTextureDescription> GetResourceTextureDescriptions<T>()
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
{
|
||||
D2D1ByteArrayResourceTextureDescriptionsLoader resourceTextureDescriptionsLoader = default;
|
||||
|
||||
Unsafe.SkipInit(out T shader);
|
||||
|
||||
shader.LoadResourceTextureDescriptions(ref resourceTextureDescriptionsLoader);
|
||||
|
||||
return resourceTextureDescriptionsLoader.GetResultingResourceTextureDescriptions();
|
||||
return shader.ResourceTextureDescriptions;
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// A resource texture descriptions loader for D2D1 pixel shaders.
|
||||
/// </summary>
|
||||
internal struct D2D1ByteArrayResourceTextureDescriptionsLoader : ID2D1ResourceTextureDescriptionsLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// The resulting <see cref="D2D1ResourceTextureDescription"/> array.
|
||||
/// </summary>
|
||||
private D2D1ResourceTextureDescription[]? resourceTextureDescriptions;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the resulting resource texture descriptions.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="D2D1ResourceTextureDescription"/> array with the available resource texture descriptions.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly D2D1ResourceTextureDescription[] GetResultingResourceTextureDescriptions()
|
||||
{
|
||||
return this.resourceTextureDescriptions!;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ID2D1ResourceTextureDescriptionsLoader.LoadResourceTextureDescriptions(ReadOnlySpan<byte> data)
|
||||
{
|
||||
this.resourceTextureDescriptions = MemoryMarshal.Cast<byte, D2D1ResourceTextureDescription>(data).ToArray();
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする