1 module skia.GRVkExtensions; 2 3 import skia.DelegateProxies; 4 import skia.SKObject; 5 import skia.SkiaApi; 6 import skia.Definitions; 7 8 class GRVkExtensions : SKObject, ISKSkipObjectRegistration 9 { 10 this (void* h, bool owns) 11 { 12 super (h, owns); 13 } 14 15 private this () 16 { 17 this (SkiaApi.gr_vk_extensions_new (), true); 18 } 19 20 protected override void DisposeNative () 21 { 22 return SkiaApi.gr_vk_extensions_delete (cast(gr_vk_extensions_t*)Handle); 23 } 24 25 26 void HasExtension (string extension, int minVersion) 27 { 28 SkiaApi.gr_vk_extensions_has_extension (cast(gr_vk_extensions_t*)Handle, extension, cast(uint)minVersion); 29 } 30 31 32 void Initialize (GRVkGetProcedureAddressDelegate getProc, void* vkInstance, void* vkPhysicalDevice) 33 { 34 return Initialize (getProc, vkInstance, vkPhysicalDevice, null, null); 35 } 36 37 38 void Initialize (GRVkGetProcedureAddressDelegate getProc, void* vkInstance, void* vkPhysicalDevice, string[] instanceExtensions, string[] deviceExtensions) 39 { 40 GRVkGetProcedureAddressDelegateWrapper wrapper = GRVkGetProcedureAddressDelegateWrapper(getProc); 41 42 void* ctx = cast(void*)&wrapper; 43 GRVkGetProcProxyDelegate getProxy = DelegateProxies.GRVkGetProcDelegateProxy; 44 GRVkGetProcProxyDelegate proxy = DelegateProxies.Create (getProxy, ctx); 45 46 try { 47 auto ie = instanceExtensions; 48 auto de = deviceExtensions; 49 SkiaApi.gr_vk_extensions_init (cast(gr_vk_extensions_t*)Handle, proxy, cast(void*)ctx, cast(vk_instance_t*)vkInstance, cast(vk_physical_device_t*)vkPhysicalDevice, cast(uint)(ie.length ? ie.length : 0), ie, cast(uint)(de.length ? de.length: 0), de); 50 } finally { 51 // gch.Free (); 52 } 53 } 54 55 static GRVkExtensions Create (GRVkGetProcedureAddressDelegate getProc, void* vkInstance, void* vkPhysicalDevice, string[] instanceExtensions, string[] deviceExtensions) 56 { 57 auto extensions = new GRVkExtensions (); 58 extensions.Initialize (getProc, vkInstance, vkPhysicalDevice, instanceExtensions, deviceExtensions); 59 return extensions; 60 } 61 62 static GRVkExtensions GetObject (void* handle) 63 { 64 return handle is null ? null : new GRVkExtensions (handle, true); 65 } 66 67 }