mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Report error messages from vkd3d_shader_parse_root_signature().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d135b4687b
commit
33eb944bf4
@ -753,7 +753,7 @@ void vkd3d_shader_free_messages(char *messages);
|
||||
void vkd3d_shader_free_shader_code(struct vkd3d_shader_code *code);
|
||||
|
||||
int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc,
|
||||
struct vkd3d_shader_versioned_root_signature_desc *root_signature);
|
||||
struct vkd3d_shader_versioned_root_signature_desc *root_signature, char **messages);
|
||||
void vkd3d_shader_free_root_signature(struct vkd3d_shader_versioned_root_signature_desc *root_signature);
|
||||
|
||||
/* FIXME: Add support for returning error messages (ID3DBlob). */
|
||||
@ -784,7 +784,7 @@ typedef void (*PFN_vkd3d_shader_free_messages)(char *messages);
|
||||
typedef void (*PFN_vkd3d_shader_free_shader_code)(struct vkd3d_shader_code *code);
|
||||
|
||||
typedef int (*PFN_vkd3d_shader_parse_root_signature)(const struct vkd3d_shader_code *dxbc,
|
||||
struct vkd3d_shader_versioned_root_signature_desc *root_signature);
|
||||
struct vkd3d_shader_versioned_root_signature_desc *root_signature, char **messages);
|
||||
typedef void (*PFN_vkd3d_shader_free_root_signature)(struct vkd3d_shader_versioned_root_signature_desc *root_signature);
|
||||
|
||||
typedef int (*PFN_vkd3d_shader_serialize_root_signature)(
|
||||
|
@ -2679,17 +2679,24 @@ static int rts0_handler(const char *data, DWORD data_size, DWORD tag, void *cont
|
||||
}
|
||||
|
||||
int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc,
|
||||
struct vkd3d_shader_versioned_root_signature_desc *root_signature)
|
||||
struct vkd3d_shader_versioned_root_signature_desc *root_signature, char **messages)
|
||||
{
|
||||
struct vkd3d_shader_message_context message_context;
|
||||
int ret;
|
||||
|
||||
TRACE("dxbc {%p, %zu}, root_signature %p.\n", dxbc->code, dxbc->size, root_signature);
|
||||
TRACE("dxbc {%p, %zu}, root_signature %p, messages %p.\n", dxbc->code, dxbc->size, root_signature, messages);
|
||||
|
||||
memset(root_signature, 0, sizeof(*root_signature));
|
||||
if (!vkd3d_shader_message_context_init(&message_context, VKD3D_SHADER_LOG_NONE, NULL))
|
||||
if (messages)
|
||||
*messages = NULL;
|
||||
if (!vkd3d_shader_message_context_init(&message_context, VKD3D_SHADER_LOG_INFO, NULL))
|
||||
return VKD3D_ERROR;
|
||||
|
||||
ret = parse_dxbc(dxbc->code, dxbc->size, &message_context, rts0_handler, root_signature);
|
||||
vkd3d_shader_message_context_trace_messages(&message_context);
|
||||
if (messages && !(*messages = vkd3d_shader_message_context_copy_messages(&message_context)))
|
||||
ret = VKD3D_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
vkd3d_shader_message_context_cleanup(&message_context);
|
||||
if (ret < 0)
|
||||
vkd3d_shader_free_root_signature(root_signature);
|
||||
|
@ -133,15 +133,13 @@ void vkd3d_shader_message_context_cleanup(struct vkd3d_shader_message_context *c
|
||||
vkd3d_string_buffer_cleanup(&context->messages);
|
||||
}
|
||||
|
||||
#define vkd3d_shader_message_context_trace_messages(context) \
|
||||
vkd3d_shader_message_context_trace_messages_(context, __FUNCTION__)
|
||||
static void vkd3d_shader_message_context_trace_messages_(const struct vkd3d_shader_message_context *context,
|
||||
void vkd3d_shader_message_context_trace_messages_(const struct vkd3d_shader_message_context *context,
|
||||
const char *function)
|
||||
{
|
||||
vkd3d_string_buffer_trace_(&context->messages, function);
|
||||
}
|
||||
|
||||
static char *vkd3d_shader_message_context_copy_messages(struct vkd3d_shader_message_context *context)
|
||||
char *vkd3d_shader_message_context_copy_messages(struct vkd3d_shader_message_context *context)
|
||||
{
|
||||
char *messages;
|
||||
|
||||
|
@ -830,8 +830,13 @@ struct vkd3d_shader_message_context
|
||||
};
|
||||
|
||||
void vkd3d_shader_message_context_cleanup(struct vkd3d_shader_message_context *context) DECLSPEC_HIDDEN;
|
||||
char *vkd3d_shader_message_context_copy_messages(struct vkd3d_shader_message_context *context) DECLSPEC_HIDDEN;
|
||||
bool vkd3d_shader_message_context_init(struct vkd3d_shader_message_context *context,
|
||||
enum vkd3d_shader_log_level log_level, const char *source_name) DECLSPEC_HIDDEN;
|
||||
void vkd3d_shader_message_context_trace_messages_(const struct vkd3d_shader_message_context *context,
|
||||
const char *function) DECLSPEC_HIDDEN;
|
||||
#define vkd3d_shader_message_context_trace_messages(context) \
|
||||
vkd3d_shader_message_context_trace_messages_(context, __FUNCTION__)
|
||||
void vkd3d_shader_error(struct vkd3d_shader_message_context *context, enum vkd3d_shader_error error,
|
||||
const char *format, ...) VKD3D_PRINTF_FUNC(3, 4) DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -174,7 +174,7 @@ int vkd3d_parse_root_signature_v_1_0(const struct vkd3d_shader_code *dxbc,
|
||||
struct vkd3d_shader_versioned_root_signature_desc desc, converted_desc;
|
||||
int ret;
|
||||
|
||||
if ((ret = vkd3d_shader_parse_root_signature(dxbc, &desc)) < 0)
|
||||
if ((ret = vkd3d_shader_parse_root_signature(dxbc, &desc, NULL)) < 0)
|
||||
{
|
||||
WARN("Failed to parse root signature, vkd3d result %d.\n", ret);
|
||||
return ret;
|
||||
@ -389,7 +389,7 @@ static HRESULT d3d12_versioned_root_signature_deserializer_init(struct d3d12_ver
|
||||
deserializer->ID3D12VersionedRootSignatureDeserializer_iface.lpVtbl = &d3d12_versioned_root_signature_deserializer_vtbl;
|
||||
deserializer->refcount = 1;
|
||||
|
||||
if ((ret = vkd3d_shader_parse_root_signature(dxbc, &deserializer->desc.vkd3d)) < 0)
|
||||
if ((ret = vkd3d_shader_parse_root_signature(dxbc, &deserializer->desc.vkd3d, NULL)) < 0)
|
||||
{
|
||||
WARN("Failed to parse root signature, vkd3d result %d.\n", ret);
|
||||
return hresult_from_vkd3d_result(ret);
|
||||
|
@ -129,7 +129,7 @@ static void test_vkd3d_shader_pfns(void)
|
||||
|
||||
rc = pfn_vkd3d_shader_serialize_root_signature(&empty_rs_desc, &dxbc);
|
||||
ok(rc == VKD3D_OK, "Got unexpected error code %d.\n", rc);
|
||||
rc = pfn_vkd3d_shader_parse_root_signature(&dxbc, &root_signature_desc);
|
||||
rc = pfn_vkd3d_shader_parse_root_signature(&dxbc, &root_signature_desc, NULL);
|
||||
ok(rc == VKD3D_OK, "Got unexpected error code %d.\n", rc);
|
||||
pfn_vkd3d_shader_free_root_signature(&root_signature_desc);
|
||||
pfn_vkd3d_shader_free_shader_code(&dxbc);
|
||||
|
Loading…
Reference in New Issue
Block a user