GLES1: glMultiTexCoord4(f|x)
BUG=angleproject:2306
+ common validation for multitexturing units
+ clang-format
Change-Id: I6eb456c273490e85fc7008e7e11d15e22dd20276
Reviewed-on: https://chromium-review.googlesource.com/987298
Commit-Queue: Lingfeng Yang <lfy@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index ada0959..4ff8d4a 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -90,8 +90,8 @@
// If we have no buffer, then we either get an error, or there are no more checks to be
// done.
- const VertexBinding &binding = vertexBindings[attrib.bindingIndex];
- gl::Buffer *buffer = binding.getBuffer().get();
+ const VertexBinding &binding = vertexBindings[attrib.bindingIndex];
+ gl::Buffer *buffer = binding.getBuffer().get();
if (!buffer)
{
if (webglCompatibility || !state.areClientArraysEnabled())
@@ -477,7 +477,7 @@
bool ValidateVertexShaderAttributeTypeMatch(Context *context)
{
- const auto &glState = context->getGLState();
+ const auto &glState = context->getGLState();
const Program *program = context->getGLState().getProgram();
const VertexArray *vao = context->getGLState().getVertexArray();
@@ -1333,7 +1333,7 @@
GLenum drawComponentType = drawFormat.info->componentType;
bool readFixedPoint = (readComponentType == GL_UNSIGNED_NORMALIZED ||
readComponentType == GL_SIGNED_NORMALIZED);
- bool drawFixedPoint = (drawComponentType == GL_UNSIGNED_NORMALIZED ||
+ bool drawFixedPoint = (drawComponentType == GL_UNSIGNED_NORMALIZED ||
drawComponentType == GL_SIGNED_NORMALIZED);
if (extensions.colorBufferFloat)
@@ -2753,7 +2753,7 @@
uniformBlockIndex < program->getActiveUniformBlockCount(); uniformBlockIndex++)
{
const gl::InterfaceBlock &uniformBlock = program->getUniformBlockByIndex(uniformBlockIndex);
- GLuint blockBinding = program->getUniformBlockBinding(uniformBlockIndex);
+ GLuint blockBinding = program->getUniformBlockBinding(uniformBlockIndex);
const OffsetBindingPointer<Buffer> &uniformBuffer =
state.getIndexedUniformBuffer(blockBinding);
@@ -5743,26 +5743,26 @@
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
case GL_TEXTURE_WRAP_R:
+ {
+ bool restrictedWrapModes =
+ target == TextureType::External || target == TextureType::Rectangle;
+ if (!ValidateTextureWrapModeValue(context, params, restrictedWrapModes))
{
- bool restrictedWrapModes =
- target == TextureType::External || target == TextureType::Rectangle;
- if (!ValidateTextureWrapModeValue(context, params, restrictedWrapModes))
- {
- return false;
- }
+ return false;
}
- break;
+ }
+ break;
case GL_TEXTURE_MIN_FILTER:
+ {
+ bool restrictedMinFilter =
+ target == TextureType::External || target == TextureType::Rectangle;
+ if (!ValidateTextureMinFilterValue(context, params, restrictedMinFilter))
{
- bool restrictedMinFilter =
- target == TextureType::External || target == TextureType::Rectangle;
- if (!ValidateTextureMinFilterValue(context, params, restrictedMinFilter))
- {
- return false;
- }
+ return false;
}
- break;
+ }
+ break;
case GL_TEXTURE_MAG_FILTER:
if (!ValidateTextureMagFilterValue(context, params))
@@ -5791,15 +5791,15 @@
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ {
+ GLfloat paramValue = static_cast<GLfloat>(params[0]);
+ if (!ValidateTextureMaxAnisotropyValue(context, paramValue))
{
- GLfloat paramValue = static_cast<GLfloat>(params[0]);
- if (!ValidateTextureMaxAnisotropyValue(context, paramValue))
- {
- return false;
- }
- ASSERT(static_cast<ParamType>(paramValue) == params[0]);
+ return false;
}
- break;
+ ASSERT(static_cast<ParamType>(paramValue) == params[0]);
+ }
+ break;
case GL_TEXTURE_MIN_LOD:
case GL_TEXTURE_MAX_LOD:
@@ -6253,4 +6253,14 @@
return true;
}
+bool ValidateMultitextureUnit(Context *context, GLenum texture)
+{
+ if (texture < GL_TEXTURE0 || texture >= GL_TEXTURE0 + context->getCaps().maxMultitextureUnits)
+ {
+ ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMultitextureUnit);
+ return false;
+ }
+ return true;
+}
+
} // namespace gl