[gl] Delete location shift WAR

bug: 143919384

Test: No regressions in dEQP-EG,GLES2, GLES3. Chrome shadertoy works.

Perf increase: Remove ~40% of cycles from glUniform* calls.
webgl aquarium, 20k fishes: 26-27 fps -> 27-29 fps (z840, quadro k2200)

Change-Id: Ib126ff0a31645fb20a40436c1d5a653ee5cf2563
diff --git a/shared/OpenglCodecCommon/GLSharedGroup.cpp b/shared/OpenglCodecCommon/GLSharedGroup.cpp
index e4bc889..46d94a9 100755
--- a/shared/OpenglCodecCommon/GLSharedGroup.cpp
+++ b/shared/OpenglCodecCommon/GLSharedGroup.cpp
@@ -34,8 +34,7 @@
 
 /**** ProgramData ****/
 ProgramData::ProgramData() : m_numIndexes(0),
-                             m_initialized(false),
-                             m_locShiftWAR(false) {
+                             m_initialized(false) {
     m_Indexes = NULL;
 }
 
@@ -46,7 +45,6 @@
     delete [] m_Indexes;
 
     m_Indexes = new IndexInfo[numIndexes];
-    m_locShiftWAR = false;
 }
 
 bool ProgramData::isInitialized() {
@@ -68,14 +66,6 @@
     m_Indexes[index].base = base;
     m_Indexes[index].size = size;
     m_Indexes[index].type = type;
-
-    if (index > 0) {
-        m_Indexes[index].appBase = m_Indexes[index-1].appBase +
-                                   m_Indexes[index-1].size;
-    } else {
-        m_Indexes[index].appBase = 0;
-    }
-
     m_Indexes[index].hostLocsPerElement = 1;
     m_Indexes[index].flags = 0;
     m_Indexes[index].samplerValue = 0;
@@ -112,52 +102,6 @@
     return 0;
 }
 
-void ProgramData::setupLocationShiftWAR() {
-    m_locShiftWAR = false;
-    for (GLuint  i= 0; i < m_numIndexes; i++) {
-        if (0 != (m_Indexes[i].base & 0xffff)) {
-            return;
-        }
-    }
-
-    // if we have one uniform at location 0, we do not need the WAR.
-    if (m_numIndexes > 1) m_locShiftWAR = true;
-}
-
-GLint ProgramData::locationWARHostToApp(GLint hostLoc, GLint arrIndex) {
-
-    if (!m_locShiftWAR) return hostLoc;
-
-    GLuint index = getIndexForLocation(hostLoc);
-
-    if (index < m_numIndexes) {
-        if (arrIndex > 0) {
-            m_Indexes[index].hostLocsPerElement =
-                (hostLoc - m_Indexes[index].base) / arrIndex;
-        }
-        return m_Indexes[index].appBase + arrIndex;
-    }
-
-    return -1;
-}
-
-GLint ProgramData::locationWARAppToHost(GLint appLoc) {
-
-    if (!m_locShiftWAR) return appLoc;
-
-    for (GLuint i = 0; i < m_numIndexes; i++) {
-        GLint elemIndex =
-            appLoc - m_Indexes[i].appBase;
-
-        if (elemIndex >= 0 && elemIndex < m_Indexes[i].size) {
-            return m_Indexes[i].base +
-                   elemIndex * m_Indexes[i].hostLocsPerElement;
-        }
-    }
-
-    return -1;
-}
-
 GLint ProgramData::getNextSamplerUniform(
     GLint index, GLint* val, GLenum* target) {
 
@@ -187,7 +131,7 @@
 
     for (GLuint i = 0; i < m_numIndexes; i++) {
 
-        GLint elemIndex = appLoc - m_Indexes[i].appBase;
+        GLint elemIndex = appLoc - m_Indexes[i].base;
 
         if (elemIndex >= 0 && elemIndex < m_Indexes[i].size) {
             if (m_Indexes[i].type == GL_SAMPLER_2D) {
@@ -520,77 +464,6 @@
     return false;
 }
 
-void GLSharedGroup::setupLocationShiftWAR(GLuint program) {
-
-    android::AutoMutex _lock(m_lock);
-
-    ProgramData* pData =
-        findObjectOrDefault(m_programs, program);
-
-    if (pData) pData->setupLocationShiftWAR();
-}
-
-GLint GLSharedGroup::locationWARHostToApp(
-    GLuint program, GLint hostLoc, GLint arrIndex) {
-
-    android::AutoMutex _lock(m_lock);
-
-    ProgramData* pData = findObjectOrDefault(m_programs, program);
-
-    if (pData) return pData->locationWARHostToApp(hostLoc, arrIndex);
-
-    if (m_shaderProgramIdMap.find(program) ==
-        m_shaderProgramIdMap.end()) return hostLoc;
-
-    ShaderProgramData* spData =
-        findObjectOrDefault(m_shaderPrograms, m_shaderProgramIdMap[program]);
-
-    if (spData) return spData->programData.locationWARHostToApp(hostLoc, arrIndex);
-
-    return hostLoc;
-}
-
-GLint GLSharedGroup::locationWARAppToHost(GLuint program, GLint appLoc) {
-
-    android::AutoMutex _lock(m_lock);
-
-    ProgramData* pData =
-        findObjectOrDefault(m_programs, program);
-
-    if (pData) return pData->locationWARAppToHost(appLoc);
-
-    if (m_shaderProgramIdMap.find(program) ==
-        m_shaderProgramIdMap.end()) return appLoc;
-
-    ShaderProgramData* spData =
-        findObjectOrDefault(
-            m_shaderPrograms, m_shaderProgramIdMap[program]);
-
-    if (spData) return spData->programData.locationWARAppToHost(appLoc);
-
-    return appLoc;
-}
-
-bool GLSharedGroup::needUniformLocationWAR(GLuint program) {
-
-    android::AutoMutex _lock(m_lock);
-
-    ProgramData* pData =
-        findObjectOrDefault(m_programs, program);
-
-    if (pData) return pData->needUniformLocationWAR();
-
-    if (m_shaderProgramIdMap.find(program) ==
-        m_shaderProgramIdMap.end()) return false;
-
-    ShaderProgramData* spData =
-        findObjectOrDefault(m_shaderPrograms, m_shaderProgramIdMap[program]);
-
-    if (spData) return spData->programData.needUniformLocationWAR();
-
-    return false;
-}
-
 GLint GLSharedGroup::getNextSamplerUniform(
     GLuint program, GLint index, GLint* val, GLenum* target) const {
 
@@ -787,8 +660,3 @@
         }
     }
 }
-
-void GLSharedGroup::setupShaderProgramLocationShiftWAR(GLuint shaderProgram) {
-    ShaderProgramData* spData = getShaderProgramData(shaderProgram);
-    spData->programData.setupLocationShiftWAR();
-}
diff --git a/shared/OpenglCodecCommon/GLSharedGroup.h b/shared/OpenglCodecCommon/GLSharedGroup.h
index 9ef92ea..d471795 100755
--- a/shared/OpenglCodecCommon/GLSharedGroup.h
+++ b/shared/OpenglCodecCommon/GLSharedGroup.h
@@ -71,7 +71,6 @@
         GLint base;
         GLint size;
         GLenum type;
-        GLint appBase;
         GLint hostLocsPerElement;
         GLuint flags;
         GLint samplerValue; // only set for sampler uniforms
@@ -80,7 +79,6 @@
     GLuint m_numIndexes;
     IndexInfo* m_Indexes;
     bool m_initialized;
-    bool m_locShiftWAR;
 
     std::vector<GLuint> m_shaders;
 
@@ -98,11 +96,6 @@
     GLuint getIndexForLocation(GLint location);
     GLenum getTypeForLocation(GLint location);
 
-    bool needUniformLocationWAR() const { return m_locShiftWAR; }
-    void setupLocationShiftWAR();
-    GLint locationWARHostToApp(GLint hostLoc, GLint arrIndex);
-    GLint locationWARAppToHost(GLint appLoc);
-
     GLint getNextSamplerUniform(GLint index, GLint* val, GLenum* target);
     bool setSamplerUniform(GLint appLoc, GLint val, GLenum* target);
 
@@ -165,10 +158,6 @@
     void    deleteProgramData(GLuint program);
     void    setProgramIndexInfo(GLuint program, GLuint index, GLint base, GLint size, GLenum type, const char* name);
     GLenum  getProgramUniformType(GLuint program, GLint location);
-    void    setupLocationShiftWAR(GLuint program);
-    GLint   locationWARHostToApp(GLuint program, GLint hostLoc, GLint arrIndex);
-    GLint   locationWARAppToHost(GLuint program, GLint appLoc);
-    bool    needUniformLocationWAR(GLuint program);
     GLint   getNextSamplerUniform(GLuint program, GLint index, GLint* val, GLenum* target) const;
     bool    setSamplerUniform(GLuint program, GLint appLoc, GLint val, GLenum* target);
 
@@ -187,7 +176,6 @@
     void deleteShaderProgramData(GLuint shaderProgramName);
     void initShaderProgramData(GLuint shaderProgram, GLuint numIndices);
     void setShaderProgramIndexInfo(GLuint shaderProgram, GLuint index, GLint base, GLint size, GLenum type, const char* name);
-    void setupShaderProgramLocationShiftWAR(GLuint shaderProgram);
 };
 
 typedef SmartPtr<GLSharedGroup> GLSharedGroupPtr; 
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index 2a7ccdc..df865e5 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -1817,7 +1817,6 @@
         location = ctx->m_glGetUniformLocation_enc(self, program, name);
         ctx->m_shared->setProgramIndexInfo(program, i, location, size, type, name);
     }
-    ctx->m_shared->setupLocationShiftWAR(program);
 
     delete[] name;
 }
@@ -1836,7 +1835,7 @@
     SET_ERROR_IF(!ctx->m_shared->isShaderOrProgramObject(program), GL_INVALID_VALUE);
     SET_ERROR_IF(!ctx->m_shared->isProgram(program), GL_INVALID_OPERATION);
     SET_ERROR_IF(!ctx->m_shared->isProgramInitialized(program), GL_INVALID_OPERATION);
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     SET_ERROR_IF(ctx->m_shared->getProgramUniformType(program,hostLoc)==0, GL_INVALID_OPERATION);
     ctx->m_glGetUniformiv_enc(self, program, hostLoc, params);
 }
@@ -1846,7 +1845,7 @@
     SET_ERROR_IF(!ctx->m_shared->isShaderOrProgramObject(program), GL_INVALID_VALUE);
     SET_ERROR_IF(!ctx->m_shared->isProgram(program), GL_INVALID_OPERATION);
     SET_ERROR_IF(!ctx->m_shared->isProgramInitialized(program), GL_INVALID_OPERATION);
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program,location);
+    GLint hostLoc = location;
     SET_ERROR_IF(ctx->m_shared->getProgramUniformType(program,hostLoc)==0, GL_INVALID_OPERATION);
     ctx->m_glGetUniformfv_enc(self, program, hostLoc, params);
 }
@@ -1957,24 +1956,8 @@
 int GL2Encoder::s_glGetUniformLocation(void *self, GLuint program, const GLchar *name)
 {
     if (!name) return -1;
-
     GL2Encoder *ctx = (GL2Encoder*)self;
-
-    // if we need the uniform location WAR
-    // parse array index from the end of the name string
-    int arrIndex = 0;
-    bool needLocationWAR = ctx->m_shared->needUniformLocationWAR(program);
-    if (needLocationWAR) {
-        int err;
-        arrIndex = sArrIndexOfUniformExpr(name, &err);
-        if (err) return -1;
-    }
-
-    int hostLoc = ctx->m_glGetUniformLocation_enc(self, program, name);
-    if (hostLoc >= 0 && needLocationWAR) {
-        return ctx->m_shared->locationWARHostToApp(program, hostLoc, arrIndex);
-    }
-    return hostLoc;
+    return ctx->m_glGetUniformLocation_enc(self, program, name);
 }
 
 bool GL2Encoder::updateHostTexture2DBinding(GLenum texUnit, GLenum newTarget)
@@ -2045,14 +2028,14 @@
 void GL2Encoder::s_glUniform1f(void *self , GLint location, GLfloat x)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform1f_enc(self, hostLoc, x);
 }
 
 void GL2Encoder::s_glUniform1fv(void *self , GLint location, GLsizei count, const GLfloat* v)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform1fv_enc(self, hostLoc, count, v);
 }
 
@@ -2062,7 +2045,7 @@
     GLClientState* state = ctx->m_state;
     GLSharedGroupPtr shared = ctx->m_shared;
 
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform1i_enc(self, hostLoc, x);
 
     GLenum target;
@@ -2078,112 +2061,112 @@
 void GL2Encoder::s_glUniform1iv(void *self , GLint location, GLsizei count, const GLint* v)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform1iv_enc(self, hostLoc, count, v);
 }
 
 void GL2Encoder::s_glUniform2f(void *self , GLint location, GLfloat x, GLfloat y)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform2f_enc(self, hostLoc, x, y);
 }
 
 void GL2Encoder::s_glUniform2fv(void *self , GLint location, GLsizei count, const GLfloat* v)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform2fv_enc(self, hostLoc, count, v);
 }
 
 void GL2Encoder::s_glUniform2i(void *self , GLint location, GLint x, GLint y)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform2i_enc(self, hostLoc, x, y);
 }
 
 void GL2Encoder::s_glUniform2iv(void *self , GLint location, GLsizei count, const GLint* v)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform2iv_enc(self, hostLoc, count, v);
 }
 
 void GL2Encoder::s_glUniform3f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform3f_enc(self, hostLoc, x, y, z);
 }
 
 void GL2Encoder::s_glUniform3fv(void *self , GLint location, GLsizei count, const GLfloat* v)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform3fv_enc(self, hostLoc, count, v);
 }
 
 void GL2Encoder::s_glUniform3i(void *self , GLint location, GLint x, GLint y, GLint z)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform3i_enc(self, hostLoc, x, y, z);
 }
 
 void GL2Encoder::s_glUniform3iv(void *self , GLint location, GLsizei count, const GLint* v)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform3iv_enc(self, hostLoc, count, v);
 }
 
 void GL2Encoder::s_glUniform4f(void *self , GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform4f_enc(self, hostLoc, x, y, z, w);
 }
 
 void GL2Encoder::s_glUniform4fv(void *self , GLint location, GLsizei count, const GLfloat* v)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform4fv_enc(self, hostLoc, count, v);
 }
 
 void GL2Encoder::s_glUniform4i(void *self , GLint location, GLint x, GLint y, GLint z, GLint w)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform4i_enc(self, hostLoc, x, y, z, w);
 }
 
 void GL2Encoder::s_glUniform4iv(void *self , GLint location, GLsizei count, const GLint* v)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform4iv_enc(self, hostLoc, count, v);
 }
 
 void GL2Encoder::s_glUniformMatrix2fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniformMatrix2fv_enc(self, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glUniformMatrix3fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniformMatrix3fv_enc(self, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glUniformMatrix4fv(void *self , GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniformMatrix4fv_enc(self, hostLoc, count, transpose, value);
 }
 
@@ -3536,7 +3519,6 @@
     std::string packed = packVarNames(uniformCount, (const char**)uniformNames, &err);
     SET_ERROR_IF(err != GL_NO_ERROR, GL_INVALID_OPERATION);
 
-    bool needLocationWAR = ctx->m_shared->needUniformLocationWAR(program);
     std::vector<int> arrIndices;
     for (size_t i = 0; i < uniformCount; i++) {
         int err;
@@ -3548,13 +3530,6 @@
     }
 
     ctx->glGetUniformIndicesAEMU(ctx, program, uniformCount, (const GLchar*)&packed[0], packed.size() + 1, uniformIndices);
-
-    for (int i = 0; i < uniformCount; i++) {
-        if (uniformIndices[i] >= 0 && needLocationWAR) {
-            uniformIndices[i] =
-                ctx->m_shared->locationWARHostToApp(program, uniformIndices[i], arrIndices[i]);
-        }
-    }
 }
 
 void GL2Encoder::s_glUniform1ui(void* self, GLint location, GLuint v0) {
@@ -3562,7 +3537,7 @@
     GLClientState* state = ctx->m_state;
     GLSharedGroupPtr shared = ctx->m_shared;
 
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform1ui_enc(self, hostLoc, v0);
 
     GLenum target;
@@ -3577,79 +3552,79 @@
 
 void GL2Encoder::s_glUniform2ui(void* self, GLint location, GLuint v0, GLuint v1) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform2ui_enc(self, hostLoc, v0, v1);
 }
 
 void GL2Encoder::s_glUniform3ui(void* self, GLint location, GLuint v0, GLuint v1, GLuint v2) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform3ui_enc(self, hostLoc, v0, v1, v2);
 }
 
 void GL2Encoder::s_glUniform4ui(void* self, GLint location, GLint v0, GLuint v1, GLuint v2, GLuint v3) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform4ui_enc(self, hostLoc, v0, v1, v2, v3);
 }
 
 void GL2Encoder::s_glUniform1uiv(void* self, GLint location, GLsizei count, const GLuint *value) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform1uiv_enc(self, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glUniform2uiv(void* self, GLint location, GLsizei count, const GLuint *value) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform2uiv_enc(self, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glUniform3uiv(void* self, GLint location, GLsizei count, const GLuint *value) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform3uiv_enc(self, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glUniform4uiv(void* self, GLint location, GLsizei count, const GLuint *value) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniform4uiv_enc(self, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glUniformMatrix2x3fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniformMatrix2x3fv_enc(self, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glUniformMatrix3x2fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniformMatrix3x2fv_enc(self, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glUniformMatrix2x4fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniformMatrix2x4fv_enc(self, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glUniformMatrix4x2fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniformMatrix4x2fv_enc(self, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glUniformMatrix3x4fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniformMatrix3x4fv_enc(self, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glUniformMatrix4x3fv(void* self, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(ctx->m_state->currentShaderProgram(),location);
+    GLint hostLoc = location;
     ctx->m_glUniformMatrix4x3fv_enc(self, hostLoc, count, transpose, value);
 }
 
@@ -3658,7 +3633,7 @@
     SET_ERROR_IF(!ctx->m_shared->isShaderOrProgramObject(program), GL_INVALID_VALUE);
     SET_ERROR_IF(!ctx->m_shared->isProgram(program), GL_INVALID_OPERATION);
     SET_ERROR_IF(!ctx->m_shared->isProgramInitialized(program), GL_INVALID_OPERATION);
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     SET_ERROR_IF(ctx->m_shared->getProgramUniformType(program,hostLoc)==0, GL_INVALID_OPERATION);
     ctx->m_glGetUniformuiv_enc(self, program, hostLoc, params);
 }
@@ -4911,8 +4886,6 @@
         ctx->m_shared->setShaderProgramIndexInfo(res, i, location, size, uniformType, name);
     }
 
-    ctx->m_shared->setupShaderProgramLocationShiftWAR(res);
-
     delete [] name;
 
     return res;
@@ -4921,21 +4894,21 @@
 void GL2Encoder::s_glProgramUniform1f(void* self, GLuint program, GLint location, GLfloat v0)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform1f_enc(self, program, hostLoc, v0);
 }
 
 void GL2Encoder::s_glProgramUniform1fv(void* self, GLuint program, GLint location, GLsizei count, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform1fv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform1i(void* self, GLuint program, GLint location, GLint v0)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform1i_enc(self, program, hostLoc, v0);
 
     GLClientState* state = ctx->m_state;
@@ -4954,14 +4927,14 @@
 void GL2Encoder::s_glProgramUniform1iv(void* self, GLuint program, GLint location, GLsizei count, const GLint *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform1iv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform1ui(void* self, GLuint program, GLint location, GLuint v0)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform1ui_enc(self, program, hostLoc, v0);
 
     GLClientState* state = ctx->m_state;
@@ -4980,196 +4953,196 @@
 void GL2Encoder::s_glProgramUniform1uiv(void* self, GLuint program, GLint location, GLsizei count, const GLuint *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform1uiv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform2f(void* self, GLuint program, GLint location, GLfloat v0, GLfloat v1)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform2f_enc(self, program, hostLoc, v0, v1);
 }
 
 void GL2Encoder::s_glProgramUniform2fv(void* self, GLuint program, GLint location, GLsizei count, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform2fv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform2i(void* self, GLuint program, GLint location, GLint v0, GLint v1)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform2i_enc(self, program, hostLoc, v0, v1);
 }
 
 void GL2Encoder::s_glProgramUniform2iv(void* self, GLuint program, GLint location, GLsizei count, const GLint *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform2iv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform2ui(void* self, GLuint program, GLint location, GLint v0, GLuint v1)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform2ui_enc(self, program, hostLoc, v0, v1);
 }
 
 void GL2Encoder::s_glProgramUniform2uiv(void* self, GLuint program, GLint location, GLsizei count, const GLuint *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform2uiv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform3f(void* self, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform3f_enc(self, program, hostLoc, v0, v1, v2);
 }
 
 void GL2Encoder::s_glProgramUniform3fv(void* self, GLuint program, GLint location, GLsizei count, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform3fv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform3i(void* self, GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform3i_enc(self, program, hostLoc, v0, v1, v2);
 }
 
 void GL2Encoder::s_glProgramUniform3iv(void* self, GLuint program, GLint location, GLsizei count, const GLint *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform3iv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform3ui(void* self, GLuint program, GLint location, GLint v0, GLint v1, GLuint v2)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform3ui_enc(self, program, hostLoc, v0, v1, v2);
 }
 
 void GL2Encoder::s_glProgramUniform3uiv(void* self, GLuint program, GLint location, GLsizei count, const GLuint *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform3uiv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform4f(void* self, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform4f_enc(self, program, hostLoc, v0, v1, v2, v3);
 }
 
 void GL2Encoder::s_glProgramUniform4fv(void* self, GLuint program, GLint location, GLsizei count, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform4fv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform4i(void* self, GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform4i_enc(self, program, hostLoc, v0, v1, v2, v3);
 }
 
 void GL2Encoder::s_glProgramUniform4iv(void* self, GLuint program, GLint location, GLsizei count, const GLint *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform4iv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniform4ui(void* self, GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLuint v3)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform4ui_enc(self, program, hostLoc, v0, v1, v2, v3);
 }
 
 void GL2Encoder::s_glProgramUniform4uiv(void* self, GLuint program, GLint location, GLsizei count, const GLuint *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniform4uiv_enc(self, program, hostLoc, count, value);
 }
 
 void GL2Encoder::s_glProgramUniformMatrix2fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniformMatrix2fv_enc(self, program, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glProgramUniformMatrix2x3fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniformMatrix2x3fv_enc(self, program, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glProgramUniformMatrix2x4fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniformMatrix2x4fv_enc(self, program, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glProgramUniformMatrix3fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniformMatrix3fv_enc(self, program, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glProgramUniformMatrix3x2fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniformMatrix3x2fv_enc(self, program, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glProgramUniformMatrix3x4fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniformMatrix3x4fv_enc(self, program, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glProgramUniformMatrix4fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniformMatrix4fv_enc(self, program, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glProgramUniformMatrix4x2fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniformMatrix4x2fv_enc(self, program, hostLoc, count, transpose, value);
 }
 
 void GL2Encoder::s_glProgramUniformMatrix4x3fv(void* self, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
 {
     GL2Encoder *ctx = (GL2Encoder*)self;
-    GLint hostLoc = ctx->m_shared->locationWARAppToHost(program, location);
+    GLint hostLoc = location;
     ctx->m_glProgramUniformMatrix4x3fv_enc(self, program, hostLoc, count, transpose, value);
 }