Exemplo n.º 1
0
        public ReadOnlySpan <byte> GetData(int layer, int level)
        {
            BackgroundResource resources = _gd.BackgroundResources.Get();

            if (_gd.CommandBufferPool.OwnedByCurrentThread)
            {
                _gd.FlushAllCommands();

                return(GetData(_gd.CommandBufferPool, resources.GetFlushBuffer(), layer, level));
            }
            else
            {
                return(GetData(resources.GetPool(), resources.GetFlushBuffer(), layer, level));
            }
        }
Exemplo n.º 2
0
        public BackgroundResource Get()
        {
            Thread thread = Thread.CurrentThread;

            lock (_resources)
            {
                BackgroundResource resource;
                if (!_resources.TryGetValue(thread, out resource))
                {
                    Cleanup();

                    resource = new BackgroundResource(_gd, _device);

                    _resources[thread] = resource;
                }

                return(resource);
            }
        }
Exemplo n.º 3
0
        public unsafe ReadOnlySpan <byte> GetData(int offset, int size)
        {
            if (_map != IntPtr.Zero)
            {
                return(GetDataStorage(offset, size));
            }
            else
            {
                BackgroundResource resource = _gd.BackgroundResources.Get();

                if (_gd.CommandBufferPool.OwnedByCurrentThread)
                {
                    _gd.FlushAllCommands();

                    return(resource.GetFlushBuffer().GetBufferData(_gd.CommandBufferPool, this, offset, size));
                }
                else
                {
                    return(resource.GetFlushBuffer().GetBufferData(resource.GetPool(), this, offset, size));
                }
            }
        }