Implemented constant support for methods, code refactoring

このコミットが含まれているのは:
Sergio Pedri committed 2021-01-11 14:01:33 +01:00
1 親 4b5c422bc3
コミット 075c7cdf9a
5ファイル変更
+88 -49

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

+9 -1
ファイルの表示
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Reflection;
using ComputeSharp.Core.Extensions;
using ComputeSharp.Exceptions;
@@ -35,13 +36,15 @@ namespace ComputeSharp.__Internals
/// <param name="types">The collection of custom types.</param>
/// <param name="invokeMethod">The source code for the target entry point method.</param>
/// <param name="methods">The collection of processed methods.</param>
public ShaderMethodSourceAttribute(string methodName, string[] types, string invokeMethod, string[] methods)
/// <param name="constants">The collection of discovered constants.</param>
public ShaderMethodSourceAttribute(string methodName, string[] types, string invokeMethod, string[] methods, object[] constants)
{
this.invokeMethod = invokeMethod;
MethodName = methodName;
Types = types;
Methods = methods;
Constants = constants.Cast<string[]>().ToDictionary(static c => c[0], static c => c[1]);
}
/// <summary>
@@ -59,6 +62,11 @@ namespace ComputeSharp.__Internals
/// </summary>
internal IReadOnlyCollection<string> Methods { get; }
/// <summary>
/// Gets the collection of discovered constants.
/// </summary>
internal IReadOnlyDictionary<string, string> Constants { get; }
/// <summary>
/// Gets the mapped source code for the current method.
/// </summary>