コード例 #1
0
 internal DescriptorUpdateTemplate(SharpVk.Device parent, SharpVk.Interop.Khronos.DescriptorUpdateTemplate handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 public static unsafe SharpVk.Khronos.DescriptorUpdateTemplate CreateDescriptorUpdateTemplate(this SharpVk.Device extendedHandle, SharpVk.Khronos.DescriptorUpdateTemplateEntry[] descriptorUpdateEntries, SharpVk.Khronos.DescriptorUpdateTemplateType templateType, SharpVk.DescriptorSetLayout descriptorSetLayout, SharpVk.PipelineLayout pipelineLayout, SharpVk.Khronos.DescriptorUpdateTemplateCreateFlags?flags = default(SharpVk.Khronos.DescriptorUpdateTemplateCreateFlags?), SharpVk.PipelineBindPoint?pipelineBindPoint = default(SharpVk.PipelineBindPoint?), uint?set = default(uint?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.Khronos.DescriptorUpdateTemplate result = default(SharpVk.Khronos.DescriptorUpdateTemplate);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo *marshalledCreateInfo    = default(SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo *);
         SharpVk.Interop.AllocationCallbacks *            marshalledAllocator                = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.Khronos.DescriptorUpdateTemplate marshalledDescriptorUpdateTemplate = default(SharpVk.Interop.Khronos.DescriptorUpdateTemplate);
         commandCache                = extendedHandle.commandCache;
         marshalledCreateInfo        = (SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Khronos.DescriptorUpdateTemplateCreateInfo>());
         marshalledCreateInfo->SType = StructureType.DescriptorUpdateTemplateCreateInfoKhr;
         marshalledCreateInfo->Next  = null;
         if (flags != null)
         {
             marshalledCreateInfo->Flags = flags.Value;
         }
         else
         {
             marshalledCreateInfo->Flags = default(SharpVk.Khronos.DescriptorUpdateTemplateCreateFlags);
         }
         marshalledCreateInfo->DescriptorUpdateEntryCount = (uint)(descriptorUpdateEntries?.Length ?? 0);
         if (descriptorUpdateEntries != null)
         {
             var fieldPointer = (SharpVk.Khronos.DescriptorUpdateTemplateEntry *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Khronos.DescriptorUpdateTemplateEntry>(descriptorUpdateEntries.Length).ToPointer());
             for (int index = 0; index < (uint)(descriptorUpdateEntries.Length); index++)
             {
                 fieldPointer[index] = descriptorUpdateEntries[index];
             }
             marshalledCreateInfo->DescriptorUpdateEntries = fieldPointer;
         }
         else
         {
             marshalledCreateInfo->DescriptorUpdateEntries = null;
         }
         marshalledCreateInfo->TemplateType        = templateType;
         marshalledCreateInfo->DescriptorSetLayout = descriptorSetLayout?.handle ?? default(SharpVk.Interop.DescriptorSetLayout);
         if (pipelineBindPoint != null)
         {
             marshalledCreateInfo->PipelineBindPoint = pipelineBindPoint.Value;
         }
         else
         {
             marshalledCreateInfo->PipelineBindPoint = default(SharpVk.PipelineBindPoint);
         }
         marshalledCreateInfo->PipelineLayout = pipelineLayout?.handle ?? default(SharpVk.Interop.PipelineLayout);
         if (set != null)
         {
             marshalledCreateInfo->Set = set.Value;
         }
         else
         {
             marshalledCreateInfo->Set = default(uint);
         }
         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.Khronos.VkDeviceCreateDescriptorUpdateTemplateDelegate commandDelegate = commandCache.GetCommandDelegate <SharpVk.Interop.Khronos.VkDeviceCreateDescriptorUpdateTemplateDelegate>("vkCreateDescriptorUpdateTemplateKHR", "instance");
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledDescriptorUpdateTemplate);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.Khronos.DescriptorUpdateTemplate(extendedHandle, marshalledDescriptorUpdateTemplate);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }