View Full Version : Glitchy/flickering transform feedback (Mac OS 10.7.5, ATI Radeon HD 5770)

10-05-2015, 03:35 PM
I'm generating an icosphere, then I'm using transform feedback to apply just a vertex shader, then I'm using another transform feedback pass to apply a vertex + geometry program, then I'm rendering the triangles. The scene is supposed to be static/unmoving.

On most systems I've tested (Mac OS 10.8 through 10.10; NVIDIA and Intel GPUs) it works just fine both transform feedback passes are correctly applied.

But on Mac OS 10.7.5 / ATI Radeon HD 5770, the positions of some of the vertices flicker around every time the second transform feedback pass is executed. Here's a video showing the problem on ATI: https://youtu.be/pX6HhYhGGq4 . In the first part of the video, I'm executing the second transform feedback pass over and over the scene should be static, but there are triangles flitting around. In the second part of the video, I executed the second transform feedback pass once, then I'm orbiting around the icosphere a few of the icosphere's triangles are missing from their expected positions on the surface, and are instead strewn through the inside of the icosphere.

GL_VENDOR = ATI Technologies Inc.
GL_VERSION = 2.1 ATI-7.32.12
GL_RENDERER = ATI Radeon HD 5770 OpenGL Engine

Here are some things I've tried so far:

glGetError() returns GL_NO_ERROR (tested both using OpenGL Profiler to break on errors (it didn't), and by manually inserting a bunch of glGetError() calls).
It only seems to flicker if the mesh has above a certain number of vertices/elements (no flicker at ~660 vertices; yes flicker at ~682 vertices). Only the vertices above that threshold seem to flicker (i.e., the first ~660 vertices remain stable, the next ~22 vertices randomly flicker).
Suspecting there might be some inter-context race condition, I tried:

Adding glFinish() calls immediately after each transform feedback pass and immediately before the render pass, but it still flickers
Uploading a fresh copy of the mesh each frame to a new buffer object still flickers

Adding a dummy fragment shader to transform feedback shaders still flickers

The only thing I've found that makes a difference is if I remove the geometry shader from the second transform pass. If I perform 2 transform feedback passes that consist only of vertex shaders, it works just fine, with no flickering. But if I add a geometry shader to the second pass, it starts flickering. (And my algorithm requires a geometry shader, so removing the geometry shader isn't a solution.)

(This project is a ton of code; I can try to make a smaller standalone example if necessary, but that will take several more hours of work. First I'm wondering if there are other debugging strategies I can try out on my codebase, or if this is a known issue with this OS/GPU combination and thus whether it's hopeless or there's a workaround.)