Code refactoring, minor optimizations to shader loading
このコミットが含まれているのは:
1 親
e57d7a9354
コミット
b6b80141c2
5ファイル変更
+39
-44
検索条件に一致するファイルはありません
@@ -100,8 +100,8 @@ namespace ComputeSharp.Shaders.Renderer
|
||||
}
|
||||
}
|
||||
|
||||
// Local functions
|
||||
foreach (var function in info.LocalFunctionsInfo)
|
||||
// Captured methods
|
||||
foreach (var function in info.MethodsInfo)
|
||||
{
|
||||
builder.AppendLine();
|
||||
builder.AppendLine(function);
|
||||
|
||||
@@ -24,9 +24,9 @@ namespace ComputeSharp.Shaders.Translation
|
||||
public IReadOnlyList<CapturedFieldInfo> FieldsInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of <see cref="LocalFunctionInfo"/> items for the shader.
|
||||
/// Gets the collection of methods to be used in the shader.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<string> LocalFunctionsInfo { get; }
|
||||
public IReadOnlyCollection<string> MethodsInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of declared types for the shader.
|
||||
|
||||
@@ -56,11 +56,6 @@ namespace ComputeSharp.Shaders.Translation
|
||||
/// </summary>
|
||||
private readonly List<CapturedFieldInfo> fieldsInfo = new();
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="List{T}"/> with the <see cref="FunctionInfo"/> items for the shader local functions.
|
||||
/// </summary>
|
||||
private readonly List<string> localFunctionsInfo = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ShaderLoader{T}"/> instance.
|
||||
/// </summary>
|
||||
@@ -86,7 +81,7 @@ namespace ComputeSharp.Shaders.Translation
|
||||
public IReadOnlyList<CapturedFieldInfo> FieldsInfo => this.fieldsInfo;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IReadOnlyCollection<string> LocalFunctionsInfo => this.localFunctionsInfo;
|
||||
public IReadOnlyCollection<string> MethodsInfo { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IReadOnlyCollection<string> DeclaredTypes { get; private set; }
|
||||
@@ -201,18 +196,9 @@ namespace ComputeSharp.Shaders.Translation
|
||||
/// </summary>
|
||||
private void LoadMethodMetadata()
|
||||
{
|
||||
// Extract the method sources
|
||||
foreach (var method in Attribute.Methods)
|
||||
{
|
||||
switch (method.Key)
|
||||
{
|
||||
case nameof(IComputeShader.Execute): EntryPoint = method.Value; break;
|
||||
default: this.localFunctionsInfo.Add(method.Value); break;
|
||||
}
|
||||
}
|
||||
|
||||
// Extract the dependent types
|
||||
DeclaredTypes = Attribute.Types;
|
||||
EntryPoint = Attribute.ExecuteMethod;
|
||||
MethodsInfo = Attribute.Methods;
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする