Exemple #1
0
 /// <summary>
 /// Returns up to requested number of global extension properties.
 /// </summary>
 public static ExtensionProperties[] EnumerateExtensionProperties(string layerName)
 {
     unsafe
     {
         try
         {
             ExtensionProperties[] result = default(ExtensionProperties[]);
             Result commandResult;
             char * marshalledLayerName = Interop.HeapUtil.MarshalTo(layerName);
             uint   propertyCount;
             Interop.ExtensionProperties *marshalledProperties = null;
             commandResult = Interop.Commands.vkEnumerateInstanceExtensionProperties(marshalledLayerName, &propertyCount, null);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             marshalledProperties = (Interop.ExtensionProperties *)Interop.HeapUtil.Allocate <Interop.ExtensionProperties>((uint)propertyCount);
             commandResult        = Interop.Commands.vkEnumerateInstanceExtensionProperties(marshalledLayerName, &propertyCount, marshalledProperties);
             if (SharpVkException.IsError(commandResult))
             {
                 throw SharpVkException.Create(commandResult);
             }
             result = new ExtensionProperties[(uint)propertyCount];
             for (int index = 0; index < (uint)propertyCount; index++)
             {
                 result[index] = ExtensionProperties.MarshalFrom(&marshalledProperties[index]);
             }
             return(result);
         }
         finally
         {
             Interop.HeapUtil.FreeLog();
         }
     }
 }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        internal static unsafe ExtensionProperties MarshalFrom(SharpVk.Interop.ExtensionProperties *pointer)
        {
            ExtensionProperties result = default(ExtensionProperties);

            result.ExtensionName = Interop.HeapUtil.MarshalStringFrom(pointer->ExtensionName, Constants.MaxExtensionNameSize, true);
            result.SpecVersion   = (Version)(pointer->SpecVersion);
            return(result);
        }
        internal static unsafe ExtensionProperties MarshalFrom(Interop.ExtensionProperties *value)
        {
            ExtensionProperties result = new ExtensionProperties();
            int ExtensionNameActualLength;

            result.ExtensionName = System.Text.Encoding.UTF8.GetString(Interop.HeapUtil.MarshalFrom(value->ExtensionName, Constants.MaxExtensionNameSize, out ExtensionNameActualLength, true), 0, ExtensionNameActualLength);
            result.SpecVersion   = value->SpecVersion;
            return(result);
        }