May 20, 2020, 22:56 by s...@jkqxz.net:

> On 19/05/2020 21:56, Lynne wrote:
>
> "Each pNext member of any structure (including this one) in the pNext chain 
> must be either NULL or a pointer to a valid instance of ... [big list which 
> does not include VkPhysicalDeviceFeatures]."  Was that meant to be 
> VkPhysicalDeviceFeatures2?
>

Yes, I fixed that after haasn pointed it out.
Here's the new patch just in case with that fixed and the new description.
Removed the "that is, it should be a copy of the pEnabledFeatures field passed 
in..." since
when VkDeviceCreateInfo.pNext is VkPhysicalDeviceFeatures2 the pEnabledFeatures 
field
must not be set.

>     * This structure should be set to the set of features that present and 
>enabled 
>     * during device creation. hen a device is created by FFmpeg, it will 
>default to
>     * enabling all that are present of the shaderImageGatherExtended,
>     * fragmentStoresAndAtomics, shaderInt64 and 
>vertexPipelineStoresAndAtomics features.

>From b5a90e0de1eadbaa05735117b77adc46e20b4359 Mon Sep 17 00:00:00 2001
From: Lynne <d...@lynne.ee>
Date: Wed, 13 May 2020 16:39:00 +0100
Subject: [PATCH 03/14] hwcontext_vulkan: expose the enabled device features

With this, the puzzle of making libplacebo, ffmpeg and any other Vulkan
API users interoperable is complete.
Users of both libraries can initialize one another's contexts without having
to create a new one.
---
 libavutil/hwcontext_vulkan.c | 11 +++++++++++
 libavutil/hwcontext_vulkan.h |  7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 2fb9c5dbfa..83de4b5cb7 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -807,6 +807,7 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
     AVDictionaryEntry *opt_d;
     VulkanDevicePriv *p = ctx->internal->priv;
     AVVulkanDeviceContext *hwctx = ctx->hwctx;
+    VkPhysicalDeviceFeatures dev_features = { 0 };
     VkDeviceQueueCreateInfo queue_create_info[3] = {
         { .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, },
         { .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, },
@@ -815,10 +816,12 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
 
     VkDeviceCreateInfo dev_info = {
         .sType                = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
+        .pNext                = &hwctx->device_features,
         .pQueueCreateInfos    = queue_create_info,
         .queueCreateInfoCount = 0,
     };
 
+    hwctx->device_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
     ctx->free = vulkan_device_free;
 
     /* Create an instance if not given one */
@@ -839,6 +842,14 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
     av_log(ctx, AV_LOG_VERBOSE, "    minMemoryMapAlignment:              %li\n",
            p->props.limits.minMemoryMapAlignment);
 
+    vkGetPhysicalDeviceFeatures(hwctx->phys_dev, &dev_features);
+#define COPY_FEATURE(DST, NAME) (DST).features.NAME = dev_features.NAME;
+    COPY_FEATURE(hwctx->device_features, shaderImageGatherExtended)
+    COPY_FEATURE(hwctx->device_features, fragmentStoresAndAtomics)
+    COPY_FEATURE(hwctx->device_features, vertexPipelineStoresAndAtomics)
+    COPY_FEATURE(hwctx->device_features, shaderInt64)
+#undef COPY_FEATURE
+
     /* Search queue family */
     if ((err = search_queue_families(ctx, &dev_info)))
         goto end;
diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h
index 9fbe8b9dcb..8fde47bb12 100644
--- a/libavutil/hwcontext_vulkan.h
+++ b/libavutil/hwcontext_vulkan.h
@@ -94,6 +94,13 @@ typedef struct AVVulkanDeviceContext {
      */
     const char * const *enabled_dev_extensions;
     int nb_enabled_dev_extensions;
+    /**
+     * This structure should be set to the set of features that present and enabled
+     * during device creation. hen a device is created by FFmpeg, it will default to
+     * enabling all that are present of the shaderImageGatherExtended,
+     * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features.
+     */
+    VkPhysicalDeviceFeatures2 device_features;
 } AVVulkanDeviceContext;
 
 /**
-- 
2.27.0.rc0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to