Пример #1
0
        public VkObjectResult <IReadOnlyList <IVkExtensionProperties> > EnumerateDeviceExtensionProperties(string layerName)
        {
            var unmanagedSize =
                layerName.SizeOfMarshalIndirect();
            var unmanagedArray = new byte[unmanagedSize];

            fixed(byte *unmanagedStart = unmanagedArray)
            {
                var unmanaged  = unmanagedStart;
                var pLayerName = layerName.MarshalIndirect(ref unmanaged);

                int propertyCount;
                var result = Direct.EnumerateDeviceExtensionProperties(Handle, pLayerName, &propertyCount, null);

                if (result != VkResult.Success)
                {
                    return(new VkObjectResult <IReadOnlyList <IVkExtensionProperties> >(result, null));
                }
                var rawArray = new VkExtensionProperties.Raw[propertyCount];

                fixed(VkExtensionProperties.Raw *pRawArray = rawArray)
                result = Direct.EnumerateDeviceExtensionProperties(Handle, pLayerName, &propertyCount, pRawArray);

                if (result != VkResult.Success)
                {
                    return(new VkObjectResult <IReadOnlyList <IVkExtensionProperties> >(result, null));
                }
                var properties = rawArray.Select(x => new VkExtensionProperties(&x)).ToArray();

                return(new VkObjectResult <IReadOnlyList <IVkExtensionProperties> >(result, properties));
            }
        }
Пример #2
0
        private IReadOnlyList <VkExtensionProperties> EnumerateInstanceExtensionPropertiesInternal(IntPtr data, string layerName)
        {
            var unmanaged  = (byte *)data;
            var pLayerName = layerName.MarshalIndirect(ref unmanaged);
            int count;

            Direct.EnumerateInstanceExtensionProperties(pLayerName, &count, (VkExtensionProperties.Raw *) 0).CheckSuccess();
            var rawArray = new VkExtensionProperties.Raw[count];

            fixed(VkExtensionProperties.Raw *pRawArray = rawArray)
            {
                Direct.EnumerateInstanceExtensionProperties(pLayerName, &count, pRawArray).CheckSuccess();
                return(rawArray.Select(x => new VkExtensionProperties(&x)).ToArray());
            }
        }
Пример #3
0
 private IReadOnlyList<VkExtensionProperties> EnumerateInstanceExtensionPropertiesInternal(IntPtr data, string layerName)
 {
     var unmanaged = (byte*)data;
     var pLayerName = layerName.MarshalIndirect(ref unmanaged);
     int count;
     Direct.EnumerateInstanceExtensionProperties(pLayerName, &count, (VkExtensionProperties.Raw*)0).CheckSuccess();
     var rawArray = new VkExtensionProperties.Raw[count];
     fixed (VkExtensionProperties.Raw* pRawArray = rawArray)
     {
         Direct.EnumerateInstanceExtensionProperties(pLayerName, &count, pRawArray).CheckSuccess();
         return rawArray.Select(x => new VkExtensionProperties(&x)).ToArray();
     }
 }