anv: Trivially implement VK_KHR_device_group
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
.lower_fdiv = true, \
|
||||
.lower_flrp64 = true, \
|
||||
.lower_ldexp = true, \
|
||||
.lower_device_index_to_zero = true, \
|
||||
.native_integers = true, \
|
||||
.use_interpolated_input_intrinsics = true, \
|
||||
.vertex_id_zero_based = true
|
||||
|
@@ -1068,3 +1068,10 @@ void anv_CmdPushDescriptorSetWithTemplateKHR(
|
||||
anv_cmd_buffer_bind_descriptor_set(cmd_buffer, template->bind_point,
|
||||
layout, _set, set, NULL, NULL);
|
||||
}
|
||||
|
||||
void anv_CmdSetDeviceMask(
|
||||
VkCommandBuffer commandBuffer,
|
||||
uint32_t deviceMask)
|
||||
{
|
||||
/* No-op */
|
||||
}
|
||||
|
@@ -672,6 +672,18 @@ anv_enumerate_devices(struct anv_instance *instance)
|
||||
return result;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
anv_instance_ensure_physical_device(struct anv_instance *instance)
|
||||
{
|
||||
if (instance->physicalDeviceCount < 0) {
|
||||
VkResult result = anv_enumerate_devices(instance);
|
||||
if (result != VK_SUCCESS &&
|
||||
result != VK_ERROR_INCOMPATIBLE_DRIVER)
|
||||
return result;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult anv_EnumeratePhysicalDevices(
|
||||
VkInstance _instance,
|
||||
@@ -680,20 +692,49 @@ VkResult anv_EnumeratePhysicalDevices(
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_instance, instance, _instance);
|
||||
VK_OUTARRAY_MAKE(out, pPhysicalDevices, pPhysicalDeviceCount);
|
||||
VkResult result;
|
||||
|
||||
if (instance->physicalDeviceCount < 0) {
|
||||
result = anv_enumerate_devices(instance);
|
||||
if (result != VK_SUCCESS &&
|
||||
result != VK_ERROR_INCOMPATIBLE_DRIVER)
|
||||
return result;
|
||||
VkResult result = anv_instance_ensure_physical_device(instance);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
if (instance->physicalDeviceCount == 0)
|
||||
return VK_SUCCESS;
|
||||
|
||||
assert(instance->physicalDeviceCount == 1);
|
||||
vk_outarray_append(&out, i) {
|
||||
*i = anv_physical_device_to_handle(&instance->physicalDevice);
|
||||
}
|
||||
|
||||
if (instance->physicalDeviceCount > 0) {
|
||||
assert(instance->physicalDeviceCount == 1);
|
||||
vk_outarray_append(&out, i) {
|
||||
*i = anv_physical_device_to_handle(&instance->physicalDevice);
|
||||
}
|
||||
return vk_outarray_status(&out);
|
||||
}
|
||||
|
||||
VkResult anv_EnumeratePhysicalDeviceGroups(
|
||||
VkInstance _instance,
|
||||
uint32_t* pPhysicalDeviceGroupCount,
|
||||
VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_instance, instance, _instance);
|
||||
VK_OUTARRAY_MAKE(out, pPhysicalDeviceGroupProperties,
|
||||
pPhysicalDeviceGroupCount);
|
||||
|
||||
VkResult result = anv_instance_ensure_physical_device(instance);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
if (instance->physicalDeviceCount == 0)
|
||||
return VK_SUCCESS;
|
||||
|
||||
assert(instance->physicalDeviceCount == 1);
|
||||
|
||||
vk_outarray_append(&out, p) {
|
||||
p->physicalDeviceCount = 1;
|
||||
memset(p->physicalDevices, 0, sizeof(p->physicalDevices));
|
||||
p->physicalDevices[0] =
|
||||
anv_physical_device_to_handle(&instance->physicalDevice);
|
||||
p->subsetAllocation = VK_FALSE;
|
||||
|
||||
vk_foreach_struct(ext, p->pNext)
|
||||
anv_debug_ignored_stype(ext->sType);
|
||||
}
|
||||
|
||||
return vk_outarray_status(&out);
|
||||
@@ -1103,6 +1144,21 @@ void anv_GetPhysicalDeviceMemoryProperties2(
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
anv_GetDeviceGroupPeerMemoryFeatures(
|
||||
VkDevice device,
|
||||
uint32_t heapIndex,
|
||||
uint32_t localDeviceIndex,
|
||||
uint32_t remoteDeviceIndex,
|
||||
VkPeerMemoryFeatureFlags* pPeerMemoryFeatures)
|
||||
{
|
||||
assert(localDeviceIndex == 0 && remoteDeviceIndex == 0);
|
||||
*pPeerMemoryFeatures = VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT |
|
||||
VK_PEER_MEMORY_FEATURE_COPY_DST_BIT |
|
||||
VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT |
|
||||
VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT;
|
||||
}
|
||||
|
||||
PFN_vkVoidFunction anv_GetInstanceProcAddr(
|
||||
VkInstance _instance,
|
||||
const char* pName)
|
||||
|
@@ -70,6 +70,8 @@ EXTENSIONS = [
|
||||
Extension('VK_KHR_bind_memory2', 1, True),
|
||||
Extension('VK_KHR_dedicated_allocation', 1, True),
|
||||
Extension('VK_KHR_descriptor_update_template', 1, True),
|
||||
Extension('VK_KHR_device_group', 1, True),
|
||||
Extension('VK_KHR_device_group_creation', 1, True),
|
||||
Extension('VK_KHR_external_fence', 1,
|
||||
'device->has_syncobj_wait'),
|
||||
Extension('VK_KHR_external_fence_capabilities', 1, True),
|
||||
|
@@ -138,6 +138,7 @@ anv_shader_compile_to_nir(struct anv_pipeline *pipeline,
|
||||
.float64 = device->instance->physicalDevice.info.gen >= 8,
|
||||
.int64 = device->instance->physicalDevice.info.gen >= 8,
|
||||
.tessellation = true,
|
||||
.device_group = true,
|
||||
.draw_parameters = true,
|
||||
.image_write_without_format = true,
|
||||
.multiview = true,
|
||||
|
@@ -242,3 +242,25 @@ VkResult anv_QueuePresentKHR(
|
||||
_queue, 0,
|
||||
pPresentInfo);
|
||||
}
|
||||
|
||||
VkResult anv_GetDeviceGroupPresentCapabilitiesKHR(
|
||||
VkDevice device,
|
||||
VkDeviceGroupPresentCapabilitiesKHR* pCapabilities)
|
||||
{
|
||||
memset(pCapabilities->presentMask, 0,
|
||||
sizeof(pCapabilities->presentMask));
|
||||
pCapabilities->presentMask[0] = 0x1;
|
||||
pCapabilities->modes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult anv_GetDeviceGroupSurfacePresentModesKHR(
|
||||
VkDevice device,
|
||||
VkSurfaceKHR surface,
|
||||
VkDeviceGroupPresentModeFlagsKHR* pModes)
|
||||
{
|
||||
*pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user