summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2022-01-03 14:47:35 -0800
committerMarge Bot <emma+marge@anholt.net>2022-01-26 01:31:35 +0000
commit4da51aa88fa54f41321a2bb5054569e216d5b4c3 (patch)
tree379bb3fe4c1705eca89b520939a9ff34cc0561ba
parentec415a274ef4bb67dca80256d4f15b5156c726f7 (diff)
microsoft/compiler: Primitive ID should only be added as a sysval in geometry shaders
Docs say that its presence in signatures as a "shadow" element (meaning it's not accessed via load/store, but with a dedicated opcode) is legacy. It seems it wasn't carried forward when HS/DS were added in D3D11. 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/nir_to_dxil.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c
index 16c4eced4e8..893c190913c 100644
--- a/src/microsoft/compiler/nir_to_dxil.c
+++ b/src/microsoft/compiler/nir_to_dxil.c
@@ -5462,12 +5462,13 @@ struct sysvalue_name {
gl_system_value value;
int slot;
char *name;
+ gl_shader_stage only_in_shader;
} possible_sysvalues[] = {
- {SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, -1, "SV_VertexID"},
- {SYSTEM_VALUE_INSTANCE_ID, -1, "SV_InstanceID"},
- {SYSTEM_VALUE_FRONT_FACE, VARYING_SLOT_FACE, "SV_IsFrontFace"},
- {SYSTEM_VALUE_PRIMITIVE_ID, VARYING_SLOT_PRIMITIVE_ID, "SV_PrimitiveID"},
- {SYSTEM_VALUE_SAMPLE_ID, -1, "SV_SampleIndex"},
+ {SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, -1, "SV_VertexID", MESA_SHADER_NONE},
+ {SYSTEM_VALUE_INSTANCE_ID, -1, "SV_InstanceID", MESA_SHADER_NONE},
+ {SYSTEM_VALUE_FRONT_FACE, VARYING_SLOT_FACE, "SV_IsFrontFace", MESA_SHADER_NONE},
+ {SYSTEM_VALUE_PRIMITIVE_ID, VARYING_SLOT_PRIMITIVE_ID, "SV_PrimitiveID", MESA_SHADER_GEOMETRY},
+ {SYSTEM_VALUE_SAMPLE_ID, -1, "SV_SampleIndex", MESA_SHADER_NONE},
};
static bool
@@ -5481,6 +5482,9 @@ allocate_sysvalues(struct ntd_context *ctx)
for (unsigned i = 0; i < ARRAY_SIZE(possible_sysvalues); ++i) {
struct sysvalue_name *info = &possible_sysvalues[i];
+ if (info->only_in_shader != MESA_SHADER_NONE &&
+ info->only_in_shader != ctx->shader->info.stage)
+ continue;
if (BITSET_TEST(ctx->shader->info.system_values_read, info->value)) {
if (!append_input_or_sysvalue(ctx, info->slot,
info->value, info->name,