Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="extendedHandle">
 /// The Device handle to extend.
 /// </param>
 /// <param name="bindInfos">
 /// </param>
 public static unsafe void BindAccelerationStructureMemory(this SharpVk.Device extendedHandle, ArrayProxy <SharpVk.NVidia.BindAccelerationStructureMemoryInfo>?bindInfos)
 {
     try
     {
         CommandCache commandCache = default(CommandCache);
         SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *marshalledBindInfos = default(SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *);
         commandCache = extendedHandle.commandCache;
         if (bindInfos.IsNull())
         {
             marshalledBindInfos = null;
         }
         else
         {
             if (bindInfos.Value.Contents == ProxyContents.Single)
             {
                 marshalledBindInfos = (SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo>());
                 bindInfos.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *)(marshalledBindInfos));
             }
             else
             {
                 var fieldPointer = (SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo>(Interop.HeapUtil.GetLength(bindInfos.Value)).ToPointer());
                 for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(bindInfos.Value)); index++)
                 {
                     bindInfos.Value[index].MarshalTo(&fieldPointer[index]);
                 }
                 marshalledBindInfos = fieldPointer;
             }
         }
         SharpVk.Interop.NVidia.VkDeviceBindAccelerationStructureMemoryDelegate commandDelegate = commandCache.Cache.vkBindAccelerationStructureMemoryNV;
         Result methodResult = commandDelegate(extendedHandle.handle, (uint)(Interop.HeapUtil.GetLength(bindInfos)), marshalledBindInfos);
         if (SharpVkException.IsError(methodResult))
         {
             throw SharpVkException.Create(methodResult);
         }
     }
     finally
     {
         Interop.HeapUtil.FreeAll();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="pointer">
 /// </param>
 internal unsafe void MarshalTo(SharpVk.Interop.NVidia.BindAccelerationStructureMemoryInfo *pointer)
 {
     pointer->SType = StructureType.BindAccelerationStructureMemoryInfo;
     pointer->Next  = null;
     pointer->AccelerationStructure = this.AccelerationStructure?.handle ?? default(SharpVk.Interop.NVidia.AccelerationStructure);
     pointer->Memory           = this.Memory?.handle ?? default(SharpVk.Interop.DeviceMemory);
     pointer->MemoryOffset     = this.MemoryOffset;
     pointer->DeviceIndexCount = (uint)(Interop.HeapUtil.GetLength(this.DeviceIndices));
     if (this.DeviceIndices != null)
     {
         var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(this.DeviceIndices.Length).ToPointer());
         for (int index = 0; index < (uint)(this.DeviceIndices.Length); index++)
         {
             fieldPointer[index] = this.DeviceIndices[index];
         }
         pointer->DeviceIndices = fieldPointer;
     }
     else
     {
         pointer->DeviceIndices = null;
     }
 }