util: move and adjust the vertex upload heuristic equation from u_vbuf

This will also be used by glthread.

The new equation is optimized for glthread.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>
This commit is contained in:
Marek Olšák
2020-03-22 21:00:18 -04:00
parent d9cb0ec5e6
commit 068a3bf0d7
2 changed files with 20 additions and 3 deletions
+19 -1
View File
@@ -783,7 +783,25 @@ util_fpstate_set_denorms_to_zero(unsigned current_fpstate);
void
util_fpstate_set(unsigned fpstate);
/**
* For indexed draw calls, return true if the vertex count to be drawn is
* much lower than the vertex count that has to be uploaded, meaning
* that the driver should flatten indices instead of trying to upload
* a too big range.
*
* This is used by vertex upload code in u_vbuf and glthread.
*/
static inline bool
util_is_vbo_upload_ratio_too_large(unsigned draw_vertex_count,
unsigned upload_vertex_count)
{
if (draw_vertex_count > 1024)
return upload_vertex_count > draw_vertex_count * 4;
else if (draw_vertex_count > 32)
return upload_vertex_count > draw_vertex_count * 8;
else
return upload_vertex_count > draw_vertex_count * 16;
}
#ifdef __cplusplus
}