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

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

Issue 1537403003: WebGL2: add types to fix bugs for vertexAttribPointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: a small fix 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 f686778137485bd46bc8a6e7538e2283d0369b50..35da67f40da76fd11b87907f8423fba5a535a029 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -1447,6 +1447,23 @@ void WebGL2RenderingContextBase::vertexAttribIuivImpl(const char* functionName,
attribValue.value.uintValue[3] = value[3];
}
+unsigned WebGL2RenderingContextBase::sizeInBytes(GLenum type, bool isIntegerAPI) const
+{
+ switch (type) {
+ case GL_HALF_FLOAT:
+ ASSERT(!isIntegerAPI);
+ return sizeof(GLushort);
+ case GL_INT_2_10_10_10_REV:
+ ASSERT(!isIntegerAPI);
+ return sizeof(GLint);
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ ASSERT(!isIntegerAPI);
+ return sizeof(GLuint);
+ default:
+ return WebGLRenderingContextBase::sizeInBytes(type, isIntegerAPI);
+ }
+}
+
bool WebGL2RenderingContextBase::validateVertexAttribPointerTypeAndSize(GLenum type, GLint size)
{
switch (type) {
@@ -1511,7 +1528,7 @@ void WebGL2RenderingContextBase::vertexAttribIPointer(GLuint index, GLint size,
synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribIPointer", "no bound ARRAY_BUFFER");
return;
}
- unsigned typeSize = sizeInBytes(type);
+ unsigned typeSize = sizeInBytes(type, true);
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");

Powered by Google App Engine
This is Rietveld 408576698