summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2022-01-03 09:04:03 -0800
committerMarge Bot <emma+marge@anholt.net>2022-01-26 01:31:35 +0000
commitec415a274ef4bb67dca80256d4f15b5156c726f7 (patch)
tree9ced5cffe4321049db5f0f10152e52a3ee0b3805
parent9aca56b137dc64887901b092cb76bbdbab6f3e1c (diff)
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>
-rw-r--r--src/microsoft/compiler/dxil_container.c6
-rw-r--r--src/microsoft/compiler/dxil_signature.h6
-rw-r--r--src/microsoft/compiler/nir_to_dxil.c20
3 files changed, 32 insertions, 0 deletions
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
@@ -93,6 +93,12 @@ struct dxil_psv_runtime_info_0 {
} 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;
uint32_t output_stream_mask;
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
@@ -1361,6 +1361,17 @@ emit_hs_state(struct ntd_context *ctx)
}
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)
{
const nir_shader *s = ctx->shader;
@@ -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");
}