mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-30 21:54:16 +08:00
anv: assert when number of primitives is higher than max
Such cases can lead to memory corruptions. Acked-by: Caio Oliveira <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20279>
This commit is contained in:
parent
d7a1916798
commit
264a0cabd1
@ -84,6 +84,14 @@ anv_nir_lower_set_vtx_and_prim_count_instr(nir_builder *b, nir_instr *instr, voi
|
||||
if (intrin->intrinsic != nir_intrinsic_set_vertex_and_primitive_count)
|
||||
return false;
|
||||
|
||||
/* Detect some cases of invalid primitive count. They might lead to URB
|
||||
* memory corruption, where workgroups overwrite each other output memory.
|
||||
*/
|
||||
if (nir_src_is_const(intrin->src[1]) &&
|
||||
nir_src_as_uint(intrin->src[1]) > b->shader->info.mesh.max_primitives_out) {
|
||||
assert(!"number of primitives bigger than max specified");
|
||||
}
|
||||
|
||||
struct lower_set_vtx_and_prim_count_state *state = data;
|
||||
/* this intrinsic should show up only once */
|
||||
assert(state->primitive_count == NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user