From: Mike Blumenkrantz Date: Thu, 2 Jul 2020 18:53:45 +0000 (-0400) Subject: zink: implement VK_EXT_robustness2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=01d6220cffb806e82a089c8d3d727f206c63be5b;p=mesa.git zink: implement VK_EXT_robustness2 this adds support for null descriptors, which is necessary for full compliance with ARB_texture_buffer_object Reviewed-by: Erik Faye-Lund Part-of: --- diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 1ccb1da0b00..ad46d60b097 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -759,7 +759,8 @@ static struct pipe_screen * zink_internal_create_screen(struct sw_winsys *winsys, int fd) { struct zink_screen *screen = CALLOC_STRUCT(zink_screen); - bool have_tf_ext = false, have_cond_render_ext = false, have_EXT_index_type_uint8 = false; + bool have_tf_ext = false, have_cond_render_ext = false, have_EXT_index_type_uint8 = false, + have_EXT_robustness2_features = false; if (!screen) return NULL; @@ -801,6 +802,9 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd) if (!strcmp(extensions[i].extensionName, VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME)) have_EXT_index_type_uint8 = true; + if (!strcmp(extensions[i].extensionName, + VK_EXT_ROBUSTNESS_2_EXTENSION_NAME)) + have_EXT_robustness2_features = true; } FREE(extensions); @@ -827,6 +831,11 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd) index_uint8_feats.pNext = feats.pNext; feats.pNext = &index_uint8_feats; } + if (have_EXT_robustness2_features) { + screen->rb2_feats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT; + screen->rb2_feats.pNext = feats.pNext; + feats.pNext = &screen->rb2_feats; + } vkGetPhysicalDeviceFeatures2(screen->pdev, &feats); memcpy(&screen->feats, &feats.features, sizeof(screen->feats)); if (have_tf_ext && tf_feats.transformFeedback) @@ -835,14 +844,20 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd) screen->have_EXT_conditional_rendering = true; if (have_EXT_index_type_uint8 && index_uint8_feats.indexTypeUint8) screen->have_EXT_index_type_uint8 = true; + screen->have_EXT_robustness2_features = have_EXT_robustness2_features; VkPhysicalDeviceProperties2 props = {}; props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; if (screen->have_EXT_transform_feedback) { screen->tf_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT; - screen->tf_props.pNext = NULL; + screen->tf_props.pNext = props.pNext; props.pNext = &screen->tf_props; } + if (have_EXT_robustness2_features) { + screen->rb2_props.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT; + screen->rb2_props.pNext = props.pNext; + props.pNext = &screen->rb2_props; + } vkGetPhysicalDeviceProperties2(screen->pdev, &props); memcpy(&screen->props, &props.properties, sizeof(screen->props)); @@ -866,7 +881,7 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd) * this requires us to pass the whole VkPhysicalDeviceFeatures2 struct */ dci.pNext = &feats; - const char *extensions[6] = { + const char *extensions[7] = { VK_KHR_MAINTENANCE1_EXTENSION_NAME, }; num_extensions = 1; @@ -889,6 +904,8 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd) if (screen->have_EXT_transform_feedback) extensions[num_extensions++] = VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME; + if (screen->have_EXT_robustness2_features) + extensions[num_extensions++] = VK_EXT_ROBUSTNESS_2_EXTENSION_NAME; assert(num_extensions <= ARRAY_SIZE(extensions)); dci.ppEnabledExtensionNames = extensions; diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h index 4625116c80b..38d1ba9c01c 100644 --- a/src/gallium/drivers/zink/zink_screen.h +++ b/src/gallium/drivers/zink/zink_screen.h @@ -49,12 +49,15 @@ struct zink_screen { VkPhysicalDeviceFeatures feats; VkPhysicalDeviceMemoryProperties mem_props; VkPhysicalDeviceTransformFeedbackPropertiesEXT tf_props; + VkPhysicalDeviceRobustness2PropertiesEXT rb2_props; + VkPhysicalDeviceRobustness2FeaturesEXT rb2_feats; bool have_KHR_maintenance1; bool have_KHR_external_memory_fd; bool have_EXT_conditional_rendering; bool have_EXT_transform_feedback; bool have_EXT_index_type_uint8; + bool have_EXT_robustness2_features; bool have_X8_D24_UNORM_PACK32; bool have_D24_UNORM_S8_UINT;