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

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

Issue 1483403002: Fix the crash problem on WebGL2 conformance test of negative state api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 return String(); 2204 return String();
2205 2205
2206 GLint maxNameLength = -1; 2206 GLint maxNameLength = -1;
2207 webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCK_MA X_NAME_LENGTH, &maxNameLength); 2207 webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCK_MA X_NAME_LENGTH, &maxNameLength);
2208 if (maxNameLength <= 0) { 2208 if (maxNameLength <= 0) {
2209 // This state indicates that there are no active uniform blocks 2209 // This state indicates that there are no active uniform blocks
2210 synthesizeGLError(GL_INVALID_VALUE, "getActiveUniformBlockName", "invali d uniform block index"); 2210 synthesizeGLError(GL_INVALID_VALUE, "getActiveUniformBlockName", "invali d uniform block index");
2211 return String(); 2211 return String();
2212 } 2212 }
2213 OwnPtr<GLchar[]> name = adoptArrayPtr(new GLchar[maxNameLength]); 2213 OwnPtr<GLchar[]> name = adoptArrayPtr(new GLchar[maxNameLength]);
2214 GLsizei length; 2214
2215 GLsizei length = -1;
Zhenyao Mo 2015/12/02 00:46:10 Initialize length to 0 is enough, returning String
2215 webContext()->getActiveUniformBlockName(objectOrZero(program), uniformBlockI ndex, maxNameLength, &length, name.get()); 2216 webContext()->getActiveUniformBlockName(objectOrZero(program), uniformBlockI ndex, maxNameLength, &length, name.get());
2217 if (length <= 0) {
2218 synthesizeGLError(GL_INVALID_VALUE, "getActiveUniformBlockName", "invali d uniform block name string");
Ken Russell (switch to Gerrit) 2015/12/02 00:38:42 Is it necessary to synthesize a GL error? One shou
2219 return String();
2220 }
2216 return String(name.get(), length); 2221 return String(name.get(), length);
2217 } 2222 }
2218 2223
2219 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui nt uniformBlockIndex, GLuint uniformBlockBinding) 2224 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui nt uniformBlockIndex, GLuint uniformBlockBinding)
2220 { 2225 {
2221 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) 2226 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program))
2222 return; 2227 return;
2223 2228
2224 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex, uniformBlockBinding); 2229 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex, uniformBlockBinding);
2225 } 2230 }
(...skipping 899 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 | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698