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

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: Add the check validation of level. 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 | third_party/WebKit/Source/modules/webgl/WebGLTexture.h » ('j') | 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 (!tex->isValidLevel(target, level)) {
qiankun 2015/11/23 12:06:53 Please use validateTexFuncLevel(). You can refer t
933 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexImage3D", "level d oes not valid");
934 return;
935 }
936
932 if (tex->isImmutable()) { 937 if (tex->isImmutable()) {
933 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexImage3D", "attempt ed to modify immutable texture"); 938 synthesizeGLError(GL_INVALID_OPERATION, "compressedTexImage3D", "attempt ed to modify immutable texture");
934 return; 939 return;
935 } 940 }
936 941
937 webContext()->compressedTexImage3D(target, level, internalformat, width, hei ght, depth, border, data->byteLength(), data->baseAddress()); 942 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); 943 tex->setLevelInfo(target, level, internalformat, width, height, depth, GL_UN SIGNED_BYTE);
939 } 944 }
940 945
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) 946 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() 3130 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat()
3126 { 3131 {
3127 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) 3132 if (m_readFramebufferBinding && m_readFramebufferBinding->object())
3128 return m_readFramebufferBinding->colorBufferFormat(); 3133 return m_readFramebufferBinding->colorBufferFormat();
3129 if (m_requestedAttributes.alpha()) 3134 if (m_requestedAttributes.alpha())
3130 return GL_RGBA; 3135 return GL_RGBA;
3131 return GL_RGB; 3136 return GL_RGB;
3132 } 3137 }
3133 3138
3134 } // namespace blink 3139 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webgl/WebGLTexture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698