Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- libs/vkd3d-shader/spirv.c | 8 +------- libs/vkd3d-shader/vkd3d_shader_main.c | 9 +++++++-- libs/vkd3d-shader/vkd3d_shader_private.h | 3 +++ 3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 6f948c31c..f604b8efd 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -127,13 +127,7 @@ static void vkd3d_spirv_dump(const struct vkd3d_shader_code *spirv,
if (!vkd3d_spirv_binary_to_text(spirv, environment, options, &text)) { - const char *str, *current = text.code; - while ((str = strchr(current, '\n'))) - { - TRACE("%.*s\n", (int)(str - current), current); - current = str + 1; - } - + vkd3d_shader_trace_text(text.code, text.size); vkd3d_shader_free_shader_code(&text); } } diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 5d7cdf019..e38261b45 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -98,12 +98,17 @@ int vkd3d_string_buffer_printf(struct vkd3d_string_buffer *buffer, const char *f
void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function) { - const char *p, *q, *end = buffer->buffer + buffer->content_size; + vkd3d_shader_trace_text_(buffer->buffer, buffer->content_size, function); +} + +void vkd3d_shader_trace_text_(const char *text, size_t size, const char *function) +{ + const char *p, *q, *end = text + size;
if (!TRACE_ON()) return;
- for (p = buffer->buffer; p < end; p = q) + for (p = text; p < end; p = q) { if (!(q = memchr(p, '\n', end - p))) q = end; diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 5ced3d532..78354a95b 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -988,6 +988,9 @@ void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const s
void vkd3d_shader_dump_shader(enum vkd3d_shader_source_type source_type, enum vkd3d_shader_type shader_type, const struct vkd3d_shader_code *shader); +void vkd3d_shader_trace_text_(const char *text, size_t size, const char *function); +#define vkd3d_shader_trace_text(text, size) \ + vkd3d_shader_trace_text_(text, size, __FUNCTION__)
int shader_extract_from_dxbc(const void *dxbc, size_t dxbc_length, struct vkd3d_shader_message_context *message_context, const char *source_name, struct vkd3d_shader_desc *desc);