[PATCH vkd3d 3/3] vkd3d-utils: Allow writing log output via a custom callback.
Zebediah Figura
zfigura at codeweavers.com
Wed Jun 1 19:01:02 CDT 2022
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>
---
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 565247820..6e84b176e 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 1e46cd865..14eb439e0 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 22953c461..644188930 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);
+}
--
2.36.1
More information about the wine-devel
mailing list