Enabled discovered types generation in shaders
このコミットが含まれているのは:
1 親
ba135ef76d
コミット
1a8e653a39
6ファイル変更
+57
-17
検索条件に一致するファイルはありません
@@ -27,10 +27,17 @@ namespace ComputeSharp.Shaders.Renderer
|
||||
builder.AppendLine("// AUTO GENERATED");
|
||||
builder.AppendLine("// ================================================");
|
||||
builder.AppendLine("// This shader was created by ComputeSharp.");
|
||||
builder.AppendLine("// See: https://github.com/Sergio0694/ComputeSharp.");
|
||||
builder.AppendLine();
|
||||
builder.AppendLine("// See: https://github.com/Sergio0694/ComputeSharp.");
|
||||
|
||||
// Declared types
|
||||
foreach (var type in info.DeclaredTypes)
|
||||
{
|
||||
builder.AppendLine();
|
||||
builder.AppendLine(type);
|
||||
}
|
||||
|
||||
// Captured variables
|
||||
builder.AppendLine();
|
||||
builder.AppendLine("cbuffer _ : register(b0)");
|
||||
builder.AppendLine('{');
|
||||
builder.AppendLine(" uint __x;");
|
||||
|
||||
@@ -47,11 +47,16 @@ namespace ComputeSharp.Shaders.Renderer.Models
|
||||
/// <summary>
|
||||
/// Gets or sets the list of static functions used by the shader.
|
||||
/// </summary>
|
||||
public IReadOnlyList<object> FunctionsList { get; init; } // TODO
|
||||
public IReadOnlyCollection<object> FunctionsList { get; init; } // TODO
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of local functions used by the shader.
|
||||
/// </summary>
|
||||
public IReadOnlyList<string> LocalFunctionsList { get; init; }
|
||||
public IReadOnlyCollection<string> LocalFunctionsList { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of dependent types for the shader.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<string> DeclaredTypes { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,8 @@ namespace ComputeSharp.Shaders
|
||||
ThreadsIdsVariableName = shaderLoader.ThreadsIdsVariableName,
|
||||
EntryPoint = shaderLoader.EntryPoint,
|
||||
FunctionsList = shaderLoader.FunctionsInfo,
|
||||
LocalFunctionsList = shaderLoader.LocalFunctionsInfo
|
||||
LocalFunctionsList = shaderLoader.LocalFunctionsInfo,
|
||||
DeclaredTypes = shaderLoader.DeclaredTypes
|
||||
});
|
||||
|
||||
// Compile the loaded shader to HLSL bytecode
|
||||
|
||||
@@ -110,7 +110,12 @@ namespace ComputeSharp.Shaders.Translation
|
||||
/// <summary>
|
||||
/// Gets the collection of <see cref="LocalFunctionInfo"/> items for the shader.
|
||||
/// </summary>
|
||||
public IReadOnlyList<string> LocalFunctionsInfo => this.localFunctionsInfo;
|
||||
public IReadOnlyCollection<string> LocalFunctionsInfo => this.localFunctionsInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of declared types for the shader.
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<string> DeclaredTypes { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads and processes an input<typeparamref name="T"/> shadeer
|
||||
@@ -128,7 +133,7 @@ namespace ComputeSharp.Shaders.Translation
|
||||
object box = shader;
|
||||
|
||||
@this.LoadFieldsInfo(box);
|
||||
@this.LoadMethodSource();
|
||||
@this.LoadMethodMetadata();
|
||||
@this.BuildDispatchDataLoader();
|
||||
|
||||
return @this;
|
||||
@@ -234,10 +239,11 @@ namespace ComputeSharp.Shaders.Translation
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the entry method for the current shader being loaded
|
||||
/// Loads the metadata info for the current shader.
|
||||
/// </summary>
|
||||
private void LoadMethodSource()
|
||||
private void LoadMethodMetadata()
|
||||
{
|
||||
// Extract the method sources
|
||||
foreach (var method in Attribute.Methods)
|
||||
{
|
||||
switch (method.Key)
|
||||
@@ -246,6 +252,9 @@ namespace ComputeSharp.Shaders.Translation
|
||||
default: this.localFunctionsInfo.Add(method.Value); break;
|
||||
}
|
||||
}
|
||||
|
||||
// Extract the dependent types
|
||||
DeclaredTypes = Attribute.Types;
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする