-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSAA for metal. #20506
base: v4
Are you sure you want to change the base?
MSAA for metal. #20506
Conversation
1) MSAA may be enabled for the general Metal pipeline with the new flag: > ENABLE_MSAA_GLOBAL_METAL (CCRenderer.cpp:156). 2) MSAA also can be enabled during drawing in to render texture (metal only). It's available the new test under the "RenderTextureTest" section. Where one can compare the quality of rendering with and without MSAA. > RenderTextureWithMsaaSprite3D (RenderTextureTest.h:200) 3) I have a mixed 2d/3d pipeline due to the specifics of my current project. And I noticed that it takes a lot of time to create each new CommandEncoder. Here provided an ad hoc solution to this issue. > MsaaMode::MtlUnified (CCRenderTexture.h:71, CommandBufferMTL.cpp::100, CCRenderer.cpp:900 ..) You may also compare the performance of common and unified multisampling in RenderTextureWithMsaaSprite3D test. 4) The creation of DepthStencilStateMTL was a bottleneck for mixed 2d/3d rendering. Depth/stencil state cache was implemented to make it's creation faster. > _depthStencilStateCache (DeviceMTL.h:160)
Fix win bild. Elvis operator removed.
@@ -219,6 +278,24 @@ inline int clamp(int value, int min, int max) { | |||
|
|||
CommandBufferMTL::~CommandBufferMTL() | |||
{ | |||
{ | |||
// если текущий CommandBuffer еще выполняется GPU |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment needs translate to English
code not related to MSAA has been removed.
Sorry, it was my colleague's code that is not related to the MSAA optimization. He experiences Sanitizer warning on every os-x app close without it. That behavior is reproduced on only half of our team MacBooks. Sanitizer stack attached:
|
Yeah, great, so I think you can post a seprate PR to fix this, and I also check google angleproject's metal renderer backend, it also have this code |
Done |
thanks for this pull request: cocos2d/cocos2d-x#20506
Can someone bring it to Axmol? |
It's available the new test under the "RenderTextureTest" section. Where one can compare the quality of rendering with and without MSAA.
Here provided an ad hoc solution to this issue.
You may also compare the performance of common and unified multisampling in RenderTextureWithMsaaSprite3D test.
I realize that this solution is pretty dirty and situational to be merged to cocos-2d master. But its a good start point for future development. Here is the capture of this test running on a 6 scale.
https://www.youtube.com/watch?v=8LinKjoj4Y8
The speedup was 12 to 60 fps on my iPhone 10.