lds_es_exporter_tid = 17,
/* bit i is set when the i'th clip distance of a vertex is negative */
lds_es_clipdist_neg_mask = 18,
+ /* TES only, relative patch ID, less than max workgroup size */
+ lds_es_tes_rel_patch_id = 19,
/* Repacked arguments - also listed separately for VS and TES */
lds_es_arg_0 = 20,
/* TES arguments which need to be repacked */
lds_es_tes_u = 20,
lds_es_tes_v = 24,
- lds_es_tes_rel_patch_id = 28,
- lds_es_tes_patch_id = 32,
+ lds_es_tes_patch_id = 28,
};
typedef struct {
if (!uses_tes_v)
progress |= remove_compacted_arg(state, &b, 1);
if (!uses_tes_rel_patch_id)
- progress |= remove_compacted_arg(state, &b, 2);
- if (!uses_tes_patch_id)
progress |= remove_compacted_arg(state, &b, 3);
+ if (!uses_tes_patch_id)
+ progress |= remove_compacted_arg(state, &b, 2);
}
return progress;
nogs_state->compact_arg_stores[i] = &store->instr;
}
+
+ /* TES rel patch id does not cost extra dword */
+ if (b->shader->info.stage == MESA_SHADER_TESS_EVAL) {
+ nir_ssa_def *arg_val = nir_load_var(b, repacked_arg_vars[3]);
+ nir_intrinsic_instr *store =
+ nir_store_shared(b, nir_u2u8(b, arg_val), exporter_addr,
+ .base = lds_es_tes_rel_patch_id);
+
+ nogs_state->compact_arg_stores[3] = &store->instr;
+ }
}
nir_pop_if(b, if_es_accepted);
nir_ssa_def *arg_val = nir_load_shared(b, 1, 32, es_vertex_lds_addr, .base = lds_es_arg_0 + 4u * i);
nir_store_var(b, repacked_arg_vars[i], arg_val, 0x1u);
}
+
+ if (b->shader->info.stage == MESA_SHADER_TESS_EVAL) {
+ nir_ssa_def *arg_val = nir_load_shared(b, 1, 8, es_vertex_lds_addr,
+ .base = lds_es_tes_rel_patch_id);
+ nir_store_var(b, repacked_arg_vars[3], nir_u2u32(b, arg_val), 0x1u);
+ }
}
nir_push_else(b, if_packed_es_thread);
{
max_args = uses_instance_id ? 2 : 1;
} else {
assert(stage == MESA_SHADER_TESS_EVAL);
- max_args = uses_primitive_id ? 4 : 3;
+ max_args = uses_primitive_id ? 3 : 2;
}
if (max_exported_args)
nir_ssa_def *tess_coord = nir_load_tess_coord(b);
nir_store_var(b, repacked_arg_vars[0], nir_channel(b, tess_coord, 0), 0x1u);
nir_store_var(b, repacked_arg_vars[1], nir_channel(b, tess_coord, 1), 0x1u);
- nir_store_var(b, repacked_arg_vars[2], nir_load_tess_rel_patch_id_amd(b), 0x1u);
+ nir_store_var(b, repacked_arg_vars[3], nir_load_tess_rel_patch_id_amd(b), 0x1u);
if (uses_tess_primitive_id)
- nir_store_var(b, repacked_arg_vars[3], nir_load_primitive_id(b), 0x1u);
+ nir_store_var(b, repacked_arg_vars[2], nir_load_primitive_id(b), 0x1u);
} else {
unreachable("Should be VS or TES.");
}