d3d12: Forward front-facing for passthrough GS

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28535>
This commit is contained in:
Jesse Natalie 2024-03-31 17:56:33 -07:00 committed by Marge Bot
parent d28a552e2a
commit 5d0c77658c

View file

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