aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/hwcontext_vulkan.c
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2024-10-03 04:27:53 +0200
committerLynne <dev@lynne.ee>2024-10-04 10:10:43 +0200
commit535e5eb7f3ef01841d76cfec9d9d00b5b34b6f76 (patch)
tree0b8ac14c3eaf4bf5362931497768d834f4e6f4e2 /libavutil/hwcontext_vulkan.c
parent0d5bfd0b21c42b7e2968cfb33a96096f928f35ff (diff)
downloadffmpeg-535e5eb7f3ef01841d76cfec9d9d00b5b34b6f76.tar.gz
hwcontext_vulkan: enable VK_KHR_shader_relaxed_extended_instruction
Diffstat (limited to 'libavutil/hwcontext_vulkan.c')
-rw-r--r--libavutil/hwcontext_vulkan.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index d6500de677..02ee7f428c 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -100,6 +100,9 @@ typedef struct VulkanDevicePriv {
VkPhysicalDeviceOpticalFlowFeaturesNV optical_flow_features;
VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features;
VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features;
+#ifdef VK_KHR_shader_relaxed_extended_instruction
+ VkPhysicalDeviceShaderRelaxedExtendedInstructionFeaturesKHR relaxed_extended_instr_features;
+#endif
/* Queues */
pthread_mutex_t **qf_mutex;
@@ -622,6 +625,28 @@ static int check_extensions(AVHWDeviceContext *ctx, int dev, AVDictionary *opts,
}
}
+#ifdef VK_KHR_shader_relaxed_extended_instruction
+ if (dev && debug_mode == FF_VULKAN_DEBUG_PRINTF) {
+ tstr = VK_KHR_SHADER_RELAXED_EXTENDED_INSTRUCTION_EXTENSION_NAME;
+ found = 0;
+ for (int j = 0; j < sup_ext_count; j++) {
+ if (!strcmp(tstr, sup_ext[j].extensionName)) {
+ found = 1;
+ break;
+ }
+ }
+ if (found) {
+ av_log(ctx, AV_LOG_VERBOSE, "Using %s extension %s\n", mod, tstr);
+ ADD_VAL_TO_LIST(extension_names, extensions_found, tstr);
+ } else {
+ av_log(ctx, AV_LOG_ERROR, "Debug printf enabled, but extension \"%s\" not found!\n",
+ tstr);
+ err = AVERROR(EINVAL);
+ goto fail;
+ }
+#endif
+ }
+
if (user_exts_str) {
char *save, *token = av_strtok(user_exts_str, "+", &save);
while (token) {
@@ -1419,9 +1444,19 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
VkPhysicalDeviceTimelineSemaphoreFeatures timeline_features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES,
};
+#ifdef VK_KHR_shader_relaxed_extended_instruction
+ VkPhysicalDeviceShaderRelaxedExtendedInstructionFeaturesKHR relaxed_extended_instr_features = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_RELAXED_EXTENDED_INSTRUCTION_FEATURES_KHR,
+ .pNext = &timeline_features,
+ };
+#endif
VkPhysicalDeviceVideoMaintenance1FeaturesKHR video_maint_1_features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR,
+#ifdef VK_KHR_shader_relaxed_extended_instruction
+ .pNext = &relaxed_extended_instr_features,
+#else
.pNext = &timeline_features,
+#endif
};
VkPhysicalDeviceShaderObjectFeaturesEXT shader_object_features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT,
@@ -1535,6 +1570,10 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
p->shader_object_features.shaderObject = shader_object_features.shaderObject;
+#ifdef VK_KHR_shader_relaxed_extended_instruction
+ p->relaxed_extended_instr_features.shaderRelaxedExtendedInstruction = relaxed_extended_instr_features.shaderRelaxedExtendedInstruction;
+#endif
+
/* Find and enable extensions */
if ((err = check_extensions(ctx, 1, opts, &dev_info.ppEnabledExtensionNames,
&dev_info.enabledExtensionCount, debug_mode))) {