예제 #1
0
        public static unsafe VkAllocationCallbacks.Raw *MarshalIndirect(this IVkAllocationCallbacks s, ref byte *unmanaged)
        {
            if (s == null)
            {
                return((VkAllocationCallbacks.Raw *) 0);
            }

            var result = (VkAllocationCallbacks.Raw *)unmanaged;

            unmanaged                    += VkAllocationCallbacks.Raw.SizeInBytes;
            result->pUserData             = s.UserData;
            result->pfnAllocation         = Marshal.GetFunctionPointerForDelegate(s.Allocation);
            result->pfnReallocation       = Marshal.GetFunctionPointerForDelegate(s.Reallocation);
            result->pfnFree               = Marshal.GetFunctionPointerForDelegate(s.Free);
            result->pfnInternalAllocation = Marshal.GetFunctionPointerForDelegate(s.InternalAllocation);
            result->pfnInternalFree       = Marshal.GetFunctionPointerForDelegate(s.InternalFree);
            return(result);
        }
예제 #2
0
 public VkDeviceMemory(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device = device;
     Handle = handle;
     Allocator = allocator;
 }
예제 #3
0
 public VkPipelineCache(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device = device;
     Handle = handle;
     Allocator = allocator;
 }
예제 #4
0
 public VkObjectResult<IVkDevice> CreateDevice(VkDeviceCreateInfo createInfo, IVkAllocationCallbacks allocator)
 {
     var size =
         createInfo.SizeOfMarshalDirect() +
         allocator.SizeOfMarshalIndirect();
     return VkHelpers.RunWithUnamangedData(size, u => CreateDevice(u, createInfo, allocator));
 }
예제 #5
0
 public VkSurfaceKHR(IVkInstance instance, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Instance  = instance;
     Handle    = handle;
     Allocator = allocator;
 }
예제 #6
0
 public VkSwapchainKHR(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device    = device;
     Handle    = handle;
     Allocator = allocator;
 }
예제 #7
0
 public VkShaderModule(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device    = device;
     Handle    = handle;
     Allocator = allocator;
 }
예제 #8
0
 public VkImageView(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device    = device;
     Handle    = handle;
     Allocator = allocator;
 }
예제 #9
0
 public VkSurfaceKHR(IVkInstance instance, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Instance = instance;
     Handle = handle;
     Allocator = allocator;
 }
예제 #10
0
 public VkCommandPool(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device = device;
     Handle = handle;
     Allocator = allocator;
 }
예제 #11
0
        public VkObjectResult <IVkDisplayModeKHR> CreateDisplayMode(IVkDisplayKHR display, VkDisplayModeCreateInfoKHR createInfo, IVkAllocationCallbacks allocator)
        {
            var unmanagedSize =
                createInfo.SizeOfMarshalIndirect() +
                allocator.SizeOfMarshalIndirect();
            var unmanagedArray = new byte[unmanagedSize];

            fixed(byte *unmanagedStart = unmanagedArray)
            {
                var unmanaged     = unmanagedStart;
                var displayHandle = display?.Handle ?? VkDisplayKHR.HandleType.Null;
                var pCreateInfo   = createInfo.MarshalIndirect(ref unmanaged);
                var pAllocator    = allocator.MarshalIndirect(ref unmanaged);

                VkDisplayModeKHR.HandleType displayModeHandle;
                var result   = Direct.CreateDisplayModeKHR(Handle, displayHandle, pCreateInfo, pAllocator, &displayModeHandle);
                var instance = result == VkResult.Success ? new VkDisplayModeKHR(Instance, displayModeHandle) : null;

                return(new VkObjectResult <IVkDisplayModeKHR>(result, instance));
            }
        }
예제 #12
0
        private VkObjectResult <IVkDevice> CreateDevice(IntPtr data, VkDeviceCreateInfo createInfo, IVkAllocationCallbacks allocator)
        {
            var unmanaged     = (byte *)data;
            var createInfoRaw = createInfo.MarshalDirect(ref unmanaged);
            var pAllocator    = allocator.MarshalIndirect(ref unmanaged);

            VkDevice.HandleType handle;
            var result = Direct.CreateDevice(Handle, &createInfoRaw, pAllocator, &handle);
            var device = result == VkResult.Success ? new VkDevice(this, handle, allocator) : null;

            return(new VkObjectResult <IVkDevice>(result, device));
        }
예제 #13
0
        public VkObjectResult <IVkDevice> CreateDevice(VkDeviceCreateInfo createInfo, IVkAllocationCallbacks allocator)
        {
            var size =
                createInfo.SizeOfMarshalDirect() +
                allocator.SizeOfMarshalIndirect();

            return(VkHelpers.RunWithUnamangedData(size, u => CreateDevice(u, createInfo, allocator)));
        }
예제 #14
0
 public VkObjectResult<IVkDisplayModeKHR> CreateDisplayMode(IVkDisplayKHR display, VkDisplayModeCreateInfoKHR createInfo, IVkAllocationCallbacks allocator)
 {
     var unmanagedSize =
         createInfo.SizeOfMarshalIndirect() +
         allocator.SizeOfMarshalIndirect();
     var unmanagedArray = new byte[unmanagedSize];
     fixed (byte* unmanagedStart = unmanagedArray)
     {
         var unmanaged = unmanagedStart;
         var displayHandle = display?.Handle ?? VkDisplayKHR.HandleType.Null;
         var pCreateInfo = createInfo.MarshalIndirect(ref unmanaged);
         var pAllocator = allocator.MarshalIndirect(ref unmanaged);
         VkDisplayModeKHR.HandleType displayModeHandle;
         var result = Direct.CreateDisplayModeKHR(Handle, displayHandle, pCreateInfo, pAllocator, &displayModeHandle);
         var instance = result == VkResult.Success ? new VkDisplayModeKHR(Instance, displayModeHandle) : null;
         return new VkObjectResult<IVkDisplayModeKHR>(result, instance);
     }
 }
예제 #15
0
 private VkObjectResult<IVkDevice> CreateDevice(IntPtr data, VkDeviceCreateInfo createInfo, IVkAllocationCallbacks allocator)
 {
     var unmanaged = (byte*)data;
     var createInfoRaw = createInfo.MarshalDirect(ref unmanaged);
     var pAllocator = allocator.MarshalIndirect(ref unmanaged);
     VkDevice.HandleType handle;
     var result = Direct.CreateDevice(Handle, &createInfoRaw, pAllocator, &handle);
     var device = result == VkResult.Success ? new VkDevice(this, handle, allocator) : null;
     return new VkObjectResult<IVkDevice>(result, device);
 }
예제 #16
0
 public VkPipelineLayout(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device    = device;
     Handle    = handle;
     Allocator = allocator;
 }
예제 #17
0
 public VkDebugReportCallbackEXT(IVkInstance instance, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Instance  = instance;
     Handle    = handle;
     Allocator = allocator;
 }
예제 #18
0
        public VkObjectResult <IVkSurfaceKHR> CreateDisplayPlaneSurfaceKHR(VkDisplaySurfaceCreateInfoKHR 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.CreateDisplayPlaneSurfaceKHR(Handle, pCreateInfo, pAllocator, &surfaceHandle);
                var instance = result == VkResult.Success ? new VkSurfaceKHR(this, surfaceHandle, allocator) : null;

                return(new VkObjectResult <IVkSurfaceKHR>(result, instance));
            }
        }
예제 #19
0
 public VkRenderPass(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device    = device;
     Handle    = handle;
     Allocator = allocator;
 }
예제 #20
0
        public VkObjectResult <IVkDebugReportCallbackEXT> CreateDebugReportCallbackEXT(VkDebugReportCallbackCreateInfoEXT 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);

                VkDebugReportCallbackEXT.HandleType callbackHandle;
                var result   = Direct.CreateDebugReportCallbackEXT(Handle, pCreateInfo, pAllocator, &callbackHandle);
                var instance = result == VkResult.Success ? new VkDebugReportCallbackEXT(this, callbackHandle, allocator) : null;

                return(new VkObjectResult <IVkDebugReportCallbackEXT>(result, instance));
            }
        }
예제 #21
0
 public VkDescriptorPool(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device    = device;
     Handle    = handle;
     Allocator = allocator;
 }
예제 #22
0
 public static int SizeOfMarshalIndirect(this IVkAllocationCallbacks s)
 => s != null
         ? VkAllocationCallbacks.Raw.SizeInBytes
         : 0;
예제 #23
0
 public VkDescriptorSetLayout(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device = device;
     Handle = handle;
     Allocator = allocator;
 }
예제 #24
0
 public VkFramebuffer(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device = device;
     Handle = handle;
     Allocator = allocator;
 }
예제 #25
0
 public VkSampler(IVkDevice device, HandleType handle, IVkAllocationCallbacks allocator)
 {
     Device    = device;
     Handle    = handle;
     Allocator = allocator;
 }
예제 #26
0
 public VkObjectResult<IVkSurfaceKHR> CreateDisplayPlaneSurfaceKHR(VkDisplaySurfaceCreateInfoKHR 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.CreateDisplayPlaneSurfaceKHR(Handle, pCreateInfo, pAllocator, &surfaceHandle);
         var instance = result == VkResult.Success ? new VkSurfaceKHR(this, surfaceHandle, allocator) : null;
         return new VkObjectResult<IVkSurfaceKHR>(result, instance);
     }
 }