Move setting the uniforms to the Renderer implementation.

TRAC #22245
Signed-off-by: Daniel Koch
Signed-off-by: Geoff Lang
Author: Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1594 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/ProgramBinary.cpp b/src/libGLESv2/ProgramBinary.cpp
index 6066a01..0de4ae3 100644
--- a/src/libGLESv2/ProgramBinary.cpp
+++ b/src/libGLESv2/ProgramBinary.cpp
@@ -978,52 +978,74 @@
     }
 }
 
-// Applies all the uniforms set for this program object to the Direct3D 9 device
+// Applies all the uniforms set for this program object to the renderer
 void ProgramBinary::applyUniforms()
 {
+    // Retrieve sampler uniform values
+    for (std::vector<Uniform*>::iterator ub = mUniforms.begin(), ue = mUniforms.end(); ub != ue; ++ub)
+    {
+        Uniform *targetUniform = *ub;
+
+        if (targetUniform->dirty)
+        {
+            int count = targetUniform->arraySize;
+            GLint *v = (GLint*)targetUniform->data;
+
+            switch (targetUniform->type)
+            {
+              case GL_SAMPLER_2D:
+              case GL_SAMPLER_CUBE:
+                {
+                    if (targetUniform->ps.registerCount)
+                    {
+                        if (targetUniform->ps.samplerIndex >= 0)
+                        {
+                            unsigned int firstIndex = targetUniform->ps.samplerIndex;
+
+                            for (int i = 0; i < count; i++)
+                            {
+                                unsigned int samplerIndex = firstIndex + i;
+
+                                if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
+                                {
+                                    ASSERT(mSamplersPS[samplerIndex].active);
+                                    mSamplersPS[samplerIndex].logicalTextureUnit = v[i];
+                                }
+                            }
+                        }
+                    }
+
+                    if (targetUniform->vs.registerCount)
+                    {
+                        if (targetUniform->vs.samplerIndex >= 0)
+                        {
+                            unsigned int firstIndex = targetUniform->vs.samplerIndex;
+
+                            for (int i = 0; i < count; i++)
+                            {
+                                unsigned int samplerIndex = firstIndex + i;
+
+                                if (samplerIndex < MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF)
+                                {
+                                    ASSERT(mSamplersVS[samplerIndex].active);
+                                    mSamplersVS[samplerIndex].logicalTextureUnit = v[i];
+                                }
+                            }
+                        }
+                    }
+                }
+                break;
+            }
+        }
+    }
+
     if (dynamic_cast<rx::Renderer9*>(mRenderer) == NULL)  // D3D9_REPLACE
     {
         return;   // UNIMPLEMENTED
     }
 
-    IDirect3DDevice9 *device = rx::Renderer9::makeRenderer9(mRenderer)->getDevice(); // D3D9_REPLACE
-
-    for (std::vector<Uniform*>::iterator ub = mUniforms.begin(), ue = mUniforms.end(); ub != ue; ++ub) {
-        Uniform *targetUniform = *ub;
-
-        if (targetUniform->dirty)
-        {
-            int arraySize = targetUniform->arraySize;
-            GLfloat *f = (GLfloat*)targetUniform->data;
-            GLint *i = (GLint*)targetUniform->data;
-            GLboolean *b = (GLboolean*)targetUniform->data;
-
-            switch (targetUniform->type)
-            {
-              case GL_BOOL:       applyUniformnbv(device, targetUniform, arraySize, 1, b);    break;
-              case GL_BOOL_VEC2:  applyUniformnbv(device, targetUniform, arraySize, 2, b);    break;
-              case GL_BOOL_VEC3:  applyUniformnbv(device, targetUniform, arraySize, 3, b);    break;
-              case GL_BOOL_VEC4:  applyUniformnbv(device, targetUniform, arraySize, 4, b);    break;
-              case GL_FLOAT:
-              case GL_FLOAT_VEC2:
-              case GL_FLOAT_VEC3:
-              case GL_FLOAT_VEC4:
-              case GL_FLOAT_MAT2:
-              case GL_FLOAT_MAT3:
-              case GL_FLOAT_MAT4: applyUniformnfv(device, targetUniform, f);                  break;
-              case GL_SAMPLER_2D:
-              case GL_SAMPLER_CUBE:
-              case GL_INT:        applyUniform1iv(device, targetUniform, arraySize, i);       break;
-              case GL_INT_VEC2:   applyUniform2iv(device, targetUniform, arraySize, i);       break;
-              case GL_INT_VEC3:   applyUniform3iv(device, targetUniform, arraySize, i);       break;
-              case GL_INT_VEC4:   applyUniform4iv(device, targetUniform, arraySize, i);       break;
-              default:
-                UNREACHABLE();
-            }
-
-            targetUniform->dirty = false;
-        }
-    }
+    // Set all other uniforms
+    rx::Renderer9::makeRenderer9(mRenderer)->applyUniforms(&mUniforms);
 }
 
 // Packs varyings into generic varying registers, using the algorithm from [OpenGL ES Shading Language 1.00 rev. 17] appendix A section 7 page 111
@@ -2214,207 +2236,6 @@
     return name;
 }
 
-// D3D9_REPLACE begin
-void ProgramBinary::applyUniformnbv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, int width, const GLboolean *v)
-{
-    float vector[D3D9_MAX_FLOAT_CONSTANTS * 4];
-    BOOL boolVector[D3D9_MAX_BOOL_CONSTANTS];
-
-    if (targetUniform->ps.float4Index >= 0 || targetUniform->vs.float4Index >= 0)
-    {
-        ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
-        for (int i = 0; i < count; i++)
-        {
-            for (int j = 0; j < 4; j++)
-            {
-                if (j < width)
-                {
-                    vector[i * 4 + j] = (v[i * width + j] == GL_FALSE) ? 0.0f : 1.0f;
-                }
-                else
-                {
-                    vector[i * 4 + j] = 0.0f;
-                }
-            }
-        }
-    }
-
-    if (targetUniform->ps.boolIndex >= 0 || targetUniform->vs.boolIndex >= 0)
-    {
-        int psCount = targetUniform->ps.boolIndex >= 0 ? targetUniform->ps.registerCount : 0;
-        int vsCount = targetUniform->vs.boolIndex >= 0 ? targetUniform->vs.registerCount : 0;
-        int copyCount = std::min(count * width, std::max(psCount, vsCount));
-        ASSERT(copyCount <= D3D9_MAX_BOOL_CONSTANTS);
-        for (int i = 0; i < copyCount; i++)
-        {
-            boolVector[i] = v[i] != GL_FALSE;
-        }
-    }
-
-    if (targetUniform->ps.float4Index >= 0)
-    {
-        device->SetPixelShaderConstantF(targetUniform->ps.float4Index, vector, targetUniform->ps.registerCount);
-    }
-        
-    if (targetUniform->ps.boolIndex >= 0)
-    {
-        device->SetPixelShaderConstantB(targetUniform->ps.boolIndex, boolVector, targetUniform->ps.registerCount);
-    }
-    
-    if (targetUniform->vs.float4Index >= 0)
-    {
-        device->SetVertexShaderConstantF(targetUniform->vs.float4Index, vector, targetUniform->vs.registerCount);
-    }
-        
-    if (targetUniform->vs.boolIndex >= 0)
-    {
-        device->SetVertexShaderConstantB(targetUniform->vs.boolIndex, boolVector, targetUniform->vs.registerCount);
-    }
-}
-
-bool ProgramBinary::applyUniformnfv(IDirect3DDevice9 *device, Uniform *targetUniform, const GLfloat *v)
-{
-    if (targetUniform->ps.registerCount)
-    {
-        device->SetPixelShaderConstantF(targetUniform->ps.float4Index, v, targetUniform->ps.registerCount);
-    }
-
-    if (targetUniform->vs.registerCount)
-    {
-        device->SetVertexShaderConstantF(targetUniform->vs.float4Index, v, targetUniform->vs.registerCount);
-    }
-
-    return true;
-}
-
-bool ProgramBinary::applyUniform1iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v)
-{
-    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
-    Vector4 vector[D3D9_MAX_FLOAT_CONSTANTS];
-
-    for (int i = 0; i < count; i++)
-    {
-        vector[i] = Vector4((float)v[i], 0, 0, 0);
-    }
-
-    if (targetUniform->ps.registerCount)
-    {
-        if (targetUniform->ps.samplerIndex >= 0)
-        {
-            unsigned int firstIndex = targetUniform->ps.samplerIndex;
-
-            for (int i = 0; i < count; i++)
-            {
-                unsigned int samplerIndex = firstIndex + i;
-
-                if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
-                {
-                    ASSERT(mSamplersPS[samplerIndex].active);
-                    mSamplersPS[samplerIndex].logicalTextureUnit = v[i];
-                }
-            }
-        }
-        else
-        {
-            ASSERT(targetUniform->ps.float4Index >= 0);
-            device->SetPixelShaderConstantF(targetUniform->ps.float4Index, (const float*)vector, targetUniform->ps.registerCount);
-        }
-    }
-
-    if (targetUniform->vs.registerCount)
-    {
-        if (targetUniform->vs.samplerIndex >= 0)
-        {
-            unsigned int firstIndex = targetUniform->vs.samplerIndex;
-
-            for (int i = 0; i < count; i++)
-            {
-                unsigned int samplerIndex = firstIndex + i;
-
-                if (samplerIndex < MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF)
-                {
-                    ASSERT(mSamplersVS[samplerIndex].active);
-                    mSamplersVS[samplerIndex].logicalTextureUnit = v[i];
-                }
-            }
-        }
-        else
-        {
-            ASSERT(targetUniform->vs.float4Index >= 0);
-            device->SetVertexShaderConstantF(targetUniform->vs.float4Index, (const float *)vector, targetUniform->vs.registerCount);
-        }
-    }
-
-    return true;
-}
-
-bool ProgramBinary::applyUniform2iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v)
-{
-    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
-    Vector4 vector[D3D9_MAX_FLOAT_CONSTANTS];
-
-    for (int i = 0; i < count; i++)
-    {
-        vector[i] = Vector4((float)v[0], (float)v[1], 0, 0);
-
-        v += 2;
-    }
-
-    applyUniformniv(device, targetUniform, count, vector);
-
-    return true;
-}
-
-bool ProgramBinary::applyUniform3iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v)
-{
-    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
-    Vector4 vector[D3D9_MAX_FLOAT_CONSTANTS];
-
-    for (int i = 0; i < count; i++)
-    {
-        vector[i] = Vector4((float)v[0], (float)v[1], (float)v[2], 0);
-
-        v += 3;
-    }
-
-    applyUniformniv(device, targetUniform, count, vector);
-
-    return true;
-}
-
-bool ProgramBinary::applyUniform4iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v)
-{
-    ASSERT(count <= D3D9_MAX_FLOAT_CONSTANTS);
-    Vector4 vector[D3D9_MAX_FLOAT_CONSTANTS];
-
-    for (int i = 0; i < count; i++)
-    {
-        vector[i] = Vector4((float)v[0], (float)v[1], (float)v[2], (float)v[3]);
-
-        v += 4;
-    }
-
-    applyUniformniv(device, targetUniform, count, vector);
-
-    return true;
-}
-
-void ProgramBinary::applyUniformniv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const Vector4 *vector)
-{
-    if (targetUniform->ps.registerCount)
-    {
-        ASSERT(targetUniform->ps.float4Index >= 0);
-        device->SetPixelShaderConstantF(targetUniform->ps.float4Index, (const float *)vector, targetUniform->ps.registerCount);
-    }
-
-    if (targetUniform->vs.registerCount)
-    {
-        ASSERT(targetUniform->vs.float4Index >= 0);
-        device->SetVertexShaderConstantF(targetUniform->vs.float4Index, (const float *)vector, targetUniform->vs.registerCount);
-    }
-}
-// D3D9_REPLACE end
-
 bool ProgramBinary::isValidated() const 
 {
     return mValidated;
diff --git a/src/libGLESv2/ProgramBinary.h b/src/libGLESv2/ProgramBinary.h
index 0e98528..3b0022d 100644
--- a/src/libGLESv2/ProgramBinary.h
+++ b/src/libGLESv2/ProgramBinary.h
@@ -81,6 +81,8 @@
     RegisterInfo vs;
 };
 
+typedef std::vector<Uniform*> UniformArray;
+
 // Struct used for correlating uniforms/elements of uniform arrays to handles
 struct UniformLocation
 {
@@ -174,14 +176,7 @@
                        rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable);
     bool defineUniform(GLenum shader, const rx::D3DConstant *constant, const std::string &name);
     Uniform *createUniform(const rx::D3DConstant *constant, const std::string &name);
-    bool applyUniformnfv(IDirect3DDevice9 *device, Uniform *targetUniform, const GLfloat *v);   // D3D9_REPLACE
-    bool applyUniform1iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v);
-    bool applyUniform2iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v);
-    bool applyUniform3iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v);
-    bool applyUniform4iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v);
-    void applyUniformniv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const Vector4 *vector);
-    void applyUniformnbv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, int width, const GLboolean *v);
-
+    
     rx::Renderer *const mRenderer;
 
     rx::ShaderExecutable *mPixelExecutable;
@@ -205,7 +200,6 @@
     GLuint mUsedPixelSamplerRange;
     bool mUsesPointSize;
 
-    typedef std::vector<Uniform*> UniformArray;
     UniformArray mUniforms;
     typedef std::vector<UniformLocation> UniformIndex;
     UniformIndex mUniformIndex;
diff --git a/src/libGLESv2/renderer/Renderer9.cpp b/src/libGLESv2/renderer/Renderer9.cpp
index fb4b5a3..6ae6f44 100644
--- a/src/libGLESv2/renderer/Renderer9.cpp
+++ b/src/libGLESv2/renderer/Renderer9.cpp
@@ -1431,6 +1431,215 @@
     }
 }
 
+void Renderer9::applyUniforms(const gl::UniformArray *uniformArray)
+{
+    for (std::vector<gl::Uniform*>::const_iterator ub = uniformArray->begin(), ue = uniformArray->end(); ub != ue; ++ub)
+    {
+        gl::Uniform *targetUniform = *ub;
+
+        if (targetUniform->dirty)
+        {
+            int arraySize = targetUniform->arraySize;
+            GLfloat *f = (GLfloat*)targetUniform->data;
+            GLint *i = (GLint*)targetUniform->data;
+            GLboolean *b = (GLboolean*)targetUniform->data;
+
+            switch (targetUniform->type)
+            {
+              case GL_SAMPLER_2D:
+              case GL_SAMPLER_CUBE:
+                  break;
+              case GL_BOOL:       applyUniformnbv(targetUniform, arraySize, 1, b);    break;
+              case GL_BOOL_VEC2:  applyUniformnbv(targetUniform, arraySize, 2, b);    break;
+              case GL_BOOL_VEC3:  applyUniformnbv(targetUniform, arraySize, 3, b);    break;
+              case GL_BOOL_VEC4:  applyUniformnbv(targetUniform, arraySize, 4, b);    break;
+              case GL_FLOAT:
+              case GL_FLOAT_VEC2:
+              case GL_FLOAT_VEC3:
+              case GL_FLOAT_VEC4:
+              case GL_FLOAT_MAT2:
+              case GL_FLOAT_MAT3:
+              case GL_FLOAT_MAT4: applyUniformnfv(targetUniform, f);                  break;
+              case GL_INT:        applyUniform1iv(targetUniform, arraySize, i);       break;
+              case GL_INT_VEC2:   applyUniform2iv(targetUniform, arraySize, i);       break;
+              case GL_INT_VEC3:   applyUniform3iv(targetUniform, arraySize, i);       break;
+              case GL_INT_VEC4:   applyUniform4iv(targetUniform, arraySize, i);       break;
+              default:
+                UNREACHABLE();
+            }
+
+            targetUniform->dirty = false;
+        }
+    }
+}
+
+void Renderer9::applyUniformnbv(gl::Uniform *targetUniform, GLsizei count, int width, const GLboolean *v)
+{
+    float vector[gl::D3D9_MAX_FLOAT_CONSTANTS * 4];
+    BOOL boolVector[gl::D3D9_MAX_BOOL_CONSTANTS];
+
+    if (targetUniform->ps.float4Index >= 0 || targetUniform->vs.float4Index >= 0)
+    {
+        ASSERT(count <= gl::D3D9_MAX_FLOAT_CONSTANTS);
+        for (int i = 0; i < count; i++)
+        {
+            for (int j = 0; j < 4; j++)
+            {
+                if (j < width)
+                {
+                    vector[i * 4 + j] = (v[i * width + j] == GL_FALSE) ? 0.0f : 1.0f;
+                }
+                else
+                {
+                    vector[i * 4 + j] = 0.0f;
+                }
+            }
+        }
+    }
+
+    if (targetUniform->ps.boolIndex >= 0 || targetUniform->vs.boolIndex >= 0)
+    {
+        int psCount = targetUniform->ps.boolIndex >= 0 ? targetUniform->ps.registerCount : 0;
+        int vsCount = targetUniform->vs.boolIndex >= 0 ? targetUniform->vs.registerCount : 0;
+        int copyCount = std::min(count * width, std::max(psCount, vsCount));
+        ASSERT(copyCount <= gl::D3D9_MAX_BOOL_CONSTANTS);
+        for (int i = 0; i < copyCount; i++)
+        {
+            boolVector[i] = v[i] != GL_FALSE;
+        }
+    }
+
+    if (targetUniform->ps.float4Index >= 0)
+    {
+        mDevice->SetPixelShaderConstantF(targetUniform->ps.float4Index, vector, targetUniform->ps.registerCount);
+    }
+        
+    if (targetUniform->ps.boolIndex >= 0)
+    {
+        mDevice->SetPixelShaderConstantB(targetUniform->ps.boolIndex, boolVector, targetUniform->ps.registerCount);
+    }
+    
+    if (targetUniform->vs.float4Index >= 0)
+    {
+        mDevice->SetVertexShaderConstantF(targetUniform->vs.float4Index, vector, targetUniform->vs.registerCount);
+    }
+        
+    if (targetUniform->vs.boolIndex >= 0)
+    {
+        mDevice->SetVertexShaderConstantB(targetUniform->vs.boolIndex, boolVector, targetUniform->vs.registerCount);
+    }
+}
+
+bool Renderer9::applyUniformnfv(gl::Uniform *targetUniform, const GLfloat *v)
+{
+    if (targetUniform->ps.registerCount)
+    {
+        mDevice->SetPixelShaderConstantF(targetUniform->ps.float4Index, v, targetUniform->ps.registerCount);
+    }
+
+    if (targetUniform->vs.registerCount)
+    {
+        mDevice->SetVertexShaderConstantF(targetUniform->vs.float4Index, v, targetUniform->vs.registerCount);
+    }
+
+    return true;
+}
+
+bool Renderer9::applyUniform1iv(gl::Uniform *targetUniform, GLsizei count, const GLint *v)
+{
+    ASSERT(count <= gl::D3D9_MAX_FLOAT_CONSTANTS);
+    gl::Vector4 vector[gl::D3D9_MAX_FLOAT_CONSTANTS];
+
+    for (int i = 0; i < count; i++)
+    {
+        vector[i] = gl::Vector4((float)v[i], 0, 0, 0);
+    }
+
+    if (targetUniform->ps.registerCount)
+    {
+        if (targetUniform->ps.float4Index >= 0)
+        {
+            mDevice->SetPixelShaderConstantF(targetUniform->ps.float4Index, (const float*)vector, targetUniform->ps.registerCount);
+        }
+    }
+
+    if (targetUniform->vs.registerCount)
+    {
+        if (targetUniform->vs.float4Index >= 0)
+        {
+            mDevice->SetVertexShaderConstantF(targetUniform->vs.float4Index, (const float *)vector, targetUniform->vs.registerCount);
+        }
+    }
+
+    return true;
+}
+
+bool Renderer9::applyUniform2iv(gl::Uniform *targetUniform, GLsizei count, const GLint *v)
+{
+    ASSERT(count <= gl::D3D9_MAX_FLOAT_CONSTANTS);
+    gl::Vector4 vector[gl::D3D9_MAX_FLOAT_CONSTANTS];
+
+    for (int i = 0; i < count; i++)
+    {
+        vector[i] = gl::Vector4((float)v[0], (float)v[1], 0, 0);
+
+        v += 2;
+    }
+
+    applyUniformniv(targetUniform, count, vector);
+
+    return true;
+}
+
+bool Renderer9::applyUniform3iv(gl::Uniform *targetUniform, GLsizei count, const GLint *v)
+{
+    ASSERT(count <= gl::D3D9_MAX_FLOAT_CONSTANTS);
+    gl::Vector4 vector[gl::D3D9_MAX_FLOAT_CONSTANTS];
+
+    for (int i = 0; i < count; i++)
+    {
+        vector[i] = gl::Vector4((float)v[0], (float)v[1], (float)v[2], 0);
+
+        v += 3;
+    }
+
+    applyUniformniv(targetUniform, count, vector);
+
+    return true;
+}
+
+bool Renderer9::applyUniform4iv(gl::Uniform *targetUniform, GLsizei count, const GLint *v)
+{
+    ASSERT(count <= gl::D3D9_MAX_FLOAT_CONSTANTS);
+    gl::Vector4 vector[gl::D3D9_MAX_FLOAT_CONSTANTS];
+
+    for (int i = 0; i < count; i++)
+    {
+        vector[i] = gl::Vector4((float)v[0], (float)v[1], (float)v[2], (float)v[3]);
+
+        v += 4;
+    }
+
+    applyUniformniv(targetUniform, count, vector);
+
+    return true;
+}
+
+void Renderer9::applyUniformniv(gl::Uniform *targetUniform, GLsizei count, const gl::Vector4 *vector)
+{
+    if (targetUniform->ps.registerCount)
+    {
+        ASSERT(targetUniform->ps.float4Index >= 0);
+        mDevice->SetPixelShaderConstantF(targetUniform->ps.float4Index, (const float *)vector, targetUniform->ps.registerCount);
+    }
+
+    if (targetUniform->vs.registerCount)
+    {
+        ASSERT(targetUniform->vs.float4Index >= 0);
+        mDevice->SetVertexShaderConstantF(targetUniform->vs.float4Index, (const float *)vector, targetUniform->vs.registerCount);
+    }
+}
+
 void Renderer9::clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer)
 {
     D3DCOLOR color = D3DCOLOR_ARGB(gl::unorm<8>(clearParams.colorClearValue.alpha),
diff --git a/src/libGLESv2/renderer/Renderer9.h b/src/libGLESv2/renderer/Renderer9.h
index 9f431b3..aed2a67 100644
--- a/src/libGLESv2/renderer/Renderer9.h
+++ b/src/libGLESv2/renderer/Renderer9.h
@@ -22,7 +22,9 @@
 #include <d3d9.h>
 
 #include "common/angleutils.h"
+#include "libGLESv2/mathutil.h"
 #include "libGLESv2/Context.h"
+#include "libGLESv2/ProgramBinary.h"
 #include "libGLESv2/renderer/ShaderCache.h"
 #include "libGLESv2/renderer/VertexDeclarationCache.h"
 #include "libGLESv2/renderer/Renderer.h"
@@ -90,6 +92,7 @@
 
     virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
     virtual void applyShaders(gl::ProgramBinary *programBinary);
+    virtual void applyUniforms(const gl::UniformArray *uniformArray);
     virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount);
     virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
     virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
@@ -181,6 +184,14 @@
   private:
     DISALLOW_COPY_AND_ASSIGN(Renderer9);
 
+    bool applyUniformnfv(gl::Uniform *targetUniform, const GLfloat *v);
+    bool applyUniform1iv(gl::Uniform *targetUniform, GLsizei count, const GLint *v);
+    bool applyUniform2iv(gl::Uniform *targetUniform, GLsizei count, const GLint *v);
+    bool applyUniform3iv(gl::Uniform *targetUniform, GLsizei count, const GLint *v);
+    bool applyUniform4iv(gl::Uniform *targetUniform, GLsizei count, const GLint *v);
+    void applyUniformniv(gl::Uniform *targetUniform, GLsizei count, const gl::Vector4 *vector);
+    void applyUniformnbv(gl::Uniform *targetUniform, GLsizei count, int width, const GLboolean *v);
+
     void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
 
     void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);