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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 1929203003: Revert of 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, 7 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/tests/gl_readback_unittest.cc ('k') | ui/gl/gl_implementation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 3502 matching lines...) Expand 10 before | Expand all | Expand 10 after
3513 return true; 3513 return true;
3514 case GL_UNSIGNED_SHORT_5_6_5: 3514 case GL_UNSIGNED_SHORT_5_6_5:
3515 case GL_UNSIGNED_SHORT_4_4_4_4: 3515 case GL_UNSIGNED_SHORT_4_4_4_4:
3516 case GL_UNSIGNED_SHORT_5_5_5_1: 3516 case GL_UNSIGNED_SHORT_5_5_5_1:
3517 if (buffer && buffer->type() != DOMArrayBufferView::TypeUint16) { 3517 if (buffer && buffer->type() != DOMArrayBufferView::TypeUint16) {
3518 synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "type UNSIGNED _SHORT but ArrayBufferView not Uint16Array"); 3518 synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "type UNSIGNED _SHORT but ArrayBufferView not Uint16Array");
3519 return false; 3519 return false;
3520 } 3520 }
3521 return true; 3521 return true;
3522 case GL_FLOAT: 3522 case GL_FLOAT:
3523 if (extensionEnabled(OESTextureFloatName) || extensionEnabled(OESTexture HalfFloatName)) { 3523 if (extensionEnabled(OESTextureFloatName)) {
3524 if (buffer && buffer->type() != DOMArrayBufferView::TypeFloat32) { 3524 if (buffer && buffer->type() != DOMArrayBufferView::TypeFloat32) {
3525 synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "type FLOA T but ArrayBufferView not Float32Array"); 3525 synthesizeGLError(GL_INVALID_OPERATION, "readPixels", "type FLOA T but ArrayBufferView not Float32Array");
3526 return false; 3526 return false;
3527 } 3527 }
3528 return true; 3528 return true;
3529 } 3529 }
3530 synthesizeGLError(GL_INVALID_ENUM, "readPixels", "invalid type"); 3530 synthesizeGLError(GL_INVALID_ENUM, "readPixels", "invalid type");
3531 return false; 3531 return false;
3532 case GL_HALF_FLOAT_OES: 3532 case GL_HALF_FLOAT_OES:
3533 if (extensionEnabled(OESTextureHalfFloatName)) { 3533 if (extensionEnabled(OESTextureHalfFloatName)) {
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
5093 { 5093 {
5094 GLfloat value = 0; 5094 GLfloat value = 0;
5095 if (!isContextLost()) 5095 if (!isContextLost())
5096 contextGL()->GetFloatv(pname, &value); 5096 contextGL()->GetFloatv(pname, &value);
5097 return WebGLAny(scriptState, value); 5097 return WebGLAny(scriptState, value);
5098 } 5098 }
5099 5099
5100 ScriptValue WebGLRenderingContextBase::getIntParameter(ScriptState* scriptState, GLenum pname) 5100 ScriptValue WebGLRenderingContextBase::getIntParameter(ScriptState* scriptState, GLenum pname)
5101 { 5101 {
5102 GLint value = 0; 5102 GLint value = 0;
5103 if (!isContextLost()) { 5103 if (!isContextLost())
5104 contextGL()->GetIntegerv(pname, &value); 5104 contextGL()->GetIntegerv(pname, &value);
5105 switch (pname) {
5106 case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
5107 case GL_IMPLEMENTATION_COLOR_READ_TYPE:
5108 if (value == 0) {
5109 // This indicates read framebuffer is incomplete and an
5110 // INVALID_OPERATION has been generated.
5111 return ScriptValue::createNull(scriptState);
5112 }
5113 break;
5114 default:
5115 break;
5116 }
5117 }
5118 return WebGLAny(scriptState, value); 5105 return WebGLAny(scriptState, value);
5119 } 5106 }
5120 5107
5121 ScriptValue WebGLRenderingContextBase::getInt64Parameter(ScriptState* scriptStat e, GLenum pname) 5108 ScriptValue WebGLRenderingContextBase::getInt64Parameter(ScriptState* scriptStat e, GLenum pname)
5122 { 5109 {
5123 GLint64 value = 0; 5110 GLint64 value = 0;
5124 if (!isContextLost()) 5111 if (!isContextLost())
5125 contextGL()->GetInteger64v(pname, &value); 5112 contextGL()->GetInteger64v(pname, &value);
5126 return WebGLAny(scriptState, value); 5113 return WebGLAny(scriptState, value);
5127 } 5114 }
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
6235 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6222 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6236 } 6223 }
6237 6224
6238 void WebGLRenderingContextBase::restoreUnpackParameters() 6225 void WebGLRenderingContextBase::restoreUnpackParameters()
6239 { 6226 {
6240 if (m_unpackAlignment != 1) 6227 if (m_unpackAlignment != 1)
6241 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6228 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6242 } 6229 }
6243 6230
6244 } // namespace blink 6231 } // namespace blink
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_readback_unittest.cc ('k') | ui/gl/gl_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698