microsoft/compiler: Emit DS PSV validation and entrypoint metadata

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>
This commit is contained in:
Jesse Natalie 2022-01-03 09:04:03 -08:00 committed by Marge Bot
parent 9aca56b137
commit ec415a274e
3 changed files with 32 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -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");
}