summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Natalie <jenatali@microsoft.com>2024-03-31 17:56:33 -0700
committerMarge Bot <emma+marge@anholt.net>2024-04-04 20:29:11 +0000
commit5d0c77658c5ca628d16e4cde9591d61d6e32280c (patch)
treeb929d702d0ea03182bc1d1519a2a676947400659
parentd28a552e2a11f744d0a534f79b61c79d4e708c0d (diff)
d3d12: Forward front-facing for passthrough GS
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
-rw-r--r--src/gallium/drivers/d3d12/d3d12_gs_variant.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/drivers/d3d12/d3d12_gs_variant.cpp b/src/gallium/drivers/d3d12/d3d12_gs_variant.cpp
index e243e9213cc..26b1c132a49 100644
--- a/src/gallium/drivers/d3d12/d3d12_gs_variant.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_gs_variant.cpp
@@ -88,6 +88,7 @@ d3d12_make_passthrough_gs(struct d3d12_context *ctx, struct d3d12_gs_variant_key
nir->info.gs.vertices_out = 1;
nir->info.gs.invocations = 1;
nir->info.gs.active_stream_mask = 1;
+ nir->num_outputs = 0;
/* Copy inputs to outputs. */
while (varyings) {
@@ -124,9 +125,21 @@ d3d12_make_passthrough_gs(struct d3d12_context *ctx, struct d3d12_gs_variant_key
nir_deref_instr *in_value = nir_build_deref_array(&b, nir_build_deref_var(&b, in),
nir_imm_int(&b, 0));
copy_vars(&b, nir_build_deref_var(&b, out), in_value);
+ nir->num_outputs++;
}
}
+ if (key->has_front_face) {
+ nir_variable *front_facing_var = nir_variable_create(nir,
+ nir_var_shader_out,
+ glsl_uint_type(),
+ "gl_FrontFacing");
+ front_facing_var->data.location = VARYING_SLOT_VAR12;
+ front_facing_var->data.driver_location = nir->num_outputs++;
+ front_facing_var->data.interpolation = INTERP_MODE_FLAT;
+ nir_store_deref(&b, nir_build_deref_var(&b, front_facing_var), nir_imm_int(&b, 1), 1);
+ }
+
nir_emit_vertex(&b, 0);
nir_end_primitive(&b, 0);