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

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

Issue 1468883002: Fix the crash of compressedTexImage3D for the WebGL2 conformance test page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use the validateTexFuncLevel instead of use new-api. Created 5 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/webgl/WebGL2RenderingContextBase.h" 6 #include "modules/webgl/WebGL2RenderingContextBase.h"
7 7
8 #include "bindings/modules/v8/WebGLAny.h" 8 #include "bindings/modules/v8/WebGLAny.h"
9 #include "core/html/HTMLCanvasElement.h" 9 #include "core/html/HTMLCanvasElement.h"
10 #include "core/html/HTMLImageElement.h" 10 #include "core/html/HTMLImageElement.h"
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 922
923 void WebGL2RenderingContextBase::compressedTexImage3D(GLenum target, GLint level , GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint bor der, DOMArrayBufferView* data) 923 void WebGL2RenderingContextBase::compressedTexImage3D(GLenum target, GLint level , GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint bor der, DOMArrayBufferView* data)
924 { 924 {
925 if (isContextLost()) 925 if (isContextLost())
926 return; 926 return;
927 927
928 WebGLTexture* tex = validateTextureBinding("compressedTexImage3D", target, t rue); 928 WebGLTexture* tex = validateTextureBinding("compressedTexImage3D", target, t rue);
929 if (!tex) 929 if (!tex)
930 return; 930 return;
931 931
932 if (!validateTexFuncLevel("compressedTexImage3D", target, level))
zmo 2015/11/23 19:07:14 I agree with Qiankun this is the right thing to do
933 return;
934
932 if (tex->isImmutable()) { 935 if (tex->isImmutable()) {
933 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexImage3D", "attempt ed to modify immutable texture"); 936 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexImage3D", "attempt ed to modify immutable texture");
934 return; 937 return;
935 } 938 }
936 939
937 webContext()->compressedTexImage3D(target, level, internalformat, width, hei ght, depth, border, data->byteLength(), data->baseAddress()); 940 webContext()->compressedTexImage3D(target, level, internalformat, width, hei ght, depth, border, data->byteLength(), data->baseAddress());
938 tex->setLevelInfo(target, level, internalformat, width, height, depth, GL_UN SIGNED_BYTE); 941 tex->setLevelInfo(target, level, internalformat, width, height, depth, GL_UN SIGNED_BYTE);
939 } 942 }
940 943
941 void WebGL2RenderingContextBase::compressedTexSubImage3D(GLenum target, GLint le vel, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, DOMArrayBufferView* data) 944 void WebGL2RenderingContextBase::compressedTexSubImage3D(GLenum target, GLint le vel, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, DOMArrayBufferView* data)
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after
3125 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() 3128 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat()
3126 { 3129 {
3127 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) 3130 if (m_readFramebufferBinding && m_readFramebufferBinding->object())
3128 return m_readFramebufferBinding->colorBufferFormat(); 3131 return m_readFramebufferBinding->colorBufferFormat();
3129 if (m_requestedAttributes.alpha()) 3132 if (m_requestedAttributes.alpha())
3130 return GL_RGBA; 3133 return GL_RGBA;
3131 return GL_RGB; 3134 return GL_RGB;
3132 } 3135 }
3133 3136
3134 } // namespace blink 3137 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698