Module: Mesa
Branch: main
Commit: 4f6e7858762a38fd7f2e4ab568fc018b4b155f86
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f6e7858762a38fd7f2e4ab568fc018b4b155f86

Author: Marek Olšák <[email protected]>
Date:   Mon Dec 19 01:17:13 2022 -0500

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: 068a3bf0d7c - util: move and adjust the vertex upload heuristic equation 
from u_vbuf

Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20824>

---

 src/util/u_math.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/u_math.h b/src/util/u_math.h
index 2a78e781180..23116ce9d38 100644
--- a/src/util/u_math.h
+++ b/src/util/u_math.h
@@ -787,9 +787,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;

Reply via email to