Proper support for token max size in WebGL+ES3.
WebGL specifies a maximum token size of 256 characters, while
ES3 specifies 1024 characters. We can determine the proper max
size to support from the spec.
BUG=angle:550
Change-Id: I6aeabe8af3b6184a27b456248ce2f84f361b76e4
Reviewed-on: https://chromium-review.googlesource.com/186973
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
index da88b9d..9003d8f 100644
--- a/src/compiler/translator/Compiler.cpp
+++ b/src/compiler/translator/Compiler.cpp
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -29,6 +29,21 @@
return spec == SH_WEBGL_SPEC || spec == SH_CSS_SHADERS_SPEC;
}
+size_t GetGlobalMaxTokenSize()
+{
+ TParseContext *parseContext = GetGlobalParseContext();
+ // WebGL defines a max token legnth of 256, while ES2 leaves max token
+ // size undefined. ES3 defines a max size of 1024 characters.
+ if (isWebGLBasedSpec(parseContext->shaderSpec))
+ {
+ return 256;
+ }
+ else
+ {
+ return 1024;
+ }
+}
+
namespace {
class TScopedPoolAllocator
{