wowser icon indicating copy to clipboard operation
wowser copied to clipboard

Excessive CPU time spent on WebGLRenderer.setProgram

Open fallenoak opened this issue 9 years ago • 3 comments

Even when a scene has fully loaded and the camera is stationary, uniform uploads seem to be burning a rather large amount of CPU time. What's happening?

fallenoak avatar Jun 10 '16 18:06 fallenoak

I might be mistaken on this... it looks like the flag goes away once the group is rendered once. However, something is clearly burning cycles on uniform updating...

fallenoak avatar Jun 10 '16 19:06 fallenoak

The biggest culprit might be context switches between different textures (ie calls to bindTexture and activeTexture). In particular, probably because of layering, terrain tends to cause a lot more of these calls than, say, a few WMOs or doodads.

Not sure what the best way to reduce these context switches would be.

fallenoak avatar Jun 14 '16 02:06 fallenoak

It would appear that objects with transparent materials are sorted by depth, whereas opaque objects are sorted by material. We're overusing transparent materials for M2s: the no-backface-culling flag and blending mode 1 both cause transparent flagging, even though neither case ought to necessitate it.

fallenoak avatar Jun 17 '16 04:06 fallenoak