Fix incorrect hashing on built-in interface block fields
This patch intends to fix an error in translating built-in interface
block fields. Any field of a built-in interface block should be kept
and cannot be hashed.
This patch can fix a bug in handling the interface block gl_in when
we try to output the translated geometry shader string.
BUG=angleproject:1941
TEST=angle_unittest
Change-Id: Iebfba4b6a30c8942ed0f66131ad30d12ad96c62a
Reviewed-on: https://chromium-review.googlesource.com/719454
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index bc4867a..a2776e9 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -582,9 +582,14 @@
const TField *field = interfaceBlock->fields()[index->getIConst(0)];
TString fieldName = field->name();
- ASSERT(!mSymbolTable->findBuiltIn(interfaceBlock->name(), mShaderVersion) ||
- interfaceBlock->name() == "gl_PerVertex");
- fieldName = hashName(TName(fieldName));
+ if (!mSymbolTable->findBuiltIn(interfaceBlock->name(), mShaderVersion))
+ {
+ fieldName = hashName(TName(fieldName));
+ }
+ else
+ {
+ ASSERT(interfaceBlock->name() == "gl_PerVertex");
+ }
out << fieldName;
visitChildren = false;