Zebediah Figura : vkd3d-utils: Allow writing log output via a custom callback.

Alexandre Julliard julliard at winehq.org
Tue Jun 7 15:36:06 CDT 2022


Module: vkd3d
Branch: master
Commit: 64b784dbb942dbb7471edfc6e6e3cc7dc3ac6174
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=64b784dbb942dbb7471edfc6e6e3cc7dc3ac6174

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Wed Jun  1 19:01:02 2022 -0500

vkd3d-utils: Allow writing log output via a custom callback.

When using PE vkd3d through Wine, debug output may be swallowed by writing to
Win32 stderr. Avoid this by providing a way to hook up vkd3d log output to Wine
output.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/vkd3d_utils.h               | 15 +++++++++++++++
 libs/vkd3d-utils/vkd3d_utils.map    |  1 +
 libs/vkd3d-utils/vkd3d_utils_main.c |  6 ++++++
 3 files changed, 22 insertions(+)

diff --git a/include/vkd3d_utils.h b/include/vkd3d_utils.h
index 56524782..6e84b176 100644
--- a/include/vkd3d_utils.h
+++ b/include/vkd3d_utils.h
@@ -75,6 +75,21 @@ VKD3D_UTILS_API HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, cons
         const D3D_SHADER_MACRO *defines, ID3DInclude *include,
         ID3DBlob **shader, ID3DBlob **error_messages);
 
+/**
+ * Set a callback to be called when vkd3d-utils outputs debug logging.
+ *
+ * If NULL, or if this function has not been called, libvkd3d-utils will print
+ * all enabled log output to stderr.
+ *
+ * Calling this function will also set the log callback for libvkd3d and
+ * libvkd3d-shader.
+ *
+ * \param callback Callback function to set.
+ *
+ * \since 1.4
+ */
+VKD3D_UTILS_API void vkd3d_utils_set_log_callback(PFN_vkd3d_log callback);
+
 #ifdef __cplusplus
 }
 #endif  /* __cplusplus */
diff --git a/libs/vkd3d-utils/vkd3d_utils.map b/libs/vkd3d-utils/vkd3d_utils.map
index 1e46cd86..14eb439e 100644
--- a/libs/vkd3d-utils/vkd3d_utils.map
+++ b/libs/vkd3d-utils/vkd3d_utils.map
@@ -15,6 +15,7 @@ global:
     vkd3d_create_event;
     vkd3d_destroy_event;
     vkd3d_signal_event;
+    vkd3d_utils_set_log_callback;
     vkd3d_wait_event;
 
 local: *;
diff --git a/libs/vkd3d-utils/vkd3d_utils_main.c b/libs/vkd3d-utils/vkd3d_utils_main.c
index 22953c46..64418893 100644
--- a/libs/vkd3d-utils/vkd3d_utils_main.c
+++ b/libs/vkd3d-utils/vkd3d_utils_main.c
@@ -536,3 +536,9 @@ HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
     }
     return hr;
 }
+
+void vkd3d_utils_set_log_callback(PFN_vkd3d_log callback)
+{
+    vkd3d_set_log_callback(callback);
+    vkd3d_dbg_set_log_callback(callback);
+}




More information about the wine-cvs mailing list