コード例 #1
0
		static AmtCommandRecording GenerateRecording(IMTLCommandBuffer cb, AmtCommandBuffer buffer)
		{
			return new AmtCommandRecording
			{
				CommandBuffer = cb,
				Compute = new AmtComputeRecording
				{
					Grid = buffer.Record.ComputeGrid,
				},
				Graphics = new AmtGraphicsRecording
				{
					Grid = buffer.Record.GraphicsGrid,
				},
				Blit = new AmtBlitRecording
				{
					Grid = buffer.Record.BlitGrid,
				},
			};
		}
コード例 #2
0
        public Result AllocateCommandBuffers(MgCommandBufferAllocateInfo pAllocateInfo, IMgCommandBuffer[] pCommandBuffers)
        {
            if (pAllocateInfo == null)
            {
                throw new ArgumentNullException(nameof(pAllocateInfo));
            }

            if (pCommandBuffers == null)
            {
                throw new ArgumentNullException(nameof(pCommandBuffers));
            }

            if (pAllocateInfo.CommandBufferCount != pCommandBuffers.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(pAllocateInfo.CommandBufferCount) + " !=  " + nameof(pCommandBuffers.Length));
            }

            var commandPool = (AmtCommandPool)pAllocateInfo.CommandPool;

            Debug.Assert(commandPool != null, nameof(pAllocateInfo.CommandPool) + " is null");

            var arraySize = pAllocateInfo.CommandBufferCount;

            for (var i = 0; i < arraySize; ++i)
            {
                var instructions = new AmtIncrementalChunkifier();
                var computeBag   = new AmtComputeBag();
                var compute      = new AmtComputeEncoder(instructions, computeBag);
                var graphicsBag  = new AmtGraphicsBag();
                var graphics     = new AmtGraphicsEncoder(instructions, mDevice, graphicsBag, commandPool.DepthCache);
                var blitBag      = new AmtBlitBag();
                var blit         = new AmtBlitEncoder(blitBag, instructions);

                var command = new AmtCommandEncoder(instructions, graphics, compute, blit);
                var cmdBuf  = new AmtCommandBuffer(commandPool.CanIndividuallyReset, command);

                commandPool.Add(cmdBuf);

                pCommandBuffers[i] = cmdBuf;
            }

            return(Result.SUCCESS);
        }
コード例 #3
0
 internal void Add(AmtCommandBuffer cmdBuf)
 {
     mBuffers.Add(cmdBuf);
 }