Add GLSL support for runtime-sized arrays in SSBOs

The GLSL parser now allows a runtime-sized array as the last member in
a shader storage block. Clamping indexing against the memory bounds is
done by determining the array length at runtime.

Runtime-sized arrays are used in dEQP tests for many compute shader
tests, so these now work on the OpenGL backend.

BUG=angleproject:1951
TEST=angle_unittests,
     dEQP-GLES31.functional.shaders.linkage.shader_storage_block.*
     dEQP-GLES31.functional.shaders.builtin_functions.*compute*

Change-Id: Ibecca24623ca8e4723af6f0e0421fe9711ea828d
Reviewed-on: https://chromium-review.googlesource.com/787976
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/RemoveArrayLengthMethod.cpp b/src/compiler/translator/RemoveArrayLengthMethod.cpp
index f6f029c..e9e6a17 100644
--- a/src/compiler/translator/RemoveArrayLengthMethod.cpp
+++ b/src/compiler/translator/RemoveArrayLengthMethod.cpp
@@ -16,6 +16,8 @@
 //
 //   Must be run after SplitSequenceOperator, SimplifyLoopConditions and SeparateDeclarations steps
 //   have been done to expressions containing calls of the array length method.
+//
+//   Does nothing to length method calls done on runtime-sized arrays.
 
 #include "compiler/translator/RemoveArrayLengthMethod.h"
 
@@ -45,7 +47,8 @@
 
 bool RemoveArrayLengthTraverser::visitUnary(Visit visit, TIntermUnary *node)
 {
-    if (node->getOp() == EOpArrayLength)
+    // The only case where we leave array length() in place is for runtime-sized arrays.
+    if (node->getOp() == EOpArrayLength && !node->getOperand()->getType().isUnsizedArray())
     {
         mFoundArrayLength = true;
         if (!node->getOperand()->hasSideEffects())