zink: enable xfb extension in screen creation
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 1 Jun 2020 19:01:47 +0000 (15:01 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 17 Jun 2020 20:42:01 +0000 (20:42 +0000)
switch around the feature enabling as well since extensions need the related
feature to also be enabled in order to function

fixes mesa/mesa#2868

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5163>

docs/features.txt
src/gallium/drivers/zink/zink_screen.c

index 0c607ba91ef0986559c67983568b6b00207ff3e4..22faa83f3c9f1116e046f690bdd3c8a4e5ce701f 100644 (file)
@@ -54,7 +54,7 @@ GL 3.0, GLSL 1.30 --- all DONE: freedreno, i965, nv50, nvc0, r600, radeonsi, llv
   GL_EXT_draw_buffers2 (Per-buffer blend and masks)     DONE (v3d, zink)
   GL_EXT_texture_compression_rgtc                       DONE (zink)
   GL_ARB_texture_rg                                     DONE (v3d, zink)
-  GL_EXT_transform_feedback (Transform feedback)        DONE (v3d)
+  GL_EXT_transform_feedback (Transform feedback)        DONE (v3d, zink)
   GL_ARB_vertex_array_object (Vertex array objects)     DONE (v3d, zink)
   GL_EXT_framebuffer_sRGB (sRGB framebuffer format)     DONE (v3d, zink)
   glClearBuffer commands                                DONE
index 71b7345dc88d331d553743ca03e47ed5d19251b5..6e5f969fcdc522c45b4537a21ae342a71364af2b 100644 (file)
@@ -139,6 +139,12 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_INDEP_BLEND_FUNC:
       return 1;
 
+   case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
+      return screen->have_EXT_transform_feedback ? screen->tf_props.maxTransformFeedbackBuffers : 0;
+   case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
+   case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
+      return 1;
+
    case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
       return screen->props.limits.maxImageArrayLayers;
 
@@ -753,7 +759,7 @@ static struct pipe_screen *
 zink_internal_create_screen(struct sw_winsys *winsys, int fd)
 {
    struct zink_screen *screen = CALLOC_STRUCT(zink_screen);
-   bool have_cond_render_ext = false;
+   bool have_tf_ext = false, have_cond_render_ext = false;
    if (!screen)
       return NULL;
 
@@ -789,15 +795,24 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd)
             if (!strcmp(extensions[i].extensionName,
                         VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME))
                have_cond_render_ext = true;
+            if (!strcmp(extensions[i].extensionName,
+                        VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME))
+               have_tf_ext = true;
 
          }
          FREE(extensions);
       }
    }
    VkPhysicalDeviceFeatures2 feats = {};
+   VkPhysicalDeviceTransformFeedbackFeaturesEXT tf_feats = {};
    VkPhysicalDeviceConditionalRenderingFeaturesEXT cond_render_feats = {};
 
    feats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
+   if (have_tf_ext) {
+      tf_feats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT;
+      tf_feats.pNext = feats.pNext;
+      feats.pNext = &tf_feats;
+   }
    if (have_cond_render_ext) {
       cond_render_feats.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT;
       cond_render_feats.pNext = feats.pNext;
@@ -805,11 +820,18 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd)
    }
    vkGetPhysicalDeviceFeatures2(screen->pdev, &feats);
    memcpy(&screen->feats, &feats.features, sizeof(screen->feats));
+   if (have_tf_ext && tf_feats.transformFeedback)
+      screen->have_EXT_transform_feedback = true;
    if (have_cond_render_ext && cond_render_feats.conditionalRendering)
       screen->have_EXT_conditional_rendering = true;
 
    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;
+      props.pNext = &screen->tf_props;
+   }
    vkGetPhysicalDeviceProperties2(screen->pdev, &props);
    memcpy(&screen->props, &props.properties, sizeof(screen->props));
 
@@ -833,7 +855,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[4] = {
+   const char *extensions[5] = {
       VK_KHR_MAINTENANCE1_EXTENSION_NAME,
    };
    num_extensions = 1;
@@ -851,6 +873,8 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd)
    if (screen->have_EXT_conditional_rendering)
       extensions[num_extensions++] = VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME;
 
+   if (screen->have_EXT_transform_feedback)
+      extensions[num_extensions++] = VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME;
    assert(num_extensions <= ARRAY_SIZE(extensions));
 
    dci.ppEnabledExtensionNames = extensions;