Exemplo n.º 1
0
        public ImageView(Device device, ImageViewCreateInfo info)
        {
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }
            if (info.image == null)
            {
                throw new ArgumentNullException(nameof(info.image));
            }

            Device = device;

            CreateImageView(info);
        }
Exemplo n.º 2
0
        void CreateImageView(ImageViewCreateInfo mInfo)
        {
            VkImageViewCreateInfo info = new VkImageViewCreateInfo();

            info.sType            = VkStructureType.ImageViewCreateInfo;
            info.image            = mInfo.image.Native;
            info.viewType         = mInfo.viewType;
            info.format           = mInfo.format;
            info.components       = mInfo.components;
            info.subresourceRange = mInfo.subresourceRange;

            var result = Device.Commands.createImageView(Device.Native, ref info, Device.Instance.AllocationCallbacks, out imageView);

            if (result != VkResult.Success)
            {
                throw new ImageViewException(string.Format("Error creating image view: {0}", result));
            }

            Image            = mInfo.image;
            ViewType         = mInfo.viewType;
            Format           = mInfo.format;
            Components       = mInfo.components;
            SubresourceRange = mInfo.subresourceRange;
        }