Code refactoring, minor optimizations to shader loading

このコミットが含まれているのは:
Sergio Pedri committed 2020-11-30 22:59:24 +01:00
1 親 e57d7a9354
コミット b6b80141c2
5ファイル変更
+39 -44

検索条件に一致するファイルはありません

+2 -2
ファイルの表示
@@ -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.
+3 -17
ファイルの表示
@@ -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;
}
}
}