Example #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="compactedSize">
 /// </param>
 /// <param name="info">
 /// </param>
 /// <param name="allocator">
 /// </param>
 public static unsafe SharpVk.NVidia.AccelerationStructure CreateAccelerationStructure(this SharpVk.Device extendedHandle, ulong compactedSize, SharpVk.NVidia.AccelerationStructureInfo info, SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?))
 {
     try
     {
         SharpVk.NVidia.AccelerationStructure result = default(SharpVk.NVidia.AccelerationStructure);
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.AccelerationStructureCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.NVidia.AccelerationStructureCreateInfo *);
         void *vkAccelerationStructureCreateInfoNVNextPointer                         = default(void *);
         SharpVk.Interop.AllocationCallbacks *        marshalledAllocator             = default(SharpVk.Interop.AllocationCallbacks *);
         SharpVk.Interop.NVidia.AccelerationStructure marshalledAccelerationStructure = default(SharpVk.Interop.NVidia.AccelerationStructure);
         commandCache                        = extendedHandle.commandCache;
         marshalledCreateInfo                = (SharpVk.Interop.NVidia.AccelerationStructureCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.AccelerationStructureCreateInfo>());
         marshalledCreateInfo->SType         = StructureType.AccelerationStructureCreateInfo;
         marshalledCreateInfo->Next          = vkAccelerationStructureCreateInfoNVNextPointer;
         marshalledCreateInfo->CompactedSize = compactedSize;
         info.MarshalTo(&marshalledCreateInfo->Info);
         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.NVidia.VkDeviceCreateAccelerationStructureDelegate commandDelegate = commandCache.Cache.vkCreateAccelerationStructureNV;
         Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledAccelerationStructure);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
         result = new SharpVk.NVidia.AccelerationStructure(extendedHandle, marshalledAccelerationStructure);
         return(result);
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
 internal AccelerationStructure(SharpVk.Device parent, SharpVk.Interop.NVidia.AccelerationStructure handle)
 {
     this.handle       = handle;
     this.parent       = parent;
     this.commandCache = parent.commandCache;
 }