1

I have a very strange VAO problem on iOS.

The problem is that a freshly created VAO becomes invalid almost immediately after creation.

I have a piece of code that creates a VAO in the usual way using glGenVertexArrayOES(1, &vao). It then binds it (glBindVertexArrayOES), sets up all the vertex bindings etc etc, then binds the zero VAO to ensure that no further glBind calls write to it accidentally. If I call glIsVertexArrayOES(vao) at this point, it returns true.

My code is structured as a job graph, where jobs are pushed into an ordered queue and picked up to execute on a threadpool. Nevertheless, for OpenGL, I only execute code that calls GL on one thread. I've got thread affinities to ensure this.

Now. My code executes, makes a VAO, and exits out of the function. It then picks up the very next job, runs it on the same thread, and tries to use the newly created VAO. If I call glIsVertexArrayOES at this point - literally, almost immediately after construction - it returns false!

Any attempt to ignore that and use it anyway fails.

I've got a breakpoint on glDeleteVertexArraysOES and that's not getting called. It's so odd... it successfully makes a VAO, exits a function, tries to use the newly created VAO on the same thread (thus dodging context and sharegroup issues) and fails.

Any help or insight greatly appreciated!

Tom Hammersley
  • 279
  • 2
  • 8
  • It's probably something trivial. However, without a *minimal* test-case (with code here) showing the problem, there really isn't much to see .. if not willing to pair-down a test-case, you might still be able to get useful responses after throwing all the code on a *code review* site. –  Mar 14 '13 at 20:17
  • That's the thing. I've tried to replicate the problem in various samples, with no success. I was hoping someone may have some insight into the internals of the VAO code, to know what tests glIsVertexArrayOES might do, that could help inform a solution. – Tom Hammersley Mar 14 '13 at 20:26
  • Start with the current code base (really, a clone). Remove everything not related. Then continue pairing down the code until the problem is isolated. –  Mar 14 '13 at 20:27
  • Ok...GLKView bindDrawable seems to be the culprit. – Tom Hammersley Mar 14 '13 at 20:59

0 Answers0