示例#1
0
        public ICAMetalDrawable GetNextDrawable()
        {
            ICAMetalDrawable currentDrawable = null;

            currentDrawable = metalLayer.NextDrawable();
            if (currentDrawable == null)
            {
                Console.WriteLine("CurrentDrawable is null");
            }

            return(currentDrawable);
        }
示例#2
0
        public override void SetDefaultRenderTarget(int width, int height, bool doClearColor)
        {
            _drawable = _layer.NextDrawable();

            MTLRenderPassColorAttachmentDescriptor attachment = _descriptor.ColorAttachments[0];

            attachment.LoadAction = doClearColor ? MTLLoadAction.Clear : MTLLoadAction.DontCare;

            if (attachment.StoreAction == MTLStoreAction.MultisampleResolve)
            {
                attachment.ResolveTexture = _drawable.Texture;
            }
            else
            {
                attachment.Texture = _drawable.Texture;
            }

            _cmdEncoder = _cmdBuffer.CreateRenderCommandEncoder(_descriptor);

            _device.SetOnScreenEncoder(_cmdEncoder.Handle, (uint)_layer.PixelFormat, (uint)MTLPixelFormat.Stencil8, _samples);
        }