From fc5df4d3307ed6d2118e983a7c3927e7ffeaeac5 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 6 Mar 2022 20:04:35 -0600 Subject: [PATCH] vkd3d-utils: Simplify handling of shader messages a bit. Signed-off-by: Zebediah Figura Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d-utils/vkd3d_utils_main.c | 36 +++++++++++++---------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/libs/vkd3d-utils/vkd3d_utils_main.c b/libs/vkd3d-utils/vkd3d_utils_main.c index 9607eddd..22953c46 100644 --- a/libs/vkd3d-utils/vkd3d_utils_main.c +++ b/libs/vkd3d-utils/vkd3d_utils_main.c @@ -263,20 +263,18 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen } ret = vkd3d_shader_compile(&compile_info, &byte_code, &messages); - if (messages) + + if (messages && messages_blob) { - if (messages_blob) + if (FAILED(hr = vkd3d_blob_create(messages, strlen(messages), messages_blob))) { - if (FAILED(hr = vkd3d_blob_create(messages, strlen(messages), messages_blob))) - { - vkd3d_shader_free_messages(messages); - vkd3d_shader_free_shader_code(&byte_code); - return hr; - } - } - else vkd3d_shader_free_messages(messages); + vkd3d_shader_free_shader_code(&byte_code); + return hr; + } + messages = NULL; } + vkd3d_shader_free_messages(messages); if (!ret) { @@ -351,20 +349,18 @@ HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename preprocess_info.include_context = include; ret = vkd3d_shader_preprocess(&compile_info, &preprocessed_code, &messages); - if (messages) + + if (messages && messages_blob) { - if (messages_blob) + if (FAILED(hr = vkd3d_blob_create(messages, strlen(messages), messages_blob))) { - if (FAILED(hr = vkd3d_blob_create(messages, strlen(messages), messages_blob))) - { - vkd3d_shader_free_messages(messages); - vkd3d_shader_free_shader_code(&preprocessed_code); - return hr; - } - } - else vkd3d_shader_free_messages(messages); + vkd3d_shader_free_shader_code(&preprocessed_code); + return hr; + } + messages = NULL; } + vkd3d_shader_free_messages(messages); if (!ret) {