glretrace: Handle glViewport better.
If a user call glViewport with non default framebuffer bind first, and then bind the default framebuffer to draw, the current apitrace won't show anything on screen and complain glViewport hasn't been called yet. Fix this by caching the width/height value in current context.
I don't quite understand the problem or the proposed fix.
If a user call glViewport with non default framebuffer bind first, and then bind the default framebuffer to draw, the current apitrace won't show anything on screen and complain glViewport hasn't been called yet.
This should never happen.
When tracing, apitrace will emit a fake glViewport call the very first time a context is bound. See _fake_glViewport().
So if you do see such trace, then I suspect the problem actually happened when tracing, and the right fix is to ensure _fake_glViewport() is called the very first time the context is bound.
Also, width and height should be initialized to zero.