- Home /
Eliminate CPU spike from shader load?
I'm trying to eliminate a large rendering related CPU spike that I see in the Profiler which is causing my game to hiccup / drop frames.
It seems that loading a shader may be the issue: Camera.Render -> Drawing -> Render.Prepare -> Loading.AwakeFromLoad -> Shader.Parse
Is there a way to preload a particular shader?
( I tried Shader.WarmAllShaders() but that took almost 30 seconds at startup on my mac)
Answer by Statement · May 30, 2013 at 03:36 PM
Well, render 1 pixel or something with your shader during load, it should force it to load. You can probably also hide this with other geometry, or do it before the main camera renders so it's overwritten by a clear.
O$$anonymous$$, thanks. I'm used to using shaders by adding geometry and assigning a material. It sounds like I can procedurally render a single pixel somehow? Also any hint on how I'd do this before the main camera renders would be great.