Fix struct uniform packing.

Our current code would not adapt properly for members that did
not fit in the previous register. Instead, use the correct adjusted
value as returned from the block layout encoder.

This fixes a dEQP WebGL test: gles2/shaders/linkage.

BUG=angle:910

Change-Id: Id77d0c76ce767665b3db97cb4d14e8008254fd9f
Reviewed-on: https://chromium-review.googlesource.com/247241
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/translator/blocklayout.cpp b/src/compiler/translator/blocklayout.cpp
index 9706784..77bf24b 100644
--- a/src/compiler/translator/blocklayout.cpp
+++ b/src/compiler/translator/blocklayout.cpp
@@ -34,6 +34,18 @@
     return memberInfo;
 }
 
+// static
+size_t BlockLayoutEncoder::getBlockRegister(const BlockMemberInfo &info)
+{
+    return (info.offset / BytesPerComponent) / ComponentsPerRegister;
+}
+
+// static
+size_t BlockLayoutEncoder::getBlockRegisterElement(const BlockMemberInfo &info)
+{
+    return (info.offset / BytesPerComponent) % ComponentsPerRegister;
+}
+
 void BlockLayoutEncoder::nextRegister()
 {
     mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, ComponentsPerRegister);