1

I'm working on an openGL ES based application for iOS. Things are looking good so far but, according to Instrument, there is a case when the CPU waits on the GPU. This warning is not consistent. When the warning appears, it seems to occur upon a change in the device orientation or a zooming. In the app, both those cases trigger a layoutSubviews call where (if there is a change in the view's frame), the dimensions of the frame buffer are updated via the code below:

[_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer*)self.layer];
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &_framebufferWidth);
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &_framebufferHeight);
glViewport(0, 0, _framebufferWidth, _framebufferHeight);

Then in the drawing callback, the uniform matrix gets updated and then the following calls complete the drawing:

glClear(GL_COLOR_BUFFER_BIT);
glDrawElements(GL_TRIANGLE_STRIP, sizeof(indices)/sizeof(indices[0]), GL_UNSIGNED_SHORT, 0);
[_context presentRenderbuffer:GL_RENDERBUFFER];

The glClear call seems to be the cause of the warning when there is a view size change. Honestly, this warning doesn't have any visual impact but I still would like to fix it but not sure how. With this question, I was hoping to get some sort of guidance on things to try. Any idea?

4

0 回答 0