Page 1 of 1
Simple test problem
Posted: Mon Nov 09, 2015 6:12 pm
by Featzen
I made a simple spritebatch draw test and it is stopping windows(7) Window manager everytime i run.
What is wrong?
The test:
Re: Simple test problem
Posted: Mon Nov 09, 2015 6:37 pm
by MadByte
The problem may be your declared spritebatch size of width*height (800x600 = 480k!!) sprites.
-> Try to use smaller values(<1000).
Re: Simple test problem
Posted: Mon Nov 09, 2015 6:59 pm
by slime
That's one part of the issue, although you don't need to limit the max number of items in a sprite batch to < 1000, even tens of thousands is fine.
The main reason your system slows down is the code draws the entire 832x896 spritesheet overlapped on itself about 3,000 (52 * 56) times, since the code doesn't use any Quads so each batch:add call makes it draw the entire spritesheet.
Even though it's all done in a single draw call because a SpriteBatch is used, the GPU still has to blend everything together. It's effectively trying to process 800*600*1000 (or so) pixels every frame, which is way more than low end GPUs are designed to handle and prevents the GPU from being used to render the rest of the OS in a timely manner.