Example #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="commandCache">
 /// </param>
 public static unsafe Version EnumerateVersion(CommandCache commandCache)
 {
     try
     {
         Version result = default(Version);
         uint    marshalledApiVersion = default(uint);
         SharpVk.Interop.VkInstanceEnumerateVersionDelegate commandDelegate = commandCache.Cache.vkEnumerateInstanceVersion;
         Result methodResult = commandDelegate(&marshalledApiVersion);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = (Version)(marshalledApiVersion);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #2
0
 internal Sampler(SharpVk.Device parent, SharpVk.Interop.Sampler handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #3
0
 internal PhysicalDevice(SharpVk.Instance parent, SharpVk.Interop.PhysicalDevice handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #4
0
 internal DescriptorSetLayout(SharpVk.Device parent, SharpVk.Interop.DescriptorSetLayout handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #5
0
 internal QueryPool(SharpVk.Device parent, SharpVk.Interop.QueryPool handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #6
0
 internal RenderPass(SharpVk.Device parent, SharpVk.Interop.RenderPass handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #7
0
 internal BufferView(SharpVk.Device parent, SharpVk.Interop.BufferView handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #8
0
 internal IndirectCommandsLayout(Interop.IndirectCommandsLayout handle, Device parent, CommandCache commandCache)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = commandCache;
 }
Example #9
0
 /// <summary>
 /// Returns up to requested number of global extension properties.
 /// </summary>
 /// <param name="commandCache">
 /// </param>
 /// <param name="layerName">
 /// </param>
 public static unsafe SharpVk.ExtensionProperties[] EnumerateExtensionProperties(CommandCache commandCache, string layerName)
 {
     try
     {
         SharpVk.ExtensionProperties[] result = default(SharpVk.ExtensionProperties[]);
         uint marshalledPropertyCount         = default(uint);
         SharpVk.Interop.ExtensionProperties *marshalledProperties = default(SharpVk.Interop.ExtensionProperties *);
         SharpVk.Interop.VkInstanceEnumerateExtensionPropertiesDelegate commandDelegate = commandCache.Cache.vkEnumerateInstanceExtensionProperties;
         Result methodResult = commandDelegate(Interop.HeapUtil.MarshalTo(layerName), &marshalledPropertyCount, marshalledProperties);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         marshalledProperties = (SharpVk.Interop.ExtensionProperties *)(Interop.HeapUtil.Allocate <SharpVk.Interop.ExtensionProperties>((uint)(marshalledPropertyCount)));
         commandDelegate(Interop.HeapUtil.MarshalTo(layerName), &marshalledPropertyCount, marshalledProperties);
         if (marshalledProperties != null)
         {
             var fieldPointer = new SharpVk.ExtensionProperties[(uint)(marshalledPropertyCount)];
             for (int index = 0; index < (uint)(marshalledPropertyCount); index++)
             {
                 fieldPointer[index] = SharpVk.ExtensionProperties.MarshalFrom(&marshalledProperties[index]);
             }
             result = fieldPointer;
         }
         else
         {
             result = null;
         }
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Example #10
0
 internal Surface(Interop.Surface handle, Instance parent, CommandCache commandCache)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = commandCache;
 }
Example #11
0
 internal Semaphore(SharpVk.Device parent, SharpVk.Interop.Semaphore handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #12
0
 internal Instance(SharpVk.Interop.Instance handle)
 {
     this.handle       = handle;
     this.commandCache = new CommandCache(this, "instance", null);
 }
Example #13
0
 internal RenderPass(Interop.RenderPass handle, Device parent, CommandCache commandCache)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = commandCache;
 }
Example #14
0
 internal CommandCache(IProcLookup host, string type, CommandCache parent)
 {
     this.host   = host;
     this.type   = type;
     this.parent = parent;
 }
Example #15
0
 internal ImageView(Interop.ImageView handle, Device parent, CommandCache commandCache)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = commandCache;
 }
Example #16
0
 internal Buffer(Interop.Buffer handle, Device parent, CommandCache commandCache)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = commandCache;
 }
Example #17
0
 internal DescriptorSet(SharpVk.DescriptorPool parent, SharpVk.Interop.DescriptorSet handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #18
0
 internal Instance(CommandCache commandCache, SharpVk.Interop.Instance handle)
 {
     this.handle       = handle;
     this.commandCache = new CommandCache(this, "instance", commandCache);
     this.commandCache.Initialise();
 }
Example #19
0
 internal Framebuffer(SharpVk.Device parent, SharpVk.Interop.Framebuffer handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #20
0
 /// <summary>
 /// Create a new Vulkan instance.
 /// </summary>
 /// <param name="commandCache">
 /// </param>
 /// <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="debugReportCallbackCreateInfoExt">
 /// Extension struct
 /// </param>
 /// <param name="validationFlagsExt">
 /// Extension struct
 /// </param>
 /// <param name="validationFeaturesExt">
 /// Extension struct
 /// </param>
 /// <param name="debugUtilsMessengerCreateInfoExt">
 /// Extension struct
 /// </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.Multivendor.ValidationFeatures?validationFeaturesExt = null, SharpVk.Multivendor.DebugUtilsMessengerCreateInfo?debugUtilsMessengerCreateInfoExt = null, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Instance result = default(SharpVk.Instance);
         SharpVk.Interop.InstanceCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.InstanceCreateInfo *);
         void *vkInstanceCreateInfoNextPointer = 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          = vkInstanceCreateInfoNextPointer;
             vkInstanceCreateInfoNextPointer = 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          = vkInstanceCreateInfoNextPointer;
             vkInstanceCreateInfoNextPointer = extensionPointer;
         }
         if (validationFeaturesExt != null)
         {
             SharpVk.Interop.Multivendor.ValidationFeatures *extensionPointer = default(SharpVk.Interop.Multivendor.ValidationFeatures *);
             extensionPointer = (SharpVk.Interop.Multivendor.ValidationFeatures *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.ValidationFeatures>());
             validationFeaturesExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next          = vkInstanceCreateInfoNextPointer;
             vkInstanceCreateInfoNextPointer = extensionPointer;
         }
         if (debugUtilsMessengerCreateInfoExt != null)
         {
             SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *extensionPointer = default(SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *);
             extensionPointer = (SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.DebugUtilsMessengerCreateInfo>());
             debugUtilsMessengerCreateInfoExt.Value.MarshalTo(extensionPointer);
             extensionPointer->Next          = vkInstanceCreateInfoNextPointer;
             vkInstanceCreateInfoNextPointer = extensionPointer;
         }
         marshalledCreateInfo        = (SharpVk.Interop.InstanceCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.InstanceCreateInfo>());
         marshalledCreateInfo->SType = StructureType.InstanceCreateInfo;
         marshalledCreateInfo->Next  = vkInstanceCreateInfoNextPointer;
         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.Cache.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();
     }
 }
Example #21
0
 internal Fence(Interop.Fence handle, Device parent, CommandCache commandCache)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = commandCache;
 }
Example #22
0
 internal DescriptorSetLayout(Interop.DescriptorSetLayout handle, Device parent, CommandCache commandCache)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = commandCache;
 }
Example #23
0
 internal PipelineLayout(SharpVk.Device parent, SharpVk.Interop.PipelineLayout handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #24
0
 internal Instance(Interop.Instance handle, AllocationCallbacks?allocator)
 {
     this.handle       = handle;
     this.allocator    = allocator;
     this.commandCache = new CommandCache(this, "instance", null);
 }
Example #25
0
 internal DeviceMemory(SharpVk.Device parent, SharpVk.Interop.DeviceMemory handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #26
0
 internal CommandPool(Interop.CommandPool handle, Device parent, CommandCache commandCache)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = commandCache;
 }
Example #27
0
 internal Event(SharpVk.Device parent, SharpVk.Interop.Event handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #28
0
 internal ObjectTable(Interop.ObjectTable handle, Device parent, CommandCache commandCache)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = commandCache;
 }
Example #29
0
 internal Fence(SharpVk.Device parent, SharpVk.Interop.Fence handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
Example #30
0
 internal ShaderModule(SharpVk.Device parent, SharpVk.Interop.ShaderModule handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }