aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2023-03-06 00:19:12 +0100
committerLynne <dev@lynne.ee>2023-05-29 00:41:49 +0200
commit83024beec226222334d7e4166da5e4cd0869e7cc (patch)
treeff4d3d9b0c69a0da452e54bccc08f1040aa3e91c /libavutil
parent758f8b26b9592438027c43533bf662e5c407ae6a (diff)
downloadffmpeg-83024beec226222334d7e4166da5e4cd0869e7cc.tar.gz
vulkan: enable forcing of full subgroups
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/vulkan.c15
-rw-r--r--libavutil/vulkan.h4
2 files changed, 16 insertions, 3 deletions
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 6dd4de0343..8a1233662f 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->subgroup_props = (VkPhysicalDeviceSubgroupSizeControlProperties) {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES,
+ .pNext = &s->hprops,
+ };
s->desc_buf_props = (VkPhysicalDeviceDescriptorBufferPropertiesEXT) {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT,
- .pNext = &s->hprops,
+ .pNext = &s->subgroup_props,
};
s->driver_props = (VkPhysicalDeviceDriverProperties) {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES,
@@ -1287,13 +1291,20 @@ void ff_vk_frame_barrier(FFVulkanContext *s, FFVkExecContext *e,
}
int ff_vk_shader_init(FFVulkanPipeline *pl, FFVkSPIRVShader *shd, const char *name,
- VkShaderStageFlags stage)
+ VkShaderStageFlags stage, uint32_t required_subgroup_size)
{
av_bprint_init(&shd->src, 0, AV_BPRINT_SIZE_UNLIMITED);
shd->shader.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shd->shader.stage = stage;
+ if (required_subgroup_size) {
+ shd->shader.flags |= VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT;
+ shd->shader.pNext = &shd->subgroup_info;
+ shd->subgroup_info.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO;
+ shd->subgroup_info.requiredSubgroupSize = required_subgroup_size;
+ }
+
shd->name = name;
GLSLF(0, #version %i ,460);
diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
index 8ea009e4da..1dc7a61d97 100644
--- a/libavutil/vulkan.h
+++ b/libavutil/vulkan.h
@@ -61,6 +61,7 @@ typedef struct FFVkSPIRVShader {
AVBPrint src;
int local_size[3]; /* Compute shader workgroup sizes */
VkPipelineShaderStageCreateInfo shader;
+ VkPipelineShaderStageRequiredSubgroupSizeCreateInfo subgroup_info;
} FFVkSPIRVShader;
typedef struct FFVulkanDescriptorSetBinding {
@@ -217,6 +218,7 @@ typedef struct FFVulkanContext {
VkPhysicalDeviceMemoryProperties mprops;
VkPhysicalDeviceExternalMemoryHostPropertiesEXT hprops;
VkPhysicalDeviceDescriptorBufferPropertiesEXT desc_buf_props;
+ VkPhysicalDeviceSubgroupSizeControlProperties subgroup_props;
VkQueueFamilyQueryResultStatusPropertiesKHR *query_props;
VkQueueFamilyVideoPropertiesKHR *video_props;
VkQueueFamilyProperties2 *qf_props;
@@ -400,7 +402,7 @@ int ff_vk_init_sampler(FFVulkanContext *s, VkSampler *sampler,
* Shader management.
*/
int ff_vk_shader_init(FFVulkanPipeline *pl, FFVkSPIRVShader *shd, const char *name,
- VkShaderStageFlags stage);
+ VkShaderStageFlags stage, uint32_t required_subgroup_size);
void ff_vk_shader_set_compute_sizes(FFVkSPIRVShader *shd, int x, int y, int z);
void ff_vk_shader_print(void *ctx, FFVkSPIRVShader *shd, int prio);
int ff_vk_shader_create(FFVulkanContext *s, FFVkSPIRVShader *shd,