On 28/03/2018 11:35, mathias.froehl...@gmx.net wrote:

Avoid using malloc in the draw path of mesa.
Since the draw_count is a user api input, fall back to malloc if
the amount of consumed stack space may get too high.

Signed-off-by: Mathias Fröhlich <mathias.froehl...@web.de>
---
  src/mesa/vbo/vbo_context.c | 70 +++++++++++++++++++++++++++++++---------------
  1 file changed, 47 insertions(+), 23 deletions(-)

This adds uses of alloca, without a corresponding include of alloca.h.

Perhaps something like the attached is needed?

See also:
https://lists.freedesktop.org/archives/mesa-dev/2018-January/184030.html
https://lists.freedesktop.org/archives/mesa-dev/2017-December/180073.html
https://lists.freedesktop.org/archives/mesa-dev/2016-July/122346.html

From 8599fd9109d59adc541ab06570732776e2c098d6 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.tur...@dronecode.org.uk>
Date: Tue, 3 Apr 2018 17:52:56 +0100
Subject: [PATCH] Fix use of alloca() without #include <c99_alloca.h>

Fix use of alloca() without #include <c99_alloca.h> in 1da345e5

vbo/vbo_context.c: In function '_vbo_draw_indirect':
vbo/vbo_context.c:284:34: error: implicit declaration of function 'alloca' 
[-Werror=implicit-function-declaration]
       struct _mesa_prim *space = alloca(draw_count*sizeof(struct _mesa_prim));
                                  ^~~~~~
vbo/vbo_context.c:284:34: warning: initialization makes pointer from integer 
without a cast [-Wint-conversion]

Signed-off-by: Jon Turney <jon.tur...@dronecode.org.uk>
---
 src/mesa/vbo/vbo_context.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index e50cee7a8c..f698fd0f41 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -25,6 +25,7 @@
  *    Keith Whitwell <kei...@vmware.com>
  */
 
+#include "c99_alloca.h"
 #include "main/mtypes.h"
 #include "main/bufferobj.h"
 #include "math/m_eval.h"
-- 
2.16.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to