Metal support alpha0 version released

#1 Game is overall slow, especially when there are many nodes.”

I can confirm this too. All animations seem very laggy and low performance. Very visible between fade in out. In the same area in our game we get 60fps with opengl cocos and only 20-25fps with metal cocos.

IMAGE%202019-01-23%2015%3A11%3A51
IMAGE%202019-01-23%2015%3A11%3A58

There is also some serious memory leaking going on. At least the first object belongs to cocos 100%. Never seen so much leaking in my life ))

@zhangxm

48%20PM

Every 10-20 seconds we have:

43%20PM

@kiranb47 can you confirm if you are facing these memory leaks too? I want to see if its connected with performance issue.

I believe MTLStensilDescriptor is connected with ClippingNode.

And i believe NSArray leak must also somehow be connected with cocos but didnt figure yet how.

@kerryk Yes, I will test tomorrow in office.

nice, im excited !

No, i haven’t created one, could you please create one?

Is there any way to reproduce it easily? You are appreciated if you can create a github issue and provide a test case that can reproduce it.

Thanks for feedback, we will take a look.

I created an issue to track ProgressTimer blink issue.

@zhangxm I created an issue regarding bad performance

Reproduced and created issue regarding memory leak

@slackmoehrle shouldnt this thread be pinned to top?

ok, sure :slight_smile: It is pinned until you read it. Then it moves down like other topics would. If you haven’t read this topic it remains pinned for you. User specific.

Makes sense ) Btw why in metal version, cocos2d-console is missing from tools folder? I can’t run cocos command in terminal. Solved it by copying console from 3.17 version. I am sure i downloaded dependencies and all other folders are ok.

But then upon run , i get this, maybe related in using console from another version?

I need to defer to @zhangxm but git submodule update init? Then download-deps?

@kerryk cocos2d-console is there. As the known issue says, new project may not work. We haven’t fixed it.

Can we have a quick update on progress? )

Sure, left part is almost 3D support. I will update it when we have a big progress.

My project now uses glBlendEquation and glBlendFuncSeparate in rendering (by modifying cocos2d::TrianglesCommand). Can I do the same modification in the future? Or can the new backend provide these functions?

No, can not use graphics specific API in engine. How did you modify the codes? We will take a look what’s missing.

I add two properties, _glBlendEquation and _isBlendFuncSeparate to TrianglesCommand, and add them to the hash struct in generateMaterialID(). Then I add those gl functions in useMaterial():

void TrianglesCommand::useMaterial() const
{
	//Set texture
	GL::bindTexture2D(_textureID);

	if (_alphaTextureID > 0)
	{ // ANDROID ETC1 ALPHA supports.
		GL::bindTexture2DN(1, _alphaTextureID);
	}
	//set blend mode
	if (_isBlendFuncSeparate)
	{
		// for render in FBO
		glBlendFuncSeparate(_blendType.src, _blendType.dst, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
		GL::blendFunc(_blendType.src, _blendType.dst);
	}
	else
	{
		GL::blendFunc(_blendType.src, _blendType.dst);
	}
	glBlendEquation(_glBlendEquation);
	_glProgramState->apply(_mv);
}

The function glBlendEquation is necessary for some special effects in my project (e.g. reverse color of the area under a sprite). And glBlendFuncSeparate would be useful when using a FBO (RenderTexture) to get correct alpha blend. Since ccGLStateCache dose not provide them, I have to call gl functions directly. I really hope the new backend can take them into account.

I am not sure if you have reviewed the codes of new backend. Now, these properties are set in Sprite, and can be set separated.

I’ve seen the new backend supports those properties and they can be set without graphics specific API. (But TrianglesCommand and RenderState::StateBlock don’t support all properties, maybe it’s expensive to do so.) It means I can do some similar modifications and it’s pretty enough for my project. Thanks a lot!