1
Graphics / Re: RenderTexture.clear() is very slow for a large texture
« on: September 13, 2015, 07:48:38 am »Quote
You are aware of what you are telling your GPU to do right?
8000 x 8000 x 4 bytes is 256 MB
Just taking into consideration a single clear operation on a single texture, you are essentially telling your GPU to update 256 MB of texture data every frame. Considering your 8800 GTS boasts a theoretical (i.e. you will probably never see this happen) maximum fillrate of 64 GB/s, assuming you expect your application to run at 30 FPS would require 7.68 GB/s just for that one clear operation. When you factor in that the GPU has other work to do as well, you shouldn't be surprised that it starts sweating.
Good point. I hadn't considered the size of the texture in terms of bits/bytes.
Quote
Judging by your video, you don't even need to use such large textures. Unless you plan on displaying ultra high definition textures on an 8K monitor or rolling your own fullscreen post-processing such as AA, using a texture that large is just wasteful and kills GPU performance. Even big game developers don't use (let alone update every frame) such huge textures in their games (unless performing some filtering), and they already tend to push hardware to its limits.
Thanks for pointing this out. I read this on my phone at a friend's house and thought about it on the way home. I was able to reduce the Fog of War to the size of my view and now the performance is back to normal. Great point!
Quote
Oh... and then there's that part about how your texture probably wouldn't even fit entirely into GPU memory . If this happens, OpenGL tries it's best not to break in your face and just keeps swapping GPU RAM contents to and from system RAM resulting in really really horrible performance.
I did make sure that this wasn't the case. I'm use textures that are at the limit.
Like I said, I was not surprised at the poor performance, but I wanted to know why as a learning experience.
Thanks for the guidance!