diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 88bec861..d0bd821b 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -6282,7 +6282,7 @@ void hlsl_run_const_passes(struct hlsl_ctx *ctx, struct hlsl_block *body) } static void generate_vsir_signature_entry(struct hlsl_ctx *ctx, struct vsir_program *program, - struct shader_signature *signature, bool output, struct hlsl_ir_var *var) + struct shader_signature *signature, bool output, bool is_patch_constant_func, struct hlsl_ir_var *var) { enum vkd3d_shader_sysval_semantic sysval = VKD3D_SHADER_SV_NONE; enum vkd3d_shader_component_type component_type; @@ -6296,9 +6296,8 @@ static void generate_vsir_signature_entry(struct hlsl_ctx *ctx, struct vsir_prog struct vkd3d_string_buffer *string; bool has_idx, ret; - ret = sm4_sysval_semantic_from_semantic_name(&sysval, &program->shader_version, - ctx->semantic_compat_mapping, ctx->domain, var->semantic.name, var->semantic.index, - output, signature == &program->patch_constant_signature); + ret = sm4_sysval_semantic_from_semantic_name(&sysval, &program->shader_version, ctx->semantic_compat_mapping, + ctx->domain, var->semantic.name, var->semantic.index, output, is_patch_constant_func); VKD3D_ASSERT(ret); if (sysval == ~0u) return; @@ -6410,21 +6409,27 @@ static void generate_vsir_signature_entry(struct hlsl_ctx *ctx, struct vsir_prog static void generate_vsir_signature(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_function_decl *func) { + bool is_domain = program->shader_version.type == VKD3D_SHADER_TYPE_DOMAIN; + bool is_patch_constant_func = func == ctx->patch_constant_func; struct hlsl_ir_var *var; LIST_FOR_EACH_ENTRY(var, &func->extern_vars, struct hlsl_ir_var, extern_entry) { - if (func == ctx->patch_constant_func) + if (var->is_input_semantic) { - generate_vsir_signature_entry(ctx, program, - &program->patch_constant_signature, var->is_output_semantic, var); + if (is_patch_constant_func) + generate_vsir_signature_entry(ctx, program, &program->patch_constant_signature, false, true, var); + else if (is_domain) + generate_vsir_signature_entry(ctx, program, &program->patch_constant_signature, false, false, var); + else + generate_vsir_signature_entry(ctx, program, &program->input_signature, false, false, var); } - else + if (var->is_output_semantic) { - if (var->is_input_semantic) - generate_vsir_signature_entry(ctx, program, &program->input_signature, false, var); - if (var->is_output_semantic) - generate_vsir_signature_entry(ctx, program, &program->output_signature, true, var); + if (is_patch_constant_func) + generate_vsir_signature_entry(ctx, program, &program->patch_constant_signature, true, true, var); + else + generate_vsir_signature_entry(ctx, program, &program->output_signature, true, false, var); } } } diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index 3be7eaab..6b8ae0c1 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -3215,7 +3215,8 @@ static void add_section(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc, static void tpf_write_signature(struct tpf_compiler *tpf, const struct shader_signature *signature, uint32_t tag) { - bool output = tag == TAG_OSGN || tag == TAG_PCSG; + bool output = tag == TAG_OSGN || (tag == TAG_PCSG + && tpf->program->shader_version.type == VKD3D_SHADER_TYPE_HULL); struct vkd3d_bytecode_buffer buffer = {0}; unsigned int i; @@ -6717,6 +6718,7 @@ int tpf_compile(struct vsir_program *program, uint64_t config_flags, struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context, struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func) { + enum vkd3d_shader_type shader_type = program->shader_version.type; struct tpf_compiler tpf = {0}; struct sm4_stat stat = {0}; size_t i; @@ -6731,7 +6733,7 @@ int tpf_compile(struct vsir_program *program, uint64_t config_flags, tpf_write_signature(&tpf, &program->input_signature, TAG_ISGN); tpf_write_signature(&tpf, &program->output_signature, TAG_OSGN); - if (ctx->profile->type == VKD3D_SHADER_TYPE_HULL) + if (shader_type == VKD3D_SHADER_TYPE_HULL || shader_type == VKD3D_SHADER_TYPE_DOMAIN) tpf_write_signature(&tpf, &program->patch_constant_signature, TAG_PCSG); write_sm4_rdef(ctx, &tpf.dxbc); tpf_write_shdr(&tpf, entry_func);