示例#1
0
文件: Driver.cs 项目: tritao/CppSharp
 public Driver(DriverOptions options, IDiagnosticConsumer diagnostics)
 {
     Options = options;
     Diagnostics = diagnostics;
     Project = new Project();
     ASTContext = new ASTContext();
     Symbols = new SymbolContext();
     Delegates = new Dictionary<Function, DelegatesPass.DelegateDefinition>();
     TypeDatabase = new TypeMapDatabase();
     TranslationUnitPasses = new PassBuilder<TranslationUnitPass>(this);
     GeneratorOutputPasses = new PassBuilder<GeneratorOutputPass>(this);
 }
示例#2
0
        public BindingContext(IDiagnostics diagnostics, DriverOptions options,
            ParserOptions parserOptions = null)
        {
            Options = options;
            Diagnostics = diagnostics;
            ParserOptions = parserOptions;

            Symbols = new SymbolContext();
            Delegates = new Dictionary<Function, DelegatesPass.DelegateDefinition>();

            TypeMaps = new TypeMapDatabase();
            TypeMaps.SetupTypeMaps(Options.GeneratorKind);

            TranslationUnitPasses = new PassBuilder<TranslationUnitPass>(this);
            GeneratorOutputPasses = new PassBuilder<GeneratorOutputPass>(this);
        }
示例#3
0
文件: Clang.cs 项目: daxiazh/CppSharp
        public void SetupPasses(PassBuilder p)
        {
            p.RemovePrefix("CX");
            p.RemovePrefix("clang_");
            p.RenameWithPattern("^_", string.Empty, RenameTargets.Any);

            // Clean up enums
            p.RemovePrefixEnumItem("ChildVisit_");
            p.RemovePrefixEnumItem("Comment_");
            p.RemovePrefixEnumItem("Availability_");
            p.RemovePrefixEnumItem("GlobalOpt_");
            p.RemovePrefixEnumItem("Diagnostic_");
            p.RemovePrefixEnumItem("LoadDiag_");
            p.RemovePrefixEnumItem("TranslationUnit_");
            p.RemovePrefixEnumItem("SaveTranslationUnit_");
            p.RemovePrefixEnumItem("SaveError_");
            p.RemovePrefixEnumItem("TranslationUnit_");
            p.RemovePrefixEnumItem("Reparse_");
            p.RemovePrefixEnumItem("TUResourceUsage_");
            p.RemovePrefixEnumItem("Cursor_");
            p.RemovePrefixEnumItem("Linkage_");
            p.RemovePrefixEnumItem("Language_");
            p.RemovePrefixEnumItem("Type_");
            p.RemovePrefixEnumItem("CallingConv_");
            p.RemovePrefixEnumItem("CommentInlineCommandRenderKind_");
            p.RemovePrefixEnumItem("CommentParamPassDirection_");
            p.RemovePrefixEnumItem("NameRange_");
            p.RemovePrefixEnumItem("Token_");
            p.RemovePrefixEnumItem("CompletionChunk_");
            p.RemovePrefixEnumItem("CodeComplete_");
            p.RemovePrefixEnumItem("CompletionContext_");
            p.RemovePrefixEnumItem("Visit_");
            p.RemovePrefixEnumItem("IdxEntity_");
            p.RemovePrefixEnumItem("IdxEntityLang_");
            p.RemovePrefixEnumItem("IdxAttr_");
            p.RemovePrefixEnumItem("IdxObjCContainer_");
            p.RemovePrefixEnumItem("IdxEntityRef_");
            p.RemovePrefixEnumItem("IndexOpt_");
            p.RemovePrefixEnumItem("IdxObjCContainer_");
        }
示例#4
0
 public void Setup()
 {
     ParseLibrary("Passes.h");
     passBuilder = new PassBuilder<TranslationUnitPass>(Driver);
 }
示例#5
0
文件: Flood.cs 项目: tritao/flood
        public void SetupPasses(Driver driver, PassBuilder builder)
        {
            const RenameTargets renameTargets = RenameTargets.Function
                | RenameTargets.Method | RenameTargets.Field;
            builder.RenameDeclsCase(renameTargets, RenameCasePattern.UpperCamelCase);

            builder.FindEvents(driver.TypeDatabase);
            builder.FunctionToInstanceMethod();
            builder.FunctionToStaticMethod();
            builder.CheckDuplicateNames();
        }
示例#6
0
 public void SetupPasses(Driver driver, PassBuilder p)
 {
     p.FunctionToInstanceMethod();
     p.FunctionToStaticMethod();
 }
示例#7
0
 public static void RemovePrefix(this PassBuilder <TranslationUnitPass> builder, string prefix,
                                 RenameTargets targets = RenameTargets.Any)
 {
     builder.AddPass(new RegexRenamePass("^" + prefix, string.Empty,
                                         targets));
 }
示例#8
0
 public static void RenameWithPattern(this PassBuilder <TranslationUnitPass> builder,
                                      string pattern, string replacement, RenameTargets targets)
 {
     builder.AddPass(new RegexRenamePass(pattern, replacement, targets));
 }
示例#9
0
 public void Setup()
 {
     ParseLibrary("Passes.h");
     passBuilder = new PassBuilder <TranslationUnitPass>(Driver);
 }
示例#10
0
 public static void SetupPasses(PassBuilder <TranslationUnitPass> passes)
 {
     passes.AddPass(new FixMethodParametersPass());
 }
示例#11
0
 public static void RenameDeclsLowerCase(this PassBuilder <TranslationUnitPass> builder,
                                         RenameTargets targets)
 {
     builder.AddPass(new CaseRenamePass(targets,
                                        RenameCasePattern.LowerCamelCase));
 }
示例#12
0
 public static void RenameDeclsCase(this PassBuilder <TranslationUnitPass> builder,
                                    RenameTargets targets, RenameCasePattern pattern)
 {
     builder.AddPass(new CaseRenamePass(targets, pattern));
 }
示例#13
0
 public void Setup()
 {
     ParseLibrary("AST.h", "ASTExtensions.h");
     passBuilder = new PassBuilder <TranslationUnitPass>(Driver);
 }
 /// <summary>
 /// Optional. Information used for Value Added Service Protocol transactions.
 /// </summary>
 /// <remarks>
 /// Available in iOS 9.0.
 /// </remarks>
 public static PassBuilder.PassBuilderNfcKeys Nfc(this PassBuilder.PassBuilderNfcKeys builder, PassBuilder.Nfc value)
 {
     builder.AppendValue(PassBuilder.GetCaller(), value);
     return(builder);
 }
示例#15
0
        void RenderOpaqueGBuffer(Camera RenderCamera, CullingResults CullingData, NativeArray <FVisibleMeshBatch> VisibleMeshBatchList)
        {
            //Request Resource
            RendererList  RenderList   = RendererList.Create(CreateRendererListDesc(CullingData, RenderCamera, InfinityPassIDs.OpaqueGBuffer));
            RDGTextureRef DepthTexture = GraphBuilder.ScopeTexture(InfinityShaderIDs.RT_DepthBuffer);

            RDGTextureDesc GBufferDescA = new RDGTextureDesc(RenderCamera.pixelWidth, RenderCamera.pixelHeight)
            {
                clearBuffer = true, clearColor = Color.clear, dimension = TextureDimension.Tex2D, enableMSAA = false, bindTextureMS = false, name = "GBufferATexture", colorFormat = GraphicsFormat.R16G16B16A16_UNorm
            };
            RDGTextureDesc GBufferDescB = new RDGTextureDesc(RenderCamera.pixelWidth, RenderCamera.pixelHeight)
            {
                clearBuffer = true, clearColor = Color.clear, dimension = TextureDimension.Tex2D, enableMSAA = false, bindTextureMS = false, name = "GBufferBTexture", colorFormat = GraphicsFormat.A2B10G10R10_UIntPack32
            };
            RDGTextureRef GBufferTextureA = GraphBuilder.CreateTexture(GBufferDescA, InfinityShaderIDs.RT_ThinGBufferA);
            RDGTextureRef GBufferTextureB = GraphBuilder.CreateTexture(GBufferDescB, InfinityShaderIDs.RT_ThinGBufferB);

            GraphBuilder.ScopeTexture(InfinityShaderIDs.RT_ThinGBufferA, GBufferTextureA);
            GraphBuilder.ScopeTexture(InfinityShaderIDs.RT_ThinGBufferB, GBufferTextureB);

            //Add RenderPass
            GraphBuilder.AddRenderPass <FOpaqueGBufferData>("OpaqueGBuffer", ProfilingSampler.Get(CustomSamplerId.OpaqueGBuffer),
                                                            (ref FOpaqueGBufferData PassData, ref RDGPassBuilder PassBuilder) =>
            {
                PassData.RendererList = RenderList;
                PassData.GBufferA     = PassBuilder.UseColorBuffer(GBufferTextureA, 0);
                PassData.GBufferB     = PassBuilder.UseColorBuffer(GBufferTextureB, 1);
                PassData.DepthBuffer  = PassBuilder.UseDepthBuffer(DepthTexture, EDepthAccess.ReadWrite);
            },
                                                            (ref FOpaqueGBufferData PassData, RDGContext GraphContext) =>
            {
                //Draw UnityRenderer
                RendererList GBufferRenderList = PassData.RendererList;
                GBufferRenderList.drawSettings.perObjectData         = PerObjectData.Lightmaps;
                GBufferRenderList.drawSettings.enableInstancing      = RenderPipelineAsset.EnableInstanceBatch;
                GBufferRenderList.drawSettings.enableDynamicBatching = RenderPipelineAsset.EnableDynamicBatch;
                GBufferRenderList.filteringSettings.renderQueueRange = new RenderQueueRange(0, 2450);
                GraphContext.RenderContext.DrawRenderers(GBufferRenderList.cullingResult, ref GBufferRenderList.drawSettings, ref GBufferRenderList.filteringSettings);

                //Draw CustomRenderer
                RenderWorld World = GraphContext.World;
                NativeList <FMeshBatch> MeshBatchList = World.GetMeshBatchColloctor().GetMeshBatchList();

                if (VisibleMeshBatchList.Length == 0)
                {
                    return;
                }

                for (int i = 0; i < VisibleMeshBatchList.Length; i++)
                {
                    FVisibleMeshBatch VisibleMeshBatch = VisibleMeshBatchList[i];
                    if (VisibleMeshBatch.visible)
                    {
                        FMeshBatch MeshBatch = MeshBatchList[VisibleMeshBatch.index];
                        Mesh mesh            = World.WorldMeshList.Get(MeshBatch.Mesh);
                        Material material    = World.WorldMaterialList.Get(MeshBatch.Material);

                        if (mesh && material)
                        {
                            GraphContext.CmdBuffer.DrawMesh(mesh, MeshBatch.Matrix_LocalToWorld, material, MeshBatch.SubmeshIndex, 2);
                        }
                    }
                }
            });
        }