Unexpected one frame stalls from AMD driver
I have a scene with a few (~10) simple objects and 2 light sources. Under specific conditions I observe a sudden one frame stall. Then it returns back to normal and never happens again until I restart the application.
- My application loads the scene and constantly renders it on the screen (sleep is not called)
- The scene is static (no animations, particles, etc.)
- So far the FPS is pretty much constant with each frame taking ~15 ms to render (vsynch is off)
- When the camera starts rotating a stall occurs with one frame taking ~65 ms to render
- After this moment the issue never happens again under any circumstances.
On the left there is a performance graph, showing the stall. On the right there are two screenshots taken before and right after the stall occurred. As you can see nothing changes except the camera slightly rotates.
Can anyone explain what is going on there? Maybe somebody has a similar experience?
Several more facts
- The issue is 100% consistent
- The magnitude of the rotation angle which triggers the issue is constant for each initial camera orientation, but it varies between different initial orientations.
- It happens only when I have at least one light source in the scene.
- When I switch light sources in the scene off, I encounter similar stalls. This makes me think that's the FFP emulator recompiles its shaders, but what would be the reason to recompile shaders just because the camera rotates?
- OpenGL 2.1 FFP with occasional use of shaders (in this particular example shaders are not used)
The issue presents on all the AMD platforms I have managed to find:
- AMD Radeon HD 6800 \ Windows 7 \ Driver 9.12 (Catalyst 13.1)
- AMD Radeon HD 6670 \ Windows 7 \ Driver 9.12
- AMD Radeon HD 6320 \ Linux \
- ATI Technologies Inc Radeon E2400 \ Linux \
The issue does not occur on all the NV platforms I have managed to find:
- NVIDIA GeForce GTX 460M \ Windows 7 \ Driver 184.108.40.20616
- NVIDIA Quadro FX 880M \ Windows 7 \ Driver 220.127.116.116
It would be great if there was a way to avoid the stalls, but I doubt it. So I'm just trying to understand this phenomena. I would appreciate any related information.
Last edited by gonzaless; 07-31-2013 at 03:15 PM.
I suspect that your guess is correct and that the FFP emulator is compiling (and - hopefully - caching) new shaders for your lights.
I've seen similar before on Intel (with D3D so let's not blame their GL driver) where the driver doesn't seem to load a shader to the GPU until the shader is actually used for the first time, causing stalls of similar magnitude until everything is built up. I don't know if the same happens with AMD.
Another possible cause is a non-resident texture or VBO coming into view for the first time; it will need to be transferred to the GPU (where hopefully it's going to subsequently stay) which could also cause a stall (I've consistently benchmarked AMD as being significantly slower than either NVIDIA or Intel at transferring textures; a likely cause is "Catalyst AI" modifying the internal format on the fly).
Thank you for such a quick response! Probably I wasn't clear enough with my description of the issue. I'm so concerned with it is because the camera sees all the objects in the scene from the very beginning.
So there's this static scene where nothing is changing. The frame rate has been settled down after loading. Then the only thing which happens is the camera slightly changes its rotation while still seeing the whole scene. This is when the stall happens.
From the logical perspective it should not be, because all the resources have been uploaded to the video memory and used in actual rendering, the number of lights doesn't change, we don't see new objects and don't see the old ones closer or farther. It's just the slightly different angle of view to the scene which triggers it and I don't get why
I'm trying to post a picture explaining what's going on. Unfortunately it seems like I don't have enough privileges here