Example #1
0
        public List <QueueWrap> CombinedList(QueueWrap first, List <QueueWrap> others)
        {
            var list = new List <QueueWrap>(others.Count + 1);

            list.Add(first);
            others.ForEach(x => list.Add(x));
            return(list);
        }
Example #2
0
        private void LoadPersistentQueueDataToGpu(QueueWrap queue)
        {
            if (queue.Queue.Data.NumRequests == 0)
            {
                return;
            }

            _blitter.UnpackAndTransferToGpu(queue, Buffers);
        }
Example #3
0
        public DrawQueueGroup(IIdGenerator idGenerator,
                              IDrawQueueFactory queueFactory,
                              IDrawStageBuffers buffers,
                              IQueueToBufferBlitter blitter,
                              bool skipDrawQueueSortingByDepthsAndLayers)
        {
            Buffers       = buffers;
            _idGenerator  = idGenerator;
            _queueFactory = queueFactory;
            _blitter      = blitter;

            _skipDrawQueueSortingByDepthsAndLayers = skipDrawQueueSortingByDepthsAndLayers;

            DynamicQueue = new QueueWrap
            {
                Id    = 0UL,
                Queue = _queueFactory.Create(_skipDrawQueueSortingByDepthsAndLayers),
                BufferPositionOfFirstVertex = 0,
                BufferPositionOfFirstIndex  = 0
            };

            PersistentQueues = new List <QueueWrap>(); //List not dictionary keyed with id so can be confident about order when iterating (dic probably fine...)
        }
Example #4
0
        public void Process(QueueWrap dyanmic, List <QueueWrap> persistent)
        {
            var combinedList = _tools.CombinedList(dyanmic, persistent);

            ProcessAndGenerateBatches(combinedList.ToArray());
        }
Example #5
0
        public QueueWrap CreateNewPersistentQueue(InternalDrawRequest[] requests, bool validate)
        {
            var queue = _queueFactory.Create(_skipDrawQueueSortingByDepthsAndLayers);

            for (var n = 0; n < requests.Length; n++)
            {
                var tex0 = requests[n].Texture0;
                var tex1 = requests[n].Texture1;

                if (validate)
                {
                    var success = queue.AddIfValid(ref requests[n].CoordinateSpace,
                                                   ref requests[n].FillType,
                                                   ref requests[n].Colour,
                                                   ref requests[n].Vertices,
                                                   ref requests[n].Indices,
                                                   ref tex0,
                                                   ref tex1,
                                                   ref requests[n].TextureMode0,
                                                   ref requests[n].TextureMode1,
                                                   ref requests[n].Depth,
                                                   ref requests[n].Layer);

                    if (!success)
                    {
                        throw new Yak2DException("Create new persistent queue failed. Request validation failed. Reason written to debug output");
                    }
                }
                else
                {
                    queue.Add(ref requests[n].CoordinateSpace,
                              ref requests[n].FillType,
                              ref requests[n].Colour,
                              ref requests[n].Vertices,
                              ref requests[n].Indices,
                              ref tex0,
                              ref tex1,
                              ref requests[n].TextureMode0,
                              ref requests[n].TextureMode1,
                              ref requests[n].Depth,
                              ref requests[n].Layer);
                }
            }

            var id = _idGenerator.New();

            var wrappedQueue = new QueueWrap
            {
                Id = id,
                BufferPositionOfFirstVertex = DynamicQueue.BufferPositionOfFirstVertex,
                BufferPositionOfFirstIndex  = DynamicQueue.BufferPositionOfFirstIndex,
                Queue = queue
            };

            PersistentQueues.Add(wrappedQueue);

            DynamicQueue.BufferPositionOfFirstVertex += queue.Data.NumVerticesUsed;
            DynamicQueue.BufferPositionOfFirstIndex  += queue.Data.NumIndicesUsed;

            return(wrappedQueue);
        }