diff --git a/src/microsoft/compiler/dxil_container.c b/src/microsoft/compiler/dxil_container.c index 2ca6603c3ce..082d6fc09cc 100644 --- a/src/microsoft/compiler/dxil_container.c +++ b/src/microsoft/compiler/dxil_container.c @@ -240,6 +240,12 @@ dxil_container_add_state_validation(struct dxil_container *c, state->state.sig_patch_const_or_prim_vectors); } } + if (state->state.shader_stage == DXIL_DOMAIN_SHADER && + state->state.sig_patch_const_or_prim_vectors && + state->state.sig_output_vectors[0]) { + dependency_table_size += sizeof(uint32_t) * compute_input_output_table_dwords( + state->state.sig_patch_const_or_prim_vectors, state->state.sig_output_vectors[0]); + } size += dependency_table_size; // TODO: Domain shader table goes here diff --git a/src/microsoft/compiler/dxil_signature.h b/src/microsoft/compiler/dxil_signature.h index 4c523b82c02..28f7dcea64c 100644 --- a/src/microsoft/compiler/dxil_signature.h +++ b/src/microsoft/compiler/dxil_signature.h @@ -92,6 +92,12 @@ struct dxil_psv_runtime_info_0 { uint32_t tessellator_output_primitive; } hs; + struct { + uint32_t input_control_point_count; + char output_position_present; + uint32_t tessellator_domain; + } ds; + struct { uint32_t input_primitive; uint32_t output_toplology; diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index 41ea2c202ff..16c4eced4e8 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -1360,6 +1360,17 @@ emit_hs_state(struct ntd_context *ctx) return dxil_get_metadata_node(&ctx->mod, hs_state_nodes, ARRAY_SIZE(hs_state_nodes)); } +static const struct dxil_mdnode * +emit_ds_state(struct ntd_context *ctx) +{ + const struct dxil_mdnode *ds_state_nodes[2]; + + ds_state_nodes[0] = dxil_get_metadata_int32(&ctx->mod, get_tessellator_domain(ctx->shader->info.tess._primitive_mode)); + ds_state_nodes[1] = dxil_get_metadata_int32(&ctx->mod, ctx->shader->info.tess.tcs_vertices_out); + + return dxil_get_metadata_node(&ctx->mod, ds_state_nodes, ARRAY_SIZE(ds_state_nodes)); +} + static const struct dxil_mdnode * emit_threads(struct ntd_context *ctx) { @@ -1539,6 +1550,9 @@ emit_metadata(struct ntd_context *ctx) if (!emit_tag(ctx, DXIL_SHADER_TAG_HS_STATE, emit_hs_state(ctx))) return false; + } else if (ctx->mod.shader_kind == DXIL_DOMAIN_SHADER) { + if (!emit_tag(ctx, DXIL_SHADER_TAG_DS_STATE, emit_ds_state(ctx))) + return false; } else if (ctx->mod.shader_kind == DXIL_COMPUTE_SHADER) { if (!emit_tag(ctx, DXIL_SHADER_TAG_NUM_THREADS, emit_threads(ctx))) return false; @@ -5391,6 +5405,12 @@ void dxil_fill_validation_state(struct ntd_context *ctx, state->state.psv0.hs.tessellator_output_primitive = get_tessellator_output_primitive(&ctx->shader->info); state->state.sig_patch_const_or_prim_vectors = ctx->mod.num_psv_patch_consts; break; + case DXIL_DOMAIN_SHADER: + state->state.psv0.ds.input_control_point_count = ctx->shader->info.tess.tcs_vertices_out; + state->state.psv0.ds.tessellator_domain = get_tessellator_domain(ctx->shader->info.tess._primitive_mode); + state->state.psv0.ds.output_position_present = ctx->mod.info.has_out_position; + state->state.sig_patch_const_or_prim_vectors = ctx->mod.num_psv_patch_consts; + break; default: assert(0 && "Shader type not (yet) supported"); }