Signed-off-by: Isabella Bosia ibosia@codeweavers.com --- include/vkd3d_shader.h | 2 ++ libs/vkd3d-shader/spirv.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 4c57f61..2309c7c 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -97,6 +97,8 @@ enum vkd3d_shader_compile_option_name VKD3D_SHADER_COMPILE_OPTION_STRIP_DEBUG = 0x00000001, /** \a value is a member of enum vkd3d_shader_compile_option_buffer_uav. */ VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV = 0x00000002, + /** \a value is a member of enum vkd3d_shader_compile_option_formatting_flags. */ + VKD3D_SHADER_COMPILE_OPTION_FORMATTING = 0x00000003,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_NAME), }; diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 530e802..913b017 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2207,6 +2207,7 @@ struct vkd3d_dxbc_compiler unsigned int spec_constant_count; struct vkd3d_shader_spec_constant *spec_constants; size_t spec_constants_size; + enum vkd3d_shader_compile_option_formatting_flags formatting; };
static bool is_control_point_phase(const struct vkd3d_shader_phase *phase) @@ -2267,6 +2268,9 @@ struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader
vkd3d_spirv_builder_init(&compiler->spirv_builder, vkd3d_dxbc_compiler_get_entry_point_name(compiler));
+ compiler->formatting = VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES | + VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT; + for (i = 0; i < compile_info->option_count; ++i) { const struct vkd3d_shader_compile_option *option = &compile_info->options[i]; @@ -2286,6 +2290,10 @@ struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader WARN("Ignoring unrecognised value %#x for option %#x.\n", option->value, option->name); break;
+ case VKD3D_SHADER_COMPILE_OPTION_FORMATTING: + compiler->formatting = option->value; + break; + default: WARN("Ignoring unrecognised option %#x with value %#x.\n", option->name, option->value); break; @@ -9227,9 +9235,7 @@ int vkd3d_dxbc_compiler_generate_spirv(struct vkd3d_dxbc_compiler *compiler, struct vkd3d_shader_code text; enum vkd3d_shader_spirv_environment environment = vkd3d_dxbc_compiler_get_target_environment(compiler); if (vkd3d_spirv_binary_to_text(spirv, environment, - get_binary_to_text_options(VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FRIENDLY_NAMES | - VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT), - &text) != VKD3D_OK) + get_binary_to_text_options(compiler->formatting), &text) != VKD3D_OK) return VKD3D_ERROR; *spirv = text; }