]> O.S.I.I.S - jp/vkvg.git/commitdiff
use of VkvgCreateInfo to create vkvg device
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 4 Dec 2022 06:35:23 +0000 (07:35 +0100)
committerj-p <jp_bruyere@hotmail.com>
Mon, 24 Mar 2025 18:12:00 +0000 (19:12 +0100)
include/vkvg.h
src/vkvg_device.c

index 3483a1ee37e85894ec5ac857514312bd71bb744b..ba719c6e25f738d7758dc8723077b4ace543e97d 100644 (file)
@@ -544,7 +544,31 @@ void vkvg_matrix_get_scale (const vkvg_matrix_t *matrix, float *sx, float *sy);
  * Device holds the font cache so that each time a context draws text, the same cache is used.
  *
  * @{ */
-
+/**
+ * @brief vkvg device creation structure
+ *
+ * Structure used to pass parameter to the device creation method.
+ *
+ * @code
+ * x_new = xx * x + xy * y + x0;
+ * y_new = yx * x + yy * y + y0;
+ * @endcode
+ *
+ * @samples: sample count.
+ * @inst: vulkan instance used to create device, may be null to create a new instance.
+ * @phy: vulkan physical device to create vkvg device for, may be null.
+ * @vkdev: vulkan logical device, may be null to create a new one.
+ * @qFamIdx: graphic queue family index, ignored if vkdev is NULL.
+ * @qIndex: queue index, ignored if vkdev is NULL.
+ */
+typedef struct {
+       VkSampleCountFlags samples;
+       VkInstance inst;
+       VkPhysicalDevice phy;
+       VkDevice vkdev;
+       uint32_t qFamIdx;
+       uint32_t qIndex;
+}vkvg_device_create_info_t;
 /**
  * @brief Set device ready for multithreading.
  *
@@ -573,7 +597,7 @@ void vkvg_device_set_context_cache_size (VkvgDevice dev, uint32_t maxCount);
 /**
  * @brief Create a new vkvg device.
  *
- * Create a new #VkvgDevice owning vulkan instance and device.
+ * Create a new #VkvgDevice.
  *
  * On success, create a new vkvg device and set its reference count to 1.
  * On error, you may query the device status by calling @ref vkvg_device_status. Error could be
@@ -586,7 +610,7 @@ void vkvg_device_set_context_cache_size (VkvgDevice dev, uint32_t maxCount);
  * to #vkvg_surface_resolve() or
  */
 vkvg_public
-VkvgDevice vkvg_device_create (VkSampleCountFlags samples, bool deferredResolve);
+VkvgDevice vkvg_device_create (vkvg_device_create_info_t* info);
 /**
  * @brief Create a new vkvg device from an existing vulkan logical device.
  *
index b3d0107bf4786516fa7e1a125721e4e0fb2c0b0f..b5e5b459c61c71fd3ed5cd0c3d5ee693605f182f 100644 (file)
@@ -269,7 +269,7 @@ const void* vkvg_get_device_requirements (VkPhysicalDeviceFeatures* pEnabledFeat
 }
 
 
-VkvgDevice vkvg_device_create (VkSampleCountFlags samples, bool deferredResolve) {
+VkvgDevice vkvg_device_create (vkvg_device_create_info_t* info) {
        LOG(VKVG_LOG_INFO, "CREATE Device\n");
        VkvgDevice dev = (vkvg_device*)calloc(1,sizeof(vkvg_device));
        if (!dev) {
@@ -323,8 +323,8 @@ VkvgDevice vkvg_device_create (VkSampleCountFlags samples, bool deferredResolve)
                if (!_device_try_get_phyinfo(phys, phyCount, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, &pi))
                        pi = phys[0];
 
-       if (!(pi->properties.limits.framebufferColorSampleCounts&samples)) {
-               LOG(VKVG_LOG_ERR, "CREATE Device failed: sample count not supported: %d\n", samples);
+       if (!(pi->properties.limits.framebufferColorSampleCounts & info->samples)) {
+               LOG(VKVG_LOG_ERR, "CREATE Device failed: sample count not supported: %d\n", info->samples);
                dev->status = VKVG_STATUS_DEVICE_ERROR;
                vkh_app_free_phyinfos (phyCount, phys);
                vkh_app_destroy (app);
@@ -365,7 +365,7 @@ VkvgDevice vkvg_device_create (VkSampleCountFlags samples, bool deferredResolve)
                                vkh_device_get_phy(vkhd),
                                vkh_device_get_vkdev(vkhd),
                                pi->gQueue, 0,
-                               samples, deferredResolve);
+                               info->samples, deferredResolve);
 
        dev->vkhDev = vkhd;