/// <summary> /// Returns up to requested number of global layer properties. /// </summary> public static LayerProperties[] EnumerateLayerProperties() { unsafe { try { LayerProperties[] result = default(LayerProperties[]); Result commandResult; uint propertyCount; Interop.LayerProperties *marshalledProperties = null; commandResult = Interop.Commands.vkEnumerateInstanceLayerProperties(&propertyCount, null); if (SharpVkException.IsError(commandResult)) { throw SharpVkException.Create(commandResult); } marshalledProperties = (Interop.LayerProperties *)Interop.HeapUtil.Allocate <Interop.LayerProperties>((uint)propertyCount); commandResult = Interop.Commands.vkEnumerateInstanceLayerProperties(&propertyCount, marshalledProperties); if (SharpVkException.IsError(commandResult)) { throw SharpVkException.Create(commandResult); } result = new LayerProperties[(uint)propertyCount]; for (int index = 0; index < (uint)propertyCount; index++) { result[index] = LayerProperties.MarshalFrom(&marshalledProperties[index]); } return(result); } finally { Interop.HeapUtil.FreeLog(); } } }
/// <summary> /// /// </summary> internal static unsafe LayerProperties MarshalFrom(SharpVk.Interop.LayerProperties *pointer) { LayerProperties result = default(LayerProperties); result.LayerName = Interop.HeapUtil.MarshalStringFrom(pointer->LayerName, Constants.MaxExtensionNameSize, true); result.SpecVersion = (Version)(pointer->SpecVersion); result.ImplementationVersion = (Version)(pointer->ImplementationVersion); result.Description = Interop.HeapUtil.MarshalStringFrom(pointer->Description, Constants.MaxDescriptionSize, true); return(result); }
internal static unsafe LayerProperties MarshalFrom(Interop.LayerProperties *value) { LayerProperties result = new LayerProperties(); int LayerNameActualLength; result.LayerName = System.Text.Encoding.UTF8.GetString(Interop.HeapUtil.MarshalFrom(value->LayerName, Constants.MaxExtensionNameSize, out LayerNameActualLength, true), 0, LayerNameActualLength); result.SpecVersion = value->SpecVersion; result.ImplementationVersion = value->ImplementationVersion; int DescriptionActualLength; result.Description = System.Text.Encoding.UTF8.GetString(Interop.HeapUtil.MarshalFrom(value->Description, Constants.MaxDescriptionSize, out DescriptionActualLength, true), 0, DescriptionActualLength); return(result); }