Refactor GL tests to use a shader library
Instead of having the same simple shaders repeated over and over in
the test code, reuse a single shader library.
BUG=angleproject:2474
TEST=angle_end2end_tests
Change-Id: I13f8ca8c0125e6d30f1761639bf8c3f69e0e77d2
Reviewed-on: https://chromium-review.googlesource.com/1012078
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/util/shader_utils.h b/util/shader_utils.h
index 6e94e34..fca921b 100644
--- a/util/shader_utils.h
+++ b/util/shader_utils.h
@@ -44,4 +44,98 @@
ANGLE_EXPORT GLuint LoadBinaryProgramOES(const std::vector<uint8_t> &binary, GLenum binaryFormat);
ANGLE_EXPORT GLuint LoadBinaryProgramES3(const std::vector<uint8_t> &binary, GLenum binaryFormat);
+namespace angle
+{
+
+namespace essl1_shaders
+{
+
+ANGLE_EXPORT const char *PositionAttrib();
+ANGLE_EXPORT const char *ColorUniform();
+
+namespace vs
+{
+
+// A shader that sets gl_Position to zero.
+ANGLE_EXPORT const char *Zero();
+
+// A shader that sets gl_Position to attribute a_position.
+ANGLE_EXPORT const char *Simple();
+
+// A shader that passes through attribute a_position, setting it to gl_Position and varying
+// v_position.
+ANGLE_EXPORT const char *Passthrough();
+
+} // namespace vs
+
+namespace fs
+{
+
+// A shader that renders a simple checker pattern of red and green. X axis and y axis separate the
+// different colors. Needs varying v_position.
+ANGLE_EXPORT const char *Checkered();
+
+// A shader that fills with color taken from uniform named "color".
+ANGLE_EXPORT const char *UniformColor();
+
+// A shader that fills with 100% opaque red.
+ANGLE_EXPORT const char *Red();
+
+// A shader that fills with 100% opaque blue.
+ANGLE_EXPORT const char *Blue();
+
+} // namespace fs
+} // namespace essl1_shaders
+
+namespace essl3_shaders
+{
+
+ANGLE_EXPORT const char *PositionAttrib();
+
+namespace vs
+{
+
+// A shader that sets gl_Position to zero.
+ANGLE_EXPORT const char *Zero();
+
+// A shader that sets gl_Position to attribute a_position.
+ANGLE_EXPORT const char *Simple();
+
+} // namespace vs
+
+namespace fs
+{
+
+// A shader that fills with 100% opaque red.
+ANGLE_EXPORT const char *Red();
+
+} // namespace fs
+} // namespace essl3_shaders
+
+namespace essl31_shaders
+{
+
+ANGLE_EXPORT const char *PositionAttrib();
+
+namespace vs
+{
+
+// A shader that sets gl_Position to zero.
+ANGLE_EXPORT const char *Zero();
+
+// A shader that sets gl_Position to attribute a_position.
+ANGLE_EXPORT const char *Simple();
+
+} // namespace vs
+
+namespace fs
+{
+
+// A shader that fills with 100% opaque red.
+ANGLE_EXPORT const char *Red();
+
+} // namespace fs
+} // namespace essl31_shaders
+} // namespace angle
+
#endif // SAMPLE_UTIL_SHADER_UTILS_H