From ca9d8e580e4b2b94c19182dcb160d9de6c904b5c Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Wed, 22 Jun 2016 00:51:16 +0200 Subject: [PATCH] Increase command queue memory pool to 16 MB and make it flush if its exhausted --- src/r_draw_rgba.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/r_draw_rgba.h b/src/r_draw_rgba.h index c94cb1e4b..47f7c8865 100644 --- a/src/r_draw_rgba.h +++ b/src/r_draw_rgba.h @@ -193,7 +193,7 @@ EXTERN_CVAR(Bool, r_mipmap) // Manages queueing up commands and executing them on worker threads class DrawerCommandQueue { - enum { memorypool_size = 4 * 1024 * 1024 }; + enum { memorypool_size = 16 * 1024 * 1024 }; char memorypool[memorypool_size]; size_t memorypool_pos = 0; @@ -241,8 +241,13 @@ public: else { void *ptr = AllocMemory(sizeof(T)); - if (!ptr) - return; + if (!ptr) // Out of memory - render what we got + { + queue->Finish(); + ptr = AllocMemory(sizeof(T)); + if (!ptr) + return; + } T *command = new (ptr)T(std::forward(args)...); queue->commands.push_back(command); }