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

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

Issue 1938493002: [Reland] Fix ReadPixels from float fbo buffer in ES2/WebGL1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: 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 828b87526c2c11865bb0ea7505af94a6f06e7b7a..294e0c46f234963ceb291f12a10d635e4897d627 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -3548,7 +3548,7 @@ bool WebGLRenderingContextBase::validateReadPixelsFormatAndType(GLenum format, G
}
return true;
case GL_FLOAT:
- if (extensionEnabled(OESTextureFloatName)) {
+ if (extensionEnabled(OESTextureFloatName) || extensionEnabled(OESTextureHalfFloatName)) {
if (buffer && buffer->type() != DOMArrayBufferView::TypeFloat32) {
synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "type FLOAT but ArrayBufferView not Float32Array");
return false;
@@ -5128,8 +5128,21 @@ ScriptValue WebGLRenderingContextBase::getFloatParameter(ScriptState* scriptStat
ScriptValue WebGLRenderingContextBase::getIntParameter(ScriptState* scriptState, GLenum pname)
{
GLint value = 0;
- if (!isContextLost())
+ if (!isContextLost()) {
contextGL()->GetIntegerv(pname, &value);
+ switch (pname) {
+ case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
+ case GL_IMPLEMENTATION_COLOR_READ_TYPE:
+ if (value == 0) {
+ // This indicates read framebuffer is incomplete and an
+ // INVALID_OPERATION has been generated.
+ return ScriptValue::createNull(scriptState);
+ }
+ break;
+ default:
+ break;
+ }
+ }
return WebGLAny(scriptState, value);
}

Powered by Google App Engine
This is Rietveld 408576698