Switched shader decompilation to full closure type

このコミットが含まれているのは:
Sergio Pedri committed 2019-08-16 02:13:40 +02:00
1 親 f636f29549
コミット e0afb3e94f
2ファイル変更
+25 -18

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

+4 -7
ファイルの表示
@@ -2,12 +2,10 @@
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using ComputeSharp.Graphics.Buffers.Abstract;
using ComputeSharp.Shaders.Mappings;
using ComputeSharp.Shaders.Renderer.Models.Fields;
using ComputeSharp.Shaders.Renderer.Models.Fields.Abstract;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using SharpDX.Direct3D12;
@@ -190,16 +188,15 @@ namespace ComputeSharp.Shaders.Translation
private void LoadMethodSource()
{
// Decompile the shader method
MethodDecompiler.Instance.GetSyntaxTree(Action.Method, out SyntaxNode root, out SemanticModel semanticModel);
MethodDecompiler.Instance.GetSyntaxTree(Action.Method, out MethodDeclarationSyntax root, out SemanticModel semanticModel);
// Rewrite the shader method (eg. to fix the type declarations)
ShaderSyntaxRewriter syntaxRewriter = new ShaderSyntaxRewriter(semanticModel);
root = syntaxRewriter.Visit(root);
root = (MethodDeclarationSyntax)syntaxRewriter.Visit(root);
// Get the thread ids identifier name and shader method body
MethodDeclarationSyntax methodNode = root.ChildNodes().OfType<MethodDeclarationSyntax>().First();
ThreadsIdsVariableName = methodNode.ParameterList.Parameters.First().Identifier.Text;
MethodBody = methodNode.Body.ToFullString();
ThreadsIdsVariableName = root.ParameterList.Parameters.First().Identifier.Text;
MethodBody = root.Body.ToFullString();
// Additional preprocessing
MethodBody = Regex.Replace(MethodBody, @"\d+[fFdD]", m => m.Value.Replace("f", ""));