vkd3d: 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:01 -05:00 committed by Alexandre Julliard
parent 174172887b
commit 46b1266809
3 changed files with 24 additions and 0 deletions

View File

@ -212,6 +212,20 @@ VKD3D_API HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED
VKD3D_API HRESULT vkd3d_create_versioned_root_signature_deserializer(const void *data, SIZE_T data_size,
REFIID iid, void **deserializer);
/**
* Set a callback to be called when vkd3d outputs debug logging.
*
* If NULL, or if this function has not been called, libvkd3d will print all
* enabled log output to stderr.
*
* Calling this function will also set the log callback for libvkd3d-shader.
*
* \param callback Callback function to set.
*
* \since 1.4
*/
VKD3D_API void vkd3d_set_log_callback(PFN_vkd3d_log callback);
#endif /* VKD3D_NO_PROTOTYPES */
/*
@ -255,6 +269,9 @@ typedef HRESULT (*PFN_vkd3d_serialize_versioned_root_signature)(const D3D12_VERS
typedef HRESULT (*PFN_vkd3d_create_versioned_root_signature_deserializer)(const void *data, SIZE_T data_size,
REFIID iid, void **deserializer);
/** Type of vkd3d_set_log_callback(). \since 1.4 */
typedef void (*PFN_vkd3d_set_log_callback)(PFN_vkd3d_log callback);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -22,6 +22,7 @@ global:
vkd3d_resource_incref;
vkd3d_serialize_root_signature;
vkd3d_serialize_versioned_root_signature;
vkd3d_set_log_callback;
local: *;
};

View File

@ -510,3 +510,9 @@ HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED_ROOT_SIGN
}
return hr;
}
void vkd3d_set_log_callback(PFN_vkd3d_log callback)
{
vkd3d_shader_set_log_callback(callback);
vkd3d_dbg_set_log_callback(callback);
}