Example #1
0
        public async Task BuildLightmapMultiInstance(string scenario, string bsp, LightmapArgs lightmapArgs, int count)
        {
            string quality   = GetLightmapQuality(lightmapArgs);
            var    instances = new List <Task>();

            for (int i = 0; i < count; i++)
            {
                instances.Add(RunSlaveLightmap(scenario, bsp, quality, count, i));
            }
            await Task.WhenAll(instances);

            await RunMergeLightmap(scenario, bsp, quality, count);
        }
Example #2
0
        public override async Task BuildLightmap(string scenario, string bsp, LightmapArgs args, ICancellableProgress <int>?progress)
        {
            if (progress is not null)
            {
                progress.DisableCancellation();
                progress.MaxValue += 1;
            }
            await RunTool(ToolType.Tool, new() { "lightmaps", scenario, bsp, Convert.ToInt32(args.radiosity_quality).ToString(), args.Threshold.ToString() });

            if (progress is not null)
            {
                progress.Report(1);
            }
        }
Example #3
0
        public override async Task BuildLightmap(string scenario, string bsp, LightmapArgs args, ICancellableProgress <int>?progress)
        {
            Debug.Assert(progress is not null);
            string quality = GetLightmapQuality(args);

            // default to all
            string lightmap_group = args.lightmapGroup;

            if (string.IsNullOrWhiteSpace(args.lightmapGroup))
            {
                lightmap_group = "all";
            }

            try
            {
                await FauxLocalFarm(scenario, bsp, lightmap_group, quality, args.instanceCount, args.NoAssert, args.instanceOutput, progress);
            } catch (OperationCanceledException)
            {
            }
        }
 /// <summary>
 /// Build a lightmap for a given scenario and BSP
 /// </summary>
 /// <param name="scenario">Path to the scenario</param>
 /// <param name="bsp">Name of the BSP</param>
 /// <param name="args">Lightmap settings</param>
 /// <returns></returns>
 public abstract Task BuildLightmap(string scenario, string bsp, LightmapArgs args);
Example #5
0
        public override async Task BuildLightmap(string scenario, string bsp, LightmapArgs args, bool noassert)
        {
            string quality = GetLightmapQuality(args);

            await RunTool(ToolType.Tool, new List <string>() { "lightmaps", scenario, bsp, quality });
        }
Example #6
0
 private static string GetLightmapQuality(LightmapArgs lightmapArgs)
 {
     return(lightmapArgs.level_combobox.ToString().ToLower());
 }
Example #7
0
 public abstract Task BuildLightmap(string scenario, string bsp, LightmapArgs args, ICancellableProgress <int>?progress = null);
Example #8
0
 public override async Task BuildLightmap(string scenario, string bsp, LightmapArgs args)
 {
     await RunTool(ToolType.Tool, new List <string>() { "lightmaps", scenario, bsp, Convert.ToInt32(args.radiosity_quality).ToString(), args.level_slider.ToString() });
 }
Example #9
0
 public abstract Task BuildLightmap(string scenario, string bsp, LightmapArgs args, bool noassert = false);
Example #10
0
        public override async Task BuildLightmap(string scenario, string bsp, LightmapArgs args, ICancellableProgress <int>?progress)
        {
            string quality = GetLightmapQuality(args);

            if (args.instanceCount > 1 && (Profile.BuildType == build_type.release_mcc || Profile.CommunityTools)) // multi instance?
            {
                if (progress is not null)
                {
                    progress.MaxValue += 1 + args.instanceCount;
                }

                async Task RunInstance(int index)
                {
                    if (index == 0 && !Profile.IsH2Codez()) // not needed for H2Codez
                    {
                        if (progress is not null)
                        {
                            progress.Status = "Delaying launch of zeroth instance";
                        }
                        await Task.Delay(1000 * 70, progress.GetCancellationToken());
                    }
                    Utility.Process.Result result = await RunLightmapWorker(
                        scenario,
                        bsp,
                        quality,
                        args.instanceCount,
                        index,
                        args.NoAssert,
                        progress.GetCancellationToken(),
                        args.instanceOutput
                        );

                    if (result is not null && result.HasErrorOccured)
                    {
                        progress.Cancel($"Tool worker {index} has failed - exit code {result.ReturnCode}");
                    }
                    if (progress is not null)
                    {
                        progress.Report(1);
                    }
                }

                var instances = new List <Task>();
                for (int i = args.instanceCount - 1; i >= 0; i--)
                {
                    instances.Add(RunInstance(i));
                }
                if (progress is not null)
                {
                    progress.Status = $"Running {args.instanceCount} instances";
                }
                await Task.WhenAll(instances);

                if (progress is not null)
                {
                    progress.Status = "Merging output";
                }

                await RunMergeLightmap(scenario, bsp, args.instanceCount, args.NoAssert);

                if (progress is not null)
                {
                    progress.Report(1);
                }
            }
            else
            {
                Debug.Assert(args.instanceCount == 1); // should be one, otherwise we got bad args
                if (progress is not null)
                {
                    progress.DisableCancellation();
                    progress.MaxValue += 1;
                }
                await RunTool((args.NoAssert && Profile.BuildType == build_type.release_mcc)?ToolType.ToolFast : ToolType.Tool, new() { "lightmaps", scenario, bsp, quality });

                if (progress is not null)
                {
                    progress.Report(1);
                }
            }
        }