Пример #1
0
        void CreateFramebuffer(FramebufferCreateInfo mInfo)
        {
            VkFramebufferCreateInfo info = new VkFramebufferCreateInfo();

            info.sType      = VkStructureType.FramebufferCreateInfo;
            info.renderPass = mInfo.renderPass.Native;

            var attachmentsMarshalled = new NativeArray <VkImageView>(mInfo.attachments.Count);

            for (int i = 0; i < mInfo.attachments.Count; i++)
            {
                attachmentsMarshalled[i] = mInfo.attachments[i].Native;
            }

            info.attachmentCount = (uint)mInfo.attachments.Count;
            info.pAttachments    = attachmentsMarshalled.Address;

            info.width  = mInfo.width;
            info.height = mInfo.height;
            info.layers = mInfo.layers;

            using (attachmentsMarshalled) {
                var result = Device.Commands.createFramebuffer(Device.Native, ref info, Device.Instance.AllocationCallbacks, out framebuffer);
                if (result != VkResult.Success)
                {
                    throw new FramebufferException(string.Format("Error creating framebuffer: {0}", result));
                }
            }

            RenderPass = mInfo.renderPass;
            Width      = mInfo.width;
            Height     = mInfo.height;
            Layers     = mInfo.layers;
        }
Пример #2
0
        public Framebuffer(Device device, FramebufferCreateInfo info)
        {
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }

            Device = device;

            CreateFramebuffer(info);
        }