GLES1: glAlphaFunc
BUG=angleproject:2306
Change-Id: I0bf229d3ab8a4a1217c12b434dcd8fa67d7cbadc
Reviewed-on: https://chromium-review.googlesource.com/973897
Commit-Queue: Lingfeng Yang <lfy@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES1.cpp b/src/libANGLE/validationES1.cpp
index 8f59649..60a34be 100644
--- a/src/libANGLE/validationES1.cpp
+++ b/src/libANGLE/validationES1.cpp
@@ -9,20 +9,53 @@
#include "libANGLE/validationES1.h"
#include "common/debug.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/ErrorStrings.h"
+
+#define ANGLE_VALIDATE_IS_GLES1(context) \
+ if (context->getClientMajorVersion() > 1) \
+ { \
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), GLES1Only); \
+ return false; \
+ }
+
+namespace
+{
+
+bool ValidateAlphaFuncCommon(gl::Context *context, gl::AlphaTestFunc func)
+{
+ switch (func)
+ {
+ case gl::AlphaTestFunc::AlwaysPass:
+ case gl::AlphaTestFunc::Equal:
+ case gl::AlphaTestFunc::Gequal:
+ case gl::AlphaTestFunc::Greater:
+ case gl::AlphaTestFunc::Lequal:
+ case gl::AlphaTestFunc::Less:
+ case gl::AlphaTestFunc::Never:
+ case gl::AlphaTestFunc::NotEqual:
+ return true;
+ default:
+ context->handleError(gl::InvalidEnum() << gl::kErrorEnumNotSupported);
+ return false;
+ }
+}
+
+} // anonymous namespace
namespace gl
{
-bool ValidateAlphaFunc(Context *context, GLenum func, GLfloat ref)
+bool ValidateAlphaFunc(Context *context, AlphaTestFunc func, GLfloat ref)
{
- UNIMPLEMENTED();
- return true;
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return ValidateAlphaFuncCommon(context, func);
}
-bool ValidateAlphaFuncx(Context *context, GLenum func, GLfixed ref)
+bool ValidateAlphaFuncx(Context *context, AlphaTestFunc func, GLfixed ref)
{
- UNIMPLEMENTED();
- return true;
+ ANGLE_VALIDATE_IS_GLES1(context);
+ return ValidateAlphaFuncCommon(context, func);
}
bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)