[CTS][deqp] avoid rebinding textures in glTex(Sub)Image2D
bug:
31307568
If we stop rebinding the same texture every call,
we can fix 4 CTS dEQP failures on Quadro K2200 / K600's:
dEQP-GLES2.functional.texture.specification.random_teximage2d.2d_3
dEQP-GLES2.functional.texture.specification.random_teximage2d.2d_7
dEQP-GLES2.functional.texture.specification.random_teximage2d.2d_8
dEQP-GLES2.functional.texture.specification.random_teximage2d.2d_9
These random (as in seeded only once, same "random" config everytime)
texture tests attempt to construct mipmaps in random order using
repeated calls to glTexImage2D.
Four of these tests fail because they construct the texture mipmaps
in just the wrong order to expose what seems like a NVIDIA driver bug:
if we attempt to glBindTexture the "same" texture before
each glTexImage2D AND do not start with mipmap level 0, we get a
corrupted texture for what seems like all mipmap levels that were
specified before mipmap level 0 was specified.
This CL avoids calling glBindTexture when we didn't need to overrride
the GL_TEXTURE_2D texture on the host. The previous behavior seems
unresonable, in fact: it is also not a high quality thing to do if
we always issue glBindTexture on host when "restoring" a texture target
that has NOT been overriden.
No regression has been detected in CTS dEQP GLES2, EGL / CTS camera.
It should also be a slight performance increase for apps that
heavily thrash glTexImage2D.
Change-Id: I6910d93733cb682737f49aff448097e263cd675b