clarify getCurrentViewport

currentViewport was used as a shadowing local variable - this change is purely for code clarification.
GPU optim # 1

store uniform locations even if location returns -1. If uniform location would not be stored, many unnecessary glGetUniformLocation requests would be issued on every draw call.

This is especially pronounced if custom shaders were used which do not define the built-in shader uniforms.

Since the uniform locations cannot change once a shader is linked, a failure to look up the uniform on the first frame will also mean a failure to look it up on every following frame. By catching this early, we don't incur a driver overhead penalty per uniform per frame.
GPU optim #2

native viewport caching.

Since most apps just use one render viewport, it pays off to cache the render viewport and only issue a glGetInteger Query should the viewport have changed.

Before this, the viewport would have been queried twice a frame at least.

glGetInteger() has the potential for high driver overhead, since worst case the pipeline needs to be flushed before the query can return, and the CPU can continue issueing commands.
removes logic for internal cache of native viewport as @arturoc suggested.
+ simplifies things!
Merge pull request #3283 from tgfrerer/feature-gpu-optimisations

Feature gpu optimisations