Exemplo n.º 1
0
 /// <summary>
 /// Bind device memory to a buffer object.
 /// </summary>
 public unsafe void BindMemory(SharpVk.DeviceMemory memory, DeviceSize memoryOffset)
 {
     try
     {
         SharpVk.Interop.VkBufferBindMemoryDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkBufferBindMemoryDelegate>("vkBindBufferMemory", "");
         Result methodResult = commandDelegate(this.parent.handle, this.handle, memory?.handle ?? default(SharpVk.Interop.DeviceMemory), memoryOffset);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Destroy a query pool object.
 /// </summary>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public unsafe void Destroy(SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.VkQueryPoolDestroyDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkQueryPoolDestroyDelegate>("vkDestroyQueryPool", "");
         commandDelegate(this.parent.handle, this.handle, marshalledAllocator);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Submits a sequence of semaphores or command buffers to a queue.
 /// </summary>
 /// <param name="submits">
 /// </param>
 public unsafe void Submit(ArrayProxy <SharpVk.SubmitInfo>?submits, SharpVk.Fence fence)
 {
     try
     {
         SharpVk.Interop.SubmitInfo *marshalledSubmits = default(SharpVk.Interop.SubmitInfo *);
         if (submits.IsNull())
         {
             marshalledSubmits = null;
         }
         else
         {
             if (submits.Value.Contents == ProxyContents.Single)
             {
                 marshalledSubmits = (SharpVk.Interop.SubmitInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.SubmitInfo>());
                 submits.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.SubmitInfo *)(marshalledSubmits));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.SubmitInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.SubmitInfo>(Interop.HeapUtil.GetLength(submits.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(submits.Value)); index++)
                 {
                     submits.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledSubmits = fieldPointer;
             }
         }
         SharpVk.Interop.VkQueueSubmitDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkQueueSubmitDelegate>("vkQueueSubmit", "");
         Result methodResult = commandDelegate(this.handle, (uint)(Interop.HeapUtil.GetLength(submits)), marshalledSubmits, fence?.handle ?? default(SharpVk.Interop.Fence));
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Reports capabilities of a physical device.
 /// </summary>
 public unsafe SharpVk.PhysicalDeviceFeatures GetFeatures()
 {
     try
     {
         SharpVk.PhysicalDeviceFeatures         result                       = default(SharpVk.PhysicalDeviceFeatures);
         SharpVk.Interop.PhysicalDeviceFeatures marshalledFeatures           = default(SharpVk.Interop.PhysicalDeviceFeatures);
         SharpVk.Interop.VkPhysicalDeviceGetFeaturesDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkPhysicalDeviceGetFeaturesDelegate>("vkGetPhysicalDeviceFeatures", "");
         commandDelegate(this.handle, &marshalledFeatures);
         result = SharpVk.PhysicalDeviceFeatures.MarshalFrom(&marshalledFeatures);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Create a new Vulkan instance.
 /// </summary>
 /// <param name="flags">
 /// Reserved for future use.
 /// </param>
 /// <param name="applicationInfo">
 /// Null or an instance of ApplicationInfo. If not Null, this
 /// information helps implementations recognize behavior inherent to
 /// classes of applications. ApplicationInfo is defined in detail
 /// below.
 /// </param>
 /// <param name="enabledLayerNames">
 /// An array of enabledLayerCount strings containing the names of
 /// layers to enable for the created instance. See the Layers section
 /// for further details.
 /// </param>
 /// <param name="enabledExtensionNames">
 /// An array of enabledExtensionCount strings containing the names of
 /// extensions to enable.
 /// </param>
 /// <param name="allocator">
 /// An optional AllocationCallbacks instance that controls host memory
 /// allocation.
 /// </param>
 public static unsafe SharpVk.Instance Create(CommandCache commandCache, ArrayProxy <string>?enabledLayerNames, ArrayProxy <string>?enabledExtensionNames, SharpVk.InstanceCreateFlags?flags = default(SharpVk.InstanceCreateFlags?), SharpVk.ApplicationInfo?applicationInfo = default(SharpVk.ApplicationInfo?), SharpVk.Multivendor.DebugReportCallbackCreateInfo?debugReportCallbackCreateInfoExt = null, SharpVk.Multivendor.ValidationFlags?validationFlagsExt = null, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Instance result = default(SharpVk.Instance);
         SharpVk.Interop.InstanceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.InstanceCreateInfo *);
         void *nextPointer = default(void *);
         SharpVk.Interop.AllocationCallbacks *marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Instance             marshalledInstance  = default(SharpVk.Interop.Instance);
         if (debugReportCallbackCreateInfoExt != null)
         {
             SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *extensionPointer = default(SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *);
             extensionPointer = (SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugReportCallbackCreateInfo>());
             debugReportCallbackCreateInfoExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         if (validationFlagsExt != null)
         {
             SharpVk.Interop.Multivendor.ValidationFlags *extensionPointer = default(SharpVk.Interop.Multivendor.ValidationFlags *);
             extensionPointer = (SharpVk.Interop.Multivendor.ValidationFlags *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.ValidationFlags>());
             validationFlagsExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next = nextPointer;
             nextPointer            = extensionPointer;
         }
         marshalledCreateInfo        = (SharpVk.Interop.InstanceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.InstanceCreateInfo>());
         marshalledCreateInfo->SType = StructureType.InstanceCreateInfo;
         marshalledCreateInfo->Next  = nextPointer;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.InstanceCreateFlags);
         }
         if (applicationInfo != null)
         {
             marshalledCreateInfo->ApplicationInfo = (SharpVk.Interop.ApplicationInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.ApplicationInfo>());
             applicationInfo.Value.MarshalTo(marshalledCreateInfo->ApplicationInfo);
         }
         else
         {
             marshalledCreateInfo->ApplicationInfo = default(SharpVk.Interop.ApplicationInfo *);
         }
         marshalledCreateInfo->EnabledLayerCount     = (uint)(Interop.HeapUtil.GetLength(enabledLayerNames));
         marshalledCreateInfo->EnabledLayerNames     = Interop.HeapUtil.MarshalTo(enabledLayerNames);
         marshalledCreateInfo->EnabledExtensionCount = (uint)(Interop.HeapUtil.GetLength(enabledExtensionNames));
         marshalledCreateInfo->EnabledExtensionNames = Interop.HeapUtil.MarshalTo(enabledExtensionNames);
         if (allocator != null)
         {
             marshalledAllocator = (SharpVk.Interop.AllocationCallbacks *)(Interop.HeapUtil.Allocate <SharpVk.Interop.AllocationCallbacks>());
             allocator.Value.MarshalTo(marshalledAllocator);
         }
         else
         {
             marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *);
         }
         SharpVk.Interop.VkInstanceCreateDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkInstanceCreateDelegate>("vkCreateInstance", "");
         Result methodResult = commandDelegate(marshalledCreateInfo, marshalledAllocator, &marshalledInstance);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Instance(commandCache, marshalledInstance);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Returns up to requested number of global layer properties.
 /// </summary>
 public static unsafe SharpVk.LayerProperties[] EnumerateLayerProperties(CommandCache commandCache)
 {
     try
     {
         SharpVk.LayerProperties[] result = default(SharpVk.LayerProperties[]);
         uint propertyCount = default(uint);
         SharpVk.Interop.LayerProperties *marshalledProperties = default(SharpVk.Interop.LayerProperties *);
         SharpVk.Interop.VkInstanceEnumerateLayerPropertiesDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.VkInstanceEnumerateLayerPropertiesDelegate>("vkEnumerateInstanceLayerProperties", "");
         Result methodResult = commandDelegate(&propertyCount, marshalledProperties);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         marshalledProperties = (SharpVk.Interop.LayerProperties *)(Interop.HeapUtil.Allocate <SharpVk.Interop.LayerProperties>((uint)(propertyCount)));
         commandDelegate(&propertyCount, marshalledProperties);
         if (marshalledProperties != null)
         {
             var fieldPointer = new SharpVk.LayerProperties[(uint)(propertyCount)];
             for (int index = 0; index < (uint)(propertyCount); index++)
             {
                 fieldPointer[index] = SharpVk.LayerProperties.MarshalFrom(&marshalledProperties[index]);
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }