Fix bug with nested struct uniforms.

TRAC #22875

Change-Id: I204cea18a710f6b9206a578a69f1dbc1e13fbd71
Signed-off-by: Shannon Woods
Signed-off-by: Geoff Lang
diff --git a/src/libGLESv2/ProgramBinary.cpp b/src/libGLESv2/ProgramBinary.cpp
index 12c2aa5..397a004 100644
--- a/src/libGLESv2/ProgramBinary.cpp
+++ b/src/libGLESv2/ProgramBinary.cpp
@@ -2377,7 +2377,7 @@
 
 bool ProgramBinary::defineUniform(GLenum shader, const sh::Uniform &constant, InfoLog &infoLog)
 {
-    if (!constant.fields.empty())
+    if (constant.isStruct())
     {
         if (constant.arraySize > 0)
         {
@@ -2389,8 +2389,11 @@
                 {
                     const sh::Uniform &field = constant.fields[fieldIndex];
                     const std::string &uniformName = constant.name + arrayString(elementIndex) + "." + field.name;
-                    const sh::Uniform fieldUniform(field.type, field.precision, uniformName.c_str(), field.arraySize,
-                                                   elementRegisterIndex, field.elementIndex);
+                    sh::Uniform fieldUniform(field.type, field.precision, uniformName.c_str(), field.arraySize,
+                                             elementRegisterIndex, field.elementIndex);
+
+                    fieldUniform.fields = field.fields;
+
                     if (!defineUniform(shader, fieldUniform, infoLog))
                     {
                         return false;