Clean up redundant initialization of gl_Position
In case gl_Position is statically used in the input shader, setting
the INIT_OUTPUT_VARIABLES flag will initialize gl_Position. Avoid
redundant initialization of gl_Position in this case.
Includes cleaning up memory management in InitOutputVariables_test:
all the pool-allocated variables will be freed at the end of each test
when the memory pool is cleared, so manual memory management is not
needed.
Also includes making the zero node check used in unit tests stricter
so that the tests are more reliable and moving it to
ShaderCompileTreeTest.h so that it can be reused in the future.
BUG=angleproject:2092
TEST=angle_unittests
Change-Id: I323a0a094afa6cea95c8a64e681d9fc485137423
Reviewed-on: https://chromium-review.googlesource.com/549418
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/test_utils/ShaderCompileTreeTest.h b/src/tests/test_utils/ShaderCompileTreeTest.h
index dc5eac6..d2188da 100644
--- a/src/tests/test_utils/ShaderCompileTreeTest.h
+++ b/src/tests/test_utils/ShaderCompileTreeTest.h
@@ -19,6 +19,7 @@
{
class TIntermBlock;
+class TIntermNode;
class TranslatorESSL;
class ShaderCompileTreeTest : public testing::Test
@@ -54,6 +55,10 @@
TPoolAllocator mAllocator;
};
+// Returns true if the node is some kind of a zero node - either constructor or a constant union
+// node.
+bool IsZero(TIntermNode *node);
+
} // namespace sh
#endif // TESTS_TEST_UTILS_SHADER_COMPILE_TREE_TEST_H_