util: fix util_is_vbo_upload_ratio_too_large

It was wrong. For example, if the draw vertex count was 10 and the upload
vertex count was 150, u_vbuf wouldn't unroll the draw and would instead
memcpy 150 vertices. This fixes that case.

Fixes: 068a3bf0d7 - util: move and adjust the vertex upload heuristic equation from u_vbuf

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20824>
(cherry picked from commit 4f6e785876)
This commit is contained in:
Marek Olšák 2022-12-19 01:17:13 -05:00 committed by Eric Engestrom
parent 6c869d993a
commit 01185dcd60
2 changed files with 3 additions and 3 deletions

View file

@ -1948,7 +1948,7 @@
"description": "util: fix util_is_vbo_upload_ratio_too_large",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "068a3bf0d7cda0301b3dfc2e258698c6848ca706"
},

View file

@ -785,9 +785,9 @@ static inline bool
util_is_vbo_upload_ratio_too_large(unsigned draw_vertex_count,
unsigned upload_vertex_count)
{
if (draw_vertex_count > 1024)
if (upload_vertex_count > 256)
return upload_vertex_count > draw_vertex_count * 4;
else if (draw_vertex_count > 32)
else if (upload_vertex_count > 64)
return upload_vertex_count > draw_vertex_count * 8;
else
return upload_vertex_count > draw_vertex_count * 16;