lavapipe: add vulkan 1.1 properties/features apis

Still have to add subgroups before advertising 1.1

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9645>
This commit is contained in:
Dave Airlie 2020-12-22 17:02:29 +10:00 committed by Marge Bot
parent 35c02f79c9
commit e47b742810

View file

@ -434,6 +434,26 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceFeatures(
};
}
static void
lvp_get_physical_device_features_1_1(struct lvp_physical_device *pdevice,
VkPhysicalDeviceVulkan11Features *f)
{
assert(f->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES);
f->storageBuffer16BitAccess = true;
f->uniformAndStorageBuffer16BitAccess = true;
f->storagePushConstant16 = true;
f->storageInputOutput16 = false;
f->multiview = true;
f->multiviewGeometryShader = true;
f->multiviewTessellationShader = true;
f->variablePointersStorageBuffer = true;
f->variablePointers = false;
f->protectedMemory = false;
f->samplerYcbcrConversion = false;
f->shaderDrawParameters = true;
}
VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceFeatures2(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures2 *pFeatures)
@ -441,12 +461,32 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceFeatures2(
LVP_FROM_HANDLE(lvp_physical_device, pdevice, physicalDevice);
lvp_GetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features);
VkPhysicalDeviceVulkan11Features core_1_1 = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES,
};
lvp_get_physical_device_features_1_1(pdevice, &core_1_1);
#define CORE_FEATURE(major, minor, feature) \
features->feature = core_##major##_##minor.feature
vk_foreach_struct(ext, pFeatures->pNext) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES: {
VkPhysicalDeviceVariablePointersFeatures *features = (void *)ext;
features->variablePointers = false;
features->variablePointersStorageBuffer = true;
CORE_FEATURE(1, 1, variablePointersStorageBuffer);
CORE_FEATURE(1, 1, variablePointers);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES: {
VkPhysicalDeviceShaderDrawParametersFeatures *features =
(VkPhysicalDeviceShaderDrawParametersFeatures*)ext;
CORE_FEATURE(1, 1, shaderDrawParameters);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES: {
VkPhysicalDeviceProtectedMemoryFeatures *features =
(VkPhysicalDeviceProtectedMemoryFeatures*)ext;
CORE_FEATURE(1, 1, protectedMemory);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES: {
@ -460,10 +500,10 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceFeatures2(
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: {
VkPhysicalDevice16BitStorageFeatures *features =
(VkPhysicalDevice16BitStorageFeatures*)ext;
features->storageBuffer16BitAccess = true;
features->uniformAndStorageBuffer16BitAccess = true;
features->storagePushConstant16 = true;
features->storageInputOutput16 = false;
CORE_FEATURE(1, 1, storageBuffer16BitAccess);
CORE_FEATURE(1, 1, uniformAndStorageBuffer16BitAccess);
CORE_FEATURE(1, 1, storagePushConstant16);
CORE_FEATURE(1, 1, storageInputOutput16);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES_EXT: {
@ -512,11 +552,14 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceFeatures2(
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES: {
VkPhysicalDeviceMultiviewFeatures *features =
(VkPhysicalDeviceMultiviewFeatures*)ext;
features->multiview = true;
features->multiviewGeometryShader = true;
features->multiviewTessellationShader = true;
VkPhysicalDeviceMultiviewFeatures *features = (VkPhysicalDeviceMultiviewFeatures*)ext;
CORE_FEATURE(1, 1, multiview);
CORE_FEATURE(1, 1, multiviewGeometryShader);
CORE_FEATURE(1, 1, multiviewTessellationShader);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: {
lvp_get_physical_device_features_1_1(pdevice, (void *)ext);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES_KHR: {
@ -714,6 +757,32 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceProperties(VkPhysicalDevice phys
}
static void
lvp_get_physical_device_properties_1_1(struct lvp_physical_device *pdevice,
VkPhysicalDeviceVulkan11Properties *p)
{
assert(p->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES);
memset(p->deviceUUID, 0, VK_UUID_SIZE);
memset(p->driverUUID, 0, VK_UUID_SIZE);
memset(p->deviceLUID, 0, VK_LUID_SIZE);
/* The LUID is for Windows. */
p->deviceLUIDValid = false;
p->deviceNodeMask = 0;
p->subgroupSize = 0;
p->subgroupSupportedStages = 0;
p->subgroupSupportedOperations = 0;
p->subgroupQuadOperationsInAllStages = false;
p->pointClippingBehavior = VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES;
p->maxMultiviewViewCount = 6;
p->maxMultiviewInstanceIndex = INT_MAX;
p->protectedNoFault = false;
p->maxPerSetDescriptors = 1024;
p->maxMemoryAllocationSize = (1u << 31);
}
VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceProperties2(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties2 *pProperties)
@ -721,6 +790,18 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceProperties2(
LVP_FROM_HANDLE(lvp_physical_device, pdevice, physicalDevice);
lvp_GetPhysicalDeviceProperties(physicalDevice, &pProperties->properties);
VkPhysicalDeviceVulkan11Properties core_1_1 = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES,
};
lvp_get_physical_device_properties_1_1(pdevice, &core_1_1);
#define CORE_RENAMED_PROPERTY(major, minor, ext_property, core_property) \
memcpy(&properties->ext_property, &core_##major##_##minor.core_property, \
sizeof(core_##major##_##minor.core_property))
#define CORE_PROPERTY(major, minor, property) \
CORE_RENAMED_PROPERTY(major, minor, property, property)
vk_foreach_struct(ext, pProperties->pNext) {
switch (ext->sType) {
@ -733,8 +814,8 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceProperties2(
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES: {
VkPhysicalDeviceMaintenance3Properties *properties =
(VkPhysicalDeviceMaintenance3Properties*)ext;
properties->maxPerSetDescriptors = 1024;
properties->maxMemoryAllocationSize = (1u << 31);
CORE_PROPERTY(1, 1, maxPerSetDescriptors);
CORE_PROPERTY(1, 1, maxMemoryAllocationSize);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR: {
@ -787,8 +868,17 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceProperties2(
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES: {
VkPhysicalDeviceMultiviewProperties *properties =
(VkPhysicalDeviceMultiviewProperties *)ext;
properties->maxMultiviewViewCount = 6;
properties->maxMultiviewInstanceIndex = INT_MAX;
CORE_PROPERTY(1, 1, maxMultiviewViewCount);
CORE_PROPERTY(1, 1, maxMultiviewInstanceIndex);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES: {
VkPhysicalDeviceIDProperties *properties =
(VkPhysicalDeviceIDProperties *)ext;
CORE_PROPERTY(1, 1, deviceUUID);
CORE_PROPERTY(1, 1, driverUUID);
CORE_PROPERTY(1, 1, deviceLUID);
CORE_PROPERTY(1, 1, deviceLUIDValid);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT: {
@ -798,6 +888,21 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceProperties2(
properties->filterMinmaxSingleComponentFormats = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES: {
VkPhysicalDeviceSubgroupProperties *properties =
(VkPhysicalDeviceSubgroupProperties*)ext;
CORE_PROPERTY(1, 1, subgroupSize);
CORE_RENAMED_PROPERTY(1, 1, supportedStages,
subgroupSupportedStages);
CORE_RENAMED_PROPERTY(1, 1, supportedOperations,
subgroupSupportedOperations);
CORE_RENAMED_PROPERTY(1, 1, quadOperationsInAllStages,
subgroupQuadOperationsInAllStages);
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES:
lvp_get_physical_device_properties_1_1(pdevice, (void *)ext);
break;
default:
break;
}