/// <summary> /// /// </summary> internal unsafe void MarshalTo(SharpVk.Interop.NVidia.ShadingRatePalette *pointer) { pointer->ShadingRatePaletteEntryCount = (uint)(Interop.HeapUtil.GetLength(this.ShadingRatePaletteEntries)); if (this.ShadingRatePaletteEntries != null) { var fieldPointer = (SharpVk.NVidia.ShadingRatePaletteEntry *)(Interop.HeapUtil.AllocateAndClear <SharpVk.NVidia.ShadingRatePaletteEntry>(this.ShadingRatePaletteEntries.Length).ToPointer()); for (int index = 0; index < (uint)(this.ShadingRatePaletteEntries.Length); index++) { fieldPointer[index] = this.ShadingRatePaletteEntries[index]; } pointer->ShadingRatePaletteEntries = fieldPointer; } else { pointer->ShadingRatePaletteEntries = null; } }
/// <summary> /// /// </summary> internal static unsafe ShadingRatePalette MarshalFrom(SharpVk.Interop.NVidia.ShadingRatePalette *pointer) { ShadingRatePalette result = default(ShadingRatePalette); if (pointer->ShadingRatePaletteEntries != null) { var fieldPointer = new SharpVk.NVidia.ShadingRatePaletteEntry[(uint)(pointer->ShadingRatePaletteEntryCount)]; for (int index = 0; index < (uint)(pointer->ShadingRatePaletteEntryCount); index++) { fieldPointer[index] = pointer->ShadingRatePaletteEntries[index]; } result.ShadingRatePaletteEntries = fieldPointer; } else { result.ShadingRatePaletteEntries = null; } return(result); }
/// <summary> /// /// </summary> /// <param name="extendedHandle"> /// The CommandBuffer handle to extend. /// </param> /// <param name="firstViewport"> /// </param> /// <param name="shadingRatePalettes"> /// </param> public static unsafe void SetViewportShadingRatePalette(this SharpVk.CommandBuffer extendedHandle, uint firstViewport, ArrayProxy <SharpVk.NVidia.ShadingRatePalette>?shadingRatePalettes) { try { CommandCache commandCache = default(CommandCache); SharpVk.Interop.NVidia.ShadingRatePalette *marshalledShadingRatePalettes = default(SharpVk.Interop.NVidia.ShadingRatePalette *); commandCache = extendedHandle.commandCache; if (shadingRatePalettes.IsNull()) { marshalledShadingRatePalettes = null; } else { if (shadingRatePalettes.Value.Contents == ProxyContents.Single) { marshalledShadingRatePalettes = (SharpVk.Interop.NVidia.ShadingRatePalette *)(Interop.HeapUtil.Allocate <SharpVk.Interop.NVidia.ShadingRatePalette>()); shadingRatePalettes.Value.GetSingleValue().MarshalTo(&*(SharpVk.Interop.NVidia.ShadingRatePalette *)(marshalledShadingRatePalettes)); } else { var fieldPointer = (SharpVk.Interop.NVidia.ShadingRatePalette *)(Interop.HeapUtil.AllocateAndClear <SharpVk.Interop.NVidia.ShadingRatePalette>(Interop.HeapUtil.GetLength(shadingRatePalettes.Value)).ToPointer()); for (int index = 0; index < (uint)(Interop.HeapUtil.GetLength(shadingRatePalettes.Value)); index++) { shadingRatePalettes.Value[index].MarshalTo(&fieldPointer[index]); } marshalledShadingRatePalettes = fieldPointer; } } SharpVk.Interop.NVidia.VkCommandBufferSetViewportShadingRatePaletteDelegate commandDelegate = commandCache.Cache.vkCmdSetViewportShadingRatePaletteNV; commandDelegate(extendedHandle.handle, firstViewport, (uint)(Interop.HeapUtil.GetLength(shadingRatePalettes)), marshalledShadingRatePalettes); } finally { Interop.HeapUtil.FreeAll(); } }