Refactor CompileProgram utility
Tests often need to call gl functions to set up program related state
after glCreateProgram has been called but prior to glLinkProgram is
called. Add a callback function to the CompileProgram utility function
to fulfill this need. This reduces code duplication considerably in
several tests.
An alternative way to improve CompileProgram would be to split it into
several different utility functions. This might be slightly easier to
read, but would also be a larger refactoring and require more checks
at the call site.
This will make it easier to implement EXT_blend_func_extended tests,
which need to bind fragment outputs to different slots.
BUG=angleproject:1085
TEST=angle_end2end_tests
Change-Id: I3ac8b7bdc21c6a1f14517bc7df0cf6f35abd7612
Reviewed-on: https://chromium-review.googlesource.com/1254062
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/util/shader_utils.h b/util/shader_utils.h
index 443222c..f93e862 100644
--- a/util/shader_utils.h
+++ b/util/shader_utils.h
@@ -15,6 +15,7 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
+#include <functional>
#include <string>
#include <vector>
@@ -27,14 +28,13 @@
const std::string &fsSource,
const std::vector<std::string> &transformFeedbackVaryings,
GLenum bufferMode);
-ANGLE_EXPORT GLuint
-CompileProgramWithGSAndTransformFeedback(const std::string &vsSource,
- const std::string &gsSource,
- const std::string &fsSource,
- const std::vector<std::string> &transformFeedbackVaryings,
- GLenum bufferMode);
+
ANGLE_EXPORT GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource);
+ANGLE_EXPORT GLuint CompileProgram(const std::string &vsSource,
+ const std::string &fsSource,
+ const std::function<void(GLuint)> &preLinkCallback);
+
ANGLE_EXPORT GLuint CompileProgramWithGS(const std::string &vsSource,
const std::string &gsSource,
const std::string &fsSource);