Little Endian
Little Endian

Reputation: 830

iPad OpenGL ES extremely slow glResolveMultisampleFramebufferAPPLE()

I am using the OpenGL ES Analyzer. It shows that calls to glResolveMultisampleFramebufferAPPLE() take around 90% of running time. Is this typical, or do I have some inefficiencies in my code? Here's my draw code:

glBindFramebuffer(GL_FRAMEBUFFER, sampleFramebuffer);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// Draw Stuff . . . 

glBindFramebuffer(GL_DRAW_FRAMEBUFFER_APPLE, defaultFramebuffer);
glBindFramebuffer(GL_READ_FRAMEBUFFER_APPLE, sampleFramebuffer);
glResolveMultisampleFramebufferAPPLE();

const GLenum discard1[]  = {GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT};
glDiscardFramebufferEXT(GL_READ_FRAMEBUFFER_APPLE, 2, discard1);
const GLenum discard2[]  = {GL_DEPTH_ATTACHMENT};
glDiscardFramebufferEXT(GL_DRAW_FRAMEBUFFER_APPLE, 1, discard2);

glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
[[EAGLContext currentContext] presentRenderbuffer:GL_RENDERBUFFER];

The scene is complex with over a million triangles rendered each frame. I thought that that my slow frame rate (10 fps) would be due to the draw calls - not the multisampling. Any thoughts?

Upvotes: 1

Views: 872

Answers (2)

Little Endian
Little Endian

Reputation: 830

This was a tricky issue. I can't say I got all the details correct with the changes I made, but I believe that I was getting conflicting information from OpenGL ES Analyzer and my own log info. My own logs were telling me that the time spent was in each separate call to glDrawElements(), suggesting that the number of triangles was the problem. I started using different VAOs depending on detail required and this helped a lot.

Upvotes: 0

HalR
HalR

Reputation: 11073

If you are on iPad, and especially if you are on Retina, multisampling can be very expensive, so its not a surprise to me. I know on many of the graphics video cards they stopped boasting of their abilities to pump millions of polys because everyone figured out that it didn't matter how many tris you pushed, because your post processing and your shaders were really taking all your time.

Upvotes: 1

Related Questions