Mesa (master): vbo: fix transitions from glVertexN to glVertexM where M < N
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Mar 11 19:27:49 UTC 2020
Module: Mesa
Branch: master
Commit: 218dfd8c1a50515105199704d7060ae1b0d3b101
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=218dfd8c1a50515105199704d7060ae1b0d3b101
Author: Marek Olšák <marek.olsak at amd.com>
Date: Thu Feb 27 16:04:00 2020 -0500
vbo: fix transitions from glVertexN to glVertexM where M < N
Fixes: 1f6e53e2 "vbo: don't store glVertex values temporarily into exec"
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3591>
---
src/mesa/vbo/vbo_exec_api.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index d97c4988b29..71c8f340702 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -493,8 +493,10 @@ do { \
ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \
} else { \
/* This is a glVertex call */ \
+ int size = exec->vtx.attr[0].size; \
+ \
/* Check if attribute size or type is changing. */ \
- if (unlikely(exec->vtx.attr[0].size < N * sz || \
+ if (unlikely(size < N * sz || \
exec->vtx.attr[0].type != T)) { \
vbo_exec_wrap_upgrade_vertex(exec, 0, N * sz, T); \
} \
@@ -514,6 +516,12 @@ do { \
if (N > 1) *dst++ = V1; \
if (N > 2) *dst++ = V2; \
if (N > 3) *dst++ = V3; \
+ \
+ if (unlikely(N < size)) { \
+ if (N < 2 && size >= 2) *dst++ = V1; \
+ if (N < 3 && size >= 3) *dst++ = V2; \
+ if (N < 4 && size >= 4) *dst++ = V3; \
+ } \
} else { \
/* 64 bits: dst can be unaligned, so copy each 4-byte word */ \
/* separately */ \
@@ -521,6 +529,12 @@ do { \
if (N > 1) SET_64BIT(dst, V1); \
if (N > 2) SET_64BIT(dst, V2); \
if (N > 3) SET_64BIT(dst, V3); \
+ \
+ if (unlikely(N * 2 < size)) { \
+ if (N < 2 && size >= 4) SET_64BIT(dst, V1); \
+ if (N < 3 && size >= 6) SET_64BIT(dst, V2); \
+ if (N < 4 && size >= 8) SET_64BIT(dst, V3); \
+ } \
} \
\
/* dst now points at the beginning of the next vertex */ \
More information about the mesa-commit
mailing list