Open huachangmiao opened 6 years ago
Does this change get enough performance? I think mapbuffer and bufferrange are not good for current Android (error and performance)
No improvement at all. Still 10-12fps/s. I try to disable the NEON tomorrow.
OK.
Finally, I found the reason.
void Renderer::setupVBO() { glGenBuffers(2, &_buffersVBO[0]); // Issue #15652 // Should not initialize VBO with a large size (VBO_SIZE=65536), // it may cause low FPS on some Android devices like LG G4 & Nexus 5X. // It's probably because some implementations of OpenGLES driver will // copy the whole memory of VBO which initialized at the first time // once glBufferData/glBufferSubData is invoked. // For more discussion, please refer to https://github.com/cocos2d/cocos2d-x/issues/15652 // mapBuffers(); } I set the maximum vertex count to 100.
It's running OK. 30fps/s
How to fix it?
Thank you !!!!!!!!! I try to think how to fix. (perhaps divide two draw call)
By the way, may I remove division count parameter in ring and track? I think it is already not needed.
-So I have a new idea. -Can the Track and the Ribbon set the count of vertices? just like the Ring.
I think it can be removed. : )
OK!! Please wait for few days. Until I fix it, you set the maximum vertex count to 100
https://github.com/effekseer/EffekseerForCocos2d-x
I updated. Is it OK?
// large buffer make application slow on Android
int32_t spriteSize = 600;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
renderer2d = ::EffekseerRendererGL::Renderer::Create(spriteSize, EffekseerRendererGL::OpenGLDeviceType::OpenGLES2);
#else
renderer2d = ::EffekseerRendererGL::Renderer::Create(spriteSize, EffekseerRendererGL::OpenGLDeviceType::OpenGL2);
#endif
where spriteSize is larger than 100, but VBO size is lower than 65536.
I'm sorry my reply was late. I spent some time trying.
I refer to the cocos rendering. Because some implementations of OpenGLES driver will copy the whole memory of VBO which initialized at the first time. I think glBufferData should be called before draw every time. I comment the glBufferData's call in VertexBuffer's creator function. and add this function into VertexBuffer::Unlock(). I built it in huawei honor v10. It 's working well. I think at least in the android platform should be modified like this. What do you think?
I think it is OK.
But it should be included with #ifdef __ANDROID__
It seem that this implementation decrease a performance on iOS and PC.
And another question, Is nBufferingMode true? If this option makes no sense, I want to remove this.
OK. This is just a temporary code. I will include #ifdef ANDROID later.
nBufferingMode is true in android opengles2.0?
nBufferingMode = !GLExt::IsSupportedBufferRange() && GLExt::IsSupportedMapBuffer();
I think it is true.
If you have a time, please would you check a performance inserting nBufferingMode = false
?
OK, I will check it.
I tested in huawei CUN-AL00: nBufferingMode = false; 38/fps nBufferingMode = true; 41/fps
ZTE C880U: nBufferingMode = false; 41/fps nBufferingMode = true; 42/fps
I think you can remove Triple buffering. It 's using with mutiThread render. But cocos is simpleThread render. mapBuffer shouldn 't be removed, because it can improve performance on android.
I optimize the code.
I fixed it. (Removed nBuffering and add ANDORID)
https://github.com/effekseer/EffekseerForCocos2d-x
Is it OK?
Thank you. This is a little different.
Thank you, I will try to fix
It's OK
Thank you for your help.
Is there a better way to optimize?