History

vulkan_shaderc: add more stages, target Vulkan 1.3 and only output debug if needed

Lynne committed 2 years ago

Commit 2bb0b6d1 parent a2a983e1 file · +19 −5Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vulkan_shaderc.c+19−5
@@ -41,6 +41,14 @@ static int shdc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx, · 40 unmodified lines
41 [VK_SHADER_STAGE_VERTEX_BIT] = shaderc_glsl_vertex_shader,41 [VK_SHADER_STAGE_VERTEX_BIT] = shaderc_glsl_vertex_shader,
42 [VK_SHADER_STAGE_FRAGMENT_BIT] = shaderc_glsl_fragment_shader,42 [VK_SHADER_STAGE_FRAGMENT_BIT] = shaderc_glsl_fragment_shader,
43 [VK_SHADER_STAGE_COMPUTE_BIT] = shaderc_glsl_compute_shader,43 [VK_SHADER_STAGE_COMPUTE_BIT] = shaderc_glsl_compute_shader,
44 [VK_SHADER_STAGE_MESH_BIT_EXT] = shaderc_mesh_shader,
45 [VK_SHADER_STAGE_TASK_BIT_EXT] = shaderc_task_shader,
46 [VK_SHADER_STAGE_RAYGEN_BIT_KHR] = shaderc_raygen_shader,
47 [VK_SHADER_STAGE_ANY_HIT_BIT_KHR] = shaderc_anyhit_shader,
48 [VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR] = shaderc_closesthit_shader,
49 [VK_SHADER_STAGE_MISS_BIT_KHR] = shaderc_miss_shader,
50 [VK_SHADER_STAGE_INTERSECTION_BIT_KHR] = shaderc_intersection_shader,
51 [VK_SHADER_STAGE_CALLABLE_BIT_KHR] = shaderc_callable_shader,
44 };52 };
45 53
46 shaderc_compile_options_t opts = shaderc_compile_options_initialize();54 shaderc_compile_options_t opts = shaderc_compile_options_initialize();
@@ -49,11 +57,17 @@ static int shdc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx, · 2 unmodified lines
49 return AVERROR(ENOMEM);57 return AVERROR(ENOMEM);
50 58
51 shaderc_compile_options_set_target_env(opts, shaderc_target_env_vulkan,59 shaderc_compile_options_set_target_env(opts, shaderc_target_env_vulkan,
52 shaderc_env_version_vulkan_1_2);60 shaderc_env_version_vulkan_1_3);
53 shaderc_compile_options_set_target_spirv(opts, shaderc_spirv_version_1_5);61 shaderc_compile_options_set_target_spirv(opts, shaderc_spirv_version_1_6);
54 shaderc_compile_options_set_generate_debug_info(opts);62
55 shaderc_compile_options_set_optimization_level(opts,63 if (s->extensions & FF_VK_EXT_DEBUG_UTILS) {
56 shaderc_optimization_level_performance);64 shaderc_compile_options_set_generate_debug_info(opts);
65 shaderc_compile_options_set_optimization_level(opts,
66 shaderc_optimization_level_zero);
67 } else {
68 shaderc_compile_options_set_optimization_level(opts,
69 shaderc_optimization_level_performance);
70 }
57 71
58 res = shaderc_compile_into_spv((shaderc_compiler_t)ctx->priv,72 res = shaderc_compile_into_spv((shaderc_compiler_t)ctx->priv,
59 shd->src.str, strlen(shd->src.str),73 shd->src.str, strlen(shd->src.str),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t