- fixed: Prevents too many drawer thread commands from queueing up. Previously, drawing too many columns (which was accumulated by amassing a huge number of sprites) would crash the game.

This commit is contained in:
raa-eruanna 2016-09-29 12:20:32 -04:00
parent 2987668af8
commit d58da58aee
2 changed files with 11 additions and 0 deletions

View file

@ -55,6 +55,8 @@ extern int wallshade;
// Use multiple threads when drawing
CVAR(Bool, r_multithreaded, true, 0);
// [SP] Set Max Threads to a sane amount
CVAR(Int, r_multithreadedmax, 1024, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
// Use linear filtering when scaling up
CVAR(Bool, r_magfilter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);

View file

@ -196,6 +196,7 @@ public:
EXTERN_CVAR(Bool, r_multithreaded)
EXTERN_CVAR(Bool, r_mipmap)
EXTERN_CVAR(Int, r_multithreadedmax)
// Manages queueing up commands and executing them on worker threads
class DrawerCommandQueue
@ -248,6 +249,14 @@ public:
}
else
{
// [SP] Note: I've put in a hack here to throttle the speed of the rendering if
// the thread queue gets to big. This is one way to prevent too many commands
// going into the thread queue, which is causing crashes when there are too
// many threads (of which, there can be only as many as there are columns on
// the screen - guess what happens when you're too full of sprites!)
if (queue->commands.size() > r_multithreadedmax)
R_EndDrawerCommands();
void *ptr = AllocMemory(sizeof(T));
if (!ptr) // Out of memory - render what we got
{