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

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

Issue 1824433002: Remove getError() and synthesizeGLError() from WebGraphicsContext3D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simples-tplus
Patch Set: Created 4 years, 9 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
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 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 if (!validateTextureBinding("generateMipmap", target)) 2282 if (!validateTextureBinding("generateMipmap", target))
2283 return; 2283 return;
2284 contextGL()->GenerateMipmap(target); 2284 contextGL()->GenerateMipmap(target);
2285 } 2285 }
2286 2286
2287 WebGLActiveInfo* WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* progra m, GLuint index) 2287 WebGLActiveInfo* WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* progra m, GLuint index)
2288 { 2288 {
2289 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) 2289 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program))
2290 return nullptr; 2290 return nullptr;
2291 WebGraphicsContext3D::ActiveInfo info; 2291 WebGraphicsContext3D::ActiveInfo info;
2292 GLuint programId = objectNonZero(program);
2293 GLint maxNameLength = -1;
2294 contextGL()->GetProgramiv(programId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxNam eLength);
2295 if (maxNameLength < 0)
2296 return nullptr;
2297 if (maxNameLength == 0) {
2298 synthesizeGLError(GL_INVALID_VALUE, "getActiveAttrib", "no active attrib utes exist");
2299 return nullptr;
2300 }
2292 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) 2301 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info))
2293 return nullptr; 2302 return nullptr;
2294 return WebGLActiveInfo::create(info.name, info.type, info.size); 2303 return WebGLActiveInfo::create(info.name, info.type, info.size);
2295 } 2304 }
2296 2305
2297 WebGLActiveInfo* WebGLRenderingContextBase::getActiveUniform(WebGLProgram* progr am, GLuint index) 2306 WebGLActiveInfo* WebGLRenderingContextBase::getActiveUniform(WebGLProgram* progr am, GLuint index)
2298 { 2307 {
2299 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) 2308 if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
2300 return nullptr; 2309 return nullptr;
2310 GLuint programId = objectNonZero(program);
2311 GLint maxNameLength = -1;
2312 contextGL()->GetProgramiv(programId, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameL ength);
2313 if (maxNameLength < 0)
2314 return nullptr;
2315 if (maxNameLength == 0) {
2316 synthesizeGLError(GL_INVALID_VALUE, "getActiveUniform", "no active unifo rms exist");
2317 return nullptr;
2318 }
2301 WebGraphicsContext3D::ActiveInfo info; 2319 WebGraphicsContext3D::ActiveInfo info;
2302 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) 2320 if (!webContext()->getActiveUniform(programId, index, info))
2303 return nullptr; 2321 return nullptr;
2304 return WebGLActiveInfo::create(info.name, info.type, info.size); 2322 return WebGLActiveInfo::create(info.name, info.type, info.size);
2305 } 2323 }
2306 2324
2307 Nullable<HeapVector<Member<WebGLShader>>> WebGLRenderingContextBase::getAttached Shaders(WebGLProgram* program) 2325 Nullable<HeapVector<Member<WebGLShader>>> WebGLRenderingContextBase::getAttached Shaders(WebGLProgram* program)
2308 { 2326 {
2309 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) 2327 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program))
2310 return nullptr; 2328 return nullptr;
2311 2329
2312 HeapVector<Member<WebGLShader>> shaderObjects; 2330 HeapVector<Member<WebGLShader>> shaderObjects;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2387 WebGraphicsContext3D::Attributes attrs = drawingBuffer()->getActualAttribute s(); 2405 WebGraphicsContext3D::Attributes attrs = drawingBuffer()->getActualAttribute s();
2388 if (m_requestedAttributes.depth() && !attrs.depth) 2406 if (m_requestedAttributes.depth() && !attrs.depth)
2389 result.get().setDepth(false); 2407 result.get().setDepth(false);
2390 if (m_requestedAttributes.stencil() && !attrs.stencil) 2408 if (m_requestedAttributes.stencil() && !attrs.stencil)
2391 result.get().setStencil(false); 2409 result.get().setStencil(false);
2392 result.get().setAntialias(drawingBuffer()->multisample()); 2410 result.get().setAntialias(drawingBuffer()->multisample());
2393 } 2411 }
2394 2412
2395 GLenum WebGLRenderingContextBase::getError() 2413 GLenum WebGLRenderingContextBase::getError()
2396 { 2414 {
2397 if (m_lostContextErrors.size()) { 2415 if (!m_lostContextErrors.isEmpty()) {
2398 GLenum err = m_lostContextErrors.first(); 2416 GLenum error = m_lostContextErrors.first();
2399 m_lostContextErrors.remove(0); 2417 m_lostContextErrors.remove(0);
2400 return err; 2418 return error;
2401 } 2419 }
2402 2420
2403 if (isContextLost()) 2421 if (isContextLost())
2404 return GL_NO_ERROR; 2422 return GL_NO_ERROR;
2405 2423
2406 return webContext()->getError(); 2424 if (m_syntheticErrors.isEmpty()) {
Ken Russell (switch to Gerrit) 2016/03/19 04:36:04 Need "!".
danakj 2016/03/21 22:45:13 Oops, thanks :)
2425 GLenum error = m_syntheticErrors.first();
2426 m_syntheticErrors.remove(0);
2427 return error;
2428 }
2429
2430 return contextGL()->GetError();
2407 } 2431 }
2408 2432
2409 const char* const* WebGLRenderingContextBase::ExtensionTracker::prefixes() const 2433 const char* const* WebGLRenderingContextBase::ExtensionTracker::prefixes() const
2410 { 2434 {
2411 static const char* const unprefixed[] = { "", 0, }; 2435 static const char* const unprefixed[] = { "", 0, };
2412 return m_prefixes ? m_prefixes : unprefixed; 2436 return m_prefixes ? m_prefixes : unprefixed;
2413 } 2437 }
2414 2438
2415 bool WebGLRenderingContextBase::ExtensionTracker::matchesNameWithPrefixes(const String& name) const 2439 bool WebGLRenderingContextBase::ExtensionTracker::matchesNameWithPrefixes(const String& name) const
2416 { 2440 {
(...skipping 3631 matching lines...) Expand 10 before | Expand all | Expand 10 after
6048 } // namespace 6072 } // namespace
6049 6073
6050 void WebGLRenderingContextBase::synthesizeGLError(GLenum error, const char* func tionName, const char* description, ConsoleDisplayPreference display) 6074 void WebGLRenderingContextBase::synthesizeGLError(GLenum error, const char* func tionName, const char* description, ConsoleDisplayPreference display)
6051 { 6075 {
6052 String errorType = GetErrorString(error); 6076 String errorType = GetErrorString(error);
6053 if (m_synthesizedErrorsToConsole && display == DisplayInConsole) { 6077 if (m_synthesizedErrorsToConsole && display == DisplayInConsole) {
6054 String message = String("WebGL: ") + errorType + ": " + String(function Name) + ": " + String(description); 6078 String message = String("WebGL: ") + errorType + ": " + String(function Name) + ": " + String(description);
6055 printGLErrorToConsole(message); 6079 printGLErrorToConsole(message);
6056 } 6080 }
6057 if (!isContextLost()) { 6081 if (!isContextLost()) {
6058 webContext()->synthesizeGLError(error); 6082 if (!m_syntheticErrors.contains(error))
6083 m_syntheticErrors.append(error);
6059 } else { 6084 } else {
6060 if (m_lostContextErrors.find(error) == WTF::kNotFound) 6085 if (!m_lostContextErrors.contains(error))
6061 m_lostContextErrors.append(error); 6086 m_lostContextErrors.append(error);
6062 } 6087 }
6063 InspectorInstrumentation::didFireWebGLError(canvas(), errorType); 6088 InspectorInstrumentation::didFireWebGLError(canvas(), errorType);
6064 } 6089 }
6065 6090
6066 void WebGLRenderingContextBase::emitGLWarning(const char* functionName, const ch ar* description) 6091 void WebGLRenderingContextBase::emitGLWarning(const char* functionName, const ch ar* description)
6067 { 6092 {
6068 if (m_synthesizedErrorsToConsole) { 6093 if (m_synthesizedErrorsToConsole) {
6069 String message = String("WebGL: ") + String(functionName) + ": " + Strin g(description); 6094 String message = String("WebGL: ") + String(functionName) + ": " + Strin g(description);
6070 printGLErrorToConsole(message); 6095 printGLErrorToConsole(message);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
6289 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6314 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6290 } 6315 }
6291 6316
6292 void WebGLRenderingContextBase::restoreUnpackParameters() 6317 void WebGLRenderingContextBase::restoreUnpackParameters()
6293 { 6318 {
6294 if (m_unpackAlignment != 1) 6319 if (m_unpackAlignment != 1)
6295 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6320 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6296 } 6321 }
6297 6322
6298 } // namespace blink 6323 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698