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

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

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

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

            VkXcbSurfaceCreateInfoKHR.Raw result;
            result.sType      = VkStructureType.XcbSurfaceCreateInfoKHR;
            result.pNext      = pNext;
            result.flags      = s.Flags;
            result.connection = s.Connection;
            result.window     = s.Window;
            return(result);
        }
Esempio n. 4
0
        public VkObjectResult <IVkSurfaceKHR> CreateXcbSurfaceKHR(VkXcbSurfaceCreateInfoKHR 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.CreateXcbSurfaceKHR(Handle, pCreateInfo, pAllocator, &surfaceHandle);
                var instance = result == VkResult.Success ? new VkSurfaceKHR(this, surfaceHandle, allocator) : null;

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