public static JobCache WritePixelsAsync(int Width, int Height, TextureFormat Format, bool GenerateMips, System.IntPtr PixelBytes, int PixelBytesLength, Camera AfterCamera = null)
    {
        var Job = new JobCache(Width, Height, Format, GenerateMips);

        Job.QueueWrite(PixelBytes, PixelBytesLength, AfterCamera);
        return(Job);
    }
Beispiel #2
0
 internal GetAction(bool verbose, string jobType, string filePath, JobCache cache)
 {
     this.verbose  = verbose;
     this.jobType  = jobType;
     this.filePath = filePath;
     this.cache    = cache;
 }
    public static JobCache WritePixelsAsync(int Width, int Height, TextureFormat Format, bool GenerateMips, byte[] Pixels, Camera AfterCamera = null)
    {
        var Job = new JobCache(Width, Height, Format, GenerateMips);

        Job.QueueWrite(Pixels, AfterCamera);
        return(Job);
    }
Beispiel #4
0
 public ListAction(bool verbose, bool json, JobCache cache, JsonSchema schema)
 {
     this.verbose = verbose;
     this.json    = json;
     this.cache   = cache ?? throw new ArgumentNullException(nameof(cache));
     this.schema  = schema ?? throw new ArgumentNullException(nameof(schema));
 }
Beispiel #5
0
        public Discovering_a_job()
        {
            var services = new ServiceCollection();

            services.AddRunlyJobs(new[] { "list" }, typeof(UnitTest).Assembly);
            sp = services.BuildServiceProvider();

            processCache = sp.GetRequiredService <JobCache>();
        }
Beispiel #6
0
        public Reduced_form_config()
        {
            var services = new ServiceCollection();

            services.AddRunlyJobs(new[] { "list" }, typeof(DiagnosticJob).Assembly);
            sp = services.BuildServiceProvider();

            jobCache = sp.GetRequiredService <JobCache>();
            reader   = new ConfigReader(jobCache);
        }
    public static JobCache WritePixelsAsync(Texture texture, byte[] Pixels, Camera AfterCamera = null)
    {
        /*
         * if ( texture is RenderTexture )
         * {
         *      var Job = new JobCache( texture as RenderTexture );
         *      Job.QueueWrite(Pixels,AfterCamera);
         *      return Job;
         * }
         */
        if (texture is Texture2D)
        {
            var Job = new JobCache(texture as Texture2D);
            Job.QueueWrite(Pixels, AfterCamera);
            return(Job);
        }

        throw new System.Exception("Texture type not handled");
    }
Beispiel #8
0
    public static JobCache ReadPixelsAsync(Texture texture, System.Action <float[], int, string> Callback, Camera AfterCamera)
    {
        Debug.Log("allocating");
        if (texture is RenderTexture)
        {
            var Job = new JobCache(texture as RenderTexture, Callback);
            Job.ReadAsync(AfterCamera);
            return(Job);
        }

        if (texture is Texture2D)
        {
            var Job = new JobCache(texture as Texture2D, Callback);
            Job.ReadAsync(AfterCamera);
            return(Job);
        }

        throw new System.Exception("Texture type not handled");
    }
        internal override bool Process(JobCache data)
        {
            bool retry = false;

            base.Context.Logger.LogVerbose("Starting automatic load balancing.", new object[0]);
            LoadBalanceAnchorContext context = base.Context as LoadBalanceAnchorContext;

            if (context == null)
            {
                base.Context.Logger.LogError(null, "Context is null or not from an expected type.", new object[0]);
                return(false);
            }
            if (!this.settings.AutomaticLoadBalancingEnabled)
            {
                base.Context.Logger.LogWarning("Automatic load balancing is no longer enabled.", new object[0]);
                return(false);
            }
            foreach (CacheEntryBase cacheEntryBase in data.Get())
            {
                if (!cacheEntryBase.Validate())
                {
                    base.Context.Logger.LogWarning("Invalid cache entry found. Skipped.", new object[0]);
                }
                else if (!cacheEntryBase.IsLocal || !cacheEntryBase.IsActive)
                {
                    base.Context.Logger.LogWarning("Inactive or non local cache entry found. Skipped.", new object[0]);
                }
                else if (!this.settings.LoadBalanceBlocked)
                {
                    CommonUtils.ProcessKnownExceptions(delegate
                    {
                        new AutomaticLoadBalancer(context).LoadBalanceForest();
                    }, delegate(Exception exception)
                    {
                        retry = true;
                        this.Context.Logger.LogError(exception, "Failed to load balance forest.", new object[0]);
                        return(true);
                    });
                }
            }
            return(retry);
        }