Skip to content

Draft implementation of v3.12 renderer #3300

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

Merged
merged 15 commits into from
Jun 22, 2016
Merged

Conversation

pandamicro
Copy link
Contributor

@pandamicro pandamicro commented Jun 14, 2016

The WebGL renderer have been greatly improved ! Again !

It's still a draft implementation, many bugs still hang in there, but anyone wants to review or discuss about the implementation, feel free to do so.

The general idea was to remove all the cache, complicate logic in v3.11, and use a much cleaner implementation to reduce memory usage and CPU cache miss. And it's working, more faster than v3.11 which have monstrous virtual buffer logic. As a result of memory usage reducing, now the engine is performing much better on Android devices, especially low end ones.

To be noted: Camera is removed because I changed from 44 matrix to 32 affine transform matrix. No more camera in Node and no more camera actions. Hope this won't affect many people

@1scaR1
Copy link
Contributor

1scaR1 commented Jun 14, 2016

To be noted: Camera is removed because I changed from 4_4 matrix to 3_2 affine transform matrix. No more camera in Node and no more camera actions. Hope this won't affect many people

So, 3D Render is totally excluded from plans on html5 version?

@pandamicro
Copy link
Contributor Author

So, 3D Render is totally excluded from plans on html5 version?

No, no, no, the current Camera is too poor for 3D render, we have bigger plan for 3D, the current implementation is just for a really fast 2D engine, the underling renderer will have more changes in the future for 3D.

@1scaR1
Copy link
Contributor

1scaR1 commented Jun 14, 2016

This is great.
Turning to this PR. I have checkouted this PR and my game started consume for about 2-3 time more CPU time.

@pandamicro
Copy link
Contributor Author

Turning to this PR. I have checkouted this PR and my game started consume for about 2-3 time more CPU time.

😂 That's not expected... So what's the platform and browser you tested ? Can you capture a profile in Chrome so that I can see what's consuming so much CPU

@1scaR1
Copy link
Contributor

1scaR1 commented Jun 14, 2016

I've inspected profile and found that you are using old code of stencil clipping(before my modification)
It takes all overhead CPU time. Rendering process except clipping takes almost the same time(hard to compare)

@1scaR1
Copy link
Contributor

1scaR1 commented Jun 14, 2016

I also found that this version of renderer fixes my issue #3279 .

@pandamicro
Copy link
Contributor Author

It's strange, I haven't touch ClippingNode yet. I will take a look at your PR and compare.

So on which platform are you testing ? Desktop ? The benefit of this version is not very clear on desktop, it will show on some extreme cases, like the bunnymark test (15000 for v3.11, 20000+ for the current version). But it's definitely running faster on Android with the reduction of memory. I'll try to find the hot point in this version and try to improve more.

@1scaR1
Copy link
Contributor

1scaR1 commented Jun 14, 2016

I test on desktops and iOs devices. Unfortunately, I don't have a lot of android devices. All of them are near the top models, and I have native(coco2d-x) versions of my game. Android browsers are not the main target on this platform.

@pandamicro
Copy link
Contributor Author

I've inspected profile and found that you are using old code of stencil clipping(before my modification)

@1scaR1 I have checked the source, your changes should have been included in my current branch, what's exactly the old code you mentioned ?

@1scaR1
Copy link
Contributor

1scaR1 commented Jun 15, 2016

I have checked the source, your changes should have been included in my current branch, what's exactly the old code you mentioned ?

I my PR (#3250) I've reduced calls of gl.getParameter, in rendec CMD's of ccui.Layout and cc.ClippingNode such as:

        this._currentStencilEnabled = gl.isEnabled(gl.STENCIL_TEST);
        this._currentStencilWriteMask = gl.getParameter(gl.STENCIL_WRITEMASK);
        this._currentStencilFunc = gl.getParameter(gl.STENCIL_FUNC);
        this._currentStencilRef = gl.getParameter(gl.STENCIL_REF);
        this._currentStencilValueMask = gl.getParameter(gl.STENCIL_VALUE_MASK);
        this._currentStencilFail = gl.getParameter(gl.STENCIL_FAIL);
        this._currentStencilPassDepthFail = gl.getParameter(gl.STENCIL_PASS_DEPTH_FAIL);
        this._currentStencilPassDepthPass = gl.getParameter(gl.STENCIL_PASS_DEPTH_PASS);

@pandamicro
Copy link
Contributor Author

I my PR (#3250) I've reduced calls of gl.getParameter, in rendec CMD's of ccui.Layout and cc.ClippingNode such as:

All this stuff should have been deleted, please take a look at my branch: https://github.com/pandamicro/cocos2d-html5/blob/develop/cocos2d/clipping-nodes/CCClippingNodeWebGLRenderCmd.js

@1scaR1
Copy link
Contributor

1scaR1 commented Jun 15, 2016

In your branch all is OK now.

@pandamicro
Copy link
Contributor Author

I have completed the new WebGL renderer, it's now passing our test cases, as this PR is nearly impossible to review, I will do the following steps:

  1. Merge into develop branch
  2. Submit to QA
  3. Test it with third party game developers to see whether it's working properly with their game
  4. Release a private beta in the community

And fix bugs reported.

Anyone interested in this can also pull the latest commit to see how it's working with your game, and please send any feedbacks in this PR or submit an issue.

Known issue: I haven't fully tested Canvas render mode, Tilemap is completed rewrote, not working on Canvas yet.

@dabingnn please take a look

@pandamicro pandamicro merged commit e85e0e2 into cocos2d:develop Jun 22, 2016
@1scaR1
Copy link
Contributor

1scaR1 commented Jun 23, 2016

Please review #3279 and #3299 .
It's complicated to test this PR in my game with this issues within user auditory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants