aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/vulkan.c
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2023-08-12 10:46:45 +0000
committerLynne <dev@lynne.ee>2023-08-26 23:14:53 +0200
commit358919506d611493508c8af203c4dd15706c570f (patch)
tree01665d674eb5aec2395d1e30b0b7271c004705e7 /libavutil/vulkan.c
parent8028b8260e6d0a4a469529ec5c5d504782a5f875 (diff)
downloadffmpeg-358919506d611493508c8af203c4dd15706c570f.tar.gz
vulkan: enable VK_KHR_cooperative_matrix
It's of interest to API users, and of interest to us, as a DCT/DST can be implemented via matrix multiplies.
Diffstat (limited to 'libavutil/vulkan.c')
-rw-r--r--libavutil/vulkan.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 48f5f4b5dc..684b92de57 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -90,9 +90,13 @@ int ff_vk_load_props(FFVulkanContext *s)
s->hprops = (VkPhysicalDeviceExternalMemoryHostPropertiesEXT) {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT,
};
+ s->coop_matrix_props = (VkPhysicalDeviceCooperativeMatrixPropertiesKHR) {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR,
+ .pNext = &s->hprops,
+ };
s->subgroup_props = (VkPhysicalDeviceSubgroupSizeControlProperties) {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES,
- .pNext = &s->hprops,
+ .pNext = &s->coop_matrix_props,
};
s->desc_buf_props = (VkPhysicalDeviceDescriptorBufferPropertiesEXT) {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT,
@@ -161,6 +165,25 @@ int ff_vk_load_props(FFVulkanContext *s)
vk->GetPhysicalDeviceQueueFamilyProperties2(s->hwctx->phys_dev, &s->tot_nb_qfs, s->qf_props);
+ if (vk->GetPhysicalDeviceCooperativeMatrixPropertiesKHR) {
+ vk->GetPhysicalDeviceCooperativeMatrixPropertiesKHR(s->hwctx->phys_dev,
+ &s->coop_mat_props_nb, NULL);
+
+ if (s->coop_mat_props_nb) {
+ s->coop_mat_props = av_malloc_array(s->coop_mat_props_nb,
+ sizeof(VkCooperativeMatrixPropertiesKHR));
+ for (int i = 0; i < s->coop_mat_props_nb; i++) {
+ s->coop_mat_props[i] = (VkCooperativeMatrixPropertiesKHR) {
+ .sType = VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_KHR,
+ };
+ }
+
+ vk->GetPhysicalDeviceCooperativeMatrixPropertiesKHR(s->hwctx->phys_dev,
+ &s->coop_mat_props_nb,
+ s->coop_mat_props);
+ }
+ }
+
return 0;
}