void initUISurface() { iFace.surf?.Dispose(); uiImage?.Dispose(); uiImage = new Image(dev, VkFormat.B8g8r8a8Unorm, VkImageUsageFlags.Sampled, VkMemoryPropertyFlags.HostVisible | VkMemoryPropertyFlags.HostCoherent, Width, Height, VkImageType.Image2D, VkSampleCountFlags.SampleCount1, VkImageTiling.Linear); uiImage.CreateView(VkImageViewType.ImageView2D, VkImageAspectFlags.Color); uiImage.CreateSampler(VkFilter.Nearest, VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder); uiImage.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal; uiImage.Map(); CommandBuffer cmd = cmdPool.AllocateAndStart(VkCommandBufferUsageFlags.OneTimeSubmit); uiImage.SetLayout(cmd, VkImageAspectFlags.Color, VkImageLayout.Undefined, VkImageLayout.ShaderReadOnlyOptimal); presentQueue.EndSubmitAndWait(cmd, true); NotifyValueChanged("uiImage", uiImage); uiImageUpdate?.Write(dev, uiImage.Descriptor); iFace.surf = new Crow.Cairo.ImageSurface(uiImage.MappedData, Crow.Cairo.Format.ARGB32, (int)Width, (int)Height, (int)uiImage.GetSubresourceLayout().rowPitch); }