mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Dump processed function bodies.
This commit is contained in:
committed by
Henri Verbeet
parent
f420e25fd5
commit
844f33025e
Notes:
Henri Verbeet
2025-07-23 17:30:00 +02:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1471
@@ -4066,20 +4066,23 @@ static void dump_instr(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hlsl_dump_function(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *func)
|
void hlsl_dump_function(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *func,
|
||||||
|
const char *description, const struct hlsl_block *processed_block)
|
||||||
{
|
{
|
||||||
struct vkd3d_string_buffer buffer;
|
struct vkd3d_string_buffer buffer;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
vkd3d_string_buffer_init(&buffer);
|
vkd3d_string_buffer_init(&buffer);
|
||||||
vkd3d_string_buffer_printf(&buffer, "Dumping function %s.\n", func->func->name);
|
vkd3d_string_buffer_printf(&buffer, "Dumping %s \"%s\".\n", description, func->func->name);
|
||||||
vkd3d_string_buffer_printf(&buffer, "Function parameters:\n");
|
vkd3d_string_buffer_printf(&buffer, "Function parameters:\n");
|
||||||
for (i = 0; i < func->parameters.count; ++i)
|
for (i = 0; i < func->parameters.count; ++i)
|
||||||
{
|
{
|
||||||
dump_ir_var(ctx, &buffer, func->parameters.vars[i]);
|
dump_ir_var(ctx, &buffer, func->parameters.vars[i]);
|
||||||
vkd3d_string_buffer_printf(&buffer, "\n");
|
vkd3d_string_buffer_printf(&buffer, "\n");
|
||||||
}
|
}
|
||||||
if (func->has_body)
|
if (processed_block)
|
||||||
|
dump_block(ctx, &buffer, processed_block);
|
||||||
|
else if (func->has_body)
|
||||||
dump_block(ctx, &buffer, &func->body);
|
dump_block(ctx, &buffer, &func->body);
|
||||||
|
|
||||||
vkd3d_string_buffer_trace(&buffer);
|
vkd3d_string_buffer_trace(&buffer);
|
||||||
|
@@ -1615,7 +1615,8 @@ struct hlsl_ir_node *hlsl_block_add_unary_expr(struct hlsl_ctx *ctx, struct hlsl
|
|||||||
void hlsl_block_cleanup(struct hlsl_block *block);
|
void hlsl_block_cleanup(struct hlsl_block *block);
|
||||||
bool hlsl_clone_block(struct hlsl_ctx *ctx, struct hlsl_block *dst_block, const struct hlsl_block *src_block);
|
bool hlsl_clone_block(struct hlsl_ctx *ctx, struct hlsl_block *dst_block, const struct hlsl_block *src_block);
|
||||||
|
|
||||||
void hlsl_dump_function(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *func);
|
void hlsl_dump_function(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *func,
|
||||||
|
const char *description, const struct hlsl_block *processed_block);
|
||||||
void hlsl_dump_ir_function_decl(struct hlsl_ctx *ctx,
|
void hlsl_dump_ir_function_decl(struct hlsl_ctx *ctx,
|
||||||
struct vkd3d_string_buffer *buffer, const struct hlsl_ir_function_decl *f);
|
struct vkd3d_string_buffer *buffer, const struct hlsl_ir_function_decl *f);
|
||||||
void hlsl_dump_var_default_values(const struct hlsl_ir_var *var);
|
void hlsl_dump_var_default_values(const struct hlsl_ir_var *var);
|
||||||
|
@@ -5294,7 +5294,7 @@ static void dump_function(struct rb_entry *entry, void *context)
|
|||||||
LIST_FOR_EACH_ENTRY(decl, &func->overloads, struct hlsl_ir_function_decl, entry)
|
LIST_FOR_EACH_ENTRY(decl, &func->overloads, struct hlsl_ir_function_decl, entry)
|
||||||
{
|
{
|
||||||
if (decl->has_body)
|
if (decl->has_body)
|
||||||
hlsl_dump_function(ctx, decl);
|
hlsl_dump_function(ctx, decl, "function", NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13957,7 +13957,12 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (TRACE_ON())
|
if (TRACE_ON())
|
||||||
|
{
|
||||||
rb_for_each_entry(&ctx->functions, dump_function, ctx);
|
rb_for_each_entry(&ctx->functions, dump_function, ctx);
|
||||||
|
hlsl_dump_function(ctx, entry_func, "processed entry point", &body);
|
||||||
|
if (profile->type == VKD3D_SHADER_TYPE_HULL)
|
||||||
|
hlsl_dump_function(ctx, ctx->patch_constant_func, "processed patch-constant function", &patch_body);
|
||||||
|
}
|
||||||
|
|
||||||
if (ctx->result)
|
if (ctx->result)
|
||||||
return ctx->result;
|
return ctx->result;
|
||||||
|
Reference in New Issue
Block a user