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

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: nits 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
« no previous file with comments | « Source/modules/webgl/WebGL2RenderingContextBase.h ('k') | Source/modules/webgl/WebGLRenderingContextBase.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webgl/WebGL2RenderingContextBase.cpp
diff --git a/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/Source/modules/webgl/WebGL2RenderingContextBase.cpp
index ac4d668041be05faea042a43cee8b63a71352934..0f9248c965aae3da005c6a66f2363dcdb0f7898a 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,29 @@ bool WebGL2RenderingContextBase::validateReadPixelsFormatAndType(GLenum format,
return true;
}
+DOMArrayBufferView::ViewType WebGL2RenderingContextBase::readPixelsExpectedArrayBufferViewType(GLenum type)
+{
+ switch (type) {
+ case GL_BYTE:
+ return DOMArrayBufferView::TypeInt8;
+ case GL_UNSIGNED_SHORT:
+ return DOMArrayBufferView::TypeUint16;
+ case GL_SHORT:
+ return DOMArrayBufferView::TypeInt16;
+ case GL_HALF_FLOAT:
+ return DOMArrayBufferView::TypeUint16;
+ 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:
+ return DOMArrayBufferView::TypeUint32;
+ case GL_INT:
+ return DOMArrayBufferView::TypeInt32;
+ default:
+ return WebGLRenderingContextBase::readPixelsExpectedArrayBufferViewType(type);
+ }
+}
+
WebGLFramebuffer* WebGL2RenderingContextBase::getFramebufferBinding(GLenum target)
{
if (target == GL_READ_FRAMEBUFFER)
« no previous file with comments | « Source/modules/webgl/WebGL2RenderingContextBase.h ('k') | Source/modules/webgl/WebGLRenderingContextBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698