GL_ARB_compute_variable_group_size on Iris.
+VK_EXT_private_data on ANV.
break;
}
+ case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES_EXT: {
+ VkPhysicalDevicePrivateDataFeaturesEXT *features = (void *)ext;
+ features->privateData = true;
+ break;
+ }
+
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES: {
VkPhysicalDeviceProtectedMemoryFeatures *features = (void *)ext;
CORE_FEATURE(1, 1, protectedMemory);
*pSupportedVersion = MIN2(*pSupportedVersion, 4u);
return VK_SUCCESS;
}
+
+VkResult anv_CreatePrivateDataSlotEXT(
+ VkDevice _device,
+ const VkPrivateDataSlotCreateInfoEXT* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkPrivateDataSlotEXT* pPrivateDataSlot)
+{
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ return vk_private_data_slot_create(&device->vk, pCreateInfo, pAllocator,
+ pPrivateDataSlot);
+}
+
+void anv_DestroyPrivateDataSlotEXT(
+ VkDevice _device,
+ VkPrivateDataSlotEXT privateDataSlot,
+ const VkAllocationCallbacks* pAllocator)
+{
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ vk_private_data_slot_destroy(&device->vk, privateDataSlot, pAllocator);
+}
+
+VkResult anv_SetPrivateDataEXT(
+ VkDevice _device,
+ VkObjectType objectType,
+ uint64_t objectHandle,
+ VkPrivateDataSlotEXT privateDataSlot,
+ uint64_t data)
+{
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ return vk_object_base_set_private_data(&device->vk,
+ objectType, objectHandle,
+ privateDataSlot, data);
+}
+
+void anv_GetPrivateDataEXT(
+ VkDevice _device,
+ VkObjectType objectType,
+ uint64_t objectHandle,
+ VkPrivateDataSlotEXT privateDataSlot,
+ uint64_t* pData)
+{
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ vk_object_base_get_private_data(&device->vk,
+ objectType, objectHandle,
+ privateDataSlot, pData);
+}
Extension('VK_EXT_pci_bus_info', 2, True),
Extension('VK_EXT_pipeline_creation_feedback', 1, True),
Extension('VK_EXT_post_depth_coverage', 1, 'device->info.gen >= 9'),
+ Extension('VK_EXT_private_data', 1, True),
Extension('VK_EXT_queue_family_foreign', 1, 'ANDROID'),
Extension('VK_EXT_robustness2', 1, True),
Extension('VK_EXT_sampler_filter_minmax', 1, 'device->info.gen >= 9'),
#include "vk_object.h"
+#include "vk_alloc.h"
+
void
vk_object_base_init(UNUSED struct vk_device *device,
struct vk_object_base *base,
{
base->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
base->type = obj_type;
+ util_sparse_array_init(&base->private_data, sizeof(uint64_t), 8);
}
void
-vk_object_base_finish(UNUSED struct vk_object_base *base)
+vk_object_base_finish(struct vk_object_base *base)
{
+ util_sparse_array_finish(&base->private_data);
}
void
device->alloc = *device_alloc;
else
device->alloc = *instance_alloc;
+
+ p_atomic_set(&device->private_data_next_index, 0);
}
void
{
vk_object_base_finish(&device->base);
}
+
+VkResult
+vk_private_data_slot_create(struct vk_device *device,
+ const VkPrivateDataSlotCreateInfoEXT* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkPrivateDataSlotEXT* pPrivateDataSlot)
+{
+ struct vk_private_data_slot *slot =
+ vk_alloc2(&device->alloc, pAllocator, sizeof(*slot), 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
+ if (slot == NULL)
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+
+ vk_object_base_init(device, &slot->base,
+ VK_OBJECT_TYPE_PRIVATE_DATA_SLOT_EXT);
+ slot->index = p_atomic_inc_return(&device->private_data_next_index);
+
+ *pPrivateDataSlot = vk_private_data_slot_to_handle(slot);
+
+ return VK_SUCCESS;
+}
+
+void
+vk_private_data_slot_destroy(struct vk_device *device,
+ VkPrivateDataSlotEXT privateDataSlot,
+ const VkAllocationCallbacks *pAllocator)
+{
+ VK_FROM_HANDLE(vk_private_data_slot, slot, privateDataSlot);
+ if (slot == NULL)
+ return;
+
+ vk_object_base_finish(&slot->base);
+ vk_free2(&device->alloc, pAllocator, slot);
+}
+
+static uint64_t *
+vk_object_base_private_data(VkObjectType objectType,
+ uint64_t objectHandle,
+ VkPrivateDataSlotEXT privateDataSlot)
+{
+ VK_FROM_HANDLE(vk_private_data_slot, slot, privateDataSlot);
+ struct vk_object_base *obj =
+ vk_object_base_from_u64_handle(objectHandle, objectType);
+ return util_sparse_array_get(&obj->private_data, slot->index);
+}
+
+VkResult
+vk_object_base_set_private_data(struct vk_device *device,
+ VkObjectType objectType,
+ uint64_t objectHandle,
+ VkPrivateDataSlotEXT privateDataSlot,
+ uint64_t data)
+{
+ uint64_t *private_data =
+ vk_object_base_private_data(objectType, objectHandle, privateDataSlot);
+ *private_data = data;
+ return VK_SUCCESS;
+}
+
+void
+vk_object_base_get_private_data(struct vk_device *device,
+ VkObjectType objectType,
+ uint64_t objectHandle,
+ VkPrivateDataSlotEXT privateDataSlot,
+ uint64_t *pData)
+{
+ uint64_t *private_data =
+ vk_object_base_private_data(objectType, objectHandle, privateDataSlot);
+ *pData = *private_data;
+}
#include <vulkan/vk_icd.h>
#include "util/macros.h"
+#include "util/sparse_array.h"
#ifdef __cplusplus
extern "C" {
struct vk_object_base {
VK_LOADER_DATA _loader_data;
VkObjectType type;
+
+ /* For VK_EXT_private_data */
+ struct util_sparse_array private_data;
};
void vk_object_base_init(UNUSED struct vk_device *device,
assert(base == NULL || base->type == obj_type);
}
+static inline struct vk_object_base *
+vk_object_base_from_u64_handle(uint64_t handle, VkObjectType obj_type)
+{
+ struct vk_object_base *base = (struct vk_object_base *)(uintptr_t)handle;
+ vk_object_base_assert_valid(base, obj_type);
+ return base;
+}
+
struct vk_device {
struct vk_object_base base;
VkAllocationCallbacks alloc;
+
+ /* For VK_EXT_private_data */
+ uint32_t private_data_next_index;
};
void vk_device_init(struct vk_device *device,
#define VK_FROM_HANDLE(__driver_type, __name, __handle) \
struct __driver_type *__name = __driver_type ## _from_handle(__handle)
+
+struct vk_private_data_slot {
+ struct vk_object_base base;
+ uint32_t index;
+};
+VK_DEFINE_NONDISP_HANDLE_CASTS(vk_private_data_slot, base,
+ VkPrivateDataSlotEXT,
+ VK_OBJECT_TYPE_PRIVATE_DATA_SLOT_EXT);
+
+VkResult
+vk_private_data_slot_create(struct vk_device *device,
+ const VkPrivateDataSlotCreateInfoEXT* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkPrivateDataSlotEXT* pPrivateDataSlot);
+void
+vk_private_data_slot_destroy(struct vk_device *device,
+ VkPrivateDataSlotEXT privateDataSlot,
+ const VkAllocationCallbacks *pAllocator);
+VkResult
+vk_object_base_set_private_data(struct vk_device *device,
+ VkObjectType objectType,
+ uint64_t objectHandle,
+ VkPrivateDataSlotEXT privateDataSlot,
+ uint64_t data);
+void
+vk_object_base_get_private_data(struct vk_device *device,
+ VkObjectType objectType,
+ uint64_t objectHandle,
+ VkPrivateDataSlotEXT privateDataSlot,
+ uint64_t *pData);
+
#ifdef __cplusplus
}
#endif