About Store Forum Documentation Contact



Post Reply 
Android backbuffer rendering performance
Author Message
MrPi Offline
Member

Post: #1
Android backbuffer rendering performance
The following code works on iOS, but not on Android devices.

PHP Code:
D.fxBegin();
   
   
// clear the area we want to render to
   
m_AggregationRect.setLU(-D.w(), D.h(), 154 g_AggregationPixelSize190 g_AggregationPixelSize);
   
D.clip(NULL);
   
D.clearCol(TRANSPARENT);
   
... 
render stuff ...
   
   
   
C ImageD.fxEnd();
   
i.lockRead();
   if (!
m_AggregatedImage.is())
      
m_AggregatedImage.create2D(154190i.type() /*IMAGE_B8G8R8A8*/1);
   if (
m_AggregatedImage.lock())
   {
      for (
Int x 0154; ++x)
         for (
Int y 0190; ++y)
            
//m_AggregatedImage.color(x, y, i.color(x, y));
            
m_AggregatedImage.pixel(xyi.pixel(xy));
      
m_AggregatedImage.unlock();
   }
   
i.unlock(); 

What could be the problem?
(This post was last modified: 04-21-2014 05:21 PM by MrPi.)
03-29-2014 12:04 PM
Find all posts by this user Quote this message in a reply
MrPi Offline
Member

Post: #2
RE: Android rendering bug
What happens is that the aggregated image is empty. I suspect it having something to do with the image type, but I couldn't find one that works. As said, the above code works without problem on iOS.
03-29-2014 06:35 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Android rendering bug
Thanks, I'll investigate this.

In the meantime, could you let me know what you mean by saying "it's empty"?
Maybe just the Alpha channel is zero? or all of the values RGBA are zero?
03-29-2014 10:48 PM
Find all posts by this user Quote this message in a reply
MrPi Offline
Member

Post: #4
RE: Android rendering bug
I can't say for sure what it is. It's not that everything is black, there is nothing to see. So it might be related to the alpha channel, I don't know.
03-29-2014 11:46 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Android rendering bug
This will work ok in next release
03-30-2014 12:06 AM
Find all posts by this user Quote this message in a reply
MrPi Offline
Member

Post: #6
RE: Android rendering bug
Hi Greg,

With the new version the code is now working, but much slower than on the much older iPhone 4. I have tested it on the Moto-G, which is quite faster than the iPhone 4.

Any chance the performance can be improved? It's really like 10 times slower.
Thanks!
04-14-2014 10:34 PM
Find all posts by this user Quote this message in a reply
MrPi Offline
Member

Post: #7
RE: Android rendering bug
More feedback. The code above is about 50 times slower on a Samsung Galaxy S3 compared to the older iPhone 4.

I can't tell you what needs to be done, but right now this recently added feature for Android is not usable.

The slow part is this:
PHP Code:
i.lockRead();
   if (!
m_AggregatedImage.is())
      
m_AggregatedImage.create2D(154190i.type(), 1);
   if (
m_AggregatedImage.lock())
   {
      for (
Int x 0154; ++x)
         for (
Int y 0190; ++y)
            
m_AggregatedImage.pixel(xyi.pixel(xy));
      
m_AggregatedImage.unlock();
   }
   
i.unlock(); 
(This post was last modified: 04-21-2014 05:53 PM by MrPi.)
04-21-2014 05:21 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: Android backbuffer rendering performance
Hi,

This is system call to 'glReadPixels' nothing can be done from my side.

I recommend trying a different approach.

In the source version there's Image.copyHw which could be useful.
04-22-2014 09:45 PM
Find all posts by this user Quote this message in a reply
MrPi Offline
Member

Post: #9
RE: Android backbuffer rendering performance
I think there is a problem with the locking there on Android. Otherwise I wouldn't understand why it is so slow compared to an older iPhone, which is slower on all the rest.

Another option would be to use the backbuffer as the texture for all the aggregated slots (24 max). They would all fit on a full screen image. But the backbuffer is swapped. Is there a way to not do that? This way I could use the backbuffer as a persistent render target and would avoid copying or locking at all.
04-22-2014 09:55 PM
Find all posts by this user Quote this message in a reply
Post Reply