[FFmpeg-cvslog] vulkan_glslang: add more stages, target Vulkan 1.3 and output debug info
Lynne
git at videolan.org
Fri Oct 4 11:28:39 EEST 2024
ffmpeg | branch: master | Lynne <dev at lynne.ee> | Wed Oct 2 11:55:39 2024 +0200| [a2a983e1d03c6635ab8fb7762b4918fe36932c62] | committer: Lynne
vulkan_glslang: add more stages, target Vulkan 1.3 and output debug info
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2a983e1d03c6635ab8fb7762b4918fe36932c62
---
libavfilter/vulkan_glslang.c | 39 ++++++++++++++++++++++++++++++++-------
1 file changed, 32 insertions(+), 7 deletions(-)
diff --git a/libavfilter/vulkan_glslang.c b/libavfilter/vulkan_glslang.c
index 7ac7d6b2c4..68c0fcbe53 100644
--- a/libavfilter/vulkan_glslang.c
+++ b/libavfilter/vulkan_glslang.c
@@ -149,21 +149,28 @@ static int glslc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx,
[VK_SHADER_STAGE_VERTEX_BIT] = GLSLANG_STAGE_VERTEX,
[VK_SHADER_STAGE_FRAGMENT_BIT] = GLSLANG_STAGE_FRAGMENT,
[VK_SHADER_STAGE_COMPUTE_BIT] = GLSLANG_STAGE_COMPUTE,
+#if ((GLSLANG_VERSION_MAJOR) > 12)
+ [VK_SHADER_STAGE_TASK_BIT_EXT] = GLSLANG_STAGE_TASK,
+ [VK_SHADER_STAGE_MESH_BIT_EXT] = GLSLANG_STAGE_MESH,
+ [VK_SHADER_STAGE_RAYGEN_BIT_KHR] = GLSLANG_STAGE_RAYGEN,
+ [VK_SHADER_STAGE_INTERSECTION_BIT_KHR] = GLSLANG_STAGE_INTERSECT,
+ [VK_SHADER_STAGE_ANY_HIT_BIT_KHR] = GLSLANG_STAGE_ANYHIT,
+ [VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR] = GLSLANG_STAGE_CLOSESTHIT,
+ [VK_SHADER_STAGE_MISS_BIT_KHR] = GLSLANG_STAGE_MISS,
+ [VK_SHADER_STAGE_CALLABLE_BIT_KHR] = GLSLANG_STAGE_CALLABLE,
+#endif
};
const glslang_input_t glslc_input = {
.language = GLSLANG_SOURCE_GLSL,
.stage = glslc_stage[shd->stage],
.client = GLSLANG_CLIENT_VULKAN,
- /* GLSLANG_TARGET_VULKAN_1_2 before 11.6 resulted in targeting 1.0 */
-#if (((GLSLANG_VERSION_MAJOR) > 11) || ((GLSLANG_VERSION_MAJOR) == 11 && \
- (((GLSLANG_VERSION_MINOR) > 6) || ((GLSLANG_VERSION_MINOR) == 6 && \
- ((GLSLANG_VERSION_PATCH) > 0)))))
+#if ((GLSLANG_VERSION_MAJOR) >= 12)
+ .client_version = GLSLANG_TARGET_VULKAN_1_3,
+ .target_language_version = GLSLANG_TARGET_SPV_1_6,
+#else
.client_version = GLSLANG_TARGET_VULKAN_1_2,
.target_language_version = GLSLANG_TARGET_SPV_1_5,
-#else
- .client_version = GLSLANG_TARGET_VULKAN_1_1,
- .target_language_version = GLSLANG_TARGET_SPV_1_3,
#endif
.target_language = GLSLANG_TARGET_SPV,
.code = shd->src.str,
@@ -175,6 +182,20 @@ static int glslc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx,
.resource = &glslc_resource_limits,
};
+#if ((GLSLANG_VERSION_MAJOR) >= 12)
+ glslang_spv_options_t glslc_opts = {
+ .generate_debug_info = !!(s->extensions & FF_VK_EXT_DEBUG_UTILS),
+ .emit_nonsemantic_shader_debug_info = !!(s->extensions & FF_VK_EXT_RELAXED_EXTENDED_INSTR),
+ .emit_nonsemantic_shader_debug_source = !!(s->extensions & FF_VK_EXT_RELAXED_EXTENDED_INSTR),
+ .disable_optimizer = !!(s->extensions & FF_VK_EXT_DEBUG_UTILS),
+ .strip_debug_info = !(s->extensions & FF_VK_EXT_DEBUG_UTILS),
+ .optimize_size = 0,
+ .disassemble = 0,
+ .validate = 1,
+ .compile_only = 0,
+ };
+#endif
+
av_assert0(glslc_refcount);
*opaque = NULL;
@@ -218,7 +239,11 @@ static int glslc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx,
return AVERROR(EINVAL);
}
+#if ((GLSLANG_VERSION_MAJOR) >= 12)
+ glslang_program_SPIRV_generate_with_options(glslc_program, glslc_input.stage, &glslc_opts);
+#else
glslang_program_SPIRV_generate(glslc_program, glslc_input.stage);
+#endif
messages = glslang_program_SPIRV_get_messages(glslc_program);
if (messages) {
More information about the ffmpeg-cvslog
mailing list