Xrysnow / cocos2d-x-live2d

Live2D for cocos2d-x, with lua binding
6 stars 2 forks source link

Draw call so much ... #2

Open Just-D opened 3 years ago

Just-D commented 3 years ago

I'm running the code on Linux and Android, but the draw call is so much. Android can't run 60 FPS. eg, the model named Rice in Live2d examples, running with 13000+ verts and 140 draw call .

So, what's the problem ?

I checked the cocos2d-x source code, the CustomCommand "flush" each command, the live2d model with 100+ drawables, perhaps leading the result.

Xrysnow commented 3 years ago

This is because each vertex batch provided by the model uses its own CustomCommand now (and its own ProgramState), so they can not be merged by the cocos renderer. Now CubismNativeFramework provides an official renderer for cocos, but it‘s draw call is exactly the same with the renderer from this repo.

It's not easy to merge draw commands because they are more likely to have different ProgramState, especially shader uniforms.