2 * Copyright © 2016 Red Hat.
3 * Copyright © 2016 Bas Nieuwenhuizen
5 * based in part on anv driver which is:
6 * Copyright © 2015 Intel Corporation
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
28 #include "tu_private.h"
34 #include <sys/sysinfo.h>
38 #include "util/debug.h"
39 #include "util/disk_cache.h"
40 #include "util/strtod.h"
41 #include "vk_format.h"
44 #include "drm/msm_drm.h"
47 tu_device_get_cache_uuid(uint16_t family
, void *uuid
)
49 uint32_t mesa_timestamp
;
51 memset(uuid
, 0, VK_UUID_SIZE
);
52 if (!disk_cache_get_function_timestamp(tu_device_get_cache_uuid
,
56 memcpy(uuid
, &mesa_timestamp
, 4);
57 memcpy((char *) uuid
+ 4, &f
, 2);
58 snprintf((char *) uuid
+ 6, VK_UUID_SIZE
- 10, "tu");
63 tu_get_driver_uuid(void *uuid
)
65 memset(uuid
, 0, VK_UUID_SIZE
);
66 snprintf(uuid
, VK_UUID_SIZE
, "freedreno");
70 tu_get_device_uuid(void *uuid
)
72 memset(uuid
, 0, VK_UUID_SIZE
);
76 tu_bo_init_new(struct tu_device
*dev
, struct tu_bo
*bo
, uint64_t size
)
78 /* TODO: Choose better flags. As of 2018-11-12, freedreno/drm/msm_bo.c
79 * always sets `flags = MSM_BO_WC`, and we copy that behavior here.
81 uint32_t gem_handle
= tu_gem_new(dev
, size
, MSM_BO_WC
);
85 /* Calling DRM_MSM_GEM_INFO forces the kernel to allocate backing pages. We
86 * want immediate backing pages because vkAllocateMemory and friends must
89 * TODO(chadv): Must we really call DRM_MSM_GEM_INFO to acquire backing
90 * pages? I infer so from reading comments in msm_bo.c:bo_allocate(), but
91 * maybe I misunderstand.
94 /* TODO: Do we need 'offset' if we have 'iova'? */
95 uint64_t offset
= tu_gem_info_offset(dev
, gem_handle
);
99 uint64_t iova
= tu_gem_info_iova(dev
, gem_handle
);
103 *bo
= (struct tu_bo
) {
104 .gem_handle
= gem_handle
,
113 tu_gem_close(dev
, bo
->gem_handle
);
115 return vk_error(dev
->instance
, VK_ERROR_OUT_OF_DEVICE_MEMORY
);
119 tu_bo_map(struct tu_device
*dev
, struct tu_bo
*bo
)
124 /* TODO: Should we use the wrapper os_mmap() like Freedreno does? */
125 void *map
= mmap(0, bo
->size
, PROT_READ
| PROT_WRITE
, MAP_SHARED
,
126 dev
->physical_device
->local_fd
, bo
->offset
);
127 if (map
== MAP_FAILED
)
128 return vk_error(dev
->instance
, VK_ERROR_MEMORY_MAP_FAILED
);
135 tu_bo_finish(struct tu_device
*dev
, struct tu_bo
*bo
)
137 assert(bo
->gem_handle
);
140 munmap(bo
->map
, bo
->size
);
142 tu_gem_close(dev
, bo
->gem_handle
);
146 tu_physical_device_init(struct tu_physical_device
*device
,
147 struct tu_instance
*instance
,
148 drmDevicePtr drm_device
)
150 const char *path
= drm_device
->nodes
[DRM_NODE_RENDER
];
151 VkResult result
= VK_SUCCESS
;
152 drmVersionPtr version
;
156 fd
= open(path
, O_RDWR
| O_CLOEXEC
);
158 return vk_errorf(instance
, VK_ERROR_INCOMPATIBLE_DRIVER
,
159 "failed to open device %s", path
);
162 /* Version 1.3 added MSM_INFO_IOVA. */
163 const int min_version_major
= 1;
164 const int min_version_minor
= 3;
166 version
= drmGetVersion(fd
);
169 return vk_errorf(instance
, VK_ERROR_INCOMPATIBLE_DRIVER
,
170 "failed to query kernel driver version for device %s",
174 if (strcmp(version
->name
, "msm")) {
175 drmFreeVersion(version
);
179 return vk_errorf(instance
, VK_ERROR_INCOMPATIBLE_DRIVER
,
180 "device %s does not use the msm kernel driver", path
);
183 if (version
->version_major
!= min_version_major
||
184 version
->version_minor
< min_version_minor
) {
185 result
= vk_errorf(instance
, VK_ERROR_INCOMPATIBLE_DRIVER
,
186 "kernel driver for device %s has version %d.%d, "
187 "but Vulkan requires version >= %d.%d",
188 path
, version
->version_major
, version
->version_minor
,
189 min_version_major
, min_version_minor
);
190 drmFreeVersion(version
);
195 drmFreeVersion(version
);
197 if (instance
->debug_flags
& TU_DEBUG_STARTUP
)
198 tu_logi("Found compatible device '%s'.", path
);
200 device
->_loader_data
.loaderMagic
= ICD_LOADER_MAGIC
;
201 device
->instance
= instance
;
202 assert(strlen(path
) < ARRAY_SIZE(device
->path
));
203 strncpy(device
->path
, path
, ARRAY_SIZE(device
->path
));
205 if (instance
->enabled_extensions
.KHR_display
) {
207 open(drm_device
->nodes
[DRM_NODE_PRIMARY
], O_RDWR
| O_CLOEXEC
);
208 if (master_fd
>= 0) {
209 /* TODO: free master_fd is accel is not working? */
213 device
->master_fd
= master_fd
;
214 device
->local_fd
= fd
;
216 if (tu_drm_get_gpu_id(device
, &device
->gpu_id
)) {
217 if (instance
->debug_flags
& TU_DEBUG_STARTUP
)
218 tu_logi("Could not query the GPU ID");
219 result
= vk_errorf(instance
, VK_ERROR_INITIALIZATION_FAILED
,
220 "could not get GPU ID");
224 if (tu_drm_get_gmem_size(device
, &device
->gmem_size
)) {
225 if (instance
->debug_flags
& TU_DEBUG_STARTUP
)
226 tu_logi("Could not query the GMEM size");
227 result
= vk_errorf(instance
, VK_ERROR_INITIALIZATION_FAILED
,
228 "could not get GMEM size");
232 memset(device
->name
, 0, sizeof(device
->name
));
233 sprintf(device
->name
, "FD%d", device
->gpu_id
);
235 switch (device
->gpu_id
) {
240 result
= vk_errorf(instance
, VK_ERROR_INITIALIZATION_FAILED
,
241 "device %s is unsupported", device
->name
);
244 if (tu_device_get_cache_uuid(device
->gpu_id
, device
->cache_uuid
)) {
245 result
= vk_errorf(instance
, VK_ERROR_INITIALIZATION_FAILED
,
246 "cannot generate UUID");
250 /* The gpu id is already embedded in the uuid so we just pass "tu"
251 * when creating the cache.
253 char buf
[VK_UUID_SIZE
* 2 + 1];
254 disk_cache_format_hex_id(buf
, device
->cache_uuid
, VK_UUID_SIZE
* 2);
255 device
->disk_cache
= disk_cache_create(device
->name
, buf
, 0);
257 fprintf(stderr
, "WARNING: tu is not a conformant vulkan implementation, "
258 "testing use only.\n");
260 tu_get_driver_uuid(&device
->device_uuid
);
261 tu_get_device_uuid(&device
->device_uuid
);
263 tu_fill_device_extension_table(device
, &device
->supported_extensions
);
265 if (result
!= VK_SUCCESS
) {
266 vk_error(instance
, result
);
280 tu_physical_device_finish(struct tu_physical_device
*device
)
282 disk_cache_destroy(device
->disk_cache
);
283 close(device
->local_fd
);
284 if (device
->master_fd
!= -1)
285 close(device
->master_fd
);
289 default_alloc_func(void *pUserData
,
292 VkSystemAllocationScope allocationScope
)
298 default_realloc_func(void *pUserData
,
302 VkSystemAllocationScope allocationScope
)
304 return realloc(pOriginal
, size
);
308 default_free_func(void *pUserData
, void *pMemory
)
313 static const VkAllocationCallbacks default_alloc
= {
315 .pfnAllocation
= default_alloc_func
,
316 .pfnReallocation
= default_realloc_func
,
317 .pfnFree
= default_free_func
,
320 static const struct debug_control tu_debug_options
[] = {
321 { "startup", TU_DEBUG_STARTUP
}, { NULL
, 0 }
325 tu_get_debug_option_name(int id
)
327 assert(id
< ARRAY_SIZE(tu_debug_options
) - 1);
328 return tu_debug_options
[id
].string
;
332 tu_get_instance_extension_index(const char *name
)
334 for (unsigned i
= 0; i
< TU_INSTANCE_EXTENSION_COUNT
; ++i
) {
335 if (strcmp(name
, tu_instance_extensions
[i
].extensionName
) == 0)
342 tu_CreateInstance(const VkInstanceCreateInfo
*pCreateInfo
,
343 const VkAllocationCallbacks
*pAllocator
,
344 VkInstance
*pInstance
)
346 struct tu_instance
*instance
;
349 assert(pCreateInfo
->sType
== VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO
);
351 uint32_t client_version
;
352 if (pCreateInfo
->pApplicationInfo
&&
353 pCreateInfo
->pApplicationInfo
->apiVersion
!= 0) {
354 client_version
= pCreateInfo
->pApplicationInfo
->apiVersion
;
356 tu_EnumerateInstanceVersion(&client_version
);
359 instance
= vk_zalloc2(&default_alloc
, pAllocator
, sizeof(*instance
), 8,
360 VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE
);
362 return vk_error(NULL
, VK_ERROR_OUT_OF_HOST_MEMORY
);
364 instance
->_loader_data
.loaderMagic
= ICD_LOADER_MAGIC
;
367 instance
->alloc
= *pAllocator
;
369 instance
->alloc
= default_alloc
;
371 instance
->api_version
= client_version
;
372 instance
->physical_device_count
= -1;
374 instance
->debug_flags
=
375 parse_debug_string(getenv("TU_DEBUG"), tu_debug_options
);
377 if (instance
->debug_flags
& TU_DEBUG_STARTUP
)
378 tu_logi("Created an instance");
380 for (uint32_t i
= 0; i
< pCreateInfo
->enabledExtensionCount
; i
++) {
381 const char *ext_name
= pCreateInfo
->ppEnabledExtensionNames
[i
];
382 int index
= tu_get_instance_extension_index(ext_name
);
384 if (index
< 0 || !tu_supported_instance_extensions
.extensions
[index
]) {
385 vk_free2(&default_alloc
, pAllocator
, instance
);
386 return vk_error(instance
, VK_ERROR_EXTENSION_NOT_PRESENT
);
389 instance
->enabled_extensions
.extensions
[index
] = true;
392 result
= vk_debug_report_instance_init(&instance
->debug_report_callbacks
);
393 if (result
!= VK_SUCCESS
) {
394 vk_free2(&default_alloc
, pAllocator
, instance
);
395 return vk_error(instance
, result
);
400 VG(VALGRIND_CREATE_MEMPOOL(instance
, 0, false));
402 *pInstance
= tu_instance_to_handle(instance
);
408 tu_DestroyInstance(VkInstance _instance
,
409 const VkAllocationCallbacks
*pAllocator
)
411 TU_FROM_HANDLE(tu_instance
, instance
, _instance
);
416 for (int i
= 0; i
< instance
->physical_device_count
; ++i
) {
417 tu_physical_device_finish(instance
->physical_devices
+ i
);
420 VG(VALGRIND_DESTROY_MEMPOOL(instance
));
424 vk_debug_report_instance_destroy(&instance
->debug_report_callbacks
);
426 vk_free(&instance
->alloc
, instance
);
430 tu_enumerate_devices(struct tu_instance
*instance
)
432 /* TODO: Check for more devices ? */
433 drmDevicePtr devices
[8];
434 VkResult result
= VK_ERROR_INCOMPATIBLE_DRIVER
;
437 instance
->physical_device_count
= 0;
439 max_devices
= drmGetDevices2(0, devices
, ARRAY_SIZE(devices
));
441 if (instance
->debug_flags
& TU_DEBUG_STARTUP
)
442 tu_logi("Found %d drm nodes", max_devices
);
445 return vk_error(instance
, VK_ERROR_INCOMPATIBLE_DRIVER
);
447 for (unsigned i
= 0; i
< (unsigned) max_devices
; i
++) {
448 if (devices
[i
]->available_nodes
& 1 << DRM_NODE_RENDER
&&
449 devices
[i
]->bustype
== DRM_BUS_PLATFORM
) {
451 result
= tu_physical_device_init(
452 instance
->physical_devices
+ instance
->physical_device_count
,
453 instance
, devices
[i
]);
454 if (result
== VK_SUCCESS
)
455 ++instance
->physical_device_count
;
456 else if (result
!= VK_ERROR_INCOMPATIBLE_DRIVER
)
460 drmFreeDevices(devices
, max_devices
);
466 tu_EnumeratePhysicalDevices(VkInstance _instance
,
467 uint32_t *pPhysicalDeviceCount
,
468 VkPhysicalDevice
*pPhysicalDevices
)
470 TU_FROM_HANDLE(tu_instance
, instance
, _instance
);
471 VK_OUTARRAY_MAKE(out
, pPhysicalDevices
, pPhysicalDeviceCount
);
475 if (instance
->physical_device_count
< 0) {
476 result
= tu_enumerate_devices(instance
);
477 if (result
!= VK_SUCCESS
&& result
!= VK_ERROR_INCOMPATIBLE_DRIVER
)
481 for (uint32_t i
= 0; i
< instance
->physical_device_count
; ++i
) {
482 vk_outarray_append(&out
, p
)
484 *p
= tu_physical_device_to_handle(instance
->physical_devices
+ i
);
488 return vk_outarray_status(&out
);
492 tu_EnumeratePhysicalDeviceGroups(
493 VkInstance _instance
,
494 uint32_t *pPhysicalDeviceGroupCount
,
495 VkPhysicalDeviceGroupProperties
*pPhysicalDeviceGroupProperties
)
497 TU_FROM_HANDLE(tu_instance
, instance
, _instance
);
498 VK_OUTARRAY_MAKE(out
, pPhysicalDeviceGroupProperties
,
499 pPhysicalDeviceGroupCount
);
502 if (instance
->physical_device_count
< 0) {
503 result
= tu_enumerate_devices(instance
);
504 if (result
!= VK_SUCCESS
&& result
!= VK_ERROR_INCOMPATIBLE_DRIVER
)
508 for (uint32_t i
= 0; i
< instance
->physical_device_count
; ++i
) {
509 vk_outarray_append(&out
, p
)
511 p
->physicalDeviceCount
= 1;
512 p
->physicalDevices
[0] =
513 tu_physical_device_to_handle(instance
->physical_devices
+ i
);
514 p
->subsetAllocation
= false;
518 return vk_outarray_status(&out
);
522 tu_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice
,
523 VkPhysicalDeviceFeatures
*pFeatures
)
525 memset(pFeatures
, 0, sizeof(*pFeatures
));
527 *pFeatures
= (VkPhysicalDeviceFeatures
) {
528 .robustBufferAccess
= false,
529 .fullDrawIndexUint32
= false,
530 .imageCubeArray
= false,
531 .independentBlend
= false,
532 .geometryShader
= false,
533 .tessellationShader
= false,
534 .sampleRateShading
= false,
535 .dualSrcBlend
= false,
537 .multiDrawIndirect
= false,
538 .drawIndirectFirstInstance
= false,
540 .depthBiasClamp
= false,
541 .fillModeNonSolid
= false,
542 .depthBounds
= false,
544 .largePoints
= false,
546 .multiViewport
= false,
547 .samplerAnisotropy
= false,
548 .textureCompressionETC2
= false,
549 .textureCompressionASTC_LDR
= false,
550 .textureCompressionBC
= false,
551 .occlusionQueryPrecise
= false,
552 .pipelineStatisticsQuery
= false,
553 .vertexPipelineStoresAndAtomics
= false,
554 .fragmentStoresAndAtomics
= false,
555 .shaderTessellationAndGeometryPointSize
= false,
556 .shaderImageGatherExtended
= false,
557 .shaderStorageImageExtendedFormats
= false,
558 .shaderStorageImageMultisample
= false,
559 .shaderUniformBufferArrayDynamicIndexing
= false,
560 .shaderSampledImageArrayDynamicIndexing
= false,
561 .shaderStorageBufferArrayDynamicIndexing
= false,
562 .shaderStorageImageArrayDynamicIndexing
= false,
563 .shaderStorageImageReadWithoutFormat
= false,
564 .shaderStorageImageWriteWithoutFormat
= false,
565 .shaderClipDistance
= false,
566 .shaderCullDistance
= false,
567 .shaderFloat64
= false,
568 .shaderInt64
= false,
569 .shaderInt16
= false,
570 .sparseBinding
= false,
571 .variableMultisampleRate
= false,
572 .inheritedQueries
= false,
577 tu_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice
,
578 VkPhysicalDeviceFeatures2KHR
*pFeatures
)
580 vk_foreach_struct(ext
, pFeatures
->pNext
)
582 switch (ext
->sType
) {
583 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR
: {
584 VkPhysicalDeviceVariablePointerFeaturesKHR
*features
= (void *) ext
;
585 features
->variablePointersStorageBuffer
= false;
586 features
->variablePointers
= false;
589 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR
: {
590 VkPhysicalDeviceMultiviewFeaturesKHR
*features
=
591 (VkPhysicalDeviceMultiviewFeaturesKHR
*) ext
;
592 features
->multiview
= false;
593 features
->multiviewGeometryShader
= false;
594 features
->multiviewTessellationShader
= false;
597 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES
: {
598 VkPhysicalDeviceShaderDrawParameterFeatures
*features
=
599 (VkPhysicalDeviceShaderDrawParameterFeatures
*) ext
;
600 features
->shaderDrawParameters
= false;
603 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES
: {
604 VkPhysicalDeviceProtectedMemoryFeatures
*features
=
605 (VkPhysicalDeviceProtectedMemoryFeatures
*) ext
;
606 features
->protectedMemory
= false;
609 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES
: {
610 VkPhysicalDevice16BitStorageFeatures
*features
=
611 (VkPhysicalDevice16BitStorageFeatures
*) ext
;
612 features
->storageBuffer16BitAccess
= false;
613 features
->uniformAndStorageBuffer16BitAccess
= false;
614 features
->storagePushConstant16
= false;
615 features
->storageInputOutput16
= false;
618 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES
: {
619 VkPhysicalDeviceSamplerYcbcrConversionFeatures
*features
=
620 (VkPhysicalDeviceSamplerYcbcrConversionFeatures
*) ext
;
621 features
->samplerYcbcrConversion
= false;
624 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT
: {
625 VkPhysicalDeviceDescriptorIndexingFeaturesEXT
*features
=
626 (VkPhysicalDeviceDescriptorIndexingFeaturesEXT
*) ext
;
627 features
->shaderInputAttachmentArrayDynamicIndexing
= false;
628 features
->shaderUniformTexelBufferArrayDynamicIndexing
= false;
629 features
->shaderStorageTexelBufferArrayDynamicIndexing
= false;
630 features
->shaderUniformBufferArrayNonUniformIndexing
= false;
631 features
->shaderSampledImageArrayNonUniformIndexing
= false;
632 features
->shaderStorageBufferArrayNonUniformIndexing
= false;
633 features
->shaderStorageImageArrayNonUniformIndexing
= false;
634 features
->shaderInputAttachmentArrayNonUniformIndexing
= false;
635 features
->shaderUniformTexelBufferArrayNonUniformIndexing
= false;
636 features
->shaderStorageTexelBufferArrayNonUniformIndexing
= false;
637 features
->descriptorBindingUniformBufferUpdateAfterBind
= false;
638 features
->descriptorBindingSampledImageUpdateAfterBind
= false;
639 features
->descriptorBindingStorageImageUpdateAfterBind
= false;
640 features
->descriptorBindingStorageBufferUpdateAfterBind
= false;
641 features
->descriptorBindingUniformTexelBufferUpdateAfterBind
= false;
642 features
->descriptorBindingStorageTexelBufferUpdateAfterBind
= false;
643 features
->descriptorBindingUpdateUnusedWhilePending
= false;
644 features
->descriptorBindingPartiallyBound
= false;
645 features
->descriptorBindingVariableDescriptorCount
= false;
646 features
->runtimeDescriptorArray
= false;
649 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT
: {
650 VkPhysicalDeviceConditionalRenderingFeaturesEXT
*features
=
651 (VkPhysicalDeviceConditionalRenderingFeaturesEXT
*) ext
;
652 features
->conditionalRendering
= false;
653 features
->inheritedConditionalRendering
= false;
660 return tu_GetPhysicalDeviceFeatures(physicalDevice
, &pFeatures
->features
);
664 tu_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice
,
665 VkPhysicalDeviceProperties
*pProperties
)
667 TU_FROM_HANDLE(tu_physical_device
, pdevice
, physicalDevice
);
668 VkSampleCountFlags sample_counts
= 0xf;
670 /* make sure that the entire descriptor set is addressable with a signed
671 * 32-bit int. So the sum of all limits scaled by descriptor size has to
672 * be at most 2 GiB. the combined image & samples object count as one of
673 * both. This limit is for the pipeline layout, not for the set layout, but
674 * there is no set limit, so we just set a pipeline limit. I don't think
675 * any app is going to hit this soon. */
676 size_t max_descriptor_set_size
=
677 ((1ull << 31) - 16 * MAX_DYNAMIC_BUFFERS
) /
678 (32 /* uniform buffer, 32 due to potential space wasted on alignment */ +
679 32 /* storage buffer, 32 due to potential space wasted on alignment */ +
680 32 /* sampler, largest when combined with image */ +
681 64 /* sampled image */ + 64 /* storage image */);
683 VkPhysicalDeviceLimits limits
= {
684 .maxImageDimension1D
= (1 << 14),
685 .maxImageDimension2D
= (1 << 14),
686 .maxImageDimension3D
= (1 << 11),
687 .maxImageDimensionCube
= (1 << 14),
688 .maxImageArrayLayers
= (1 << 11),
689 .maxTexelBufferElements
= 128 * 1024 * 1024,
690 .maxUniformBufferRange
= UINT32_MAX
,
691 .maxStorageBufferRange
= UINT32_MAX
,
692 .maxPushConstantsSize
= MAX_PUSH_CONSTANTS_SIZE
,
693 .maxMemoryAllocationCount
= UINT32_MAX
,
694 .maxSamplerAllocationCount
= 64 * 1024,
695 .bufferImageGranularity
= 64, /* A cache line */
696 .sparseAddressSpaceSize
= 0xffffffffu
, /* buffer max size */
697 .maxBoundDescriptorSets
= MAX_SETS
,
698 .maxPerStageDescriptorSamplers
= max_descriptor_set_size
,
699 .maxPerStageDescriptorUniformBuffers
= max_descriptor_set_size
,
700 .maxPerStageDescriptorStorageBuffers
= max_descriptor_set_size
,
701 .maxPerStageDescriptorSampledImages
= max_descriptor_set_size
,
702 .maxPerStageDescriptorStorageImages
= max_descriptor_set_size
,
703 .maxPerStageDescriptorInputAttachments
= max_descriptor_set_size
,
704 .maxPerStageResources
= max_descriptor_set_size
,
705 .maxDescriptorSetSamplers
= max_descriptor_set_size
,
706 .maxDescriptorSetUniformBuffers
= max_descriptor_set_size
,
707 .maxDescriptorSetUniformBuffersDynamic
= MAX_DYNAMIC_UNIFORM_BUFFERS
,
708 .maxDescriptorSetStorageBuffers
= max_descriptor_set_size
,
709 .maxDescriptorSetStorageBuffersDynamic
= MAX_DYNAMIC_STORAGE_BUFFERS
,
710 .maxDescriptorSetSampledImages
= max_descriptor_set_size
,
711 .maxDescriptorSetStorageImages
= max_descriptor_set_size
,
712 .maxDescriptorSetInputAttachments
= max_descriptor_set_size
,
713 .maxVertexInputAttributes
= 32,
714 .maxVertexInputBindings
= 32,
715 .maxVertexInputAttributeOffset
= 2047,
716 .maxVertexInputBindingStride
= 2048,
717 .maxVertexOutputComponents
= 128,
718 .maxTessellationGenerationLevel
= 64,
719 .maxTessellationPatchSize
= 32,
720 .maxTessellationControlPerVertexInputComponents
= 128,
721 .maxTessellationControlPerVertexOutputComponents
= 128,
722 .maxTessellationControlPerPatchOutputComponents
= 120,
723 .maxTessellationControlTotalOutputComponents
= 4096,
724 .maxTessellationEvaluationInputComponents
= 128,
725 .maxTessellationEvaluationOutputComponents
= 128,
726 .maxGeometryShaderInvocations
= 127,
727 .maxGeometryInputComponents
= 64,
728 .maxGeometryOutputComponents
= 128,
729 .maxGeometryOutputVertices
= 256,
730 .maxGeometryTotalOutputComponents
= 1024,
731 .maxFragmentInputComponents
= 128,
732 .maxFragmentOutputAttachments
= 8,
733 .maxFragmentDualSrcAttachments
= 1,
734 .maxFragmentCombinedOutputResources
= 8,
735 .maxComputeSharedMemorySize
= 32768,
736 .maxComputeWorkGroupCount
= { 65535, 65535, 65535 },
737 .maxComputeWorkGroupInvocations
= 2048,
738 .maxComputeWorkGroupSize
= { 2048, 2048, 2048 },
739 .subPixelPrecisionBits
= 4 /* FIXME */,
740 .subTexelPrecisionBits
= 4 /* FIXME */,
741 .mipmapPrecisionBits
= 4 /* FIXME */,
742 .maxDrawIndexedIndexValue
= UINT32_MAX
,
743 .maxDrawIndirectCount
= UINT32_MAX
,
744 .maxSamplerLodBias
= 16,
745 .maxSamplerAnisotropy
= 16,
746 .maxViewports
= MAX_VIEWPORTS
,
747 .maxViewportDimensions
= { (1 << 14), (1 << 14) },
748 .viewportBoundsRange
= { INT16_MIN
, INT16_MAX
},
749 .viewportSubPixelBits
= 8,
750 .minMemoryMapAlignment
= 4096, /* A page */
751 .minTexelBufferOffsetAlignment
= 1,
752 .minUniformBufferOffsetAlignment
= 4,
753 .minStorageBufferOffsetAlignment
= 4,
754 .minTexelOffset
= -32,
755 .maxTexelOffset
= 31,
756 .minTexelGatherOffset
= -32,
757 .maxTexelGatherOffset
= 31,
758 .minInterpolationOffset
= -2,
759 .maxInterpolationOffset
= 2,
760 .subPixelInterpolationOffsetBits
= 8,
761 .maxFramebufferWidth
= (1 << 14),
762 .maxFramebufferHeight
= (1 << 14),
763 .maxFramebufferLayers
= (1 << 10),
764 .framebufferColorSampleCounts
= sample_counts
,
765 .framebufferDepthSampleCounts
= sample_counts
,
766 .framebufferStencilSampleCounts
= sample_counts
,
767 .framebufferNoAttachmentsSampleCounts
= sample_counts
,
768 .maxColorAttachments
= MAX_RTS
,
769 .sampledImageColorSampleCounts
= sample_counts
,
770 .sampledImageIntegerSampleCounts
= VK_SAMPLE_COUNT_1_BIT
,
771 .sampledImageDepthSampleCounts
= sample_counts
,
772 .sampledImageStencilSampleCounts
= sample_counts
,
773 .storageImageSampleCounts
= VK_SAMPLE_COUNT_1_BIT
,
774 .maxSampleMaskWords
= 1,
775 .timestampComputeAndGraphics
= true,
776 .timestampPeriod
= 1,
777 .maxClipDistances
= 8,
778 .maxCullDistances
= 8,
779 .maxCombinedClipAndCullDistances
= 8,
780 .discreteQueuePriorities
= 1,
781 .pointSizeRange
= { 0.125, 255.875 },
782 .lineWidthRange
= { 0.0, 7.9921875 },
783 .pointSizeGranularity
= (1.0 / 8.0),
784 .lineWidthGranularity
= (1.0 / 128.0),
785 .strictLines
= false, /* FINISHME */
786 .standardSampleLocations
= true,
787 .optimalBufferCopyOffsetAlignment
= 128,
788 .optimalBufferCopyRowPitchAlignment
= 128,
789 .nonCoherentAtomSize
= 64,
792 *pProperties
= (VkPhysicalDeviceProperties
) {
793 .apiVersion
= tu_physical_device_api_version(pdevice
),
794 .driverVersion
= vk_get_driver_version(),
795 .vendorID
= 0, /* TODO */
797 .deviceType
= VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
,
799 .sparseProperties
= { 0 },
802 strcpy(pProperties
->deviceName
, pdevice
->name
);
803 memcpy(pProperties
->pipelineCacheUUID
, pdevice
->cache_uuid
, VK_UUID_SIZE
);
807 tu_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice
,
808 VkPhysicalDeviceProperties2KHR
*pProperties
)
810 TU_FROM_HANDLE(tu_physical_device
, pdevice
, physicalDevice
);
811 tu_GetPhysicalDeviceProperties(physicalDevice
, &pProperties
->properties
);
813 vk_foreach_struct(ext
, pProperties
->pNext
)
815 switch (ext
->sType
) {
816 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR
: {
817 VkPhysicalDevicePushDescriptorPropertiesKHR
*properties
=
818 (VkPhysicalDevicePushDescriptorPropertiesKHR
*) ext
;
819 properties
->maxPushDescriptors
= MAX_PUSH_DESCRIPTORS
;
822 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR
: {
823 VkPhysicalDeviceIDPropertiesKHR
*properties
=
824 (VkPhysicalDeviceIDPropertiesKHR
*) ext
;
825 memcpy(properties
->driverUUID
, pdevice
->driver_uuid
, VK_UUID_SIZE
);
826 memcpy(properties
->deviceUUID
, pdevice
->device_uuid
, VK_UUID_SIZE
);
827 properties
->deviceLUIDValid
= false;
830 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR
: {
831 VkPhysicalDeviceMultiviewPropertiesKHR
*properties
=
832 (VkPhysicalDeviceMultiviewPropertiesKHR
*) ext
;
833 properties
->maxMultiviewViewCount
= MAX_VIEWS
;
834 properties
->maxMultiviewInstanceIndex
= INT_MAX
;
837 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES_KHR
: {
838 VkPhysicalDevicePointClippingPropertiesKHR
*properties
=
839 (VkPhysicalDevicePointClippingPropertiesKHR
*) ext
;
840 properties
->pointClippingBehavior
=
841 VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR
;
844 case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES
: {
845 VkPhysicalDeviceMaintenance3Properties
*properties
=
846 (VkPhysicalDeviceMaintenance3Properties
*) ext
;
847 /* Make sure everything is addressable by a signed 32-bit int, and
848 * our largest descriptors are 96 bytes. */
849 properties
->maxPerSetDescriptors
= (1ull << 31) / 96;
850 /* Our buffer size fields allow only this much */
851 properties
->maxMemoryAllocationSize
= 0xFFFFFFFFull
;
860 static const VkQueueFamilyProperties tu_queue_family_properties
= {
862 VK_QUEUE_GRAPHICS_BIT
| VK_QUEUE_COMPUTE_BIT
| VK_QUEUE_TRANSFER_BIT
,
864 .timestampValidBits
= 64,
865 .minImageTransferGranularity
= (VkExtent3D
) { 1, 1, 1 },
869 tu_GetPhysicalDeviceQueueFamilyProperties(
870 VkPhysicalDevice physicalDevice
,
871 uint32_t *pQueueFamilyPropertyCount
,
872 VkQueueFamilyProperties
*pQueueFamilyProperties
)
874 VK_OUTARRAY_MAKE(out
, pQueueFamilyProperties
, pQueueFamilyPropertyCount
);
876 vk_outarray_append(&out
, p
) { *p
= tu_queue_family_properties
; }
880 tu_GetPhysicalDeviceQueueFamilyProperties2(
881 VkPhysicalDevice physicalDevice
,
882 uint32_t *pQueueFamilyPropertyCount
,
883 VkQueueFamilyProperties2KHR
*pQueueFamilyProperties
)
885 VK_OUTARRAY_MAKE(out
, pQueueFamilyProperties
, pQueueFamilyPropertyCount
);
887 vk_outarray_append(&out
, p
)
889 p
->queueFamilyProperties
= tu_queue_family_properties
;
894 tu_get_system_heap_size()
899 uint64_t total_ram
= (uint64_t) info
.totalram
* (uint64_t) info
.mem_unit
;
901 /* We don't want to burn too much ram with the GPU. If the user has 4GiB
902 * or less, we use at most half. If they have more than 4GiB, we use 3/4.
904 uint64_t available_ram
;
905 if (total_ram
<= 4ull * 1024ull * 1024ull * 1024ull)
906 available_ram
= total_ram
/ 2;
908 available_ram
= total_ram
* 3 / 4;
910 return available_ram
;
914 tu_GetPhysicalDeviceMemoryProperties(
915 VkPhysicalDevice physicalDevice
,
916 VkPhysicalDeviceMemoryProperties
*pMemoryProperties
)
918 pMemoryProperties
->memoryHeapCount
= 1;
919 pMemoryProperties
->memoryHeaps
[0].size
= tu_get_system_heap_size();
920 pMemoryProperties
->memoryHeaps
[0].flags
= VK_MEMORY_HEAP_DEVICE_LOCAL_BIT
;
922 pMemoryProperties
->memoryTypeCount
= 1;
923 pMemoryProperties
->memoryTypes
[0].propertyFlags
=
924 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
|
925 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
|
926 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
;
927 pMemoryProperties
->memoryTypes
[0].heapIndex
= 0;
931 tu_GetPhysicalDeviceMemoryProperties2(
932 VkPhysicalDevice physicalDevice
,
933 VkPhysicalDeviceMemoryProperties2KHR
*pMemoryProperties
)
935 return tu_GetPhysicalDeviceMemoryProperties(
936 physicalDevice
, &pMemoryProperties
->memoryProperties
);
940 tu_queue_init(struct tu_device
*device
,
941 struct tu_queue
*queue
,
942 uint32_t queue_family_index
,
944 VkDeviceQueueCreateFlags flags
)
946 queue
->_loader_data
.loaderMagic
= ICD_LOADER_MAGIC
;
947 queue
->device
= device
;
948 queue
->queue_family_index
= queue_family_index
;
949 queue
->queue_idx
= idx
;
950 queue
->flags
= flags
;
952 int ret
= tu_drm_submitqueue_new(device
, 0, &queue
->msm_queue_id
);
954 return VK_ERROR_INITIALIZATION_FAILED
;
960 tu_queue_finish(struct tu_queue
*queue
)
962 tu_drm_submitqueue_close(queue
->device
, queue
->msm_queue_id
);
966 tu_get_device_extension_index(const char *name
)
968 for (unsigned i
= 0; i
< TU_DEVICE_EXTENSION_COUNT
; ++i
) {
969 if (strcmp(name
, tu_device_extensions
[i
].extensionName
) == 0)
976 tu_CreateDevice(VkPhysicalDevice physicalDevice
,
977 const VkDeviceCreateInfo
*pCreateInfo
,
978 const VkAllocationCallbacks
*pAllocator
,
981 TU_FROM_HANDLE(tu_physical_device
, physical_device
, physicalDevice
);
983 struct tu_device
*device
;
985 /* Check enabled features */
986 if (pCreateInfo
->pEnabledFeatures
) {
987 VkPhysicalDeviceFeatures supported_features
;
988 tu_GetPhysicalDeviceFeatures(physicalDevice
, &supported_features
);
989 VkBool32
*supported_feature
= (VkBool32
*) &supported_features
;
990 VkBool32
*enabled_feature
= (VkBool32
*) pCreateInfo
->pEnabledFeatures
;
991 unsigned num_features
=
992 sizeof(VkPhysicalDeviceFeatures
) / sizeof(VkBool32
);
993 for (uint32_t i
= 0; i
< num_features
; i
++) {
994 if (enabled_feature
[i
] && !supported_feature
[i
])
995 return vk_error(physical_device
->instance
,
996 VK_ERROR_FEATURE_NOT_PRESENT
);
1000 device
= vk_zalloc2(&physical_device
->instance
->alloc
, pAllocator
,
1001 sizeof(*device
), 8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE
);
1003 return vk_error(physical_device
->instance
, VK_ERROR_OUT_OF_HOST_MEMORY
);
1005 device
->_loader_data
.loaderMagic
= ICD_LOADER_MAGIC
;
1006 device
->instance
= physical_device
->instance
;
1007 device
->physical_device
= physical_device
;
1010 device
->alloc
= *pAllocator
;
1012 device
->alloc
= physical_device
->instance
->alloc
;
1014 for (uint32_t i
= 0; i
< pCreateInfo
->enabledExtensionCount
; i
++) {
1015 const char *ext_name
= pCreateInfo
->ppEnabledExtensionNames
[i
];
1016 int index
= tu_get_device_extension_index(ext_name
);
1018 !physical_device
->supported_extensions
.extensions
[index
]) {
1019 vk_free(&device
->alloc
, device
);
1020 return vk_error(physical_device
->instance
,
1021 VK_ERROR_EXTENSION_NOT_PRESENT
);
1024 device
->enabled_extensions
.extensions
[index
] = true;
1027 for (unsigned i
= 0; i
< pCreateInfo
->queueCreateInfoCount
; i
++) {
1028 const VkDeviceQueueCreateInfo
*queue_create
=
1029 &pCreateInfo
->pQueueCreateInfos
[i
];
1030 uint32_t qfi
= queue_create
->queueFamilyIndex
;
1031 device
->queues
[qfi
] = vk_alloc(
1032 &device
->alloc
, queue_create
->queueCount
* sizeof(struct tu_queue
),
1033 8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE
);
1034 if (!device
->queues
[qfi
]) {
1035 result
= VK_ERROR_OUT_OF_HOST_MEMORY
;
1039 memset(device
->queues
[qfi
], 0,
1040 queue_create
->queueCount
* sizeof(struct tu_queue
));
1042 device
->queue_count
[qfi
] = queue_create
->queueCount
;
1044 for (unsigned q
= 0; q
< queue_create
->queueCount
; q
++) {
1045 result
= tu_queue_init(device
, &device
->queues
[qfi
][q
], qfi
, q
,
1046 queue_create
->flags
);
1047 if (result
!= VK_SUCCESS
)
1052 VkPipelineCacheCreateInfo ci
;
1053 ci
.sType
= VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO
;
1056 ci
.pInitialData
= NULL
;
1057 ci
.initialDataSize
= 0;
1060 tu_CreatePipelineCache(tu_device_to_handle(device
), &ci
, NULL
, &pc
);
1061 if (result
!= VK_SUCCESS
)
1064 device
->mem_cache
= tu_pipeline_cache_from_handle(pc
);
1066 *pDevice
= tu_device_to_handle(device
);
1070 for (unsigned i
= 0; i
< TU_MAX_QUEUE_FAMILIES
; i
++) {
1071 for (unsigned q
= 0; q
< device
->queue_count
[i
]; q
++)
1072 tu_queue_finish(&device
->queues
[i
][q
]);
1073 if (device
->queue_count
[i
])
1074 vk_free(&device
->alloc
, device
->queues
[i
]);
1077 vk_free(&device
->alloc
, device
);
1082 tu_DestroyDevice(VkDevice _device
, const VkAllocationCallbacks
*pAllocator
)
1084 TU_FROM_HANDLE(tu_device
, device
, _device
);
1089 for (unsigned i
= 0; i
< TU_MAX_QUEUE_FAMILIES
; i
++) {
1090 for (unsigned q
= 0; q
< device
->queue_count
[i
]; q
++)
1091 tu_queue_finish(&device
->queues
[i
][q
]);
1092 if (device
->queue_count
[i
])
1093 vk_free(&device
->alloc
, device
->queues
[i
]);
1096 VkPipelineCache pc
= tu_pipeline_cache_to_handle(device
->mem_cache
);
1097 tu_DestroyPipelineCache(tu_device_to_handle(device
), pc
, NULL
);
1099 vk_free(&device
->alloc
, device
);
1103 tu_EnumerateInstanceLayerProperties(uint32_t *pPropertyCount
,
1104 VkLayerProperties
*pProperties
)
1106 *pPropertyCount
= 0;
1111 tu_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice
,
1112 uint32_t *pPropertyCount
,
1113 VkLayerProperties
*pProperties
)
1115 *pPropertyCount
= 0;
1120 tu_GetDeviceQueue2(VkDevice _device
,
1121 const VkDeviceQueueInfo2
*pQueueInfo
,
1124 TU_FROM_HANDLE(tu_device
, device
, _device
);
1125 struct tu_queue
*queue
;
1128 &device
->queues
[pQueueInfo
->queueFamilyIndex
][pQueueInfo
->queueIndex
];
1129 if (pQueueInfo
->flags
!= queue
->flags
) {
1130 /* From the Vulkan 1.1.70 spec:
1132 * "The queue returned by vkGetDeviceQueue2 must have the same
1133 * flags value from this structure as that used at device
1134 * creation time in a VkDeviceQueueCreateInfo instance. If no
1135 * matching flags were specified at device creation time then
1136 * pQueue will return VK_NULL_HANDLE."
1138 *pQueue
= VK_NULL_HANDLE
;
1142 *pQueue
= tu_queue_to_handle(queue
);
1146 tu_GetDeviceQueue(VkDevice _device
,
1147 uint32_t queueFamilyIndex
,
1148 uint32_t queueIndex
,
1151 const VkDeviceQueueInfo2 info
=
1152 (VkDeviceQueueInfo2
) { .sType
= VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2
,
1153 .queueFamilyIndex
= queueFamilyIndex
,
1154 .queueIndex
= queueIndex
};
1156 tu_GetDeviceQueue2(_device
, &info
, pQueue
);
1160 tu_QueueSubmit(VkQueue _queue
,
1161 uint32_t submitCount
,
1162 const VkSubmitInfo
*pSubmits
,
1165 TU_FROM_HANDLE(tu_queue
, queue
, _queue
);
1167 for (uint32_t i
= 0; i
< submitCount
; ++i
) {
1168 const VkSubmitInfo
*submit
= pSubmits
+ i
;
1169 struct tu_bo_list bo_list
;
1170 tu_bo_list_init(&bo_list
);
1172 uint32_t entry_count
= 0;
1173 for(uint32_t j
= 0; j
< submit
->commandBufferCount
; ++j
) {
1174 TU_FROM_HANDLE(tu_cmd_buffer
, cmdbuf
, submit
->pCommandBuffers
[j
]);
1175 entry_count
+= cmdbuf
->cs
.entry_count
;
1178 struct drm_msm_gem_submit_cmd cmds
[entry_count
];
1179 uint32_t entry_idx
= 0;
1180 for(uint32_t j
= 0; j
< submit
->commandBufferCount
; ++j
) {
1181 TU_FROM_HANDLE(tu_cmd_buffer
, cmdbuf
, submit
->pCommandBuffers
[j
]);
1182 struct tu_cmd_stream
*stream
= &cmdbuf
->cs
;
1183 for (unsigned i
= 0; i
< stream
->entry_count
; ++i
, ++entry_idx
) {
1184 cmds
[entry_idx
].type
= MSM_SUBMIT_CMD_BUF
;
1185 cmds
[entry_idx
].submit_idx
= tu_bo_list_add(&bo_list
, stream
->entries
[i
].bo
);
1186 cmds
[entry_idx
].submit_offset
= stream
->entries
[i
].offset
;
1187 cmds
[entry_idx
].size
= stream
->entries
[i
].size
;
1188 cmds
[entry_idx
].pad
= 0;
1189 cmds
[entry_idx
].nr_relocs
= 0;
1190 cmds
[entry_idx
].relocs
= 0;
1195 struct drm_msm_gem_submit_bo bos
[bo_list
.count
];
1196 for (unsigned i
= 0; i
< bo_list
.count
; ++i
) {
1197 bos
[i
].flags
= MSM_SUBMIT_BO_READ
| MSM_SUBMIT_BO_WRITE
;
1198 bos
[i
].handle
= bo_list
.handles
[i
];
1199 bos
[i
].presumed
= 0;
1202 struct drm_msm_gem_submit req
= {
1203 .flags
= MSM_PIPE_3D0
,
1204 .queueid
= queue
->msm_queue_id
,
1205 .bos
= (uint64_t)(uintptr_t)bos
,
1206 .nr_bos
= bo_list
.count
,
1207 .cmds
= (uint64_t)(uintptr_t)cmds
,
1208 .nr_cmds
= entry_count
,
1211 int ret
= drmCommandWriteRead(queue
->device
->physical_device
->local_fd
,
1215 fprintf(stderr
, "submit failed: %s\n", strerror(errno
));
1219 tu_bo_list_destroy(&bo_list
);
1225 tu_QueueWaitIdle(VkQueue _queue
)
1231 tu_DeviceWaitIdle(VkDevice _device
)
1233 TU_FROM_HANDLE(tu_device
, device
, _device
);
1235 for (unsigned i
= 0; i
< TU_MAX_QUEUE_FAMILIES
; i
++) {
1236 for (unsigned q
= 0; q
< device
->queue_count
[i
]; q
++) {
1237 tu_QueueWaitIdle(tu_queue_to_handle(&device
->queues
[i
][q
]));
1244 tu_EnumerateInstanceExtensionProperties(const char *pLayerName
,
1245 uint32_t *pPropertyCount
,
1246 VkExtensionProperties
*pProperties
)
1248 VK_OUTARRAY_MAKE(out
, pProperties
, pPropertyCount
);
1250 /* We spport no lyaers */
1252 return vk_error(NULL
, VK_ERROR_LAYER_NOT_PRESENT
);
1254 for (int i
= 0; i
< TU_INSTANCE_EXTENSION_COUNT
; i
++) {
1255 if (tu_supported_instance_extensions
.extensions
[i
]) {
1256 vk_outarray_append(&out
, prop
) { *prop
= tu_instance_extensions
[i
]; }
1260 return vk_outarray_status(&out
);
1264 tu_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice
,
1265 const char *pLayerName
,
1266 uint32_t *pPropertyCount
,
1267 VkExtensionProperties
*pProperties
)
1269 /* We spport no lyaers */
1270 TU_FROM_HANDLE(tu_physical_device
, device
, physicalDevice
);
1271 VK_OUTARRAY_MAKE(out
, pProperties
, pPropertyCount
);
1273 /* We spport no lyaers */
1275 return vk_error(NULL
, VK_ERROR_LAYER_NOT_PRESENT
);
1277 for (int i
= 0; i
< TU_DEVICE_EXTENSION_COUNT
; i
++) {
1278 if (device
->supported_extensions
.extensions
[i
]) {
1279 vk_outarray_append(&out
, prop
) { *prop
= tu_device_extensions
[i
]; }
1283 return vk_outarray_status(&out
);
1287 tu_GetInstanceProcAddr(VkInstance _instance
, const char *pName
)
1289 TU_FROM_HANDLE(tu_instance
, instance
, _instance
);
1291 return tu_lookup_entrypoint_checked(
1292 pName
, instance
? instance
->api_version
: 0,
1293 instance
? &instance
->enabled_extensions
: NULL
, NULL
);
1296 /* The loader wants us to expose a second GetInstanceProcAddr function
1297 * to work around certain LD_PRELOAD issues seen in apps.
1300 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
1301 vk_icdGetInstanceProcAddr(VkInstance instance
, const char *pName
);
1304 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
1305 vk_icdGetInstanceProcAddr(VkInstance instance
, const char *pName
)
1307 return tu_GetInstanceProcAddr(instance
, pName
);
1311 tu_GetDeviceProcAddr(VkDevice _device
, const char *pName
)
1313 TU_FROM_HANDLE(tu_device
, device
, _device
);
1315 return tu_lookup_entrypoint_checked(pName
, device
->instance
->api_version
,
1316 &device
->instance
->enabled_extensions
,
1317 &device
->enabled_extensions
);
1321 tu_alloc_memory(struct tu_device
*device
,
1322 const VkMemoryAllocateInfo
*pAllocateInfo
,
1323 const VkAllocationCallbacks
*pAllocator
,
1324 VkDeviceMemory
*pMem
)
1326 struct tu_device_memory
*mem
;
1329 assert(pAllocateInfo
->sType
== VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
);
1331 if (pAllocateInfo
->allocationSize
== 0) {
1332 /* Apparently, this is allowed */
1333 *pMem
= VK_NULL_HANDLE
;
1337 mem
= vk_alloc2(&device
->alloc
, pAllocator
, sizeof(*mem
), 8,
1338 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
1340 return vk_error(device
->instance
, VK_ERROR_OUT_OF_HOST_MEMORY
);
1342 result
= tu_bo_init_new(device
, &mem
->bo
, pAllocateInfo
->allocationSize
);
1343 if (result
!= VK_SUCCESS
) {
1344 vk_free2(&device
->alloc
, pAllocator
, mem
);
1348 mem
->size
= pAllocateInfo
->allocationSize
;
1349 mem
->type_index
= pAllocateInfo
->memoryTypeIndex
;
1352 mem
->user_ptr
= NULL
;
1354 *pMem
= tu_device_memory_to_handle(mem
);
1360 tu_AllocateMemory(VkDevice _device
,
1361 const VkMemoryAllocateInfo
*pAllocateInfo
,
1362 const VkAllocationCallbacks
*pAllocator
,
1363 VkDeviceMemory
*pMem
)
1365 TU_FROM_HANDLE(tu_device
, device
, _device
);
1366 return tu_alloc_memory(device
, pAllocateInfo
, pAllocator
, pMem
);
1370 tu_FreeMemory(VkDevice _device
,
1371 VkDeviceMemory _mem
,
1372 const VkAllocationCallbacks
*pAllocator
)
1374 TU_FROM_HANDLE(tu_device
, device
, _device
);
1375 TU_FROM_HANDLE(tu_device_memory
, mem
, _mem
);
1380 tu_bo_finish(device
, &mem
->bo
);
1381 vk_free2(&device
->alloc
, pAllocator
, mem
);
1385 tu_MapMemory(VkDevice _device
,
1386 VkDeviceMemory _memory
,
1387 VkDeviceSize offset
,
1389 VkMemoryMapFlags flags
,
1392 TU_FROM_HANDLE(tu_device
, device
, _device
);
1393 TU_FROM_HANDLE(tu_device_memory
, mem
, _memory
);
1401 if (mem
->user_ptr
) {
1402 *ppData
= mem
->user_ptr
;
1403 } else if (!mem
->map
) {
1404 result
= tu_bo_map(device
, &mem
->bo
);
1405 if (result
!= VK_SUCCESS
)
1407 *ppData
= mem
->map
= mem
->bo
.map
;
1416 return vk_error(device
->instance
, VK_ERROR_MEMORY_MAP_FAILED
);
1420 tu_UnmapMemory(VkDevice _device
, VkDeviceMemory _memory
)
1422 /* I do not see any unmapping done by the freedreno Gallium driver. */
1426 tu_FlushMappedMemoryRanges(VkDevice _device
,
1427 uint32_t memoryRangeCount
,
1428 const VkMappedMemoryRange
*pMemoryRanges
)
1434 tu_InvalidateMappedMemoryRanges(VkDevice _device
,
1435 uint32_t memoryRangeCount
,
1436 const VkMappedMemoryRange
*pMemoryRanges
)
1442 tu_GetBufferMemoryRequirements(VkDevice _device
,
1444 VkMemoryRequirements
*pMemoryRequirements
)
1446 TU_FROM_HANDLE(tu_buffer
, buffer
, _buffer
);
1448 pMemoryRequirements
->memoryTypeBits
= 1;
1449 pMemoryRequirements
->alignment
= 16;
1450 pMemoryRequirements
->size
=
1451 align64(buffer
->size
, pMemoryRequirements
->alignment
);
1455 tu_GetBufferMemoryRequirements2(
1457 const VkBufferMemoryRequirementsInfo2KHR
*pInfo
,
1458 VkMemoryRequirements2KHR
*pMemoryRequirements
)
1460 tu_GetBufferMemoryRequirements(device
, pInfo
->buffer
,
1461 &pMemoryRequirements
->memoryRequirements
);
1465 tu_GetImageMemoryRequirements(VkDevice _device
,
1467 VkMemoryRequirements
*pMemoryRequirements
)
1469 TU_FROM_HANDLE(tu_image
, image
, _image
);
1471 pMemoryRequirements
->memoryTypeBits
= 1;
1472 pMemoryRequirements
->size
= image
->size
;
1473 pMemoryRequirements
->alignment
= image
->alignment
;
1477 tu_GetImageMemoryRequirements2(VkDevice device
,
1478 const VkImageMemoryRequirementsInfo2KHR
*pInfo
,
1479 VkMemoryRequirements2KHR
*pMemoryRequirements
)
1481 tu_GetImageMemoryRequirements(device
, pInfo
->image
,
1482 &pMemoryRequirements
->memoryRequirements
);
1486 tu_GetImageSparseMemoryRequirements(
1489 uint32_t *pSparseMemoryRequirementCount
,
1490 VkSparseImageMemoryRequirements
*pSparseMemoryRequirements
)
1496 tu_GetImageSparseMemoryRequirements2(
1498 const VkImageSparseMemoryRequirementsInfo2KHR
*pInfo
,
1499 uint32_t *pSparseMemoryRequirementCount
,
1500 VkSparseImageMemoryRequirements2KHR
*pSparseMemoryRequirements
)
1506 tu_GetDeviceMemoryCommitment(VkDevice device
,
1507 VkDeviceMemory memory
,
1508 VkDeviceSize
*pCommittedMemoryInBytes
)
1510 *pCommittedMemoryInBytes
= 0;
1514 tu_BindBufferMemory2(VkDevice device
,
1515 uint32_t bindInfoCount
,
1516 const VkBindBufferMemoryInfoKHR
*pBindInfos
)
1522 tu_BindBufferMemory(VkDevice device
,
1524 VkDeviceMemory memory
,
1525 VkDeviceSize memoryOffset
)
1527 const VkBindBufferMemoryInfoKHR info
= {
1528 .sType
= VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR
,
1531 .memoryOffset
= memoryOffset
1534 return tu_BindBufferMemory2(device
, 1, &info
);
1538 tu_BindImageMemory2(VkDevice device
,
1539 uint32_t bindInfoCount
,
1540 const VkBindImageMemoryInfoKHR
*pBindInfos
)
1546 tu_BindImageMemory(VkDevice device
,
1548 VkDeviceMemory memory
,
1549 VkDeviceSize memoryOffset
)
1551 const VkBindImageMemoryInfoKHR info
= {
1552 .sType
= VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR
,
1555 .memoryOffset
= memoryOffset
1558 return tu_BindImageMemory2(device
, 1, &info
);
1562 tu_QueueBindSparse(VkQueue _queue
,
1563 uint32_t bindInfoCount
,
1564 const VkBindSparseInfo
*pBindInfo
,
1571 tu_CreateFence(VkDevice _device
,
1572 const VkFenceCreateInfo
*pCreateInfo
,
1573 const VkAllocationCallbacks
*pAllocator
,
1576 TU_FROM_HANDLE(tu_device
, device
, _device
);
1578 struct tu_fence
*fence
=
1579 vk_alloc2(&device
->alloc
, pAllocator
, sizeof(*fence
), 8,
1580 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
1583 return vk_error(device
->instance
, VK_ERROR_OUT_OF_HOST_MEMORY
);
1585 *pFence
= tu_fence_to_handle(fence
);
1591 tu_DestroyFence(VkDevice _device
,
1593 const VkAllocationCallbacks
*pAllocator
)
1595 TU_FROM_HANDLE(tu_device
, device
, _device
);
1596 TU_FROM_HANDLE(tu_fence
, fence
, _fence
);
1601 vk_free2(&device
->alloc
, pAllocator
, fence
);
1605 tu_WaitForFences(VkDevice _device
,
1606 uint32_t fenceCount
,
1607 const VkFence
*pFences
,
1615 tu_ResetFences(VkDevice _device
, uint32_t fenceCount
, const VkFence
*pFences
)
1621 tu_GetFenceStatus(VkDevice _device
, VkFence _fence
)
1626 // Queue semaphore functions
1629 tu_CreateSemaphore(VkDevice _device
,
1630 const VkSemaphoreCreateInfo
*pCreateInfo
,
1631 const VkAllocationCallbacks
*pAllocator
,
1632 VkSemaphore
*pSemaphore
)
1634 TU_FROM_HANDLE(tu_device
, device
, _device
);
1636 struct tu_semaphore
*sem
=
1637 vk_alloc2(&device
->alloc
, pAllocator
, sizeof(*sem
), 8,
1638 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
1640 return vk_error(device
->instance
, VK_ERROR_OUT_OF_HOST_MEMORY
);
1642 *pSemaphore
= tu_semaphore_to_handle(sem
);
1647 tu_DestroySemaphore(VkDevice _device
,
1648 VkSemaphore _semaphore
,
1649 const VkAllocationCallbacks
*pAllocator
)
1651 TU_FROM_HANDLE(tu_device
, device
, _device
);
1652 TU_FROM_HANDLE(tu_semaphore
, sem
, _semaphore
);
1656 vk_free2(&device
->alloc
, pAllocator
, sem
);
1660 tu_CreateEvent(VkDevice _device
,
1661 const VkEventCreateInfo
*pCreateInfo
,
1662 const VkAllocationCallbacks
*pAllocator
,
1665 TU_FROM_HANDLE(tu_device
, device
, _device
);
1666 struct tu_event
*event
=
1667 vk_alloc2(&device
->alloc
, pAllocator
, sizeof(*event
), 8,
1668 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
1671 return vk_error(device
->instance
, VK_ERROR_OUT_OF_HOST_MEMORY
);
1673 *pEvent
= tu_event_to_handle(event
);
1679 tu_DestroyEvent(VkDevice _device
,
1681 const VkAllocationCallbacks
*pAllocator
)
1683 TU_FROM_HANDLE(tu_device
, device
, _device
);
1684 TU_FROM_HANDLE(tu_event
, event
, _event
);
1688 vk_free2(&device
->alloc
, pAllocator
, event
);
1692 tu_GetEventStatus(VkDevice _device
, VkEvent _event
)
1694 TU_FROM_HANDLE(tu_event
, event
, _event
);
1696 if (*event
->map
== 1)
1697 return VK_EVENT_SET
;
1698 return VK_EVENT_RESET
;
1702 tu_SetEvent(VkDevice _device
, VkEvent _event
)
1704 TU_FROM_HANDLE(tu_event
, event
, _event
);
1711 tu_ResetEvent(VkDevice _device
, VkEvent _event
)
1713 TU_FROM_HANDLE(tu_event
, event
, _event
);
1720 tu_CreateBuffer(VkDevice _device
,
1721 const VkBufferCreateInfo
*pCreateInfo
,
1722 const VkAllocationCallbacks
*pAllocator
,
1725 TU_FROM_HANDLE(tu_device
, device
, _device
);
1726 struct tu_buffer
*buffer
;
1728 assert(pCreateInfo
->sType
== VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO
);
1730 buffer
= vk_alloc2(&device
->alloc
, pAllocator
, sizeof(*buffer
), 8,
1731 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
1733 return vk_error(device
->instance
, VK_ERROR_OUT_OF_HOST_MEMORY
);
1735 buffer
->size
= pCreateInfo
->size
;
1736 buffer
->usage
= pCreateInfo
->usage
;
1737 buffer
->flags
= pCreateInfo
->flags
;
1739 *pBuffer
= tu_buffer_to_handle(buffer
);
1745 tu_DestroyBuffer(VkDevice _device
,
1747 const VkAllocationCallbacks
*pAllocator
)
1749 TU_FROM_HANDLE(tu_device
, device
, _device
);
1750 TU_FROM_HANDLE(tu_buffer
, buffer
, _buffer
);
1755 vk_free2(&device
->alloc
, pAllocator
, buffer
);
1759 tu_surface_max_layer_count(struct tu_image_view
*iview
)
1761 return iview
->type
== VK_IMAGE_VIEW_TYPE_3D
1762 ? iview
->extent
.depth
1763 : (iview
->base_layer
+ iview
->layer_count
);
1767 tu_CreateFramebuffer(VkDevice _device
,
1768 const VkFramebufferCreateInfo
*pCreateInfo
,
1769 const VkAllocationCallbacks
*pAllocator
,
1770 VkFramebuffer
*pFramebuffer
)
1772 TU_FROM_HANDLE(tu_device
, device
, _device
);
1773 struct tu_framebuffer
*framebuffer
;
1775 assert(pCreateInfo
->sType
== VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO
);
1777 size_t size
= sizeof(*framebuffer
) + sizeof(struct tu_attachment_info
) *
1778 pCreateInfo
->attachmentCount
;
1779 framebuffer
= vk_alloc2(&device
->alloc
, pAllocator
, size
, 8,
1780 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
1781 if (framebuffer
== NULL
)
1782 return vk_error(device
->instance
, VK_ERROR_OUT_OF_HOST_MEMORY
);
1784 framebuffer
->attachment_count
= pCreateInfo
->attachmentCount
;
1785 framebuffer
->width
= pCreateInfo
->width
;
1786 framebuffer
->height
= pCreateInfo
->height
;
1787 framebuffer
->layers
= pCreateInfo
->layers
;
1788 for (uint32_t i
= 0; i
< pCreateInfo
->attachmentCount
; i
++) {
1789 VkImageView _iview
= pCreateInfo
->pAttachments
[i
];
1790 struct tu_image_view
*iview
= tu_image_view_from_handle(_iview
);
1791 framebuffer
->attachments
[i
].attachment
= iview
;
1793 framebuffer
->width
= MIN2(framebuffer
->width
, iview
->extent
.width
);
1794 framebuffer
->height
= MIN2(framebuffer
->height
, iview
->extent
.height
);
1795 framebuffer
->layers
=
1796 MIN2(framebuffer
->layers
, tu_surface_max_layer_count(iview
));
1799 *pFramebuffer
= tu_framebuffer_to_handle(framebuffer
);
1804 tu_DestroyFramebuffer(VkDevice _device
,
1806 const VkAllocationCallbacks
*pAllocator
)
1808 TU_FROM_HANDLE(tu_device
, device
, _device
);
1809 TU_FROM_HANDLE(tu_framebuffer
, fb
, _fb
);
1813 vk_free2(&device
->alloc
, pAllocator
, fb
);
1817 tu_init_sampler(struct tu_device
*device
,
1818 struct tu_sampler
*sampler
,
1819 const VkSamplerCreateInfo
*pCreateInfo
)
1824 tu_CreateSampler(VkDevice _device
,
1825 const VkSamplerCreateInfo
*pCreateInfo
,
1826 const VkAllocationCallbacks
*pAllocator
,
1827 VkSampler
*pSampler
)
1829 TU_FROM_HANDLE(tu_device
, device
, _device
);
1830 struct tu_sampler
*sampler
;
1832 assert(pCreateInfo
->sType
== VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO
);
1834 sampler
= vk_alloc2(&device
->alloc
, pAllocator
, sizeof(*sampler
), 8,
1835 VK_SYSTEM_ALLOCATION_SCOPE_OBJECT
);
1837 return vk_error(device
->instance
, VK_ERROR_OUT_OF_HOST_MEMORY
);
1839 tu_init_sampler(device
, sampler
, pCreateInfo
);
1840 *pSampler
= tu_sampler_to_handle(sampler
);
1846 tu_DestroySampler(VkDevice _device
,
1848 const VkAllocationCallbacks
*pAllocator
)
1850 TU_FROM_HANDLE(tu_device
, device
, _device
);
1851 TU_FROM_HANDLE(tu_sampler
, sampler
, _sampler
);
1855 vk_free2(&device
->alloc
, pAllocator
, sampler
);
1858 /* vk_icd.h does not declare this function, so we declare it here to
1859 * suppress Wmissing-prototypes.
1861 PUBLIC VKAPI_ATTR VkResult VKAPI_CALL
1862 vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pSupportedVersion
);
1864 PUBLIC VKAPI_ATTR VkResult VKAPI_CALL
1865 vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pSupportedVersion
)
1867 /* For the full details on loader interface versioning, see
1868 * <https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/blob/master/loader/LoaderAndLayerInterface.md>.
1869 * What follows is a condensed summary, to help you navigate the large and
1870 * confusing official doc.
1872 * - Loader interface v0 is incompatible with later versions. We don't
1875 * - In loader interface v1:
1876 * - The first ICD entrypoint called by the loader is
1877 * vk_icdGetInstanceProcAddr(). The ICD must statically expose this
1879 * - The ICD must statically expose no other Vulkan symbol unless it
1880 * is linked with -Bsymbolic.
1881 * - Each dispatchable Vulkan handle created by the ICD must be
1882 * a pointer to a struct whose first member is VK_LOADER_DATA. The
1883 * ICD must initialize VK_LOADER_DATA.loadMagic to
1885 * - The loader implements vkCreate{PLATFORM}SurfaceKHR() and
1886 * vkDestroySurfaceKHR(). The ICD must be capable of working with
1887 * such loader-managed surfaces.
1889 * - Loader interface v2 differs from v1 in:
1890 * - The first ICD entrypoint called by the loader is
1891 * vk_icdNegotiateLoaderICDInterfaceVersion(). The ICD must
1892 * statically expose this entrypoint.
1894 * - Loader interface v3 differs from v2 in:
1895 * - The ICD must implement vkCreate{PLATFORM}SurfaceKHR(),
1896 * vkDestroySurfaceKHR(), and other API which uses VKSurfaceKHR,
1897 * because the loader no longer does so.
1899 *pSupportedVersion
= MIN2(*pSupportedVersion
, 3u);
1904 tu_GetPhysicalDeviceExternalSemaphoreProperties(
1905 VkPhysicalDevice physicalDevice
,
1906 const VkPhysicalDeviceExternalSemaphoreInfoKHR
*pExternalSemaphoreInfo
,
1907 VkExternalSemaphorePropertiesKHR
*pExternalSemaphoreProperties
)
1909 pExternalSemaphoreProperties
->exportFromImportedHandleTypes
= 0;
1910 pExternalSemaphoreProperties
->compatibleHandleTypes
= 0;
1911 pExternalSemaphoreProperties
->externalSemaphoreFeatures
= 0;
1915 tu_GetPhysicalDeviceExternalFenceProperties(
1916 VkPhysicalDevice physicalDevice
,
1917 const VkPhysicalDeviceExternalFenceInfoKHR
*pExternalFenceInfo
,
1918 VkExternalFencePropertiesKHR
*pExternalFenceProperties
)
1920 pExternalFenceProperties
->exportFromImportedHandleTypes
= 0;
1921 pExternalFenceProperties
->compatibleHandleTypes
= 0;
1922 pExternalFenceProperties
->externalFenceFeatures
= 0;
1926 tu_CreateDebugReportCallbackEXT(
1927 VkInstance _instance
,
1928 const VkDebugReportCallbackCreateInfoEXT
*pCreateInfo
,
1929 const VkAllocationCallbacks
*pAllocator
,
1930 VkDebugReportCallbackEXT
*pCallback
)
1932 TU_FROM_HANDLE(tu_instance
, instance
, _instance
);
1933 return vk_create_debug_report_callback(&instance
->debug_report_callbacks
,
1934 pCreateInfo
, pAllocator
,
1935 &instance
->alloc
, pCallback
);
1939 tu_DestroyDebugReportCallbackEXT(VkInstance _instance
,
1940 VkDebugReportCallbackEXT _callback
,
1941 const VkAllocationCallbacks
*pAllocator
)
1943 TU_FROM_HANDLE(tu_instance
, instance
, _instance
);
1944 vk_destroy_debug_report_callback(&instance
->debug_report_callbacks
,
1945 _callback
, pAllocator
, &instance
->alloc
);
1949 tu_DebugReportMessageEXT(VkInstance _instance
,
1950 VkDebugReportFlagsEXT flags
,
1951 VkDebugReportObjectTypeEXT objectType
,
1954 int32_t messageCode
,
1955 const char *pLayerPrefix
,
1956 const char *pMessage
)
1958 TU_FROM_HANDLE(tu_instance
, instance
, _instance
);
1959 vk_debug_report(&instance
->debug_report_callbacks
, flags
, objectType
,
1960 object
, location
, messageCode
, pLayerPrefix
, pMessage
);
1964 tu_GetDeviceGroupPeerMemoryFeatures(
1967 uint32_t localDeviceIndex
,
1968 uint32_t remoteDeviceIndex
,
1969 VkPeerMemoryFeatureFlags
*pPeerMemoryFeatures
)
1971 assert(localDeviceIndex
== remoteDeviceIndex
);
1973 *pPeerMemoryFeatures
= VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT
|
1974 VK_PEER_MEMORY_FEATURE_COPY_DST_BIT
|
1975 VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT
|
1976 VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT
;