/// <summary> /// /// </summary> internal unsafe void MarshalTo(SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *pointer) { pointer->SType = StructureType.ValidationCacheCreateInfo; pointer->Next = null; if (this.Flags != null) { pointer->Flags = this.Flags.Value; } else { pointer->Flags = default(SharpVk.Multivendor.ValidationCacheCreateFlags); } pointer->InitialDataSize = (HostSize)(Interop.HeapUtil.GetLength(this.InitialData)); if (this.InitialData != null) { var fieldPointer = (byte *)(Interop.HeapUtil.AllocateAndClear <byte>(this.InitialData.Length).ToPointer()); for (int index = 0; index < (uint)(this.InitialData.Length); index++) { fieldPointer[index] = this.InitialData[index]; } pointer->InitialData = fieldPointer; } else { pointer->InitialData = null; } }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The Device handle to extend. /// </param> /// <param name="flags"> /// </param> /// <param name="initialData"> /// </param> /// <param name="allocator"> /// </param> public static unsafe SharpVk.Multivendor.ValidationCache CreateValidationCache(this SharpVk.Device extendedHandle, ArrayProxy <byte>?initialData, SharpVk.Multivendor.ValidationCacheCreateFlags?flags = default(SharpVk.Multivendor.ValidationCacheCreateFlags?), SharpVk.AllocationCallbacks?allocator = default(SharpVk.AllocationCallbacks?)) { try { SharpVk.Multivendor.ValidationCache result = default(SharpVk.Multivendor.ValidationCache); CommandCache commandCache = default(CommandCache); SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *marshalledCreateInfo = default(SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *); void *vkValidationCacheCreateInfoEXTNextPointer = default(void *); SharpVk.Interop.AllocationCallbacks * marshalledAllocator = default(SharpVk.Interop.AllocationCallbacks *); SharpVk.Interop.Multivendor.ValidationCache marshalledValidationCache = default(SharpVk.Interop.Multivendor.ValidationCache); commandCache = extendedHandle.commandCache; marshalledCreateInfo = (SharpVk.Interop.Multivendor.ValidationCacheCreateInfo *)(Interop.HeapUtil.Allocate <SharpVk.Interop.Multivendor.ValidationCacheCreateInfo>()); marshalledCreateInfo->SType = StructureType.ValidationCacheCreateInfo; marshalledCreateInfo->Next = vkValidationCacheCreateInfoEXTNextPointer; if (flags != null) { marshalledCreateInfo->Flags = flags.Value; } else { marshalledCreateInfo->Flags = default(SharpVk.Multivendor.ValidationCacheCreateFlags); } marshalledCreateInfo->InitialDataSize = (HostSize)(Interop.HeapUtil.GetLength(initialData)); if (initialData.IsNull()) { marshalledCreateInfo->InitialData = null; } else { if (initialData.Value.Contents == ProxyContents.Single) { marshalledCreateInfo->InitialData = (byte *)(Interop.HeapUtil.Allocate <byte>()); *(byte *)(marshalledCreateInfo->InitialData) = initialData.Value.GetSingleValue(); } else { var fieldPointer = (byte *)(Interop.HeapUtil.AllocateAndClear <byte>(Interop.HeapUtil.GetLength(initialData.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(initialData.Value)); index++) { fieldPointer[index] = initialData.Value[index]; } marshalledCreateInfo->InitialData = fieldPointer; } } 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.Multivendor.VkDeviceCreateValidationCacheDelegate commandDelegate = commandCache.Cache.vkCreateValidationCacheEXT; Result methodResult = commandDelegate(extendedHandle.handle, marshalledCreateInfo, marshalledAllocator, &marshalledValidationCache); if (SharpVkException.IsError(methodResult)) { throw SharpVkException.Create(methodResult); } result = new SharpVk.Multivendor.ValidationCache(extendedHandle, marshalledValidationCache); return(result); } finally { Interop.HeapUtil.FreeAll(); } }