Refactored internal IShader<TSelf> interface
このコミットが含まれているのは:
1 親
ed20c56fd7
コミット
56b326a6e4
10ファイル変更
+65
-39
検索条件に一致するファイルはありません
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ComputeSharp.__Internals
|
||||
{
|
||||
/// <summary>
|
||||
/// A base <see langword="interface"/> representing a given shader that can be dispatched.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("This interface is not intended to be used directly by user code")]
|
||||
public interface IShader
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ComputeSharp.__Internals;
|
||||
using ComputeSharp.SourceGenerators.Diagnostics;
|
||||
using ComputeSharp.SourceGenerators.Extensions;
|
||||
using Microsoft.CodeAnalysis;
|
||||
@@ -11,6 +12,8 @@ using static ComputeSharp.SourceGenerators.Diagnostics.DiagnosticDescriptors;
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
using static Microsoft.CodeAnalysis.SymbolDisplayTypeQualificationStyle;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.SourceGenerators
|
||||
{
|
||||
/// <summary>
|
||||
@@ -97,16 +100,13 @@ namespace ComputeSharp.SourceGenerators
|
||||
// Create the partial shader type declaration with the hashcode interface method implementation.
|
||||
// This code produces a struct declaration as follows:
|
||||
//
|
||||
// public struct ShaderType : IShader<ShaderType>
|
||||
// public <MODIFIERS> struct ShaderType
|
||||
// {
|
||||
// <METHODS_LIST>
|
||||
// }
|
||||
var structDeclarationSyntax =
|
||||
StructDeclaration(structName)
|
||||
.WithModifiers(structModifiers)
|
||||
.AddBaseListTypes(SimpleBaseType(
|
||||
GenericName(Identifier("IShader"))
|
||||
.AddTypeArgumentListArguments(IdentifierName(structName))))
|
||||
.AddMembers(methods.Select(m => m.AddAttributeLists(attributes)).ToArray());
|
||||
|
||||
TypeDeclarationSyntax typeDeclarationSyntax = structDeclarationSyntax;
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする