diff --git a/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ExecuteMethodRewriter.cs b/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ExecuteMethodRewriter.cs index 4fdb0251..65c4d830 100644 --- a/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ExecuteMethodRewriter.cs +++ b/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ExecuteMethodRewriter.cs @@ -24,6 +24,22 @@ internal abstract class ExecuteMethodRewriter(ShaderSourceRewriter shaderSourceR return (TNode?)base.Visit(node); } + /// + public override SyntaxNode? VisitMethodDeclaration(MethodDeclarationSyntax node) + { + MethodDeclarationSyntax updatedNode = ((MethodDeclarationSyntax)base.VisitMethodDeclaration(node)!).WithModifiers(TokenList()); + + // The entry point might be an explicit interface method implementation. In that case, + // the transpiled method will have the rewritten interface name as a prefix for the + // method name, which we don't want (it's invalid HLSL). So in that case, remove it. + if (updatedNode.ExplicitInterfaceSpecifier is not null) + { + updatedNode = updatedNode.WithExplicitInterfaceSpecifier(null); + } + + return updatedNode; + } + /// public override SyntaxNode? VisitParameterList(ParameterListSyntax node) {