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

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

Issue 1288303002: WebGL 2: add types into glReadPixels (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: To make the code snippet clearer, override the part of getting ArrayBuffer ViewType in readPixels f… Created 5 years, 4 months 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: Source/modules/webgl/WebGL2RenderingContextBase.cpp
diff --git a/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/Source/modules/webgl/WebGL2RenderingContextBase.cpp
index ac4d668041be05faea042a43cee8b63a71352934..d51c2186c904e2db4261c7bae02d7dc17a14b74a 100644
--- a/Source/modules/webgl/WebGL2RenderingContextBase.cpp
+++ b/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -2115,9 +2115,11 @@ bool WebGL2RenderingContextBase::validateReadPixelsFormatAndType(GLenum format,
case GL_BYTE:
case GL_HALF_FLOAT:
case GL_FLOAT:
+ case GL_UNSIGNED_SHORT:
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_SHORT:
case GL_UNSIGNED_INT:
case GL_UNSIGNED_INT_2_10_10_10_REV:
case GL_UNSIGNED_INT_10F_11F_11F_REV:
@@ -2132,6 +2134,37 @@ bool WebGL2RenderingContextBase::validateReadPixelsFormatAndType(GLenum format,
return true;
}
+DOMArrayBufferView::ViewType WebGL2RenderingContextBase::readPixelsExpectedArrayBufferViewType(GLenum type)
+{
+ DOMArrayBufferView::ViewType expectedViewType;
Zhenyao Mo 2015/08/14 16:07:42 nit: you don't need this expectedViewType. You ca
+ switch (type) {
+ case GL_BYTE:
+ expectedViewType = DOMArrayBufferView::TypeInt8;
+ break;
+ case GL_UNSIGNED_SHORT:
+ expectedViewType = DOMArrayBufferView::TypeUint16;
+ break;
+ case GL_SHORT:
+ expectedViewType = DOMArrayBufferView::TypeInt16;
+ break;
+ case GL_HALF_FLOAT:
+ expectedViewType = DOMArrayBufferView::TypeUint16;
+ break;
+ case GL_UNSIGNED_INT:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_10F_11F_11F_REV:
+ case GL_UNSIGNED_INT_5_9_9_9_REV:
+ expectedViewType = DOMArrayBufferView::TypeUint32;
+ break;
+ case GL_INT:
+ expectedViewType = DOMArrayBufferView::TypeInt32;
+ break;
+ default:
+ return WebGLRenderingContextBase::readPixelsExpectedArrayBufferViewType(type);
+ }
+ return expectedViewType;
+}
+
WebGLFramebuffer* WebGL2RenderingContextBase::getFramebufferBinding(GLenum target)
{
if (target == GL_READ_FRAMEBUFFER)

Powered by Google App Engine
This is Rietveld 408576698