Debian Codegraph @

gsk/gpu/gskvulkanimage.c

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 #cxx . . $ `<file>/gsk/gpu/gskvulkanimage.c`/include "config.h"cxx . . $ `<file>/build/config.h`/
2
3 #include "gskvulkanimageprivate.h"cxx . . $ `<file>/gsk/gpu/gskvulkanimageprivate.h`/
4
5 #include "gskgpuutilsprivate.h"cxx . . $ `<file>/gsk/gpu/gskgpuutilsprivate.h`/
6 #include "gskvulkanbufferprivate.h"cxx . . $ `<file>/gsk/gpu/gskvulkanbufferprivate.h`/
7 #include "gskvulkanframeprivate.h"cxx . . $ `<file>/gsk/gpu/gskvulkanframeprivate.h`/
8 #include "gskvulkanmemoryprivate.h"cxx . . $ `<file>/gsk/gpu/gskvulkanmemoryprivate.h`/
9 #include "gskvulkanycbcrprivate.h"cxx . . $ `<file>/gsk/gpu/gskvulkanycbcrprivate.h`/
10
11 #include "gdk/gdkdisplayprivate.h"cxx . . $ `<file>/gdk/gdkdisplayprivate.h`/
12 #include "gdk/gdkdmabuftextureprivate.h"cxx . . $ `<file>/gdk/gdkdmabuftextureprivate.h`/
13 #include "gdk/gdkvulkancontextprivate.h"cxx . . $ `<file>/gdk/gdkvulkancontextprivate.h`/
14 #include "gdk/gdkmemoryformatprivate.h"cxx . . $ `<file>/gdk/gdkmemoryformatprivate.h`/
15 #include "gdk/gdkvulkancontextprivate.h"cxx . . $ `<file>/gdk/gdkvulkancontextprivate.h`/
16
17 #include <fcntl.h>
18 #include <string.h>
19 #ifdef HAVE_DMABUFcxx . . $ `build/config.h:34:9`!
20 #include <linux/dma-buf.h>
21 #endif
22
23 struct _GskVulkanImagecxx . . $ _GskVulkanImage#
24 {
25 GskGpuImagecxx . . $ GskGpuImage# parent_instancecxx . . $ _GskVulkanImage#parent_instance.;
26
27 GskVulkanDevicecxx . . $ GskVulkanDevice# *devicecxx . . $ _GskVulkanImage#device.;
28
29 VkFormatcxx . . $ VkFormat# vk_formatcxx . . $ _GskVulkanImage#vk_format.;
30 VkImageTilingcxx . . $ VkImageTiling# vk_tilingcxx . . $ _GskVulkanImage#vk_tiling.;
31 VkImageUsageFlagscxx . . $ VkImageUsageFlags# vk_usagecxx . . $ _GskVulkanImage#vk_usage.;
32 VkImagecxx . . $ VkImage# vk_imagecxx . . $ _GskVulkanImage#vk_image.;
33 VkImageViewcxx . . $ VkImageView# vk_image_viewcxx . . $ _GskVulkanImage#vk_image_view.;
34 VkFramebuffercxx . . $ VkFramebuffer# vk_framebuffercxx . . $ _GskVulkanImage#vk_framebuffer.;
35 VkImageViewcxx . . $ VkImageView# vk_framebuffer_image_viewcxx . . $ _GskVulkanImage#vk_framebuffer_image_view.;
36 GskVulkanYcbcrcxx . . $ GskVulkanYcbcr# *ycbcrcxx . . $ _GskVulkanImage#ycbcr.;
37 VkSemaphorecxx . . $ VkSemaphore# vk_semaphorecxx . . $ _GskVulkanImage#vk_semaphore.;
38 uint64_tcxx . . $ uint64_t# vk_semaphore_waitcxx . . $ _GskVulkanImage#vk_semaphore_wait.;
39 structcxx . . $ _GskVulkanImage#$anonymous_type_0# {
40 VkDescriptorSetcxx . . $ VkDescriptorSet# vk_descriptor_setcxx . . $ _GskVulkanImage#$anonymous_type_0#vk_descriptor_set.;
41 gsizecxx . . $ gsize# pool_idcxx . . $ _GskVulkanImage#$anonymous_type_0#pool_id.;
42 } descriptor_setscxx . . $ _GskVulkanImage#descriptor_sets.[GSK_GPU_SAMPLER_N_SAMPLERScxx . . $ GSK_GPU_SAMPLER_N_SAMPLERS.];
43
44 VkPipelineStageFlagscxx . . $ VkPipelineStageFlags# vk_pipeline_stagecxx . . $ _GskVulkanImage#vk_pipeline_stage.;
45 VkImageLayoutcxx . . $ VkImageLayout# vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout.;
46 VkAccessFlagscxx . . $ VkAccessFlags# vk_accesscxx . . $ _GskVulkanImage#vk_access.;
47
48 GskVulkanAllocatorcxx . . $ GskVulkanAllocator# *allocatorcxx . . $ _GskVulkanImage#allocator.;
49 GskVulkanAllocationcxx . . $ GskVulkanAllocation# allocationcxx . . $ _GskVulkanImage#allocation.;
50 };
51
52 G_DEFINE_TYPEcxx . . $ `<external>/9567554376676449156/gtype.h:1834:9`! (GskVulkanImage, gsk_vulkan_image, GSK_TYPE_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:9:9`!)
53
54 static gbooleancxx . . $ gboolean#
55 gsk_component_mapping_is_framebuffer_compatiblecxx . . $ gsk_component_mapping_is_framebuffer_compatible(3468eded089dc2ed). (const VkComponentMappingcxx . . $ VkComponentMapping# *components)
56 {
57 if ((components->rcxx . . $ VkComponentMapping#r. != VK_COMPONENT_SWIZZLE_Rcxx . . $ VK_COMPONENT_SWIZZLE_R. && components->rcxx . . $ VkComponentMapping#r. != VK_COMPONENT_SWIZZLE_IDENTITYcxx . . $ VK_COMPONENT_SWIZZLE_IDENTITY.) ||
58 (components->gcxx . . $ VkComponentMapping#g. != VK_COMPONENT_SWIZZLE_Gcxx . . $ VK_COMPONENT_SWIZZLE_G. && components->gcxx . . $ VkComponentMapping#g. != VK_COMPONENT_SWIZZLE_IDENTITYcxx . . $ VK_COMPONENT_SWIZZLE_IDENTITY.) ||
59 (components->bcxx . . $ VkComponentMapping#b. != VK_COMPONENT_SWIZZLE_Bcxx . . $ VK_COMPONENT_SWIZZLE_B. && components->bcxx . . $ VkComponentMapping#b. != VK_COMPONENT_SWIZZLE_IDENTITYcxx . . $ VK_COMPONENT_SWIZZLE_IDENTITY.) ||
60 (components->acxx . . $ VkComponentMapping#a. != VK_COMPONENT_SWIZZLE_Acxx . . $ VK_COMPONENT_SWIZZLE_A. && components->acxx . . $ VkComponentMapping#a. != VK_COMPONENT_SWIZZLE_IDENTITYcxx . . $ VK_COMPONENT_SWIZZLE_IDENTITY.))
61 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
62
63 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
64 }
65
66 static gbooleancxx . . $ gboolean#
67 gsk_vulkan_get_ycbcr_flagscxx . . $ gsk_vulkan_get_ycbcr_flags(c0e49c9c417fca4). (GskGpuConversioncxx . . $ GskGpuConversion# conv,
68 VkSamplerYcbcrModelConversioncxx . . $ VkSamplerYcbcrModelConversion# *out_model,
69 VkSamplerYcbcrRangecxx . . $ VkSamplerYcbcrRange# *out_range)
70 {
71 switch (conv)
72 {
73 case GSK_GPU_CONVERSION_NONEcxx . . $ GSK_GPU_CONVERSION_NONE.:
74 *out_model = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITYcxx . . $ VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY.;
75 *out_range = VK_SAMPLER_YCBCR_RANGE_ITU_FULLcxx . . $ VK_SAMPLER_YCBCR_RANGE_ITU_FULL.;
76 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
77
78 case GSK_GPU_CONVERSION_SRGBcxx . . $ GSK_GPU_CONVERSION_SRGB.:
79 *out_model = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITYcxx . . $ VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY.;
80 *out_range = VK_SAMPLER_YCBCR_RANGE_ITU_FULLcxx . . $ VK_SAMPLER_YCBCR_RANGE_ITU_FULL.;
81 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
82
83 case GSK_GPU_CONVERSION_BT601cxx . . $ GSK_GPU_CONVERSION_BT601.:
84 *out_model = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601cxx . . $ VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601.;
85 *out_range = VK_SAMPLER_YCBCR_RANGE_ITU_FULLcxx . . $ VK_SAMPLER_YCBCR_RANGE_ITU_FULL.;
86 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
87
88 case GSK_GPU_CONVERSION_BT601_NARROWcxx . . $ GSK_GPU_CONVERSION_BT601_NARROW.:
89 *out_model = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601cxx . . $ VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601.;
90 *out_range = VK_SAMPLER_YCBCR_RANGE_ITU_NARROWcxx . . $ VK_SAMPLER_YCBCR_RANGE_ITU_NARROW.;
91 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
92
93 case GSK_GPU_CONVERSION_BT709cxx . . $ GSK_GPU_CONVERSION_BT709.:
94 *out_model = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709cxx . . $ VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709.;
95 *out_range = VK_SAMPLER_YCBCR_RANGE_ITU_FULLcxx . . $ VK_SAMPLER_YCBCR_RANGE_ITU_FULL.;
96 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
97
98 case GSK_GPU_CONVERSION_BT709_NARROWcxx . . $ GSK_GPU_CONVERSION_BT709_NARROW.:
99 *out_model = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709cxx . . $ VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709.;
100 *out_range = VK_SAMPLER_YCBCR_RANGE_ITU_NARROWcxx . . $ VK_SAMPLER_YCBCR_RANGE_ITU_NARROW.;
101 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
102
103 case GSK_GPU_CONVERSION_BT2020cxx . . $ GSK_GPU_CONVERSION_BT2020.:
104 *out_model = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020cxx . . $ VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020.;
105 *out_range = VK_SAMPLER_YCBCR_RANGE_ITU_FULLcxx . . $ VK_SAMPLER_YCBCR_RANGE_ITU_FULL.;
106 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
107
108 case GSK_GPU_CONVERSION_BT2020_NARROWcxx . . $ GSK_GPU_CONVERSION_BT2020_NARROW.:
109 *out_model = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020cxx . . $ VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020.;
110 *out_range = VK_SAMPLER_YCBCR_RANGE_ITU_NARROWcxx . . $ VK_SAMPLER_YCBCR_RANGE_ITU_NARROW.;
111 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
112
113 default:
114 g_assert_not_reachedcxx . . $ `<external>/15287032793271088244/gtestutils.h:274:9`! ();
115 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
116 }
117 }
118
119 static VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags#
120 gsk_vulkan_device_get_format_featurescxx . . $ gsk_vulkan_device_get_format_features(d323b03bf76e494). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
121 VkFormatcxx . . $ VkFormat# format,
122 uint64_tcxx . . $ uint64_t# modifier,
123 guintcxx . . $ guint# n_planes,
124 VkImageTilingcxx . . $ VkImageTiling# tiling,
125 VkImageUsageFlagscxx . . $ VkImageUsageFlags# usage)
126 {
127 VkDrmFormatModifierPropertiesEXTcxx . . $ VkDrmFormatModifierPropertiesEXT# drm_mod_properties[100];
128 VkDrmFormatModifierPropertiesListEXTcxx . . $ VkDrmFormatModifierPropertiesListEXT# drm_properties;
129 VkPhysicalDevicecxx . . $ VkPhysicalDevice# vk_phys_device;
130 VkFormatProperties2cxx . . $ VkFormatProperties2# properties;
131 gsizecxx . . $ gsize# i;
132
133 vk_phys_device = gsk_vulkan_device_get_vk_physical_devicecxx . . $ gsk_vulkan_device_get_vk_physical_device(fbb7f33f5baaff7). (device);
134
135 drm_properties = (VkDrmFormatModifierPropertiesListEXTcxx . . $ VkDrmFormatModifierPropertiesListEXT#) {
136 .sType = VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXTcxx . . $ VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT.,
137 .drmFormatModifierCount = G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (drm_mod_properties),
138 .pDrmFormatModifierProperties = drm_mod_properties,
139 };
140 properties = (VkFormatProperties2cxx . . $ VkFormatProperties2#) {
141 .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2cxx . . $ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2.,
142 .pNext = (tiling != VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXTcxx . . $ VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.) ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! : &drm_properties
143 };
144 vkGetPhysicalDeviceFormatProperties2cxx . . $ vkGetPhysicalDeviceFormatProperties2(5ffc95bfbb3a6bc7). (vk_phys_device,
145 format,
146 &properties);
147
148 switch ((int) tiling)
149 {
150 case VK_IMAGE_TILING_OPTIMALcxx . . $ VK_IMAGE_TILING_OPTIMAL.:
151 return properties.formatPropertiescxx . . $ VkFormatProperties2#formatProperties..optimalTilingFeaturescxx . . $ VkFormatProperties#optimalTilingFeatures.;
152
153 case VK_IMAGE_TILING_LINEARcxx . . $ VK_IMAGE_TILING_LINEAR.:
154 return properties.formatPropertiescxx . . $ VkFormatProperties2#formatProperties..linearTilingFeaturescxx . . $ VkFormatProperties#linearTilingFeatures.;
155
156 case VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXTcxx . . $ VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.:
157 for (i = 0; i < drm_properties.drmFormatModifierCountcxx . . $ VkDrmFormatModifierPropertiesListEXT#drmFormatModifierCount.; i++)
158 {
159 if (drm_mod_properties[i].drmFormatModifiercxx . . $ VkDrmFormatModifierPropertiesEXT#drmFormatModifier. == modifier &&
160 drm_mod_properties[i].drmFormatModifierPlaneCountcxx . . $ VkDrmFormatModifierPropertiesEXT#drmFormatModifierPlaneCount. == n_planes)
161 return drm_mod_properties[i].drmFormatModifierTilingFeaturescxx . . $ VkDrmFormatModifierPropertiesEXT#drmFormatModifierTilingFeatures.;
162 }
163 return 0;
164
165 default:
166 return 0;
167 }
168 }
169
170 static GskGpuImageFlagscxx . . $ GskGpuImageFlags#
171 gsk_vulkan_image_flags_for_featurescxx . . $ gsk_vulkan_image_flags_for_features(17e27be084a7d9d7). (VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags# features)
172 {
173 GskGpuImageFlagscxx . . $ GskGpuImageFlags# result;
174
175 result = 0;
176
177 if (features & VK_FORMAT_FEATURE_BLIT_SRC_BITcxx . . $ VK_FORMAT_FEATURE_BLIT_SRC_BIT.)
178 result |= GSK_GPU_IMAGE_BLITcxx . . $ GSK_GPU_IMAGE_BLIT.;
179 if (features & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BITcxx . . $ VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT.)
180 result |= GSK_GPU_IMAGE_FILTERABLEcxx . . $ GSK_GPU_IMAGE_FILTERABLE.;
181 if (features & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BITcxx . . $ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT.)
182 result |= GSK_GPU_IMAGE_RENDERABLEcxx . . $ GSK_GPU_IMAGE_RENDERABLE.;
183 if (features & VK_FORMAT_FEATURE_TRANSFER_SRC_BITcxx . . $ VK_FORMAT_FEATURE_TRANSFER_SRC_BIT.)
184 result |= GSK_GPU_IMAGE_DOWNLOADABLEcxx . . $ GSK_GPU_IMAGE_DOWNLOADABLE.;
185
186 return result;
187 }
188
189 static VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags#
190 gsk_vulkan_device_supports_formatcxx . . $ gsk_vulkan_device_supports_format(4ae85958a486c0b4). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
191 VkFormatcxx . . $ VkFormat# format,
192 uint64_tcxx . . $ uint64_t# modifier,
193 guintcxx . . $ guint# n_planes,
194 gbooleancxx . . $ gboolean# needs_ycbcr_conversion,
195 VkImageTilingcxx . . $ VkImageTiling# tiling,
196 VkImageUsageFlagscxx . . $ VkImageUsageFlags# usage,
197 gsizecxx . . $ gsize# width,
198 gsizecxx . . $ gsize# height,
199 GskGpuImageFlagscxx . . $ GskGpuImageFlags# *out_flags)
200 {
201 VkPhysicalDevicecxx . . $ VkPhysicalDevice# vk_phys_device;
202 VkImageFormatProperties2cxx . . $ VkImageFormatProperties2# image_properties;
203 VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags# features;
204 VkResultcxx . . $ VkResult# res;
205
206 vk_phys_device = gsk_vulkan_device_get_vk_physical_devicecxx . . $ gsk_vulkan_device_get_vk_physical_device(fbb7f33f5baaff7). (device);
207
208 features = gsk_vulkan_device_get_format_featurescxx . . $ gsk_vulkan_device_get_format_features(d323b03bf76e494). (device, format, modifier, n_planes, tiling, usage);
209 if (!(features & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BITcxx . . $ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT.))
210 return 0;
211
212 if (needs_ycbcr_conversion && !gsk_vulkan_ycbcr_is_supportedcxx . . $ gsk_vulkan_ycbcr_is_supported(4c679297bf94b9eb). (features))
213 return 0;
214
215 image_properties = (VkImageFormatProperties2cxx . . $ VkImageFormatProperties2#) {
216 .sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2cxx . . $ VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2.,
217 };
218 res = vkGetPhysicalDeviceImageFormatProperties2cxx . . $ vkGetPhysicalDeviceImageFormatProperties2(4905e7968aa16577). (vk_phys_device,
219 &(VkPhysicalDeviceImageFormatInfo2cxx . . $ VkPhysicalDeviceImageFormatInfo2#) {
220 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2cxx . . $ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2.,
221 .format = format,
222 .type = VK_IMAGE_TYPE_2Dcxx . . $ VK_IMAGE_TYPE_2D.,
223 .tiling = tiling,
224 .usage = usage,
225 .flags = 0,
226 .pNext = (tiling != VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXTcxx . . $ VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.) ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! : &(VkPhysicalDeviceImageDrmFormatModifierInfoEXTcxx . . $ VkPhysicalDeviceImageDrmFormatModifierInfoEXT#) {
227 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXTcxx . . $ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT.,
228 .drmFormatModifier = modifier,
229 .sharingMode = VK_SHARING_MODE_EXCLUSIVEcxx . . $ VK_SHARING_MODE_EXCLUSIVE.,
230 .queueFamilyIndexCount = 1,
231 .pQueueFamilyIndices = (uint32_tcxx . . $ uint32_t#[1]) { gsk_vulkan_device_get_vk_queue_family_indexcxx . . $ gsk_vulkan_device_get_vk_queue_family_index(79c754cf35296986). (device) },
232 }
233 },
234 &image_properties);
235 if (res != VK_SUCCESScxx . . $ VK_SUCCESS.)
236 return 0;
237
238 if (image_properties.imageFormatPropertiescxx . . $ VkImageFormatProperties2#imageFormatProperties..maxExtentcxx . . $ VkImageFormatProperties#maxExtent..widthcxx . . $ VkExtent3D#width. < width ||
239 image_properties.imageFormatPropertiescxx . . $ VkImageFormatProperties2#imageFormatProperties..maxExtentcxx . . $ VkImageFormatProperties#maxExtent..heightcxx . . $ VkExtent3D#height. < height)
240 return 0;
241
242 *out_flags = gsk_vulkan_image_flags_for_featurescxx . . $ gsk_vulkan_image_flags_for_features(17e27be084a7d9d7). (features);
243 if (image_properties.imageFormatPropertiescxx . . $ VkImageFormatProperties2#imageFormatProperties..maxMipLevelscxx . . $ VkImageFormatProperties#maxMipLevels. >= gsk_gpu_mipmap_levelscxx . . $ gsk_gpu_mipmap_levels(747bb0b251b16f99). (width, height) &&
244 (*out_flags & (GSK_GPU_IMAGE_BLITcxx . . $ GSK_GPU_IMAGE_BLIT. | GSK_GPU_IMAGE_FILTERABLEcxx . . $ GSK_GPU_IMAGE_FILTERABLE. | GSK_GPU_IMAGE_RENDERABLEcxx . . $ GSK_GPU_IMAGE_RENDERABLE.)) == (GSK_GPU_IMAGE_BLITcxx . . $ GSK_GPU_IMAGE_BLIT. | GSK_GPU_IMAGE_FILTERABLEcxx . . $ GSK_GPU_IMAGE_FILTERABLE. | GSK_GPU_IMAGE_RENDERABLEcxx . . $ GSK_GPU_IMAGE_RENDERABLE.))
245 *out_flags |= GSK_GPU_IMAGE_CAN_MIPMAPcxx . . $ GSK_GPU_IMAGE_CAN_MIPMAP.;
246
247 return features;
248 }
249
250 static void
251 gsk_vulkan_image_create_viewcxx . . $ gsk_vulkan_image_create_view(c995d2fb44cd1749). (GskVulkanImagecxx . . $ GskVulkanImage# *self,
252 VkFormatcxx . . $ VkFormat# vk_format,
253 const VkComponentMappingcxx . . $ VkComponentMapping# *vk_components,
254 VkSamplerYcbcrConversioncxx . . $ VkSamplerYcbcrConversion# vk_conversion)
255 {
256 GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (vkCreateImageView, gsk_vulkan_device_get_vk_device (self->device),
257 &(VkImageViewCreateInfo) {
258 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
259 .image = self->vk_image,
260 .viewType = VK_IMAGE_VIEW_TYPE_2D,
261 .format = vk_format,
262 .components = vk_conversion ? (VkComponentMapping) { 0, }
263 : *vk_components,
264 .subresourceRange = {
265 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
266 .baseMipLevel = 0,
267 .levelCount = VK_REMAINING_MIP_LEVELScxx . . $ `<external>/13734482859137699468/vulkan_core.h:128:9`!,
268 .baseArrayLayer = 0,
269 .layerCount = 1,
270 },
271 .pNext = vk_conversion == VK_NULL_HANDLEcxx . . $ `<external>/13734482859137699468/vulkan_core.h:43:21`! ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! : &(VkSamplerYcbcrConversionInfo) {
272 .sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO,
273 .conversion = vk_conversion
274 }
275 },
276 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
277 &self->vk_image_view);
278 }
279
280 static VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags#
281 gsk_vulkan_device_check_formatcxx . . $ gsk_vulkan_device_check_format(6bdcf8d3dfe0d548). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
282 VkFormatcxx . . $ VkFormat# vk_format,
283 const VkComponentMappingcxx . . $ VkComponentMapping# *vk_components,
284 GskGpuImageFlagscxx . . $ GskGpuImageFlags# required_flags,
285 gbooleancxx . . $ gboolean# needs_ycbcr_conversion,
286 VkImageTilingcxx . . $ VkImageTiling# vk_tiling,
287 VkImageUsageFlagscxx . . $ VkImageUsageFlags# vk_usage,
288 gsizecxx . . $ gsize# width,
289 gsizecxx . . $ gsize# height,
290 VkImageTilingcxx . . $ VkImageTiling# *out_tiling,
291 GskGpuImageFlagscxx . . $ GskGpuImageFlags# *out_flags)
292 {
293 #define CHECK_FLAGScxx . . $ `gsk/gpu/gskvulkanimage.c:293:9`! (GSK_GPU_IMAGE_BLIT | GSK_GPU_IMAGE_FILTERABLE | GSK_GPU_IMAGE_RENDERABLE | GSK_GPU_IMAGE_CAN_MIPMAP)
294 VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags# vk_features;
295 GskGpuImageFlagscxx . . $ GskGpuImageFlags# flags;
296
297 if (vk_format == VK_FORMAT_UNDEFINEDcxx . . $ VK_FORMAT_UNDEFINED.)
298 return 0;
299
300 if (vk_usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BITcxx . . $ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT. &&
301 !gsk_component_mapping_is_framebuffer_compatiblecxx . . $ gsk_component_mapping_is_framebuffer_compatible(3468eded089dc2ed). (vk_components))
302 return 0;
303
304 vk_features = gsk_vulkan_device_supports_formatcxx . . $ gsk_vulkan_device_supports_format(4ae85958a486c0b4). (device,
305 vk_format,
306 0, 1,
307 needs_ycbcr_conversion,
308 vk_tiling, vk_usage,
309 width, height,
310 &flags);
311 if (vk_features != 0 && ((flags & required_flags & CHECK_FLAGScxx . . $ `gsk/gpu/gskvulkanimage.c:293:9`!) == (required_flags & CHECK_FLAGScxx . . $ `gsk/gpu/gskvulkanimage.c:293:9`!)))
312 {
313 *out_tiling = vk_tiling;
314 *out_flags = flags;
315 return vk_features;
316 }
317
318 if (vk_tiling == VK_IMAGE_TILING_LINEARcxx . . $ VK_IMAGE_TILING_LINEAR.)
319 {
320 vk_features = gsk_vulkan_device_supports_formatcxx . . $ gsk_vulkan_device_supports_format(4ae85958a486c0b4). (device,
321 vk_format,
322 0, 1,
323 needs_ycbcr_conversion,
324 VK_IMAGE_TILING_OPTIMALcxx . . $ VK_IMAGE_TILING_OPTIMAL., vk_usage,
325 width, height,
326 &flags);
327 if (vk_features != 0 && ((flags & required_flags & CHECK_FLAGScxx . . $ `gsk/gpu/gskvulkanimage.c:293:9`!) == (required_flags & CHECK_FLAGScxx . . $ `gsk/gpu/gskvulkanimage.c:293:9`!)))
328 {
329 *out_tiling = VK_IMAGE_TILING_OPTIMALcxx . . $ VK_IMAGE_TILING_OPTIMAL.;
330 *out_flags = flags;
331 return vk_features;
332 }
333 }
334
335 return 0;
336 #undef CHECK_FLAGScxx . . $ `gsk/gpu/gskvulkanimage.c:293:9`!
337 }
338
339 static gbooleancxx . . $ gboolean#
340 gsk_vulkan_device_supports_conversioncxx . . $ gsk_vulkan_device_supports_conversion(45e820a6e8b600cc). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
341 GskGpuConversioncxx . . $ GskGpuConversion# conv)
342 {
343 switch (conv)
344 {
345 case GSK_GPU_CONVERSION_SRGBcxx . . $ GSK_GPU_CONVERSION_SRGB.:
346 case GSK_GPU_CONVERSION_NONEcxx . . $ GSK_GPU_CONVERSION_NONE.:
347 break;
348
349 case GSK_GPU_CONVERSION_BT601cxx . . $ GSK_GPU_CONVERSION_BT601.:
350 case GSK_GPU_CONVERSION_BT601_NARROWcxx . . $ GSK_GPU_CONVERSION_BT601_NARROW.:
351 case GSK_GPU_CONVERSION_BT709cxx . . $ GSK_GPU_CONVERSION_BT709.:
352 case GSK_GPU_CONVERSION_BT709_NARROWcxx . . $ GSK_GPU_CONVERSION_BT709_NARROW.:
353 case GSK_GPU_CONVERSION_BT2020cxx . . $ GSK_GPU_CONVERSION_BT2020.:
354 case GSK_GPU_CONVERSION_BT2020_NARROWcxx . . $ GSK_GPU_CONVERSION_BT2020_NARROW.:
355 if (!gsk_vulkan_device_has_featurecxx . . $ gsk_vulkan_device_has_feature(b413dc2ca189b5dd). (device, GDK_VULKAN_FEATURE_YCBCRcxx . . $ GDK_VULKAN_FEATURE_YCBCR.))
356 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
357 break;
358
359 default:
360 break;
361 }
362
363 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
364 }
365
366 static GskVulkanImagecxx . . $ GskVulkanImage# *
367 gsk_vulkan_image_newcxx . . $ gsk_vulkan_image_new(9c2eceb915088e79). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
368 GdkMemoryFormatcxx . . $ GdkMemoryFormat# format,
369 GskGpuConversioncxx . . $ GskGpuConversion# conv,
370 GskGpuImageFlagscxx . . $ GskGpuImageFlags# required_flags,
371 gsizecxx . . $ gsize# width,
372 gsizecxx . . $ gsize# height,
373 VkImageTilingcxx . . $ VkImageTiling# tiling,
374 VkImageUsageFlagscxx . . $ VkImageUsageFlags# usage,
375 VkPipelineStageFlagscxx . . $ VkPipelineStageFlags# stage,
376 VkImageLayoutcxx . . $ VkImageLayout# layout,
377 VkAccessFlagscxx . . $ VkAccessFlags# access,
378 VkMemoryPropertyFlagscxx . . $ VkMemoryPropertyFlags# memory)
379 {
380 VkMemoryRequirementscxx . . $ VkMemoryRequirements# requirements;
381 GskVulkanImagecxx . . $ GskVulkanImage# *self;
382 VkDevicecxx . . $ VkDevice# vk_device;
383 GskGpuImageFlagscxx . . $ GskGpuImageFlags# flags;
384 gbooleancxx . . $ gboolean# try_srgb;
385 VkFormatcxx . . $ VkFormat# vk_format, vk_srgb_format;
386 VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags# vk_features;
387 VkComponentMappingcxx . . $ VkComponentMapping# vk_components;
388 VkSamplerYcbcrConversioncxx . . $ VkSamplerYcbcrConversion# vk_conversion;
389 VkSamplerYcbcrModelConversioncxx . . $ VkSamplerYcbcrModelConversion# vk_model;
390 VkSamplerYcbcrRangecxx . . $ VkSamplerYcbcrRange# vk_range;
391 GdkShaderOpcxx . . $ GdkShaderOp# shader_op;
392 gbooleancxx . . $ gboolean# needs_conversion;
393 gsizecxx . . $ gsize# memory_index;
394
395 g_assertcxx . . $ `<external>/15287032793271088244/gtestutils.h:275:9`! (width > 0 && height > 0);
396
397 if (!gsk_vulkan_device_supports_conversioncxx . . $ gsk_vulkan_device_supports_conversion(45e820a6e8b600cc). (device, conv))
398 conv = GSK_GPU_CONVERSION_NONEcxx . . $ GSK_GPU_CONVERSION_NONE.;
399
400 vk_srgb_format = VK_FORMAT_UNDEFINEDcxx . . $ VK_FORMAT_UNDEFINED.;
401 try_srgb = conv == GSK_GPU_CONVERSION_SRGBcxx . . $ GSK_GPU_CONVERSION_SRGB.;
402
403 /* First, try the actual format */
404 vk_format = gdk_memory_format_vk_formatcxx . . $ gdk_memory_format_vk_format(b8cf3792259afe28). (format, &vk_components, &needs_conversion);
405 if (try_srgb)
406 vk_srgb_format = gdk_memory_format_vk_srgb_formatcxx . . $ gdk_memory_format_vk_srgb_format(6735f5b7a9b389f8). (format);
407 if ((vk_features = gsk_vulkan_device_check_formatcxx . . $ gsk_vulkan_device_check_format(6bdcf8d3dfe0d548). (device, vk_srgb_format, &vk_components,
408 required_flags, needs_conversion,
409 tiling, usage, width, height,
410 &tiling, &flags)))
411 {
412 vk_format = vk_srgb_format;
413 }
414 else if ((vk_features = gsk_vulkan_device_check_formatcxx . . $ gsk_vulkan_device_check_format(6bdcf8d3dfe0d548). (device, vk_format, &vk_components,
415 required_flags, needs_conversion,
416 tiling, usage, width, height,
417 &tiling, &flags)))
418 {
419 /* nothing to do */
420 }
421 else
422 {
423 GdkMemoryFormatcxx . . $ GdkMemoryFormat# rgba_format;
424 GdkSwizzlecxx . . $ GdkSwizzle# rgba_swizzle;
425
426 /* Second, try the potential RGBA format */
427 if (gdk_memory_format_get_rgba_formatcxx . . $ gdk_memory_format_get_rgba_format(55025bd1e5f58516). (format, &rgba_format, &rgba_swizzle))
428 {
429 vk_format = gdk_memory_format_vk_formatcxx . . $ gdk_memory_format_vk_format(b8cf3792259afe28). (rgba_format, &vk_components, &needs_conversion);
430 gdk_swizzle_to_vk_component_mappingcxx . . $ gdk_swizzle_to_vk_component_mapping(d93e2179a5ba439). (rgba_swizzle, &vk_components);
431 }
432 else
433 vk_format = VK_FORMAT_UNDEFINEDcxx . . $ VK_FORMAT_UNDEFINED.;
434 if (try_srgb && vk_format != VK_FORMAT_UNDEFINEDcxx . . $ VK_FORMAT_UNDEFINED.)
435 vk_srgb_format = gdk_memory_format_vk_srgb_formatcxx . . $ gdk_memory_format_vk_srgb_format(6735f5b7a9b389f8). (rgba_format);
436 else
437 vk_srgb_format = VK_FORMAT_UNDEFINEDcxx . . $ VK_FORMAT_UNDEFINED.;
438 if ((vk_features = gsk_vulkan_device_check_formatcxx . . $ gsk_vulkan_device_check_format(6bdcf8d3dfe0d548). (device, vk_srgb_format, &vk_components,
439 required_flags, needs_conversion,
440 tiling, usage, width, height,
441 &tiling, &flags)))
442 {
443 vk_format = vk_srgb_format;
444 }
445 else if ((vk_features = gsk_vulkan_device_check_formatcxx . . $ gsk_vulkan_device_check_format(6bdcf8d3dfe0d548). (device, vk_format, &vk_components,
446 required_flags, needs_conversion,
447 tiling, usage, width, height,
448 &tiling, &flags)))
449 {
450 /* nothing to do */
451 }
452 else
453 {
454 const GdkMemoryFormatcxx . . $ GdkMemoryFormat# *fallbacks;
455 gsizecxx . . $ gsize# i;
456
457 /* Next, try the fallbacks */
458 fallbacks = gdk_memory_format_get_fallbackscxx . . $ gdk_memory_format_get_fallbacks(88fc4d54335d67b1). (format);
459 for (i = 0; fallbacks[i] != -1; i++)
460 {
461 vk_format = gdk_memory_format_vk_formatcxx . . $ gdk_memory_format_vk_format(b8cf3792259afe28). (fallbacks[i], &vk_components, &needs_conversion);
462 if (try_srgb)
463 vk_srgb_format = gdk_memory_format_vk_srgb_formatcxx . . $ gdk_memory_format_vk_srgb_format(6735f5b7a9b389f8). (fallbacks[i]);
464 if ((vk_features = gsk_vulkan_device_check_formatcxx . . $ gsk_vulkan_device_check_format(6bdcf8d3dfe0d548). (device, vk_srgb_format, &vk_components,
465 required_flags, needs_conversion,
466 tiling, usage, width, height,
467 &tiling, &flags)))
468 {
469 vk_format = vk_srgb_format;
470 format = fallbacks[i];
471 break;
472 }
473 else if ((vk_features = gsk_vulkan_device_check_formatcxx . . $ gsk_vulkan_device_check_format(6bdcf8d3dfe0d548). (device, vk_format, &vk_components,
474 required_flags, needs_conversion,
475 tiling, usage, width, height,
476 &tiling, &flags)))
477 {
478 format = fallbacks[i];
479 break;
480 }
481 }
482
483 /* No format found. Likely, the width/height are too big */
484 if (fallbacks[i] == -1)
485 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
486 }
487 }
488
489 shader_op = gdk_memory_format_get_default_shader_opcxx . . $ gdk_memory_format_get_default_shader_op(5326846c0929fc0c). (format);
490
491 if (vk_format != vk_srgb_format && conv == GSK_GPU_CONVERSION_SRGBcxx . . $ GSK_GPU_CONVERSION_SRGB.)
492 conv = GSK_GPU_CONVERSION_NONEcxx . . $ GSK_GPU_CONVERSION_NONE.;
493
494 if (((flags & (GSK_GPU_IMAGE_FILTERABLEcxx . . $ GSK_GPU_IMAGE_FILTERABLE. | GSK_GPU_IMAGE_RENDERABLEcxx . . $ GSK_GPU_IMAGE_RENDERABLE. | GSK_GPU_IMAGE_BLITcxx . . $ GSK_GPU_IMAGE_BLIT. | GSK_GPU_IMAGE_CAN_MIPMAPcxx . . $ GSK_GPU_IMAGE_CAN_MIPMAP.)) !=
495 (GSK_GPU_IMAGE_FILTERABLEcxx . . $ GSK_GPU_IMAGE_FILTERABLE. | GSK_GPU_IMAGE_RENDERABLEcxx . . $ GSK_GPU_IMAGE_RENDERABLE. | GSK_GPU_IMAGE_BLITcxx . . $ GSK_GPU_IMAGE_BLIT. | GSK_GPU_IMAGE_CAN_MIPMAPcxx . . $ GSK_GPU_IMAGE_CAN_MIPMAP.)) ||
496 shader_op != GDK_SHADER_DEFAULTcxx . . $ GDK_SHADER_DEFAULT. ||
497 !(required_flags & GSK_GPU_IMAGE_CAN_MIPMAPcxx . . $ GSK_GPU_IMAGE_CAN_MIPMAP.))
498 flags &= ~GSK_GPU_IMAGE_CAN_MIPMAPcxx . . $ GSK_GPU_IMAGE_CAN_MIPMAP.;
499
500 if (!gsk_component_mapping_is_framebuffer_compatiblecxx . . $ gsk_component_mapping_is_framebuffer_compatible(3468eded089dc2ed). (&vk_components) || needs_conversion)
501 flags &= ~GSK_GPU_IMAGE_BLITcxx . . $ GSK_GPU_IMAGE_BLIT.;
502
503 vk_device = gsk_vulkan_device_get_vk_devicecxx . . $ gsk_vulkan_device_get_vk_device(4319e0de3864a3a5). (device);
504
505 self = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GSK_TYPE_VULKAN_IMAGEcxx . . $ `gsk/gpu/gskvulkanimageprivate.h:14:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
506
507 self->devicecxx . . $ _GskVulkanImage#device. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (device);
508 self->vk_formatcxx . . $ _GskVulkanImage#vk_format. = vk_format;
509 self->vk_tilingcxx . . $ _GskVulkanImage#vk_tiling. = tiling;
510 self->vk_usagecxx . . $ _GskVulkanImage#vk_usage. = usage;
511 self->vk_pipeline_stagecxx . . $ _GskVulkanImage#vk_pipeline_stage. = stage;
512 self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout. = layout;
513 self->vk_accesscxx . . $ _GskVulkanImage#vk_access. = access;
514
515 if (gsk_vulkan_ycbcr_is_supportedcxx . . $ gsk_vulkan_ycbcr_is_supported(4c679297bf94b9eb). (vk_features) &&
516 (gsk_vulkan_get_ycbcr_flagscxx . . $ gsk_vulkan_get_ycbcr_flags(c0e49c9c417fca4). (conv, &vk_model, &vk_range) || needs_conversion))
517 {
518 self->ycbcrcxx . . $ _GskVulkanImage#ycbcr. = gsk_vulkan_ycbcr_getcxx . . $ gsk_vulkan_ycbcr_get(1924c2a1ca461aa0). (device,
519 &(GskVulkanYcbcrInfocxx . . $ GskVulkanYcbcrInfo#) {
520 .vk_format = vk_format,
521 .vk_features = vk_features,
522 .vk_components = vk_components,
523 .vk_ycbcr_model = vk_model,
524 .vk_ycbcr_range = vk_range,
525 });
526 gsk_vulkan_ycbcr_refcxx . . $ gsk_vulkan_ycbcr_ref(4bce327b04ab8794). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.);
527 vk_conversion = gsk_vulkan_ycbcr_get_vk_conversioncxx . . $ gsk_vulkan_ycbcr_get_vk_conversion(dc9f0bf7e829fc64). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.);
528 flags |= GSK_GPU_IMAGE_EXTERNALcxx . . $ GSK_GPU_IMAGE_EXTERNAL.;
529 if (!gsk_vulkan_ycbcr_is_filterablecxx . . $ gsk_vulkan_ycbcr_is_filterable(3da581327ae55198). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.))
530 flags &= ~(GSK_GPU_IMAGE_FILTERABLEcxx . . $ GSK_GPU_IMAGE_FILTERABLE.);
531 shader_op = GDK_SHADER_DEFAULTcxx . . $ GDK_SHADER_DEFAULT.;
532 }
533 else
534 {
535 /* Something is broken if this happens, we checked for this above */
536 g_warn_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:563:9`! (!needs_conversion);
537 vk_conversion = VK_NULL_HANDLEcxx . . $ `<external>/13734482859137699468/vulkan_core.h:43:21`!;
538 conv = GSK_GPU_CONVERSION_NONEcxx . . $ GSK_GPU_CONVERSION_NONE.;
539 }
540
541 gsk_gpu_image_setupcxx . . $ gsk_gpu_image_setup(6cddd1d066e686d8). (GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self), flags, conv, shader_op, format, width, height);
542
543 GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (vkCreateImage, vk_device,
544 &(VkImageCreateInfo) {
545 .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
546 .flags = 0,
547 .imageType = VK_IMAGE_TYPE_2D,
548 .format = vk_format,
549 .extent = { width, height, 1 },
550 .mipLevels = (flags & GSK_GPU_IMAGE_CAN_MIPMAP) ? gsk_gpu_mipmap_levels (width, height) : 1,
551 .arrayLayers = 1,
552 .samples = VK_SAMPLE_COUNT_1_BIT,
553 .tiling = tiling,
554 .usage = usage |
555 (flags & (GSK_GPU_IMAGE_BLIT | GSK_GPU_IMAGE_DOWNLOADABLE) ? VK_IMAGE_USAGE_TRANSFER_SRC_BIT : 0),
556 .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
557 .initialLayout = self->vk_image_layout,
558 },
559 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
560 &self->vk_image);
561
562 vkGetImageMemoryRequirementscxx . . $ vkGetImageMemoryRequirements(a6b81d78e8848133). (vk_device,
563 self->vk_imagecxx . . $ _GskVulkanImage#vk_image.,
564 &requirements);
565
566 memory_index = gsk_vulkan_device_find_allocatorcxx . . $ gsk_vulkan_device_find_allocator(3b98c1ed9ff9deb7). (device,
567 requirements.memoryTypeBitscxx . . $ VkMemoryRequirements#memoryTypeBits.,
568 0,
569 tiling == VK_IMAGE_TILING_LINEARcxx . . $ VK_IMAGE_TILING_LINEAR. ? GSK_VULKAN_MEMORY_MAPPABLEcxx . . $ `gsk/gpu/gskvulkanmemoryprivate.h:9:9`! : 0);
570 self->allocatorcxx . . $ _GskVulkanImage#allocator. = gsk_vulkan_device_get_allocatorcxx . . $ gsk_vulkan_device_get_allocator(1dc6e80fd5bf1545). (device, memory_index);
571 gsk_vulkan_allocator_refcxx . . $ gsk_vulkan_allocator_ref(89e72274fd28ab01). (self->allocatorcxx . . $ _GskVulkanImage#allocator.);
572
573 gsk_vulkan_alloccxx . . $ gsk_vulkan_alloc(e9555ce67b338ccd). (self->allocatorcxx . . $ _GskVulkanImage#allocator.,
574 requirements.sizecxx . . $ VkMemoryRequirements#size.,
575 requirements.alignmentcxx . . $ VkMemoryRequirements#alignment.,
576 &self->allocationcxx . . $ _GskVulkanImage#allocation.);
577
578 GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (vkBindImageMemory, vk_device,
579 self->vk_image,
580 self->allocation.vk_memory,
581 self->allocation.offset);
582
583 gsk_vulkan_image_create_viewcxx . . $ gsk_vulkan_image_create_view(c995d2fb44cd1749). (self, vk_format, &vk_components, vk_conversion);
584
585 return self;
586 }
587
588 GskGpuImagecxx . . $ GskGpuImage# *
589 gsk_vulkan_image_new_for_uploadcxx . . $ gsk_vulkan_image_new_for_upload(78efe1fc65058df7). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
590 gbooleancxx . . $ gboolean# with_mipmap,
591 GdkMemoryFormatcxx . . $ GdkMemoryFormat# format,
592 GskGpuConversioncxx . . $ GskGpuConversion# conv,
593 gsizecxx . . $ gsize# width,
594 gsizecxx . . $ gsize# height)
595 {
596 GskVulkanImagecxx . . $ GskVulkanImage# *self;
597
598 self = gsk_vulkan_image_newcxx . . $ gsk_vulkan_image_new(9c2eceb915088e79). (device,
599 format,
600 conv,
601 0, //with_mipmap ? (GSK_GPU_IMAGE_CAN_MIPMAP | GSK_GPU_IMAGE_RENDERABLE | GSK_GPU_IMAGE_FILTERABLE) : 0,
602 width,
603 height,
604 VK_IMAGE_TILING_LINEARcxx . . $ VK_IMAGE_TILING_LINEAR.,
605 VK_IMAGE_USAGE_TRANSFER_SRC_BITcxx . . $ VK_IMAGE_USAGE_TRANSFER_SRC_BIT. |
606 VK_IMAGE_USAGE_TRANSFER_DST_BITcxx . . $ VK_IMAGE_USAGE_TRANSFER_DST_BIT. |
607 VK_IMAGE_USAGE_SAMPLED_BITcxx . . $ VK_IMAGE_USAGE_SAMPLED_BIT.,
608 VK_PIPELINE_STAGE_TRANSFER_BITcxx . . $ VK_PIPELINE_STAGE_TRANSFER_BIT.,
609 VK_IMAGE_LAYOUT_PREINITIALIZEDcxx . . $ VK_IMAGE_LAYOUT_PREINITIALIZED.,
610 VK_ACCESS_TRANSFER_WRITE_BITcxx . . $ VK_ACCESS_TRANSFER_WRITE_BIT.,
611 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BITcxx . . $ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT.);
612
613 return GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self);
614 }
615
616 static gbooleancxx . . $ gboolean#
617 gsk_vulkan_image_can_mapcxx . . $ gsk_vulkan_image_can_map(917bdaf622ef27a0). (GskVulkanImagecxx . . $ GskVulkanImage# *self)
618 {
619 if (GSK_DEBUG_CHECKcxx . . $ `gsk/gskdebugprivate.h:31:9`! (STAGING))
620 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
621
622 if (self->vk_tilingcxx . . $ _GskVulkanImage#vk_tiling. != VK_IMAGE_TILING_LINEARcxx . . $ VK_IMAGE_TILING_LINEAR.)
623 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
624
625 if (self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout. != VK_IMAGE_LAYOUT_PREINITIALIZEDcxx . . $ VK_IMAGE_LAYOUT_PREINITIALIZED. &&
626 self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout. != VK_IMAGE_LAYOUT_GENERALcxx . . $ VK_IMAGE_LAYOUT_GENERAL.)
627 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
628
629 if ((self->allocationcxx . . $ _GskVulkanImage#allocation..memory_flagscxx . . $ _GskVulkanAllocation#memory_flags. & VK_MEMORY_PROPERTY_HOST_CACHED_BITcxx . . $ VK_MEMORY_PROPERTY_HOST_CACHED_BIT.) == 0)
630 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
631
632 return self->allocationcxx . . $ _GskVulkanImage#allocation..mapcxx . . $ _GskVulkanAllocation#map. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
633 }
634
635 gucharcxx . . $ guchar# *
636 gsk_vulkan_image_get_datacxx . . $ gsk_vulkan_image_get_data(95279b7c61294aed). (GskVulkanImagecxx . . $ GskVulkanImage# *self,
637 GdkMemoryLayoutcxx . . $ GdkMemoryLayout# *out_layout)
638 {
639 const VkImageAspectFlagscxx . . $ VkImageAspectFlags# aspect_flags[3] = { VK_IMAGE_ASPECT_PLANE_0_BITcxx . . $ VK_IMAGE_ASPECT_PLANE_0_BIT., VK_IMAGE_ASPECT_PLANE_1_BITcxx . . $ VK_IMAGE_ASPECT_PLANE_1_BIT., VK_IMAGE_ASPECT_PLANE_2_BITcxx . . $ VK_IMAGE_ASPECT_PLANE_2_BIT. };
640 GskGpuImagecxx . . $ GskGpuImage# *image = GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self);
641 VkSubresourceLayoutcxx . . $ VkSubresourceLayout# image_layout;
642 VkDevicecxx . . $ VkDevice# vk_device;
643 gsizecxx . . $ gsize# i, n_planes;
644
645 if (!gsk_vulkan_image_can_mapcxx . . $ gsk_vulkan_image_can_map(917bdaf622ef27a0). (self))
646 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
647
648 out_layout->formatcxx . . $ _GdkMemoryLayout#format. = gsk_gpu_image_get_formatcxx . . $ gsk_gpu_image_get_format(48c0d736573b6e75). (image);
649 out_layout->widthcxx . . $ _GdkMemoryLayout#width. = gsk_gpu_image_get_widthcxx . . $ gsk_gpu_image_get_width(4bdeec44aa36e037). (image);
650 out_layout->heightcxx . . $ _GdkMemoryLayout#height. = gsk_gpu_image_get_heightcxx . . $ gsk_gpu_image_get_height(4bdeec44aa36e037). (image);
651 out_layout->sizecxx . . $ _GdkMemoryLayout#size. = self->allocationcxx . . $ _GskVulkanImage#allocation..sizecxx . . $ _GskVulkanAllocation#size.;
652 n_planes = gdk_memory_format_get_n_planescxx . . $ gdk_memory_format_get_n_planes(297990571baf5d1d). (out_layout->formatcxx . . $ _GdkMemoryLayout#format.);
653 vk_device = gsk_vulkan_device_get_vk_devicecxx . . $ gsk_vulkan_device_get_vk_device(4319e0de3864a3a5). (self->devicecxx . . $ _GskVulkanImage#device.);
654
655 for (i = 0; i < n_planes; i++)
656 {
657 vkGetImageSubresourceLayoutcxx . . $ vkGetImageSubresourceLayout(fb26ff27536c7d04). (vk_device,
658 self->vk_imagecxx . . $ _GskVulkanImage#vk_image.,
659 &(VkImageSubresourcecxx . . $ VkImageSubresource#) {
660 .aspectMask = n_planes == 1 ? VK_IMAGE_ASPECT_COLOR_BITcxx . . $ VK_IMAGE_ASPECT_COLOR_BIT. : aspect_flags[i],
661 .mipLevel = 0,
662 .arrayLayer = 0
663 },
664 &image_layout);
665 out_layout->planescxx . . $ _GdkMemoryLayout#planes.[i].offsetcxx . . $ _GdkMemoryLayout#$anonymous_type_0#offset. = image_layout.offsetcxx . . $ VkSubresourceLayout#offset.;
666 out_layout->planescxx . . $ _GdkMemoryLayout#planes.[i].stridecxx . . $ _GdkMemoryLayout#$anonymous_type_0#stride. = image_layout.rowPitchcxx . . $ VkSubresourceLayout#rowPitch.;
667 }
668
669 return self->allocationcxx . . $ _GskVulkanImage#allocation..mapcxx . . $ _GskVulkanAllocation#map.;
670 }
671
672 GskGpuImagecxx . . $ GskGpuImage# *
673 gsk_vulkan_image_new_for_swapchaincxx . . $ gsk_vulkan_image_new_for_swapchain(65246620f235994a). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
674 VkImagecxx . . $ VkImage# image,
675 VkFormatcxx . . $ VkFormat# format,
676 GdkMemoryFormatcxx . . $ GdkMemoryFormat# memory_format,
677 gsizecxx . . $ gsize# width,
678 gsizecxx . . $ gsize# height)
679 {
680 GskVulkanImagecxx . . $ GskVulkanImage# *self;
681 GskGpuImageFlagscxx . . $ GskGpuImageFlags# flags = 0;
682 GskGpuConversioncxx . . $ GskGpuConversion# conv;
683
684 self = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GSK_TYPE_VULKAN_IMAGEcxx . . $ `gsk/gpu/gskvulkanimageprivate.h:14:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
685
686 self->devicecxx . . $ _GskVulkanImage#device. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (device);
687 self->vk_tilingcxx . . $ _GskVulkanImage#vk_tiling. = VK_IMAGE_TILING_OPTIMALcxx . . $ VK_IMAGE_TILING_OPTIMAL.;
688 self->vk_imagecxx . . $ _GskVulkanImage#vk_image. = image;
689 self->vk_formatcxx . . $ _GskVulkanImage#vk_format. = format;
690 self->vk_pipeline_stagecxx . . $ _GskVulkanImage#vk_pipeline_stage. = VK_PIPELINE_STAGE_TOP_OF_PIPE_BITcxx . . $ VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT.;
691 self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout. = VK_IMAGE_LAYOUT_UNDEFINEDcxx . . $ VK_IMAGE_LAYOUT_UNDEFINED.;
692 self->vk_accesscxx . . $ _GskVulkanImage#vk_access. = 0;
693
694 if (format == gdk_memory_format_vk_srgb_formatcxx . . $ gdk_memory_format_vk_srgb_format(6735f5b7a9b389f8). (memory_format))
695 conv = GSK_GPU_CONVERSION_SRGBcxx . . $ GSK_GPU_CONVERSION_SRGB.;
696 else
697 conv = GSK_GPU_CONVERSION_NONEcxx . . $ GSK_GPU_CONVERSION_NONE.;
698
699 /* FIXME: The flags here are very suboptimal */
700 gsk_gpu_image_setupcxx . . $ gsk_gpu_image_setup(6cddd1d066e686d8). (GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self), flags, conv, GDK_SHADER_DEFAULTcxx . . $ GDK_SHADER_DEFAULT., memory_format, width, height);
701
702 gsk_vulkan_image_create_viewcxx . . $ gsk_vulkan_image_create_view(c995d2fb44cd1749). (self,
703 format,
704 &(VkComponentMappingcxx . . $ VkComponentMapping#) {
705 VK_COMPONENT_SWIZZLE_Rcxx . . $ VK_COMPONENT_SWIZZLE_R.,
706 VK_COMPONENT_SWIZZLE_Gcxx . . $ VK_COMPONENT_SWIZZLE_G.,
707 VK_COMPONENT_SWIZZLE_Bcxx . . $ VK_COMPONENT_SWIZZLE_B.,
708 VK_COMPONENT_SWIZZLE_Acxx . . $ VK_COMPONENT_SWIZZLE_A.
709 },
710 VK_NULL_HANDLEcxx . . $ `<external>/13734482859137699468/vulkan_core.h:43:21`!);
711
712 return GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self);
713 }
714
715 GskGpuImagecxx . . $ GskGpuImage# *
716 gsk_vulkan_image_new_for_atlascxx . . $ gsk_vulkan_image_new_for_atlas(3b8dc5acfad566a1). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
717 gsizecxx . . $ gsize# width,
718 gsizecxx . . $ gsize# height)
719 {
720 GskVulkanImagecxx . . $ GskVulkanImage# *self;
721
722 self = gsk_vulkan_image_newcxx . . $ gsk_vulkan_image_new(9c2eceb915088e79). (device,
723 GDK_MEMORY_DEFAULTcxx . . $ `gdk/gdkmemorytexture.h:43:9`!,
724 GSK_GPU_CONVERSION_NONEcxx . . $ GSK_GPU_CONVERSION_NONE.,
725 GSK_GPU_IMAGE_FILTERABLEcxx . . $ GSK_GPU_IMAGE_FILTERABLE. | GSK_GPU_IMAGE_RENDERABLEcxx . . $ GSK_GPU_IMAGE_RENDERABLE.,
726 width,
727 height,
728 VK_IMAGE_TILING_OPTIMALcxx . . $ VK_IMAGE_TILING_OPTIMAL.,
729 VK_IMAGE_USAGE_TRANSFER_DST_BITcxx . . $ VK_IMAGE_USAGE_TRANSFER_DST_BIT. | VK_IMAGE_USAGE_SAMPLED_BITcxx . . $ VK_IMAGE_USAGE_SAMPLED_BIT.,
730 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BITcxx . . $ VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT.,
731 VK_IMAGE_LAYOUT_UNDEFINEDcxx . . $ VK_IMAGE_LAYOUT_UNDEFINED.,
732 0,
733 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BITcxx . . $ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT.);
734
735 return GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self);
736 }
737
738 GskGpuImagecxx . . $ GskGpuImage# *
739 gsk_vulkan_image_new_for_offscreencxx . . $ gsk_vulkan_image_new_for_offscreen(91dd39fc8120a300). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
740 gbooleancxx . . $ gboolean# with_mipmap,
741 GdkMemoryFormatcxx . . $ GdkMemoryFormat# preferred_format,
742 gbooleancxx . . $ gboolean# try_srgb,
743 gsizecxx . . $ gsize# width,
744 gsizecxx . . $ gsize# height)
745 {
746 GskVulkanImagecxx . . $ GskVulkanImage# *self;
747
748 self = gsk_vulkan_image_newcxx . . $ gsk_vulkan_image_new(9c2eceb915088e79). (device,
749 preferred_format,
750 try_srgb ? GSK_GPU_CONVERSION_SRGBcxx . . $ GSK_GPU_CONVERSION_SRGB. : GSK_GPU_CONVERSION_NONEcxx . . $ GSK_GPU_CONVERSION_NONE.,
751 GSK_GPU_IMAGE_RENDERABLEcxx . . $ GSK_GPU_IMAGE_RENDERABLE. |
752 (with_mipmap ? GSK_GPU_IMAGE_CAN_MIPMAPcxx . . $ GSK_GPU_IMAGE_CAN_MIPMAP. | GSK_GPU_IMAGE_FILTERABLEcxx . . $ GSK_GPU_IMAGE_FILTERABLE. : 0),
753 width,
754 height,
755 VK_IMAGE_TILING_OPTIMALcxx . . $ VK_IMAGE_TILING_OPTIMAL.,
756 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BITcxx . . $ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT. |
757 VK_IMAGE_USAGE_SAMPLED_BITcxx . . $ VK_IMAGE_USAGE_SAMPLED_BIT. |
758 VK_IMAGE_USAGE_TRANSFER_SRC_BITcxx . . $ VK_IMAGE_USAGE_TRANSFER_SRC_BIT. |
759 VK_IMAGE_USAGE_TRANSFER_DST_BITcxx . . $ VK_IMAGE_USAGE_TRANSFER_DST_BIT.,
760 VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BITcxx . . $ VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT.,
761 VK_IMAGE_LAYOUT_UNDEFINEDcxx . . $ VK_IMAGE_LAYOUT_UNDEFINED.,
762 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BITcxx . . $ VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT.,
763 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BITcxx . . $ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT.);
764
765 return GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self);
766 }
767
768 #ifdef HAVE_DMABUFcxx . . $ `build/config.h:34:9`!
769 static VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags#
770 gsk_vulkan_device_check_dmabuf_formatcxx . . $ gsk_vulkan_device_check_dmabuf_format(de77809220c8d133). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
771 VkFormatcxx . . $ VkFormat# vk_format,
772 const VkComponentMappingcxx . . $ VkComponentMapping# *vk_components,
773 gsizecxx . . $ gsize# width,
774 gsizecxx . . $ gsize# height,
775 uint64_tcxx . . $ uint64_t# modifiers[100],
776 gsizecxx . . $ gsize# *out_n_modifiers)
777
778 {
779 const VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags# required = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BITcxx . . $ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT. | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BITcxx . . $ VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT.;
780 VkDrmFormatModifierPropertiesEXTcxx . . $ VkDrmFormatModifierPropertiesEXT# drm_mod_properties[100];
781 VkDrmFormatModifierPropertiesListEXTcxx . . $ VkDrmFormatModifierPropertiesListEXT# drm_properties;
782 VkPhysicalDevicecxx . . $ VkPhysicalDevice# vk_phys_device;
783 VkFormatProperties2cxx . . $ VkFormatProperties2# properties;
784 VkImageFormatProperties2cxx . . $ VkImageFormatProperties2# image_properties;
785 VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags# vk_features;
786 gsizecxx . . $ gsize# i, n_modifiers;
787 VkResultcxx . . $ VkResult# res;
788
789 drm_properties = (VkDrmFormatModifierPropertiesListEXTcxx . . $ VkDrmFormatModifierPropertiesListEXT#) {
790 .sType = VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXTcxx . . $ VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT.,
791 .drmFormatModifierCount = G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (drm_mod_properties),
792 .pDrmFormatModifierProperties = drm_mod_properties,
793 };
794 properties = (VkFormatProperties2cxx . . $ VkFormatProperties2#) {
795 .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2cxx . . $ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2.,
796 .pNext = &drm_properties
797 };
798
799 if (vk_format == VK_FORMAT_UNDEFINEDcxx . . $ VK_FORMAT_UNDEFINED.)
800 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
801
802 if (!gsk_component_mapping_is_framebuffer_compatiblecxx . . $ gsk_component_mapping_is_framebuffer_compatible(3468eded089dc2ed). (vk_components))
803 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
804
805 vk_phys_device = gsk_vulkan_device_get_vk_physical_devicecxx . . $ gsk_vulkan_device_get_vk_physical_device(fbb7f33f5baaff7). (device);
806
807 vkGetPhysicalDeviceFormatProperties2cxx . . $ vkGetPhysicalDeviceFormatProperties2(5ffc95bfbb3a6bc7). (vk_phys_device,
808 vk_format,
809 &properties);
810
811 n_modifiers = 0;
812 vk_features = -1;
813 for (i = 0; i < drm_properties.drmFormatModifierCountcxx . . $ VkDrmFormatModifierPropertiesListEXT#drmFormatModifierCount.; i++)
814 {
815 if ((drm_mod_properties[i].drmFormatModifierTilingFeaturescxx . . $ VkDrmFormatModifierPropertiesEXT#drmFormatModifierTilingFeatures. & required) != required)
816 continue;
817
818 image_properties = (VkImageFormatProperties2cxx . . $ VkImageFormatProperties2#) {
819 .sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2cxx . . $ VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2.,
820 };
821 res = vkGetPhysicalDeviceImageFormatProperties2cxx . . $ vkGetPhysicalDeviceImageFormatProperties2(4905e7968aa16577). (vk_phys_device,
822 &(VkPhysicalDeviceImageFormatInfo2cxx . . $ VkPhysicalDeviceImageFormatInfo2#) {
823 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2cxx . . $ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2.,
824 .format = vk_format,
825 .type = VK_IMAGE_TYPE_2Dcxx . . $ VK_IMAGE_TYPE_2D.,
826 .tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXTcxx . . $ VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.,
827 .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BITcxx . . $ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT.,
828 .flags = 0,
829 .pNext = &(VkPhysicalDeviceImageDrmFormatModifierInfoEXTcxx . . $ VkPhysicalDeviceImageDrmFormatModifierInfoEXT#) {
830 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXTcxx . . $ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT.,
831 .drmFormatModifier = drm_mod_properties[i].drmFormatModifiercxx . . $ VkDrmFormatModifierPropertiesEXT#drmFormatModifier.,
832 .sharingMode = VK_SHARING_MODE_EXCLUSIVEcxx . . $ VK_SHARING_MODE_EXCLUSIVE.,
833 .queueFamilyIndexCount = 1,
834 .pQueueFamilyIndices = (uint32_tcxx . . $ uint32_t#[1]) { gsk_vulkan_device_get_vk_queue_family_indexcxx . . $ gsk_vulkan_device_get_vk_queue_family_index(79c754cf35296986). (device) },
835 }
836 },
837 &image_properties);
838 if (res != VK_SUCCESScxx . . $ VK_SUCCESS.)
839 continue;
840
841 if (image_properties.imageFormatPropertiescxx . . $ VkImageFormatProperties2#imageFormatProperties..maxExtentcxx . . $ VkImageFormatProperties#maxExtent..widthcxx . . $ VkExtent3D#width. < width ||
842 image_properties.imageFormatPropertiescxx . . $ VkImageFormatProperties2#imageFormatProperties..maxExtentcxx . . $ VkImageFormatProperties#maxExtent..heightcxx . . $ VkExtent3D#height. < height)
843 continue;
844
845 modifiers[n_modifiers++] = drm_mod_properties[i].drmFormatModifiercxx . . $ VkDrmFormatModifierPropertiesEXT#drmFormatModifier.;
846 vk_features &= drm_mod_properties[i].drmFormatModifierTilingFeaturescxx . . $ VkDrmFormatModifierPropertiesEXT#drmFormatModifierTilingFeatures.;
847 }
848
849 if (n_modifiers == 0)
850 return 0;
851
852 *out_n_modifiers = n_modifiers;
853 return vk_features;
854 }
855
856 GskGpuImagecxx . . $ GskGpuImage# *
857 gsk_vulkan_image_new_dmabufcxx . . $ gsk_vulkan_image_new_dmabuf(c661ead3e2143954). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
858 GdkMemoryFormatcxx . . $ GdkMemoryFormat# format,
859 gbooleancxx . . $ gboolean# try_srgb,
860 gsizecxx . . $ gsize# width,
861 gsizecxx . . $ gsize# height)
862 {
863 uint64_tcxx . . $ uint64_t# modifiers[100];
864 VkDevicecxx . . $ VkDevice# vk_device;
865 VkFormatcxx . . $ VkFormat# vk_format, vk_srgb_format;
866 VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags# vk_features;
867 VkComponentMappingcxx . . $ VkComponentMapping# vk_components;
868 VkMemoryRequirementscxx . . $ VkMemoryRequirements# requirements;
869 VkSamplerYcbcrConversioncxx . . $ VkSamplerYcbcrConversion# vk_conversion;
870 gsizecxx . . $ gsize# memory_index;
871 GskVulkanImagecxx . . $ GskVulkanImage# *self;
872 VkResultcxx . . $ VkResult# res;
873 gsizecxx . . $ gsize# n_modifiers;
874 GskGpuImageFlagscxx . . $ GskGpuImageFlags# flags;
875 GskGpuConversioncxx . . $ GskGpuConversion# conv;
876 GdkShaderOpcxx . . $ GdkShaderOp# shader_op;
877 gbooleancxx . . $ gboolean# needs_conversion;
878
879 if (!gdk_has_featurecxx . . $ gdk_has_feature(5507ce0fbce1d269). (GDK_FEATURE_DMABUFcxx . . $ GDK_FEATURE_DMABUF.) ||
880 !gsk_vulkan_device_has_featurecxx . . $ gsk_vulkan_device_has_feature(b413dc2ca189b5dd). (device, GDK_VULKAN_FEATURE_DMABUFcxx . . $ GDK_VULKAN_FEATURE_DMABUF.))
881 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
882
883 vk_srgb_format = VK_FORMAT_UNDEFINEDcxx . . $ VK_FORMAT_UNDEFINED.;
884
885 vk_device = gsk_vulkan_device_get_vk_devicecxx . . $ gsk_vulkan_device_get_vk_device(4319e0de3864a3a5). (device);
886
887 /* First, try the actual format */
888 vk_format = gdk_memory_format_vk_formatcxx . . $ gdk_memory_format_vk_format(b8cf3792259afe28). (format, &vk_components, &needs_conversion);
889 if (try_srgb)
890 vk_srgb_format = gdk_memory_format_vk_srgb_formatcxx . . $ gdk_memory_format_vk_srgb_format(6735f5b7a9b389f8). (format);
891 if ((vk_features = gsk_vulkan_device_check_dmabuf_formatcxx . . $ gsk_vulkan_device_check_dmabuf_format(de77809220c8d133). (device, vk_srgb_format, &vk_components,
892 width, height,
893 modifiers, &n_modifiers)))
894 {
895 vk_format = vk_srgb_format;
896 }
897 else if ((vk_features = gsk_vulkan_device_check_dmabuf_formatcxx . . $ gsk_vulkan_device_check_dmabuf_format(de77809220c8d133). (device, vk_format, &vk_components,
898 width, height,
899 modifiers, &n_modifiers)))
900 {
901 /* nothing to do */
902 }
903 else
904 {
905 /* Second, try the potential RGBA format, but as a fallback */
906 GdkMemoryFormatcxx . . $ GdkMemoryFormat# rgba_format;
907 GdkSwizzlecxx . . $ GdkSwizzle# rgba_swizzle;
908 if (gdk_memory_format_get_rgba_formatcxx . . $ gdk_memory_format_get_rgba_format(55025bd1e5f58516). (format, &rgba_format, &rgba_swizzle))
909 {
910 vk_format = gdk_memory_format_vk_formatcxx . . $ gdk_memory_format_vk_format(b8cf3792259afe28). (rgba_format, &vk_components, &needs_conversion);
911 gdk_swizzle_to_vk_component_mappingcxx . . $ gdk_swizzle_to_vk_component_mapping(d93e2179a5ba439). (rgba_swizzle, &vk_components);
912 if (try_srgb)
913 vk_srgb_format = gdk_memory_format_vk_srgb_formatcxx . . $ gdk_memory_format_vk_srgb_format(6735f5b7a9b389f8). (format);
914 }
915 else
916 vk_format = vk_srgb_format = VK_FORMAT_UNDEFINEDcxx . . $ VK_FORMAT_UNDEFINED.;
917 if ((vk_features = gsk_vulkan_device_check_dmabuf_formatcxx . . $ gsk_vulkan_device_check_dmabuf_format(de77809220c8d133). (device, vk_srgb_format, &vk_components,
918 width, height,
919 modifiers, &n_modifiers)))
920 {
921 vk_format = vk_srgb_format;
922 format = rgba_format;
923 }
924 else if ((vk_features = gsk_vulkan_device_check_dmabuf_formatcxx . . $ gsk_vulkan_device_check_dmabuf_format(de77809220c8d133). (device, vk_format, &vk_components,
925 width, height,
926 modifiers, &n_modifiers)))
927 {
928 format = rgba_format;
929 }
930 else
931 {
932 const GdkMemoryFormatcxx . . $ GdkMemoryFormat# *fallbacks;
933 gsizecxx . . $ gsize# i;
934
935 /* Next, try the fallbacks */
936 fallbacks = gdk_memory_format_get_fallbackscxx . . $ gdk_memory_format_get_fallbacks(88fc4d54335d67b1). (format);
937 for (i = 0; fallbacks[i] != -1; i++)
938 {
939 vk_format = gdk_memory_format_vk_formatcxx . . $ gdk_memory_format_vk_format(b8cf3792259afe28). (fallbacks[i], &vk_components, &needs_conversion);
940 if (try_srgb)
941 vk_srgb_format = gdk_memory_format_vk_srgb_formatcxx . . $ gdk_memory_format_vk_srgb_format(6735f5b7a9b389f8). (format);
942 if ((vk_features = gsk_vulkan_device_check_dmabuf_formatcxx . . $ gsk_vulkan_device_check_dmabuf_format(de77809220c8d133). (device, vk_srgb_format, &vk_components,
943 width, height,
944 modifiers, &n_modifiers)))
945 {
946 vk_format = vk_srgb_format;
947 format = fallbacks[i];
948 break;
949 }
950 else if ((vk_features = gsk_vulkan_device_check_dmabuf_formatcxx . . $ gsk_vulkan_device_check_dmabuf_format(de77809220c8d133). (device, vk_format, &vk_components,
951 width, height,
952 modifiers, &n_modifiers)))
953 {
954 format = fallbacks[i];
955 break;
956 }
957 }
958
959 /* No format found. Likely, the width/height are too big */
960 if (fallbacks[i] == -1)
961 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
962 }
963 }
964
965 self = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GSK_TYPE_VULKAN_IMAGEcxx . . $ `gsk/gpu/gskvulkanimageprivate.h:14:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
966
967 self->devicecxx . . $ _GskVulkanImage#device. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (device);
968 self->vk_tilingcxx . . $ _GskVulkanImage#vk_tiling. = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXTcxx . . $ VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.;
969 self->vk_formatcxx . . $ _GskVulkanImage#vk_format. = vk_format;
970 self->vk_pipeline_stagecxx . . $ _GskVulkanImage#vk_pipeline_stage. = VK_PIPELINE_STAGE_TOP_OF_PIPE_BITcxx . . $ VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT.;
971 self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout. = VK_IMAGE_LAYOUT_UNDEFINEDcxx . . $ VK_IMAGE_LAYOUT_UNDEFINED.;
972 self->vk_accesscxx . . $ _GskVulkanImage#vk_access. = 0;
973
974 flags = gsk_vulkan_image_flags_for_featurescxx . . $ gsk_vulkan_image_flags_for_features(17e27be084a7d9d7). (vk_features) | GSK_GPU_IMAGE_EXTERNALcxx . . $ GSK_GPU_IMAGE_EXTERNAL.;
975
976 if (vk_format == vk_srgb_format)
977 conv = GSK_GPU_CONVERSION_SRGBcxx . . $ GSK_GPU_CONVERSION_SRGB.;
978 else
979 conv = GSK_GPU_CONVERSION_NONEcxx . . $ GSK_GPU_CONVERSION_NONE.;
980
981 if (!gsk_component_mapping_is_framebuffer_compatiblecxx . . $ gsk_component_mapping_is_framebuffer_compatible(3468eded089dc2ed). (&vk_components) || needs_conversion)
982 flags &= ~GSK_GPU_IMAGE_BLITcxx . . $ GSK_GPU_IMAGE_BLIT.;
983
984 if (needs_conversion)
985 shader_op = GDK_SHADER_DEFAULTcxx . . $ GDK_SHADER_DEFAULT.;
986 else
987 shader_op = gdk_memory_format_get_default_shader_opcxx . . $ gdk_memory_format_get_default_shader_op(5326846c0929fc0c). (format);
988
989 res = vkCreateImagecxx . . $ vkCreateImage(980188b1bb18635a). (vk_device,
990 &(VkImageCreateInfocxx . . $ VkImageCreateInfo#) {
991 .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFOcxx . . $ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO.,
992 .flags = 0,
993 .imageType = VK_IMAGE_TYPE_2Dcxx . . $ VK_IMAGE_TYPE_2D.,
994 .format = vk_format,
995 .extent = { width, height, 1 },
996 .mipLevels = 1,
997 .arrayLayers = 1,
998 .samples = VK_SAMPLE_COUNT_1_BITcxx . . $ VK_SAMPLE_COUNT_1_BIT.,
999 .tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXTcxx . . $ VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.,
1000 .usage = VK_IMAGE_USAGE_SAMPLED_BITcxx . . $ VK_IMAGE_USAGE_SAMPLED_BIT. | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BITcxx . . $ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT. |
1001 (flags & (GSK_GPU_IMAGE_BLITcxx . . $ GSK_GPU_IMAGE_BLIT. | GSK_GPU_IMAGE_DOWNLOADABLEcxx . . $ GSK_GPU_IMAGE_DOWNLOADABLE.) ? VK_IMAGE_USAGE_TRANSFER_SRC_BITcxx . . $ VK_IMAGE_USAGE_TRANSFER_SRC_BIT. : 0),
1002 .sharingMode = VK_SHARING_MODE_EXCLUSIVEcxx . . $ VK_SHARING_MODE_EXCLUSIVE.,
1003 .initialLayout = self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout.,
1004 .pNext = &(VkExternalMemoryImageCreateInfocxx . . $ VkExternalMemoryImageCreateInfo#) {
1005 .sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFOcxx . . $ VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO.,
1006 .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXTcxx . . $ VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT.,
1007 .pNext = &(VkImageDrmFormatModifierListCreateInfoEXTcxx . . $ VkImageDrmFormatModifierListCreateInfoEXT#) {
1008 .sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXTcxx . . $ VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT.,
1009 .drmFormatModifierCount = n_modifiers,
1010 .pDrmFormatModifiers = modifiers
1011 }
1012 },
1013 },
1014 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
1015 &self->vk_imagecxx . . $ _GskVulkanImage#vk_image.);
1016 if (res != VK_SUCCESScxx . . $ VK_SUCCESS.)
1017 {
1018 gsk_vulkan_handle_resultcxx . . $ gsk_vulkan_handle_result(7846cacdad6d2912). (res, "vkCreateImage");
1019 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (self);
1020 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1021 }
1022
1023 vkGetImageMemoryRequirementscxx . . $ vkGetImageMemoryRequirements(a6b81d78e8848133). (vk_device,
1024 self->vk_imagecxx . . $ _GskVulkanImage#vk_image.,
1025 &requirements);
1026
1027 memory_index = gsk_vulkan_device_find_allocatorcxx . . $ gsk_vulkan_device_find_allocator(3b98c1ed9ff9deb7). (device,
1028 requirements.memoryTypeBitscxx . . $ VkMemoryRequirements#memoryTypeBits.,
1029 0,
1030 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BITcxx . . $ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT.);
1031 self->allocatorcxx . . $ _GskVulkanImage#allocator. = gsk_vulkan_device_get_external_allocatorcxx . . $ gsk_vulkan_device_get_external_allocator(19d372d1a0656920). (device);
1032 gsk_vulkan_allocator_refcxx . . $ gsk_vulkan_allocator_ref(89e72274fd28ab01). (self->allocatorcxx . . $ _GskVulkanImage#allocator.);
1033
1034 gsk_vulkan_alloccxx . . $ gsk_vulkan_alloc(e9555ce67b338ccd). (self->allocatorcxx . . $ _GskVulkanImage#allocator.,
1035 requirements.sizecxx . . $ VkMemoryRequirements#size.,
1036 requirements.alignmentcxx . . $ VkMemoryRequirements#alignment.,
1037 &self->allocationcxx . . $ _GskVulkanImage#allocation.);
1038
1039 res = vkAllocateMemorycxx . . $ vkAllocateMemory(ffce6ec704e8416f). (vk_device,
1040 &(VkMemoryAllocateInfocxx . . $ VkMemoryAllocateInfo#) {
1041 .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFOcxx . . $ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO.,
1042 .allocationSize = requirements.sizecxx . . $ VkMemoryRequirements#size.,
1043 .memoryTypeIndex = memory_index,
1044 .pNext = &(VkExportMemoryAllocateInfocxx . . $ VkExportMemoryAllocateInfo#) {
1045 .sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFOcxx . . $ VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO.,
1046 .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXTcxx . . $ VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT.,
1047 .pNext = &(VkMemoryDedicatedAllocateInfocxx . . $ VkMemoryDedicatedAllocateInfo#) {
1048 .sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFOcxx . . $ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO.,
1049 .image = self->vk_imagecxx . . $ _GskVulkanImage#vk_image.,
1050 },
1051 },
1052 },
1053 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
1054 &self->allocationcxx . . $ _GskVulkanImage#allocation..vk_memorycxx . . $ _GskVulkanAllocation#vk_memory.);
1055 if (res != VK_SUCCESScxx . . $ VK_SUCCESS.)
1056 {
1057 gsk_vulkan_handle_resultcxx . . $ gsk_vulkan_handle_result(7846cacdad6d2912). (res, "vkAllocateMemory");
1058 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (self);
1059 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1060 }
1061
1062 GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (vkBindImageMemory, vk_device,
1063 self->vk_image,
1064 self->allocation.vk_memory,
1065 self->allocation.offset);
1066
1067 if (needs_conversion)
1068 {
1069 self->ycbcrcxx . . $ _GskVulkanImage#ycbcr. = gsk_vulkan_ycbcr_getcxx . . $ gsk_vulkan_ycbcr_get(1924c2a1ca461aa0). (device,
1070 &(GskVulkanYcbcrInfocxx . . $ GskVulkanYcbcrInfo#) {
1071 .vk_format = vk_format,
1072 .vk_features = vk_features,
1073 .vk_components = vk_components,
1074 .vk_ycbcr_model = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITYcxx . . $ VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY.,
1075 .vk_ycbcr_range = VK_SAMPLER_YCBCR_RANGE_ITU_FULLcxx . . $ VK_SAMPLER_YCBCR_RANGE_ITU_FULL.,
1076 });
1077 gsk_vulkan_ycbcr_refcxx . . $ gsk_vulkan_ycbcr_ref(4bce327b04ab8794). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.);
1078 if (!gsk_vulkan_ycbcr_is_filterablecxx . . $ gsk_vulkan_ycbcr_is_filterable(3da581327ae55198). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.))
1079 flags &= ~(GSK_GPU_IMAGE_FILTERABLEcxx . . $ GSK_GPU_IMAGE_FILTERABLE.);
1080 vk_conversion = gsk_vulkan_ycbcr_get_vk_conversioncxx . . $ gsk_vulkan_ycbcr_get_vk_conversion(dc9f0bf7e829fc64). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.);
1081 }
1082 else
1083 vk_conversion = VK_NULL_HANDLEcxx . . $ `<external>/13734482859137699468/vulkan_core.h:43:21`!;
1084
1085 gsk_gpu_image_setupcxx . . $ gsk_gpu_image_setup(6cddd1d066e686d8). (GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self),
1086 flags,
1087 conv,
1088 shader_op,
1089 format,
1090 width, height);
1091
1092 gsk_vulkan_image_create_viewcxx . . $ gsk_vulkan_image_create_view(c995d2fb44cd1749). (self, vk_format, &vk_components, vk_conversion);
1093
1094 return GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self);
1095 }
1096
1097 GskGpuImagecxx . . $ GskGpuImage# *
1098 gsk_vulkan_image_new_for_dmabufcxx . . $ gsk_vulkan_image_new_for_dmabuf(cf1eca32ca887970). (GskVulkanDevicecxx . . $ GskVulkanDevice# *device,
1099 gsizecxx . . $ gsize# width,
1100 gsizecxx . . $ gsize# height,
1101 const GdkDmabufcxx . . $ GdkDmabuf# *dmabuf,
1102 gbooleancxx . . $ gboolean# premultiplied,
1103 GskGpuConversioncxx . . $ GskGpuConversion# conv)
1104 {
1105 GskVulkanImagecxx . . $ GskVulkanImage# *self;
1106 VkDevicecxx . . $ VkDevice# vk_device;
1107 VkFormatcxx . . $ VkFormat# vk_format;
1108 VkComponentMappingcxx . . $ VkComponentMapping# vk_components;
1109 VkSamplerYcbcrConversioncxx . . $ VkSamplerYcbcrConversion# vk_conversion;
1110 VkSamplerYcbcrModelConversioncxx . . $ VkSamplerYcbcrModelConversion# model;
1111 VkSamplerYcbcrRangecxx . . $ VkSamplerYcbcrRange# range;
1112 PFN_vkGetMemoryFdPropertiesKHRcxx . . $ PFN_vkGetMemoryFdPropertiesKHR# func_vkGetMemoryFdPropertiesKHR;
1113 VkFormatFeatureFlagscxx . . $ VkFormatFeatureFlags# vk_features;
1114 VkMemoryFdPropertiesKHRcxx . . $ VkMemoryFdPropertiesKHR# fd_props = {
1115 .sType = VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHRcxx . . $ VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR.,
1116 };
1117 VkMemoryRequirements2cxx . . $ VkMemoryRequirements2# requirements = {
1118 .sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2cxx . . $ VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2.,
1119 };
1120 gsizecxx . . $ gsize# memory_index;
1121 int fd;
1122 VkResultcxx . . $ VkResult# res;
1123 GdkMemoryFormatcxx . . $ GdkMemoryFormat# format;
1124 GskGpuImageFlagscxx . . $ GskGpuImageFlags# flags;
1125 GdkShaderOpcxx . . $ GdkShaderOp# shader_op;
1126 gbooleancxx . . $ gboolean# is_yuv, needs_conversion;
1127
1128 if (!gsk_vulkan_device_has_featurecxx . . $ gsk_vulkan_device_has_feature(b413dc2ca189b5dd). (device, GDK_VULKAN_FEATURE_DMABUFcxx . . $ GDK_VULKAN_FEATURE_DMABUF.))
1129 {
1130 GDK_DEBUGcxx . . $ `gdk/gdkdebugprivate.h:138:9`! (DMABUF, "Vulkan does not support dmabufs");
1131 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1132 }
1133
1134 if (gdk_memory_format_find_by_dmabuf_fourcccxx . . $ gdk_memory_format_find_by_dmabuf_fourcc(99557810107d2563). (dmabuf->fourcccxx . . $ _GdkDmabuf#fourcc., premultiplied, &format, &is_yuv))
1135 {
1136 vk_format = gdk_memory_format_vk_formatcxx . . $ gdk_memory_format_vk_format(b8cf3792259afe28). (format, &vk_components, &needs_conversion);
1137 }
1138 else
1139 {
1140 GDK_DEBUGcxx . . $ `gdk/gdkdebugprivate.h:138:9`! (DMABUF, "GTK's Vulkan doesn't support fourcc %.4s", (char *) &dmabuf->fourcc);
1141 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1142 }
1143
1144 vk_device = gsk_vulkan_device_get_vk_devicecxx . . $ gsk_vulkan_device_get_vk_device(4319e0de3864a3a5). (device);
1145 func_vkGetMemoryFdPropertiesKHR = (PFN_vkGetMemoryFdPropertiesKHRcxx . . $ PFN_vkGetMemoryFdPropertiesKHR#) vkGetDeviceProcAddrcxx . . $ vkGetDeviceProcAddr(29d0f37f971a0e47). (vk_device, "vkGetMemoryFdPropertiesKHR");
1146
1147 /* FIXME: Add support for disjoint images */
1148 if (gdk_dmabuf_is_disjointcxx . . $ gdk_dmabuf_is_disjoint(f6b09399bc10708). (dmabuf))
1149 {
1150 GDK_DEBUGcxx . . $ `gdk/gdkdebugprivate.h:138:9`! (DMABUF, "FIXME: Add support for disjoint dmabufs to Vulkan");
1151 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1152 }
1153
1154 vk_features = gsk_vulkan_device_get_format_featurescxx . . $ gsk_vulkan_device_get_format_features(d323b03bf76e494). (device,
1155 vk_format,
1156 dmabuf->modifiercxx . . $ _GdkDmabuf#modifier.,
1157 dmabuf->n_planescxx . . $ _GdkDmabuf#n_planes.,
1158 VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXTcxx . . $ VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.,
1159 VK_IMAGE_USAGE_SAMPLED_BITcxx . . $ VK_IMAGE_USAGE_SAMPLED_BIT.);
1160 if (!(vk_features & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BITcxx . . $ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT.))
1161 {
1162 GDK_DEBUGcxx . . $ `gdk/gdkdebugprivate.h:138:9`! (DMABUF, "Vulkan driver does not support format %.4s::%016llx with %u planes",
1163 (char *) &dmabuf->fourcc, (unsigned long long) dmabuf->modifier, dmabuf->n_planes);
1164 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1165 }
1166 if (!gsk_vulkan_ycbcr_is_supportedcxx . . $ gsk_vulkan_ycbcr_is_supported(4c679297bf94b9eb). (vk_features))
1167 {
1168 if (needs_conversion)
1169 {
1170 GDK_DEBUGcxx . . $ `gdk/gdkdebugprivate.h:138:9`! (DMABUF, "Vulkan driver broken: Can't do YCbcrConversion for YCbcr format %.4s::%016llx with %u planes",
1171 (char *) &dmabuf->fourcc, (unsigned long long) dmabuf->modifier, dmabuf->n_planes);
1172 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1173 }
1174 conv = GSK_GPU_CONVERSION_NONEcxx . . $ GSK_GPU_CONVERSION_NONE.;
1175 }
1176 flags = gsk_vulkan_image_flags_for_featurescxx . . $ gsk_vulkan_image_flags_for_features(17e27be084a7d9d7). (vk_features) & ~(GSK_GPU_IMAGE_RENDERABLEcxx . . $ GSK_GPU_IMAGE_RENDERABLE.);
1177
1178 self = g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GSK_TYPE_VULKAN_IMAGEcxx . . $ `gsk/gpu/gskvulkanimageprivate.h:14:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1179
1180 self->devicecxx . . $ _GskVulkanImage#device. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (device);
1181 self->vk_tilingcxx . . $ _GskVulkanImage#vk_tiling. = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXTcxx . . $ VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.;
1182 self->vk_formatcxx . . $ _GskVulkanImage#vk_format. = vk_format;
1183 self->vk_pipeline_stagecxx . . $ _GskVulkanImage#vk_pipeline_stage. = VK_PIPELINE_STAGE_TOP_OF_PIPE_BITcxx . . $ VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT.;
1184 self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout. = VK_IMAGE_LAYOUT_GENERALcxx . . $ VK_IMAGE_LAYOUT_GENERAL.;
1185 self->vk_accesscxx . . $ _GskVulkanImage#vk_access. = 0;
1186
1187 res = vkCreateImagecxx . . $ vkCreateImage(980188b1bb18635a). (vk_device,
1188 &(VkImageCreateInfocxx . . $ VkImageCreateInfo#) {
1189 .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFOcxx . . $ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO.,
1190 .flags = 0, //disjoint ? VK_IMAGE_CREATE_DISJOINT_BIT : 0,
1191 .imageType = VK_IMAGE_TYPE_2Dcxx . . $ VK_IMAGE_TYPE_2D.,
1192 .format = vk_format,
1193 .extent = { width, height, 1 },
1194 .mipLevels = 1,
1195 .arrayLayers = 1,
1196 .samples = VK_SAMPLE_COUNT_1_BITcxx . . $ VK_SAMPLE_COUNT_1_BIT.,
1197 .tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXTcxx . . $ VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.,
1198 .usage = VK_IMAGE_USAGE_SAMPLED_BITcxx . . $ VK_IMAGE_USAGE_SAMPLED_BIT. |
1199 (flags & (GSK_GPU_IMAGE_BLITcxx . . $ GSK_GPU_IMAGE_BLIT. | GSK_GPU_IMAGE_DOWNLOADABLEcxx . . $ GSK_GPU_IMAGE_DOWNLOADABLE.) ? VK_IMAGE_USAGE_TRANSFER_SRC_BITcxx . . $ VK_IMAGE_USAGE_TRANSFER_SRC_BIT. : 0),
1200 .sharingMode = VK_SHARING_MODE_EXCLUSIVEcxx . . $ VK_SHARING_MODE_EXCLUSIVE.,
1201 .initialLayout = self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout.,
1202 .pNext = &(VkExternalMemoryImageCreateInfocxx . . $ VkExternalMemoryImageCreateInfo#) {
1203 .sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFOcxx . . $ VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO.,
1204 .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXTcxx . . $ VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT.,
1205 .pNext = &(VkImageDrmFormatModifierExplicitCreateInfoEXTcxx . . $ VkImageDrmFormatModifierExplicitCreateInfoEXT#) {
1206 .sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXTcxx . . $ VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT.,
1207 .drmFormatModifier = dmabuf->modifiercxx . . $ _GdkDmabuf#modifier.,
1208 .drmFormatModifierPlaneCount = dmabuf->n_planescxx . . $ _GdkDmabuf#n_planes.,
1209 .pPlaneLayouts = (VkSubresourceLayoutcxx . . $ VkSubresourceLayout#[4]) {
1210 {
1211 .offset = dmabuf->planescxx . . $ _GdkDmabuf#planes.[0].offsetcxx . . $ _GdkDmabuf#$anonymous_type_0#offset.,
1212 .rowPitch = dmabuf->planescxx . . $ _GdkDmabuf#planes.[0].stridecxx . . $ _GdkDmabuf#$anonymous_type_0#stride.,
1213 },
1214 {
1215 .offset = dmabuf->planescxx . . $ _GdkDmabuf#planes.[1].offsetcxx . . $ _GdkDmabuf#$anonymous_type_0#offset.,
1216 .rowPitch = dmabuf->planescxx . . $ _GdkDmabuf#planes.[1].stridecxx . . $ _GdkDmabuf#$anonymous_type_0#stride.,
1217 },
1218 {
1219 .offset = dmabuf->planescxx . . $ _GdkDmabuf#planes.[2].offsetcxx . . $ _GdkDmabuf#$anonymous_type_0#offset.,
1220 .rowPitch = dmabuf->planescxx . . $ _GdkDmabuf#planes.[2].stridecxx . . $ _GdkDmabuf#$anonymous_type_0#stride.,
1221 },
1222 {
1223 .offset = dmabuf->planescxx . . $ _GdkDmabuf#planes.[3].offsetcxx . . $ _GdkDmabuf#$anonymous_type_0#offset.,
1224 .rowPitch = dmabuf->planescxx . . $ _GdkDmabuf#planes.[3].stridecxx . . $ _GdkDmabuf#$anonymous_type_0#stride.,
1225 },
1226 },
1227 }
1228 },
1229 },
1230 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
1231 &self->vk_imagecxx . . $ _GskVulkanImage#vk_image.);
1232 if (res != VK_SUCCESScxx . . $ VK_SUCCESS.)
1233 {
1234 GDK_DEBUGcxx . . $ `gdk/gdkdebugprivate.h:138:9`! (DMABUF, "vkCreateImage() failed: %s", gdk_vulkan_strerror (res));
1235 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (self);
1236 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1237 }
1238
1239 if (needs_conversion)
1240 flags |= GSK_GPU_IMAGE_EXTERNALcxx . . $ GSK_GPU_IMAGE_EXTERNAL.;
1241 if (needs_conversion || !gsk_component_mapping_is_framebuffer_compatiblecxx . . $ gsk_component_mapping_is_framebuffer_compatible(3468eded089dc2ed). (&vk_components))
1242 flags &= ~GSK_GPU_IMAGE_BLITcxx . . $ GSK_GPU_IMAGE_BLIT.;
1243
1244 if (gsk_vulkan_get_ycbcr_flagscxx . . $ gsk_vulkan_get_ycbcr_flags(c0e49c9c417fca4). (conv, &model, &range) || needs_conversion)
1245 {
1246 self->ycbcrcxx . . $ _GskVulkanImage#ycbcr. = gsk_vulkan_ycbcr_getcxx . . $ gsk_vulkan_ycbcr_get(1924c2a1ca461aa0). (device,
1247 &(GskVulkanYcbcrInfocxx . . $ GskVulkanYcbcrInfo#) {
1248 .vk_format = vk_format,
1249 .vk_features = vk_features,
1250 .vk_components = vk_components,
1251 .vk_ycbcr_model = model,
1252 .vk_ycbcr_range = range,
1253 });
1254 gsk_vulkan_ycbcr_refcxx . . $ gsk_vulkan_ycbcr_ref(4bce327b04ab8794). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.);
1255 if (!gsk_vulkan_ycbcr_is_filterablecxx . . $ gsk_vulkan_ycbcr_is_filterable(3da581327ae55198). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.))
1256 flags &= ~(GSK_GPU_IMAGE_FILTERABLEcxx . . $ GSK_GPU_IMAGE_FILTERABLE.);
1257 vk_conversion = gsk_vulkan_ycbcr_get_vk_conversioncxx . . $ gsk_vulkan_ycbcr_get_vk_conversion(dc9f0bf7e829fc64). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.);
1258 shader_op = GDK_SHADER_DEFAULTcxx . . $ GDK_SHADER_DEFAULT.;
1259 }
1260 else
1261 {
1262 vk_conversion = VK_NULL_HANDLEcxx . . $ `<external>/13734482859137699468/vulkan_core.h:43:21`!;
1263 shader_op = gdk_memory_format_get_default_shader_opcxx . . $ gdk_memory_format_get_default_shader_op(5326846c0929fc0c). (format);
1264 }
1265
1266 gsk_gpu_image_setupcxx . . $ gsk_gpu_image_setup(6cddd1d066e686d8). (GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self),
1267 flags,
1268 conv,
1269 shader_op,
1270 format,
1271 width, height);
1272
1273 fd = fcntlcxx . . $ fcntl(cac4efb70f20a0fb). (dmabuf->planescxx . . $ _GdkDmabuf#planes.[0].fdcxx . . $ _GdkDmabuf#$anonymous_type_0#fd., F_DUPFD_CLOEXECcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:214:10`!, (int) 3);
1274 if (fd < 0)
1275 {
1276 GDK_DEBUGcxx . . $ `gdk/gdkdebugprivate.h:138:9`! (DMABUF, "Vulkan failed to dup() fd: %s", g_strerror (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
1277 vkDestroyImagecxx . . $ vkDestroyImage(3e69a458d7ef6a33). (vk_device, self->vk_imagecxx . . $ _GskVulkanImage#vk_image., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
•1278 self->vk_imagecxx . . $ _GskVulkanImage#vk_image. = VK_NULL_HANDLEcxx . . $ `<external>/13734482859137699468/vulkan_core.h:43:21`!;
1279 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (self);
1280 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1281 }
1282
1283 GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (func_vkGetMemoryFdPropertiesKHR, vk_device,
1284 VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
1285 fd,
1286 &fd_props);
1287
1288 vkGetImageMemoryRequirements2cxx . . $ vkGetImageMemoryRequirements2(28e33f58ca2c867b). (vk_device,
1289 &(VkImageMemoryRequirementsInfo2cxx . . $ VkImageMemoryRequirementsInfo2#) {
1290 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2cxx . . $ VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2.,
1291 .image = self->vk_imagecxx . . $ _GskVulkanImage#vk_image.,
1292 },
1293 &requirements);
1294
1295 if (gsk_vulkan_device_has_featurecxx . . $ gsk_vulkan_device_has_feature(b413dc2ca189b5dd). (device, GDK_VULKAN_FEATURE_SEMAPHORE_IMPORTcxx . . $ GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT.))
1296 {
1297 int sync_file_fd = gdk_dmabuf_export_sync_filecxx . . $ gdk_dmabuf_export_sync_file(b223e862534b1804). (fd, DMA_BUF_SYNC_READcxx . . $ `<external>/2383884457642537125/dma-buf.h:79:9`!);
1298 if (sync_file_fd >= 0)
1299 {
1300 PFN_vkImportSemaphoreFdKHRcxx . . $ PFN_vkImportSemaphoreFdKHR# func_vkImportSemaphoreFdKHR;
1301 func_vkImportSemaphoreFdKHR = (PFN_vkImportSemaphoreFdKHRcxx . . $ PFN_vkImportSemaphoreFdKHR#) vkGetDeviceProcAddrcxx . . $ vkGetDeviceProcAddr(29d0f37f971a0e47). (vk_device, "vkImportSemaphoreFdKHR");
1302
1303 GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (vkCreateSemaphore, vk_device,
1304 &(VkSemaphoreCreateInfo) {
1305 .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,
1306 },
1307 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
1308 &self->vk_semaphore);
1309
1310 GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (func_vkImportSemaphoreFdKHR, vk_device,
1311 &(VkImportSemaphoreFdInfoKHR) {
1312 .sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR,
1313 .handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT,
1314 .flags = VK_SEMAPHORE_IMPORT_TEMPORARY_BIT,
1315 .semaphore = self->vk_semaphore,
1316 .fd = sync_file_fd,
1317 });
1318 }
1319 }
1320
1321 memory_index = gsk_vulkan_device_find_allocatorcxx . . $ gsk_vulkan_device_find_allocator(3b98c1ed9ff9deb7). (device,
1322 fd_props.memoryTypeBitscxx . . $ VkMemoryFdPropertiesKHR#memoryTypeBits.,
1323 0,
1324 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BITcxx . . $ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT.);
1325 self->allocatorcxx . . $ _GskVulkanImage#allocator. = gsk_vulkan_device_get_external_allocatorcxx . . $ gsk_vulkan_device_get_external_allocator(19d372d1a0656920). (device);
1326 gsk_vulkan_allocator_refcxx . . $ gsk_vulkan_allocator_ref(89e72274fd28ab01). (self->allocatorcxx . . $ _GskVulkanImage#allocator.);
1327 gsk_vulkan_alloccxx . . $ gsk_vulkan_alloc(e9555ce67b338ccd). (self->allocatorcxx . . $ _GskVulkanImage#allocator.,
1328 requirements.memoryRequirementscxx . . $ VkMemoryRequirements2#memoryRequirements..sizecxx . . $ VkMemoryRequirements#size.,
1329 requirements.memoryRequirementscxx . . $ VkMemoryRequirements2#memoryRequirements..alignmentcxx . . $ VkMemoryRequirements#alignment.,
1330 &self->allocationcxx . . $ _GskVulkanImage#allocation.);
1331
1332 res = vkAllocateMemorycxx . . $ vkAllocateMemory(ffce6ec704e8416f). (vk_device,
1333 &(VkMemoryAllocateInfocxx . . $ VkMemoryAllocateInfo#) {
1334 .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFOcxx . . $ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO.,
1335 .allocationSize = requirements.memoryRequirementscxx . . $ VkMemoryRequirements2#memoryRequirements..sizecxx . . $ VkMemoryRequirements#size.,
1336 .memoryTypeIndex = memory_index,
1337 .pNext = &(VkImportMemoryFdInfoKHRcxx . . $ VkImportMemoryFdInfoKHR#) {
1338 .sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHRcxx . . $ VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR.,
1339 .handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXTcxx . . $ VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT.,
1340 .fd = fd,
1341 .pNext = &(VkMemoryDedicatedAllocateInfocxx . . $ VkMemoryDedicatedAllocateInfo#) {
1342 .sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFOcxx . . $ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO.,
1343 .image = self->vk_imagecxx . . $ _GskVulkanImage#vk_image.,
1344 }
1345 }
1346 },
1347 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
1348 &self->allocationcxx . . $ _GskVulkanImage#allocation..vk_memorycxx . . $ _GskVulkanAllocation#vk_memory.);
1349 if (res != VK_SUCCESScxx . . $ VK_SUCCESS.)
1350 {
1351 GDK_DEBUGcxx . . $ `gdk/gdkdebugprivate.h:138:9`! (DMABUF, "vkAllocateMemory() failed: %s", gdk_vulkan_strerror (res));
1352 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (self);
1353 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1354 }
1355
1356 GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (vkBindImageMemory2, gsk_vulkan_device_get_vk_device (self->device),
1357 1,
1358 &(VkBindImageMemoryInfo) {
1359 .sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,
1360 .image = self->vk_image,
1361 .memory = self->allocation.vk_memory,
1362 .memoryOffset = self->allocation.offset,
1363 });
1364
1365 gsk_vulkan_image_create_viewcxx . . $ gsk_vulkan_image_create_view(c995d2fb44cd1749). (self, vk_format, &vk_components, vk_conversion);
1366
1367 GDK_DEBUGcxx . . $ `gdk/gdkdebugprivate.h:138:9`! (DMABUF, "Vulkan uploaded %zux%zu %.4s:%016llx %sdmabuf",
1368 width, height,
1369 (char *) &dmabuf->fourcc, (unsigned long long) dmabuf->modifier,
1370 is_yuv ? "YUV " : "");
1371
1372 return GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self);
1373 }
1374
1375 static void
1376 close_the_fdcxx . . $ close_the_fd(5d22bdacc48458e8). (gpointercxx . . $ gpointer# the_fd)
1377 {
1378 closecxx . . $ close(7864480464b09eea). (GPOINTER_TO_INTcxx . . $ `<external>/10505296616216143549/glibconfig.h:103:9`! (the_fd));
1379 }
1380
1381 static guintcxx . . $ guint#
1382 gsk_vulkan_image_get_n_planescxx . . $ gsk_vulkan_image_get_n_planes(2693acaa992cf2a9). (GskVulkanImagecxx . . $ GskVulkanImage# *self,
1383 guint64cxx . . $ guint64# modifier)
1384 {
1385 VkDrmFormatModifierPropertiesEXTcxx . . $ VkDrmFormatModifierPropertiesEXT# drm_mod_properties[100];
1386 VkDrmFormatModifierPropertiesListEXTcxx . . $ VkDrmFormatModifierPropertiesListEXT# drm_properties = {
1387 .sType = VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXTcxx . . $ VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT.,
1388 .drmFormatModifierCount = G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (drm_mod_properties),
1389 .pDrmFormatModifierProperties = drm_mod_properties,
1390 };
1391 VkFormatProperties2cxx . . $ VkFormatProperties2# properties = {
1392 .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2cxx . . $ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2.,
1393 .pNext = &drm_properties
1394 };
1395 gsizecxx . . $ gsize# i;
1396
1397 vkGetPhysicalDeviceFormatProperties2cxx . . $ vkGetPhysicalDeviceFormatProperties2(5ffc95bfbb3a6bc7). (gsk_vulkan_device_get_vk_physical_devicecxx . . $ gsk_vulkan_device_get_vk_physical_device(fbb7f33f5baaff7). (self->devicecxx . . $ _GskVulkanImage#device.),
1398 self->vk_formatcxx . . $ _GskVulkanImage#vk_format.,
1399 &properties);
1400
1401 for (i = 0; i < drm_properties.drmFormatModifierCountcxx . . $ VkDrmFormatModifierPropertiesListEXT#drmFormatModifierCount.; i++)
1402 {
1403 if (drm_mod_properties[i].drmFormatModifiercxx . . $ VkDrmFormatModifierPropertiesEXT#drmFormatModifier. == modifier)
1404 return drm_mod_properties[i].drmFormatModifierPlaneCountcxx . . $ VkDrmFormatModifierPropertiesEXT#drmFormatModifierPlaneCount.;
1405 }
1406
1407 g_return_val_if_reachedcxx . . $ `<external>/5169755362661750954/gmessages.h:689:9`! (0);
1408 }
1409
1410 GdkTexturecxx . . $ GdkTexture# *
1411 gsk_vulkan_image_to_dmabuf_texturecxx . . $ gsk_vulkan_image_to_dmabuf_texture(e020573b4f9730e). (GskVulkanImagecxx . . $ GskVulkanImage# *self,
1412 GdkColorStatecxx . . $ GdkColorState# *color_state)
1413 {
1414 GskGpuImagecxx . . $ GskGpuImage# *image = GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self);
1415 GdkDmabufTextureBuildercxx . . $ GdkDmabufTextureBuilder# *builder;
1416 GErrorcxx . . $ GError# *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1417 PFN_vkGetImageDrmFormatModifierPropertiesEXTcxx . . $ PFN_vkGetImageDrmFormatModifierPropertiesEXT# func_vkGetImageDrmFormatModifierPropertiesEXT;
1418 PFN_vkGetMemoryFdKHRcxx . . $ PFN_vkGetMemoryFdKHR# func_vkGetMemoryFdKHR;
1419 VkImageDrmFormatModifierPropertiesEXTcxx . . $ VkImageDrmFormatModifierPropertiesEXT# properties = {
1420 .sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXTcxx . . $ VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT.,
1421 };
1422 VkSubresourceLayoutcxx . . $ VkSubresourceLayout# layout;
1423 VkDevicecxx . . $ VkDevice# vk_device;
1424 GdkTexturecxx . . $ GdkTexture# *texture;
1425 GdkMemoryFormatcxx . . $ GdkMemoryFormat# format;
1426 VkResultcxx . . $ VkResult# res;
1427 guint32cxx . . $ guint32# fourcc;
1428 int fd;
1429 guintcxx . . $ guint# plane, n_planes;
1430
1431 if (!(gsk_gpu_image_get_flagscxx . . $ gsk_gpu_image_get_flags(5c3e52b92b0ce578). (image) & GSK_GPU_IMAGE_EXTERNALcxx . . $ GSK_GPU_IMAGE_EXTERNAL.))
1432 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
1433
1434 format = gsk_gpu_image_get_formatcxx . . $ gsk_gpu_image_get_format(48c0d736573b6e75). (image);
1435 fourcc = gdk_memory_format_get_dmabuf_rgb_fourcccxx . . $ gdk_memory_format_get_dmabuf_rgb_fourcc(a3ba24a75bc20aa0). (format);
1436 if (fourcc == 0)
1437 fourcc = gdk_memory_format_get_dmabuf_yuv_fourcccxx . . $ gdk_memory_format_get_dmabuf_yuv_fourcc(a3ba24a75bc20aa0). (format);
1438 if (fourcc == 0)
1439 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
1440
1441 vk_device = gsk_vulkan_device_get_vk_devicecxx . . $ gsk_vulkan_device_get_vk_device(4319e0de3864a3a5). (self->devicecxx . . $ _GskVulkanImage#device.);
1442
1443 func_vkGetImageDrmFormatModifierPropertiesEXT = (PFN_vkGetImageDrmFormatModifierPropertiesEXTcxx . . $ PFN_vkGetImageDrmFormatModifierPropertiesEXT#)
1444 vkGetDeviceProcAddrcxx . . $ vkGetDeviceProcAddr(29d0f37f971a0e47). (vk_device, "vkGetImageDrmFormatModifierPropertiesEXT");
1445 func_vkGetMemoryFdKHR = (PFN_vkGetMemoryFdKHRcxx . . $ PFN_vkGetMemoryFdKHR#) vkGetDeviceProcAddrcxx . . $ vkGetDeviceProcAddr(29d0f37f971a0e47). (vk_device, "vkGetMemoryFdKHR");
1446 res = GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (func_vkGetImageDrmFormatModifierPropertiesEXT, vk_device, self->vk_image, &properties);
1447 if (res != VK_SUCCESScxx . . $ VK_SUCCESS.)
1448 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
1449 n_planes = gsk_vulkan_image_get_n_planescxx . . $ gsk_vulkan_image_get_n_planes(2693acaa992cf2a9). (self, properties.drmFormatModifiercxx . . $ VkImageDrmFormatModifierPropertiesEXT#drmFormatModifier.);
1450 if (n_planes == 0 || n_planes > GDK_DMABUF_MAX_PLANEScxx . . $ `gdk/gdkdmabufprivate.h:10:9`!)
1451 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
1452 res = GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (func_vkGetMemoryFdKHR, vk_device,
1453 &(VkMemoryGetFdInfoKHR) {
1454 .sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR,
1455 .memory = self->allocation.vk_memory,
1456 .handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
1457 },
1458 &fd);
1459 if (res != VK_SUCCESScxx . . $ VK_SUCCESS.)
1460 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
1461
1462 builder = gdk_dmabuf_texture_builder_newcxx . . $ gdk_dmabuf_texture_builder_new(3ac516e86cd7e87e). ();
1463 gdk_dmabuf_texture_builder_set_displaycxx . . $ gdk_dmabuf_texture_builder_set_display(a287a5162a42ca05). (builder, gsk_gpu_device_get_displaycxx . . $ gsk_gpu_device_get_display(4085a5602869895b). (GSK_GPU_DEVICEcxx . . $ `gsk/gpu/gskgpudeviceprivate.h:10:9`! (self->device)));
1464 gdk_dmabuf_texture_builder_set_widthcxx . . $ gdk_dmabuf_texture_builder_set_width(c5a74fad691ad46). (builder, gsk_gpu_image_get_widthcxx . . $ gsk_gpu_image_get_width(4bdeec44aa36e037). (image));
1465 gdk_dmabuf_texture_builder_set_heightcxx . . $ gdk_dmabuf_texture_builder_set_height(c5a74fad691ad46). (builder, gsk_gpu_image_get_heightcxx . . $ gsk_gpu_image_get_height(4bdeec44aa36e037). (image));
1466 gdk_dmabuf_texture_builder_set_fourcccxx . . $ gdk_dmabuf_texture_builder_set_fourcc(c5a74fad691ad46). (builder, fourcc);
1467 gdk_dmabuf_texture_builder_set_modifiercxx . . $ gdk_dmabuf_texture_builder_set_modifier(d523176e4bb167c2). (builder, properties.drmFormatModifiercxx . . $ VkImageDrmFormatModifierPropertiesEXT#drmFormatModifier.);
1468 gdk_dmabuf_texture_builder_set_premultipliedcxx . . $ gdk_dmabuf_texture_builder_set_premultiplied(8849e63316d6d93d). (builder, gdk_memory_format_alphacxx . . $ gdk_memory_format_alpha(f49b74239c5d66df). (format) != GDK_MEMORY_ALPHA_STRAIGHTcxx . . $ GDK_MEMORY_ALPHA_STRAIGHT.);
1469 gdk_dmabuf_texture_builder_set_n_planescxx . . $ gdk_dmabuf_texture_builder_set_n_planes(c5a74fad691ad46). (builder, n_planes);
1470 gdk_dmabuf_texture_builder_set_color_statecxx . . $ gdk_dmabuf_texture_builder_set_color_state(e9353b12365bed84). (builder, color_state);
1471
1472 gdk_dmabuf_texture_builder_set_fdcxx . . $ gdk_dmabuf_texture_builder_set_fd(13b1190cfba6cca). (builder, 0, fd);
1473
1474 for (plane = 0; plane < n_planes; plane++)
1475 {
1476 static const VkImageAspectFlagBitscxx . . $ VkImageAspectFlagBits# aspect[GDK_DMABUF_MAX_PLANEScxx . . $ `gdk/gdkdmabufprivate.h:10:9`!] = {
1477 VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXTcxx . . $ VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT.,
1478 VK_IMAGE_ASPECT_MEMORY_PLANE_1_BIT_EXTcxx . . $ VK_IMAGE_ASPECT_MEMORY_PLANE_1_BIT_EXT.,
1479 VK_IMAGE_ASPECT_MEMORY_PLANE_2_BIT_EXTcxx . . $ VK_IMAGE_ASPECT_MEMORY_PLANE_2_BIT_EXT.,
1480 VK_IMAGE_ASPECT_MEMORY_PLANE_3_BIT_EXTcxx . . $ VK_IMAGE_ASPECT_MEMORY_PLANE_3_BIT_EXT.
1481 };
1482 vkGetImageSubresourceLayoutcxx . . $ vkGetImageSubresourceLayout(fb26ff27536c7d04). (vk_device,
1483 self->vk_imagecxx . . $ _GskVulkanImage#vk_image.,
1484 &(VkImageSubresourcecxx . . $ VkImageSubresource#) {
1485 .aspectMask = aspect[plane],
1486 .mipLevel = 0,
1487 .arrayLayer = 0
1488 },
1489 &layout);
1490 gdk_dmabuf_texture_builder_set_stridecxx . . $ gdk_dmabuf_texture_builder_set_stride(99111c64f93fa375). (builder, plane, layout.rowPitchcxx . . $ VkSubresourceLayout#rowPitch.);
1491 gdk_dmabuf_texture_builder_set_offsetcxx . . $ gdk_dmabuf_texture_builder_set_offset(99111c64f93fa375). (builder, plane, layout.offsetcxx . . $ VkSubresourceLayout#offset.);
1492 }
1493
1494 texture = gdk_dmabuf_texture_builder_buildcxx . . $ gdk_dmabuf_texture_builder_build(351b6e640d4c3b36). (builder, close_the_fdcxx . . $ close_the_fd(5d22bdacc48458e8)., GINT_TO_POINTERcxx . . $ `<external>/10505296616216143549/glibconfig.h:106:9`! (fd), &error);
1495 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (builder);
1496 if (texture == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
1497 {
1498 GDK_DEBUGcxx . . $ `gdk/gdkdebugprivate.h:138:9`! (VULKAN, "Failed to create dmabuf texture: %s", error->message);
1499 g_clear_errorcxx . . $ g_clear_error(19f343512d040fc2). (&error);
1500 closecxx . . $ close(7864480464b09eea). (fd);
1501 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1502 }
1503
1504 gsk_gpu_image_toggle_ref_texturecxx . . $ gsk_gpu_image_toggle_ref_texture(4dcee13dd32f5a35). (GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self), texture);
1505
1506 return texture;
1507 }
1508 #endif
1509
1510 #ifdef GDK_WINDOWING_WIN32
1511 static gboolean
1512 gsk_vulkan_is_same_device (VkDevice vk_device,
1513 ID3D12DeviceChild *child)
1514 {
1515 /* FIXME: implement */
1516 return TRUE;
1517 }
1518
1519 GskGpuImage *
1520 gsk_vulkan_image_new_for_d3d12resource (GskVulkanDevice *device,
1521 ID3D12Resource *resource,
1522 HANDLE resource_handle,
1523 ID3D12Fence *fence,
1524 HANDLE fence_handle,
1525 guint64 fence_wait,
1526 gboolean premultiplied)
1527 {
1528 GskVulkanImage *self;
1529 VkDevice vk_device;
1530 VkFormat vk_format;
1531 VkFormatFeatureFlags vk_features;
1532 VkComponentMapping vk_components;
1533 VkSamplerYcbcrConversion vk_conversion;
1534 PFN_vkGetMemoryWin32HandlePropertiesKHR func_vkGetMemoryWin32HandlePropertiesKHR;
1535 VkResult res;
1536 GdkMemoryFormat format;
1537 GdkShaderOp shader_op;
1538 GskGpuImageFlags flags;
1539 D3D12_RESOURCE_DESC desc;
1540 gsize memory_index;
1541 gboolean needs_conversion;
1542 VkMemoryRequirements2 requirements = {
1543 .sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
1544 };
1545 VkMemoryWin32HandlePropertiesKHR handle_properties = {
1546 .sType = VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR,
1547 };
1548
1549 if (!gsk_vulkan_device_has_feature (device, GDK_VULKAN_FEATURE_WIN32))
1550 {
1551 GDK_DEBUG (D3D12, "Vulkan does not support D3D12Resource import");
1552 return NULL;
1553 }
1554
1555 vk_device = gsk_vulkan_device_get_vk_device (device);
1556 func_vkGetMemoryWin32HandlePropertiesKHR = (PFN_vkGetMemoryWin32HandlePropertiesKHR) vkGetDeviceProcAddr (vk_device, "vkGetMemoryWin32HandlePropertiesKHR");
1557 ID3D12Resource_GetDesc (resource, &desc);
1558
1559 if (!gsk_vulkan_is_same_device (vk_device, (ID3D12DeviceChild *) resource))
1560 {
1561 GDK_DEBUG (D3D12, "Resource is from a different device");
1562 return NULL;
1563 }
1564
1565 if (!gdk_memory_format_find_by_dxgi_format (desc.Format, premultiplied, &format))
1566 {
1567 GDK_DEBUG (D3D12, "Unsupported DXGI format %u", desc.Format);
1568 return NULL;
1569 }
1570
1571 vk_format = gdk_memory_format_vk_format (format, &vk_components, &needs_conversion);
1572 if (vk_format == VK_FORMAT_UNDEFINED)
1573 {
1574 GDK_DEBUG (D3D12, "GTK's Vulkan doesn't support DXGI format %u", desc.Format);
1575 return NULL;
1576 }
1577
1578 if (needs_conversion && !gsk_vulkan_device_has_feature (device, GDK_VULKAN_FEATURE_YCBCR))
1579 {
1580 GDK_DEBUG (D3D12, "Vulkan driver cannot import DXGI format %u because it lacks YCbCr support", desc.Format);
1581 return NULL;
1582 }
1583
1584 vk_features = gsk_vulkan_device_supports_format (device,
1585 vk_format,
1586 0, 1,
1587 needs_conversion,
1588 VK_IMAGE_TILING_OPTIMAL,
1589 VK_IMAGE_USAGE_SAMPLED_BIT,
1590 desc.Width, desc.Height,
1591 &flags);
1592 if (vk_features == 0)
1593 {
1594 GDK_DEBUG (D3D12, "Vulkan driver does not support DXGI format %u", desc.Format);
1595 return NULL;
1596 }
1597
1598 if (!gsk_vulkan_ycbcr_is_supported (vk_features))
1599 {
1600 if (needs_conversion)
1601 {
1602 GDK_DEBUG (D3D12, "Vulkan driver broken: Can't do YCbcrConversion for YCbcr format %u", desc.Format);
1603 return NULL;
1604 }
1605 }
1606 if (needs_conversion)
1607 shader_op = GDK_SHADER_DEFAULT;
1608 else
1609 shader_op = gdk_memory_format_get_default_shader_op (format);
1610
1611 flags &= ~(GSK_GPU_IMAGE_CAN_MIPMAP | GSK_GPU_IMAGE_RENDERABLE);
1612 if (desc.MipLevels)
1613 flags |= GSK_GPU_IMAGE_CAN_MIPMAP | GSK_GPU_IMAGE_MIPMAP;
1614
1615 self = g_object_new (GSK_TYPE_VULKAN_IMAGE, NULL);
1616
1617 self->device = g_object_ref (device);
1618 self->vk_tiling = VK_IMAGE_TILING_OPTIMAL;
1619 self->vk_format = vk_format;
1620 self->vk_pipeline_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
1621 self->vk_image_layout = VK_IMAGE_LAYOUT_UNDEFINED;
1622 self->vk_access = 0;
1623
1624 res = vkCreateImage (vk_device,
1625 &(VkImageCreateInfo) {
1626 .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
1627 .flags = 0,
1628 .imageType = VK_IMAGE_TYPE_2D,
1629 .format = vk_format,
1630 .extent = { desc.Width, desc.Height, 1 },
1631 .mipLevels = desc.MipLevels,
1632 .arrayLayers = 1,
1633 .samples = VK_SAMPLE_COUNT_1_BIT,
1634 .tiling = self->vk_tiling,
1635 .usage = VK_IMAGE_USAGE_SAMPLED_BIT |
1636 (flags & (GSK_GPU_IMAGE_BLIT | GSK_GPU_IMAGE_DOWNLOADABLE) ? VK_IMAGE_USAGE_TRANSFER_SRC_BIT : 0),
1637 .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
1638 .initialLayout = self->vk_image_layout,
1639 .pNext = &(VkExternalMemoryImageCreateInfo) {
1640 .sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO,
1641 .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT,
1642 },
1643 },
1644 NULL,
1645 &self->vk_image);
1646 if (res != VK_SUCCESS)
1647 {
1648 GDK_DEBUG (D3D12, "vkCreateImage() failed: %s", gdk_vulkan_strerror (res));
1649 return NULL;
1650 }
1651
1652 vkGetImageMemoryRequirements2 (vk_device,
1653 &(VkImageMemoryRequirementsInfo2) {
1654 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2,
1655 .image = self->vk_image,
1656 },
1657 &requirements);
1658 // Vulkan memory import
1659 GSK_VK_CHECK (func_vkGetMemoryWin32HandlePropertiesKHR, vk_device,
1660 VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT,
1661 resource_handle,
1662 &handle_properties);
1663
1664 memory_index = gsk_vulkan_device_find_allocator (device,
1665 handle_properties.memoryTypeBits,
1666 0,
1667 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
1668 self->allocator = gsk_vulkan_device_get_external_allocator (device);
1669 gsk_vulkan_allocator_ref (self->allocator);
1670
1671 gsk_vulkan_alloc (self->allocator,
1672 requirements.memoryRequirements.size,
1673 requirements.memoryRequirements.alignment,
1674 &self->allocation);
1675
1676 GSK_VK_CHECK (vkAllocateMemory, vk_device,
1677 &(VkMemoryAllocateInfo) {
1678 .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
1679 .allocationSize = requirements.memoryRequirements.size,
1680 .memoryTypeIndex = memory_index,
1681 .pNext = &(VkImportMemoryWin32HandleInfoKHR) {
1682 .sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR,
1683 .handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT,
1684 .handle = resource_handle,
1685 .pNext = &(VkMemoryDedicatedAllocateInfo) {
1686 .sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
1687 .image = self->vk_image,
1688 }
1689 }
1690 },
1691 NULL,
1692 &self->allocation.vk_memory);
1693
1694 GSK_VK_CHECK (vkBindImageMemory2, gsk_vulkan_device_get_vk_device (self->device),
1695 1,
1696 &(VkBindImageMemoryInfo) {
1697 .sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,
1698 .image = self->vk_image,
1699 .memory = self->allocation.vk_memory,
1700 .memoryOffset = self->allocation.offset,
1701 });
1702
1703 if (gsk_vulkan_device_has_feature (device, GDK_VULKAN_FEATURE_WIN32_SEMAPHORE) && fence)
1704 {
1705 PFN_vkImportSemaphoreWin32HandleKHR func_vkImportSemaphoreWin32HandleKHR;
1706 func_vkImportSemaphoreWin32HandleKHR = (PFN_vkImportSemaphoreWin32HandleKHR) vkGetDeviceProcAddr (vk_device, "vkImportSemaphoreWin32HandleKHR");
1707
1708 GSK_VK_CHECK (vkCreateSemaphore, vk_device,
1709 &(VkSemaphoreCreateInfo) {
1710 .sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,
1711 .pNext = &(VkSemaphoreTypeCreateInfo) {
1712 .sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO,
1713 .semaphoreType = VK_SEMAPHORE_TYPE_TIMELINE,
1714 },
1715 },
1716 NULL,
1717 &self->vk_semaphore);
1718
1719 GSK_VK_CHECK (func_vkImportSemaphoreWin32HandleKHR, vk_device,
1720 &(VkImportSemaphoreWin32HandleInfoKHR) {
1721 .sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR,
1722 .handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT,
1723 .semaphore = self->vk_semaphore,
1724 .handle = fence_handle,
1725 });
1726 self->vk_semaphore_wait = fence_wait;
1727 }
1728
1729 if (needs_conversion)
1730 {
1731 self->ycbcr = gsk_vulkan_ycbcr_get (device,
1732 &(GskVulkanYcbcrInfo) {
1733 .vk_format = vk_format,
1734 .vk_features = vk_features,
1735 .vk_components = vk_components,
1736 .vk_ycbcr_model = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY,
1737 .vk_ycbcr_range = VK_SAMPLER_YCBCR_RANGE_ITU_FULL,
1738 });
1739 gsk_vulkan_ycbcr_ref (self->ycbcr);
1740 if (!gsk_vulkan_ycbcr_is_filterable (self->ycbcr))
1741 flags &= ~(GSK_GPU_IMAGE_FILTERABLE);
1742 vk_conversion = gsk_vulkan_ycbcr_get_vk_conversion (self->ycbcr);
1743 }
1744 else
1745 vk_conversion = VK_NULL_HANDLE;
1746
1747 gsk_gpu_image_setup (GSK_GPU_IMAGE (self),
1748 flags |
1749 (needs_conversion ? GSK_GPU_IMAGE_EXTERNAL : 0) |
1750 (desc.MipLevels > 1 ? GSK_GPU_IMAGE_CAN_MIPMAP | GSK_GPU_IMAGE_MIPMAP : 0),
1751 GSK_GPU_CONVERSION_NONE,
1752 shader_op,
1753 format,
1754 desc.Width, desc.Height);
1755
1756 gsk_vulkan_image_create_view (self,
1757 vk_format,
1758 &vk_components,
1759 vk_conversion);
1760
1761 GDK_DEBUG (D3D12, "Vulkan uploaded %ux%u resource of %sformat %u",
1762 (guint) desc.Width, (guint) desc.Height,
1763 needs_conversion ? "YUV " : "",
1764 desc.Format);
1765
1766 return GSK_GPU_IMAGE (self);
1767 }
1768 #endif
1769
1770 static void
1771 gsk_vulkan_image_get_projection_matrixcxx . . $ gsk_vulkan_image_get_projection_matrix(a6adf07d9a49cf57). (GskGpuImagecxx . . $ GskGpuImage# *image,
1772 graphene_matrix_tcxx . . $ graphene_matrix_t# *out_projection)
1773 {
1774 graphene_matrix_tcxx . . $ graphene_matrix_t# scale_z;
1775
1776 GSK_GPU_IMAGE_CLASScxx . . $ `gsk/gpu/gskgpuimageprivate.h:11:9`! (gsk_vulkan_image_parent_class)->get_projection_matrixcxx . . $ _GskGpuImageClass#get_projection_matrix. (image, out_projection);
1777
1778 graphene_matrix_init_from_floatcxx . . $ graphene_matrix_init_from_float(3b2d9e3ae13b80cc). (&scale_z,
1779 (float[16]) {
1780 1, 0, 0, 0,
1781 0, 1, 0, 0,
1782 0, 0, 0.5, 0,
1783 0, 0, 0.5, 1
1784 });
1785
1786 graphene_matrix_multiplycxx . . $ graphene_matrix_multiply(c49528f6c5c054cb). (out_projection, &scale_z, out_projection);
1787 }
1788
1789 static void
1790 gsk_vulkan_image_finalizecxx . . $ gsk_vulkan_image_finalize(6087475fa43034d3). (GObjectcxx . . $ GObject# *object)
1791 {
1792 GskVulkanImagecxx . . $ GskVulkanImage# *self = GSK_VULKAN_IMAGEcxx . . $ GSK_VULKAN_IMAGE(2b1a9dca49a658fd). (object);
1793 VkDevicecxx . . $ VkDevice# vk_device;
1794 gsizecxx . . $ gsize# i;
1795
1796 vk_device = gsk_vulkan_device_get_vk_devicecxx . . $ gsk_vulkan_device_get_vk_device(4319e0de3864a3a5). (self->devicecxx . . $ _GskVulkanImage#device.);
1797
1798 g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&self->ycbcr, gsk_vulkan_ycbcr_unref);
1799
1800 for (i = 0; i < GSK_GPU_SAMPLER_N_SAMPLERScxx . . $ GSK_GPU_SAMPLER_N_SAMPLERS.; i++)
1801 {
1802 if (self->descriptor_setscxx . . $ _GskVulkanImage#descriptor_sets.[i].vk_descriptor_setcxx . . $ _GskVulkanImage#$anonymous_type_0#vk_descriptor_set.)
1803 gsk_vulkan_device_free_descriptorcxx . . $ gsk_vulkan_device_free_descriptor(7936c67c77d03ec9). (self->devicecxx . . $ _GskVulkanImage#device.,
1804 self->descriptor_setscxx . . $ _GskVulkanImage#descriptor_sets.[i].pool_idcxx . . $ _GskVulkanImage#$anonymous_type_0#pool_id.,
1805 self->descriptor_setscxx . . $ _GskVulkanImage#descriptor_sets.[i].vk_descriptor_setcxx . . $ _GskVulkanImage#$anonymous_type_0#vk_descriptor_set.);
1806 }
1807
1808 if (self->vk_framebuffercxx . . $ _GskVulkanImage#vk_framebuffer. != VK_NULL_HANDLEcxx . . $ `<external>/13734482859137699468/vulkan_core.h:43:21`!)
1809 vkDestroyFramebuffercxx . . $ vkDestroyFramebuffer(6296ef2b31636270). (vk_device, self->vk_framebuffercxx . . $ _GskVulkanImage#vk_framebuffer., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1810
1811 if (self->vk_framebuffer_image_viewcxx . . $ _GskVulkanImage#vk_framebuffer_image_view. != VK_NULL_HANDLEcxx . . $ `<external>/13734482859137699468/vulkan_core.h:43:21`! &&
1812 self->vk_framebuffer_image_viewcxx . . $ _GskVulkanImage#vk_framebuffer_image_view. != self->vk_image_viewcxx . . $ _GskVulkanImage#vk_image_view.)
1813 vkDestroyImageViewcxx . . $ vkDestroyImageView(a7d513fc087b0a05). (vk_device, self->vk_framebuffer_image_viewcxx . . $ _GskVulkanImage#vk_framebuffer_image_view., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1814
1815 if (self->vk_image_viewcxx . . $ _GskVulkanImage#vk_image_view. != VK_NULL_HANDLEcxx . . $ `<external>/13734482859137699468/vulkan_core.h:43:21`!)
1816 vkDestroyImageViewcxx . . $ vkDestroyImageView(a7d513fc087b0a05). (vk_device, self->vk_image_viewcxx . . $ _GskVulkanImage#vk_image_view., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1817
1818 if (self->vk_semaphorecxx . . $ _GskVulkanImage#vk_semaphore. != VK_NULL_HANDLEcxx . . $ `<external>/13734482859137699468/vulkan_core.h:43:21`!)
1819 vkDestroySemaphorecxx . . $ vkDestroySemaphore(9f95ec9e67729a6). (vk_device, self->vk_semaphorecxx . . $ _GskVulkanImage#vk_semaphore., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1820
1821 /* memory is NULL for for_swapchain() images, where we don't own
1822 * the VkImage */
1823 if (self->allocatorcxx . . $ _GskVulkanImage#allocator.)
1824 {
1825 vkDestroyImagecxx . . $ vkDestroyImage(3e69a458d7ef6a33). (vk_device, self->vk_imagecxx . . $ _GskVulkanImage#vk_image., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1826 gsk_vulkan_freecxx . . $ gsk_vulkan_free(b959903ae9b4433e). (self->allocatorcxx . . $ _GskVulkanImage#allocator., &self->allocationcxx . . $ _GskVulkanImage#allocation.);
1827 gsk_vulkan_allocator_unrefcxx . . $ gsk_vulkan_allocator_unref(94330cac9e160a62). (self->allocatorcxx . . $ _GskVulkanImage#allocator.);
1828 }
1829
1830 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (self->devicecxx . . $ _GskVulkanImage#device.);
1831
1832 G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gsk_vulkan_image_parent_class)->finalizecxx . . $ _GObjectClass#finalize. (object);
1833 }
1834
1835 static void
1836 gsk_vulkan_image_class_initcxx . . $ gsk_vulkan_image_class_init(f448995ccb06f289). (GskVulkanImageClasscxx . . $ GskVulkanImageClass# *klass)
1837 {
1838 GskGpuImageClasscxx . . $ GskGpuImageClass# *image_class = GSK_GPU_IMAGE_CLASScxx . . $ `gsk/gpu/gskgpuimageprivate.h:11:9`! (klass);
1839 GObjectClasscxx . . $ GObjectClass# *object_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (klass);
1840
1841 image_class->get_projection_matrixcxx . . $ _GskGpuImageClass#get_projection_matrix. = gsk_vulkan_image_get_projection_matrixcxx . . $ gsk_vulkan_image_get_projection_matrix(a6adf07d9a49cf57).;
1842
1843 object_class->finalizecxx . . $ _GObjectClass#finalize. = gsk_vulkan_image_finalizecxx . . $ gsk_vulkan_image_finalize(6087475fa43034d3).;
1844 }
1845
1846 static void
1847 gsk_vulkan_image_initcxx . . $ gsk_vulkan_image_init(b663be4a543f755). (GskVulkanImagecxx . . $ GskVulkanImage# *self)
1848 {
1849 }
1850
1851 VkFramebuffercxx . . $ VkFramebuffer#
1852 gsk_vulkan_image_get_vk_framebuffercxx . . $ gsk_vulkan_image_get_vk_framebuffer(bfa39304e7afd955). (GskVulkanImagecxx . . $ GskVulkanImage# *self,
1853 VkRenderPasscxx . . $ VkRenderPass# render_pass)
1854 {
1855 VkDevicecxx . . $ VkDevice# vk_device;
1856
1857 if (self->vk_framebuffercxx . . $ _GskVulkanImage#vk_framebuffer.)
1858 return self->vk_framebuffercxx . . $ _GskVulkanImage#vk_framebuffer.;
1859
1860 vk_device = gsk_vulkan_device_get_vk_devicecxx . . $ gsk_vulkan_device_get_vk_device(4319e0de3864a3a5). (self->devicecxx . . $ _GskVulkanImage#device.);
1861
1862 if (gsk_gpu_image_get_flagscxx . . $ gsk_gpu_image_get_flags(5c3e52b92b0ce578). (GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self)) & GSK_GPU_IMAGE_CAN_MIPMAPcxx . . $ GSK_GPU_IMAGE_CAN_MIPMAP.)
1863 {
1864 GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (vkCreateImageView, vk_device,
1865 &(VkImageViewCreateInfo) {
1866 .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
1867 .image = self->vk_image,
1868 .viewType = VK_IMAGE_VIEW_TYPE_2D,
1869 .format = self->vk_format,
1870 .subresourceRange = {
1871 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
1872 .baseMipLevel = 0,
1873 .levelCount = 1,
1874 .baseArrayLayer = 0,
1875 .layerCount = 1,
1876 }
1877 },
1878 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
1879 &self->vk_framebuffer_image_view);
1880 }
1881 else
1882 {
1883 self->vk_framebuffer_image_viewcxx . . $ _GskVulkanImage#vk_framebuffer_image_view. = self->vk_image_viewcxx . . $ _GskVulkanImage#vk_image_view.;
1884 }
1885
1886 GSK_VK_CHECKcxx . . $ `gsk/gpu/gskvulkandeviceprivate.h:85:9`! (vkCreateFramebuffer, vk_device,
1887 &(VkFramebufferCreateInfo) {
1888 .sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
1889 .renderPass = render_pass,
1890 .attachmentCount = 1,
1891 .pAttachments = (VkImageView[1]) {
1892 self->vk_framebuffer_image_view,
1893 },
1894 .width = gsk_gpu_image_get_width (GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self)),
1895 .height = gsk_gpu_image_get_height (GSK_GPU_IMAGEcxx . . $ `gsk/gpu/gskgpuimageprivate.h:10:9`! (self)),
1896 .layers = 1
1897 },
1898 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
1899 &self->vk_framebuffer);
1900
1901 return self->vk_framebuffercxx . . $ _GskVulkanImage#vk_framebuffer.;
1902 }
1903
1904 VkDescriptorSetcxx . . $ VkDescriptorSet#
1905 gsk_vulkan_image_get_vk_descriptor_setcxx . . $ gsk_vulkan_image_get_vk_descriptor_set(6d6335c22251a59c). (GskVulkanImagecxx . . $ GskVulkanImage# *self,
1906 GskGpuSamplercxx . . $ GskGpuSampler# sampler)
1907 {
1908 if (!self->descriptor_setscxx . . $ _GskVulkanImage#descriptor_sets.[sampler].vk_descriptor_setcxx . . $ _GskVulkanImage#$anonymous_type_0#vk_descriptor_set.)
1909 {
1910 self->descriptor_setscxx . . $ _GskVulkanImage#descriptor_sets.[sampler].vk_descriptor_setcxx . . $ _GskVulkanImage#$anonymous_type_0#vk_descriptor_set. =
1911 gsk_vulkan_device_allocate_descriptorcxx . . $ gsk_vulkan_device_allocate_descriptor(b27ba07c11bd7878). (self->devicecxx . . $ _GskVulkanImage#device.,
1912 self->ycbcrcxx . . $ _GskVulkanImage#ycbcr. ? gsk_vulkan_ycbcr_get_vk_descriptor_set_layoutcxx . . $ gsk_vulkan_ycbcr_get_vk_descriptor_set_layout(cb8ff4d171c8f1a). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.)
1913 : gsk_vulkan_device_get_vk_image_set_layoutcxx . . $ gsk_vulkan_device_get_vk_image_set_layout(f25e28857a1e2aa8). (self->devicecxx . . $ _GskVulkanImage#device.),
1914 &self->descriptor_setscxx . . $ _GskVulkanImage#descriptor_sets.[sampler].pool_idcxx . . $ _GskVulkanImage#$anonymous_type_0#pool_id.);
1915
1916 vkUpdateDescriptorSetscxx . . $ vkUpdateDescriptorSets(6c4015bf30b249b8). (gsk_vulkan_device_get_vk_devicecxx . . $ gsk_vulkan_device_get_vk_device(4319e0de3864a3a5). (self->devicecxx . . $ _GskVulkanImage#device.),
1917 1,
1918 &(VkWriteDescriptorSetcxx . . $ VkWriteDescriptorSet#) {
1919 .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SETcxx . . $ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET.,
1920 .dstSet = self->descriptor_setscxx . . $ _GskVulkanImage#descriptor_sets.[sampler].vk_descriptor_setcxx . . $ _GskVulkanImage#$anonymous_type_0#vk_descriptor_set.,
1921 .dstBinding = 0,
1922 .dstArrayElement = 0,
1923 .descriptorCount = 3,
1924 .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLERcxx . . $ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER.,
1925 .pImageInfo = (VkDescriptorImageInfocxx . . $ VkDescriptorImageInfo#[3]) {
1926 {
1927 .sampler = self->ycbcrcxx . . $ _GskVulkanImage#ycbcr. ? gsk_vulkan_ycbcr_get_vk_samplercxx . . $ gsk_vulkan_ycbcr_get_vk_sampler(98f93537c842c516). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.)
1928 : gsk_vulkan_device_get_vk_samplercxx . . $ gsk_vulkan_device_get_vk_sampler(e17a4034ee184b0d). (self->devicecxx . . $ _GskVulkanImage#device., sampler),
1929 .imageView = self->vk_image_viewcxx . . $ _GskVulkanImage#vk_image_view.,
1930 .imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMALcxx . . $ VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.
1931 },
1932 {
1933 .sampler = self->ycbcrcxx . . $ _GskVulkanImage#ycbcr. ? gsk_vulkan_ycbcr_get_vk_samplercxx . . $ gsk_vulkan_ycbcr_get_vk_sampler(98f93537c842c516). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.)
1934 : gsk_vulkan_device_get_vk_samplercxx . . $ gsk_vulkan_device_get_vk_sampler(e17a4034ee184b0d). (self->devicecxx . . $ _GskVulkanImage#device., sampler),
1935 .imageView = self->vk_image_viewcxx . . $ _GskVulkanImage#vk_image_view.,
1936 .imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMALcxx . . $ VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.
1937 },
1938 {
1939 .sampler = self->ycbcrcxx . . $ _GskVulkanImage#ycbcr. ? gsk_vulkan_ycbcr_get_vk_samplercxx . . $ gsk_vulkan_ycbcr_get_vk_sampler(98f93537c842c516). (self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.)
1940 : gsk_vulkan_device_get_vk_samplercxx . . $ gsk_vulkan_device_get_vk_sampler(e17a4034ee184b0d). (self->devicecxx . . $ _GskVulkanImage#device., sampler),
1941 .imageView = self->vk_image_viewcxx . . $ _GskVulkanImage#vk_image_view.,
1942 .imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMALcxx . . $ VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.
1943 }
1944 },
1945 },
1946 0,
1947 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1948 }
1949
1950 return self->descriptor_setscxx . . $ _GskVulkanImage#descriptor_sets.[sampler].vk_descriptor_setcxx . . $ _GskVulkanImage#$anonymous_type_0#vk_descriptor_set.;
1951 }
1952
1953 GskVulkanYcbcrcxx . . $ GskVulkanYcbcr# *
1954 gsk_vulkan_image_get_ycbcrcxx . . $ gsk_vulkan_image_get_ycbcr(bd25e7cb83a5f55b). (GskVulkanImagecxx . . $ GskVulkanImage# *self)
1955 {
1956 return self->ycbcrcxx . . $ _GskVulkanImage#ycbcr.;
1957 }
1958
1959 VkImagecxx . . $ VkImage#
1960 gsk_vulkan_image_get_vk_imagecxx . . $ gsk_vulkan_image_get_vk_image(60c9576da85bf88). (GskVulkanImagecxx . . $ GskVulkanImage# *self)
1961 {
1962 return self->vk_imagecxx . . $ _GskVulkanImage#vk_image.;
1963 }
1964
1965 VkImageViewcxx . . $ VkImageView#
1966 gsk_vulkan_image_get_vk_image_viewcxx . . $ gsk_vulkan_image_get_vk_image_view(5f8b410b2bdde867). (GskVulkanImagecxx . . $ GskVulkanImage# *self)
1967 {
1968 return self->vk_image_viewcxx . . $ _GskVulkanImage#vk_image_view.;
1969 }
1970
1971 VkPipelineStageFlagscxx . . $ VkPipelineStageFlags#
1972 gsk_vulkan_image_get_vk_pipeline_stagecxx . . $ gsk_vulkan_image_get_vk_pipeline_stage(2f48e66698dd8760). (GskVulkanImagecxx . . $ GskVulkanImage# *self)
1973 {
1974 return self->vk_pipeline_stagecxx . . $ _GskVulkanImage#vk_pipeline_stage.;
1975 }
1976
1977 VkImageLayoutcxx . . $ VkImageLayout#
1978 gsk_vulkan_image_get_vk_image_layoutcxx . . $ gsk_vulkan_image_get_vk_image_layout(79b8ac8694fc1740). (GskVulkanImagecxx . . $ GskVulkanImage# *self)
1979 {
1980 return self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout.;
1981 }
1982
1983 VkAccessFlagscxx . . $ VkAccessFlags#
1984 gsk_vulkan_image_get_vk_accesscxx . . $ gsk_vulkan_image_get_vk_access(2f48e66698dd8760). (GskVulkanImagecxx . . $ GskVulkanImage# *self)
1985 {
1986 return self->vk_accesscxx . . $ _GskVulkanImage#vk_access.;
1987 }
1988
1989 void
1990 gsk_vulkan_image_set_vk_image_layoutcxx . . $ gsk_vulkan_image_set_vk_image_layout(a34424fcac50c0e3). (GskVulkanImagecxx . . $ GskVulkanImage# *self,
1991 VkPipelineStageFlagscxx . . $ VkPipelineStageFlags# stage,
1992 VkImageLayoutcxx . . $ VkImageLayout# image_layout,
1993 VkAccessFlagscxx . . $ VkAccessFlags# access)
1994 {
1995 self->vk_pipeline_stagecxx . . $ _GskVulkanImage#vk_pipeline_stage. = stage;
1996 self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout. = image_layout;
1997 self->vk_accesscxx . . $ _GskVulkanImage#vk_access. = access;
1998 }
1999
2000 void
2001 gsk_vulkan_image_transitioncxx . . $ gsk_vulkan_image_transition(e4b8ad8b21b1fcbd). (GskVulkanImagecxx . . $ GskVulkanImage# *self,
2002 GskVulkanSemaphorescxx . . $ GskVulkanSemaphores# *semaphores,
2003 VkCommandBuffercxx . . $ VkCommandBuffer# command_buffer,
2004 VkPipelineStageFlagscxx . . $ VkPipelineStageFlags# stage,
2005 VkImageLayoutcxx . . $ VkImageLayout# image_layout,
2006 VkAccessFlagscxx . . $ VkAccessFlags# access)
2007 {
2008 if (self->vk_pipeline_stagecxx . . $ _GskVulkanImage#vk_pipeline_stage. == stage &&
2009 self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout. == image_layout &&
2010 self->vk_accesscxx . . $ _GskVulkanImage#vk_access. == access)
2011 return;
2012
2013 if (self->vk_pipeline_stagecxx . . $ _GskVulkanImage#vk_pipeline_stage. == VK_IMAGE_LAYOUT_GENERALcxx . . $ VK_IMAGE_LAYOUT_GENERAL. &&
2014 self->vk_semaphorecxx . . $ _GskVulkanImage#vk_semaphore.)
2015 {
2016 gsk_vulkan_semaphores_add_waitcxx . . $ gsk_vulkan_semaphores_add_wait(445bdaa0b3b7b6e8). (semaphores,
2017 self->vk_semaphorecxx . . $ _GskVulkanImage#vk_semaphore.,
2018 self->vk_semaphore_waitcxx . . $ _GskVulkanImage#vk_semaphore_wait.,
2019 stage);
2020 }
2021
2022 vkCmdPipelineBarriercxx . . $ vkCmdPipelineBarrier(ca392870b0aa0c0c). (command_buffer,
2023 self->vk_pipeline_stagecxx . . $ _GskVulkanImage#vk_pipeline_stage.,
2024 stage,
2025 0,
2026 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
2027 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!,
2028 1, &(VkImageMemoryBarriercxx . . $ VkImageMemoryBarrier#) {
2029 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIERcxx . . $ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER.,
2030 .srcAccessMask = self->vk_accesscxx . . $ _GskVulkanImage#vk_access.,
2031 .dstAccessMask = access,
2032 .oldLayout = self->vk_image_layoutcxx . . $ _GskVulkanImage#vk_image_layout.,
2033 .newLayout = image_layout,
2034 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNOREDcxx . . $ `<external>/13734482859137699468/vulkan_core.h:126:9`!,
2035 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNOREDcxx . . $ `<external>/13734482859137699468/vulkan_core.h:126:9`!,
2036 .image = self->vk_imagecxx . . $ _GskVulkanImage#vk_image.,
2037 .subresourceRange = {
2038 .aspectMask = VK_IMAGE_ASPECT_COLOR_BITcxx . . $ VK_IMAGE_ASPECT_COLOR_BIT.,
2039 .baseMipLevel = 0,
2040 .levelCount = VK_REMAINING_MIP_LEVELScxx . . $ `<external>/13734482859137699468/vulkan_core.h:128:9`!,
2041 .baseArrayLayer = 0,
2042 .layerCount = 1
2043 },
2044 });
2045
2046 gsk_vulkan_image_set_vk_image_layoutcxx . . $ gsk_vulkan_image_set_vk_image_layout(a34424fcac50c0e3). (self, stage, image_layout, access);
2047 }
2048
2049 VkFormatcxx . . $ VkFormat#
2050 gsk_vulkan_image_get_vk_formatcxx . . $ gsk_vulkan_image_get_vk_format(78c5ba136e4b2135). (GskVulkanImagecxx . . $ GskVulkanImage# *self)
2051 {
2052 return self->vk_formatcxx . . $ _GskVulkanImage#vk_format.;
2053 }
2054