Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1019)

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 1555523002: WebGL: remove validation code for vertexAttribPointer and vertexAttribIPointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unused validations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index e6bae38a812113ee4a06e161d314c457cb47526a..3ca22b4a964a01ca744c2e032aa4ffe3da45db98 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -1436,7 +1436,6 @@ unsigned WebGLRenderingContextBase::sizeInBytes(GLenum type) const
case GL_UNSIGNED_INT_2_10_10_10_REV:
return sizeof(GLuint);
}
- ASSERT_NOT_REACHED();
return 0;
}
@@ -5140,49 +5139,11 @@ void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, const Vector<GLflo
vertexAttribfvImpl("vertexAttrib4fv", index, v.data(), v.size(), 4);
}
-bool WebGLRenderingContextBase::validateVertexAttribPointerTypeAndSize(GLenum type, GLint size)
-{
- switch (type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_FLOAT:
- if (size < 1 || size > 4) {
- synthesizeGLError(GL_INVALID_VALUE, "vertexAttribPointer", "bad size");
- return false;
- }
- return true;
- default:
- synthesizeGLError(GL_INVALID_ENUM, "vertexAttribPointer", "invalid type");
- return false;
- }
-}
-
void WebGLRenderingContextBase::vertexAttribPointer(ScriptState* scriptState, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, long long offset)
{
- if (isContextLost() || !validateVertexAttribPointerTypeAndSize(type, size))
- return;
- if (index >= m_maxVertexAttribs) {
- synthesizeGLError(GL_INVALID_VALUE, "vertexAttribPointer", "index out of range");
- return;
- }
- if (stride < 0 || stride > 255) {
- synthesizeGLError(GL_INVALID_VALUE, "vertexAttribPointer", "bad stride");
- return;
- }
- if (!validateValueFitNonNegInt32("vertexAttribPointer", "offset", offset))
- return;
- if (!m_boundArrayBuffer) {
- synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "no bound ARRAY_BUFFER");
+ if (isContextLost())
return;
- }
unsigned typeSize = sizeInBytes(type);
- ASSERT((typeSize & (typeSize - 1)) == 0); // Ensure that the value is POT.
- if ((stride & (typeSize - 1)) || (static_cast<GLintptr>(offset) & (typeSize - 1))) {
- synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "stride or offset not valid for type");
- return;
- }
GLsizei bytesPerElement = size * typeSize;
m_boundVertexArrayObject->setVertexAttribState(index, bytesPerElement, size, type, normalized, stride, static_cast<GLintptr>(offset), m_boundArrayBuffer);

Powered by Google App Engine
This is Rietveld 408576698