opengles emulator: make glFramebufferTexture2D work

The GLES and OpenGL specs for glFramebufferTexture2D are different, which
caused valid GLES calls to fail when moved over to OpenGL. Specifically,
a framebuffer in OpenGL must have a color attachment in order to be valid
for draw, while in GLES it doesn't. So add a validate function, and call
it from each drawing API call.
This patch also contains a workaround for a bug in the ATI driver, where
changing the framebuffer attachments requires a rebind of the framebuffer.

Change-Id: I011fbe0e2b1c66564322268868a24a9d5958a434
8 files changed