Commit 1a6a31c4 authored by Louis-Francis Ratté-Boulianne's avatar Louis-Francis Ratté-Boulianne Committed by Erik Faye-Lund
Browse files

d3d12: Fix provoking vertex when lowering polygon mode to gs

parent a8093036
......@@ -492,6 +492,8 @@ validate_geometry_shader_variant(struct d3d12_selection_context *sel_ctx)
} else if (sel_ctx->fill_mode_lowered != PIPE_POLYGON_MODE_FILL) {
key.fill_mode = sel_ctx->fill_mode_lowered;
fill_flat_varyings(&key, fs);
if (key.flat_varyings != 0)
key.flatshade_first = ctx->gfx_pipeline_state.rast->base.flatshade_first;
variant_needed = true;
}
......
......@@ -139,6 +139,7 @@ struct d3d12_gs_variant_key
unsigned provoking_vertex:3;
unsigned alternate_tri:1;
unsigned fill_mode:2;
unsigned flatshade_first:1;
uint64_t flat_varyings;
struct d3d12_varying_info varyings;
};
......
......@@ -276,7 +276,7 @@ d3d12_emit_points(struct d3d12_context *ctx, struct d3d12_gs_variant_key *key)
*/
for (unsigned i = 0; i < emit_ctx.num_vars; ++i) {
nir_ssa_def *index = (key->flat_varyings & (1 << emit_ctx.in[i]->data.location)) ?
nir_imm_int(b, 2) : emit_ctx.loop_index;
nir_imm_int(b, (key->flatshade_first ? 0 : 2)) : emit_ctx.loop_index;
nir_deref_instr *in_value = nir_build_deref_array(b, nir_build_deref_var(b, emit_ctx.in[i]), index);
if (emit_ctx.in[i]->data.location == VARYING_SLOT_POS && emit_ctx.edgeflag_cmp) {
nir_if *edge_check = nir_push_if(b, emit_ctx.edgeflag_cmp);
......@@ -307,7 +307,7 @@ d3d12_emit_lines(struct d3d12_context *ctx, struct d3d12_gs_variant_key *key)
/* First vertex */
for (unsigned i = 0; i < emit_ctx.num_vars; ++i) {
nir_ssa_def *index = (key->flat_varyings & (1 << emit_ctx.in[i]->data.location)) ?
nir_imm_int(b, 2) : emit_ctx.loop_index;
nir_imm_int(b, (key->flatshade_first ? 0 : 2)) : emit_ctx.loop_index;
nir_deref_instr *in_value = nir_build_deref_array(b, nir_build_deref_var(b, emit_ctx.in[i]), index);
nir_copy_deref(b, nir_build_deref_var(b, emit_ctx.out[i]), in_value);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment