-
Notifications
You must be signed in to change notification settings - Fork 491
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
The WebGL is slower than Canvas in my game on IOS ? #356
Comments
WebGL performance can vary by device and by game. Make sure you turn off |
By any chance you have text on the screen? If so then I think it's related to this issue. If you remove the text on your screen then your performance on device should go up. |
I do have some text on it.But when I remove the text it isn't working better than before. |
We are having this same issue and are quite confused by it. We are getting <10fps with a relatively simple game on an iPhone 7, but switching it to CANVAS makes it run at a smooth 60fps. It is really too bad that Phaser's PIXI diverged so much from the current PIXI as I suspect an up-to-date version of PIXI would solve these problems. |
Have you checked the draw counts? |
I would disable |
@photonstorm Yeah, we actually already disabled multiTexture and are still facing the same issues. |
Our draws peak out at ~39 with ~419 calls using WebGL, but it is practically unplayable on an iPhone 7. In canvas mode it has ~102 draws with ~317 calls and runs at a smooth 60fps. We don't necessarily need to use WebGL mode, but the ability to use shaders was something that is important for our plans and I can't see any reason why WebGL should be performing this poorly compared to Canvas. |
@samme Can you comment on why this issue was closed? |
Guess I was too hasty. |
Ok, thanks for reopening 👍 |
@goldfire Did you find anything that might be causing this? Honestly, >100 draw calls seem a bit too much for mobile web. Do you have loads of display objects? From what I can see, PIXI (Phaser) seems to upload entire buffers on every render (and this also entails calculating the new transform for every object, on the CPU :/ I wonder why this was not done using model matrices on the GPU) frame. So since your draw calls for CANVAS and WEBGL are comparable, I am thinking you are uploading too much every frame. |
@gaurav-dixitv Unfortunately, no, we haven't made much progress here. Honestly, it isn't that complex of a scene, and I don't see why that would be too many draws. We developed a canvas game with a different engine that has 300+ and runs at a smooth 60fps on mobile. Our new game is quite a bit simpler and we assumed we'd get significantly better performance with the batching in pixi/phaser. We have noticed that updating the transforms is fairly heavy. Any idea if this still happens with killed entities by chance? There's generally only a few dozen entities on the screen at once, but there are up to a few thousand killed entities waiting to be recycled in groups. |
@goldfire Shots in the dark:
I think profiling should really help here! |
Well, that is the real problem. We've done quite a bit of profiling in Chrome and it runs quite well on desktop. iOS is where the performance drops off a cliff, but Safari's remote profiler is essentially worthless as far as we can tell, so we are having a hard time even pinpointing where the issue might be. We disabled the only custom shader we are using and it made no difference in performance. We haven't directly set the scale mode, which looks like it defaults to linear. Setting |
@goldfire Hi buddy, we are now facing this problem too. Since we have to use Spine, we have to also use Phaser with WebGL. So may I know what is your team's final solution? Do we need to abandon WebGL? Or how we can improve the performance for it? |
@willieZhao In our case, the solution was to completely eliminate parent/child relationships in the code, which were preventing the sprite batching from working. We were also using a hue shifting filter that broke batching, so we over-wrote the built-in batch shader with our own custom version that had our custom filters included in it. These two changes took us from several hundred draw calls to around 5 or 6 and massively improved the performance of the game. |
@goldfire Hello, I'm also facing the same problem. Would you please explain what it means to "eliminate parent/child relationships in the code" ? |
@AhmedElyamani We just never use |
I believe this issue shouldn't be closed, because in mobile devices performances are still very bad. Or maybe there are techniques that I am not aware of? Please help. |
@samme thanks for re-opening this issue. |
For Phaser CE I think this issue will remain until someone good at WebGL gives a lot of attention to it. For better WebGL performance, you should always:
|
@samme thanks for your tips and support Regarding Phaser 3, if you have some tips on the same topic or a document/blog post I can read about it, please share it. |
I've changed nothing except the game config 'renderer' in Phaser.AUTO or Phaser.CANVAS
But it's very slow in Phaser.AUTO and it's renderType is 2 on my iphone. But it shows very well on android.
When I change Phaser.AUTO to Phaser.CANVAS it shows pretty good.
I used to use Pixi.js.It didn't show like this.
I don't know why ? Have you ever meet this scene ? It is really confused me.
My phaser-ce is 2.8.6
The text was updated successfully, but these errors were encountered: