Ejemplo 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());
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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));
            }
        }
Ejemplo n.º 5
0
 public static int SizeOfMarshalIndirect(this VkXcbSurfaceCreateInfoKHR s) =>
 s == null ? 0 : s.SizeOfMarshalDirect() + VkXcbSurfaceCreateInfoKHR.Raw.SizeInBytes;