public static int SizeOfMarshalDirect(this VkWaylandSurfaceCreateInfoKHR s)
        {
            if (s == null)
            {
                throw new InvalidOperationException("Trying to directly marshal a null.");
            }

            return
                (s.Next.SizeOfMarshalIndirect());
        }
        public static VkWaylandSurfaceCreateInfoKHR.Raw *MarshalIndirect(this VkWaylandSurfaceCreateInfoKHR s, ref byte *unmanaged)
        {
            if (s == null)
            {
                return((VkWaylandSurfaceCreateInfoKHR.Raw *) 0);
            }
            var result = (VkWaylandSurfaceCreateInfoKHR.Raw *)unmanaged;

            unmanaged += VkWaylandSurfaceCreateInfoKHR.Raw.SizeInBytes;
            *result = s.MarshalDirect(ref unmanaged);
            return(result);
        }
        public static VkWaylandSurfaceCreateInfoKHR.Raw MarshalDirect(this VkWaylandSurfaceCreateInfoKHR s, ref byte *unmanaged)
        {
            if (s == null)
            {
                throw new InvalidOperationException("Trying to directly marshal a null.");
            }

            var pNext = s.Next.MarshalIndirect(ref unmanaged);

            VkWaylandSurfaceCreateInfoKHR.Raw result;
            result.sType   = VkStructureType.WaylandSurfaceCreateInfoKHR;
            result.pNext   = pNext;
            result.flags   = s.Flags;
            result.display = s.Display;
            result.surface = s.Surface;
            return(result);
        }
Esempio n. 4
0
        public VkObjectResult <IVkSurfaceKHR> CreateWaylandSurfaceKHR(VkWaylandSurfaceCreateInfoKHR createInfo, IVkAllocationCallbacks allocator)
        {
            var unmanagedSize =
                createInfo.SizeOfMarshalIndirect() +
                allocator.SizeOfMarshalIndirect();
            var unmanagedArray = new byte[unmanagedSize];

            fixed(byte *unmanagedStart = unmanagedArray)
            {
                var unmanaged   = unmanagedStart;
                var pCreateInfo = createInfo.MarshalIndirect(ref unmanaged);
                var pAllocator  = allocator.MarshalIndirect(ref unmanaged);

                VkSurfaceKHR.HandleType surfaceHandle;
                var result   = Direct.CreateWaylandSurfaceKHR(Handle, pCreateInfo, pAllocator, &surfaceHandle);
                var instance = result == VkResult.Success ? new VkSurfaceKHR(this, surfaceHandle, allocator) : null;

                return(new VkObjectResult <IVkSurfaceKHR>(result, instance));
            }
        }
 public static int SizeOfMarshalIndirect(this VkWaylandSurfaceCreateInfoKHR s) =>
 s == null ? 0 : s.SizeOfMarshalDirect() + VkWaylandSurfaceCreateInfoKHR.Raw.SizeInBytes;