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@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-06-01 19:01:02 -05:00 committed by Alexandre Julliard
parent 46b1266809
commit 64b784dbb9
3 changed files with 22 additions and 0 deletions

View File

@ -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 */

View File

@ -15,6 +15,7 @@ global:
vkd3d_create_event;
vkd3d_destroy_event;
vkd3d_signal_event;
vkd3d_utils_set_log_callback;
vkd3d_wait_event;
local: *;

View File

@ -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);
}