Skip to content
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

Fix of ccui.ScrollView renderer #3501

Open
yuriilychak opened this issue Jul 11, 2017 · 0 comments
Open

Fix of ccui.ScrollView renderer #3501

yuriilychak opened this issue Jul 11, 2017 · 0 comments

Comments

@yuriilychak
Copy link

@pandamicro Hello again. Today i have batch fixing day for my project:) ccui.ScrollView and ccui.ListView have terrible performance, cause every sprite render at single batch.

Steps to reproduce:

  1. Create ccui.ListView or ccui.ScrollView;
  2. Create ccui.Widget with few (for example 5) Sprites from same atlas in it;
  3. Add few (for example 5) Items from previous step to list view;
  4. Get bunch draw calls except one. (In example 25);

The problem is in UIScrollViewWebGLRenderCmd.js. It called render command for every sprite.
Solution is call renderer when data dont have uploadData function.
Your code:

for (i = 0, len = locCmds.length; i < len; ++i) {
            cmd = locCmds[i];
            checkNode = cmd._node;

            if (checkNode && checkNode._parent && checkNode._inViewRect == false)
                continue;

            if (cmd.uploadData) {
                cc.renderer._uploadBufferData(cmd);
            }
            else {
                if (cmd._batchingSize > 0) {
                    cc.renderer._batchRendering();
                }
                cmd.rendering(context);
            }
         cc.renderer._batchRendering();
        }

Fix:

for (i = 0, len = locCmds.length; i < len; ++i) {
            cmd = locCmds[i];
            checkNode = cmd._node;

            if (checkNode && checkNode._parent && checkNode._inViewRect == false)
                continue;

            if (cmd.uploadData) {
                cc.renderer._uploadBufferData(cmd);
            }
            else {
                cc.renderer._batchRendering();
                cmd.rendering(context);
            }
        }
        cc.renderer._batchRendering();
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

No branches or pull requests

1 participant