Пример #1
0
        public static void CreateBufferQueue(Switch device, KProcess process, out BufferQueueProducer producer, out BufferQueueConsumer consumer)
        {
            BufferQueueCore core = new BufferQueueCore(device, process);

            producer = new BufferQueueProducer(core);
            consumer = new BufferQueueConsumer(core);
        }
Пример #2
0
        public BufferItemConsumer(Switch device,
                                  BufferQueueConsumer consumer,
                                  uint consumerUsage,
                                  int bufferCount,
                                  bool controlledByApp,
                                  IConsumerListener listener = null) : base(consumer, controlledByApp, listener)
        {
            _gpuContext = device.Gpu;

            Status status = Consumer.SetConsumerUsageBits(consumerUsage);

            if (status != Status.Success)
            {
                throw new InvalidOperationException();
            }

            if (bufferCount != -1)
            {
                status = Consumer.SetMaxAcquiredBufferCount(bufferCount);

                if (status != Status.Success)
                {
                    throw new InvalidOperationException();
                }
            }
        }
Пример #3
0
        public ConsumerBase(BufferQueueConsumer consumer, bool controlledByApp, IConsumerListener listener)
        {
            for (int i = 0; i < Slots.Length; i++)
            {
                Slots[i] = new Slot();
            }

            IsAbandoned = false;
            Consumer    = consumer;
            _listener   = listener;

            Status connectStatus = consumer.Connect(this, controlledByApp);

            if (connectStatus != Status.Success)
            {
                throw new InvalidOperationException();
            }
        }