Gio Posted August 8, 2013 Share Posted August 8, 2013 I would use a different solution, with 2 non-hidden canvases. That is, instead of having a single visible canvas that covers the whole screen, actually show two smaller canvases side by side on the screen and draw to them directly. That'd be the best of both worlds in my opinion: you don't need context.clip() and you don't need the extra memory for the hidden canvases. Also, if you draw to a canvas with no transform, and then transform the whole thing afterwards, you end up drawing more pixels than you actually see on the screen (your hidden canvas will have to be larger than the visible area, if when it's transformed it's going to be scaled down for example). Since fill rate is the most common bottleneck on mobiles, I would imagine that this could be potentially quite a lot slower, depending on the extent of the scaling and rotation. Quote Link to comment Share on other sites More sharing options...
rich Posted August 8, 2013 Author Share Posted August 8, 2013 Yeah my worry with that approach is that I focus on mobile first, always, and there are several phones where GPU acceleration really screws up if you start overlapping canvases. For a side-by-side it would be fine, but for a camera-in-camera you've got overlap, or a rotation where one may touch the other. I've seen Samsung phones screw the whole rendering doing this, you get really psychedelic results (like when the palette and textures gets corrupted in GPU memory), or large black regions around the overlapping areas. I suspect on desktop it would be flawless though, but 90% of my work is on mobile Quote Link to comment Share on other sites More sharing options...
Gio Posted August 9, 2013 Share Posted August 9, 2013 As far as I know, the problem you mention with Samsung mobiles only happens in the stock Android browser in Android 4.x with the Mali400 GPU and, most importantly, only when you clear and redraw a part of your layered canvases. If you clear and redraw the whole canvas every frame, that should never happen. Of course I haven't tried every single Samsung device, but that's what I've found so far. If you noticed that this happens in other circumstances too, I'd really like to know that, as I've been relying on layered canvases for quite a few things Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.