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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.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/WebGL2RenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
index 459901c6163fb260ba22d8f1a14e834cbf95cb8e..b7c7d40450d650305cb64b97fba20959ce9728ce 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -1451,76 +1451,11 @@ void WebGL2RenderingContextBase::vertexAttribIuivImpl(const char* functionName,
attribValue.value.uintValue[3] = value[3];
}
-bool WebGL2RenderingContextBase::validateVertexAttribPointerTypeAndSize(GLenum type, GLint size)
-{
- switch (type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- case GL_HALF_FLOAT:
- if (size < 1 || size > 4) {
- synthesizeGLError(GL_INVALID_VALUE, "vertexAttribPointer", "invalid size");
- return false;
- }
- return true;
- case GL_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- if (size < 1 || size > 4) {
- synthesizeGLError(GL_INVALID_VALUE, "vertexAttribPointer", "invalid size");
- return false;
- }
- if (size != 4) {
- synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "size != 4");
- return false;
- }
- return true;
- default:
- synthesizeGLError(GL_INVALID_ENUM, "vertexAttribPointer", "invalid type");
- return false;
- }
-}
-
void WebGL2RenderingContextBase::vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, long long offset)
{
if (isContextLost())
return;
-
- switch (type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- break;
- default:
- synthesizeGLError(GL_INVALID_ENUM, "vertexAttribIPointer", "invalid type");
- return;
- }
- if (index >= m_maxVertexAttribs) {
- synthesizeGLError(GL_INVALID_VALUE, "vertexAttribIPointer", "index out of range");
- return;
- }
- if (size < 1 || size > 4 || stride < 0 || stride > 255) {
- synthesizeGLError(GL_INVALID_VALUE, "vertexAttribIPointer", "bad size or stride");
- return;
- }
- if (!validateValueFitNonNegInt32("vertexAttribIPointer", "offset", offset))
- return;
- if (!m_boundArrayBuffer) {
- synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribIPointer", "no bound ARRAY_BUFFER");
- 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, "vertexAttribIPointer", "stride or offset not valid for type");
- return;
- }
GLsizei bytesPerElement = size * typeSize;
m_boundVertexArrayObject->setVertexAttribState(index, bytesPerElement, size, type, false, stride, static_cast<GLintptr>(offset), m_boundArrayBuffer);
Zhenyao Mo 2015/12/29 22:04:04 When you remove the above validation, then you end
yunchao 2015/12/30 01:02:11 Yeah, that's true. But Chromium will report error/

Powered by Google App Engine
This is Rietveld 408576698