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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index b62b7d4da07522baeaa88b20bec994b1d701239d..ccbe0b796e3241d00237773fb9e1d88dbbf1e0a0 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -2289,6 +2289,15 @@ WebGLActiveInfo* WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* progra
if (isContextLost() || !validateWebGLObject("getActiveAttrib", program))
return nullptr;
WebGraphicsContext3D::ActiveInfo info;
+ GLuint programId = objectNonZero(program);
+ GLint maxNameLength = -1;
+ contextGL()->GetProgramiv(programId, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxNameLength);
+ if (maxNameLength < 0)
+ return nullptr;
+ if (maxNameLength == 0) {
+ synthesizeGLError(GL_INVALID_VALUE, "getActiveAttrib", "no active attributes exist");
+ return nullptr;
+ }
if (!webContext()->getActiveAttrib(objectOrZero(program), index, info))
return nullptr;
return WebGLActiveInfo::create(info.name, info.type, info.size);
@@ -2298,8 +2307,17 @@ WebGLActiveInfo* WebGLRenderingContextBase::getActiveUniform(WebGLProgram* progr
{
if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
return nullptr;
+ GLuint programId = objectNonZero(program);
+ GLint maxNameLength = -1;
+ contextGL()->GetProgramiv(programId, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameLength);
+ if (maxNameLength < 0)
+ return nullptr;
+ if (maxNameLength == 0) {
+ synthesizeGLError(GL_INVALID_VALUE, "getActiveUniform", "no active uniforms exist");
+ return nullptr;
+ }
WebGraphicsContext3D::ActiveInfo info;
- if (!webContext()->getActiveUniform(objectOrZero(program), index, info))
+ if (!webContext()->getActiveUniform(programId, index, info))
return nullptr;
return WebGLActiveInfo::create(info.name, info.type, info.size);
}
@@ -2394,16 +2412,22 @@ void WebGLRenderingContextBase::getContextAttributes(Nullable<WebGLContextAttrib
GLenum WebGLRenderingContextBase::getError()
{
- if (m_lostContextErrors.size()) {
- GLenum err = m_lostContextErrors.first();
+ if (!m_lostContextErrors.isEmpty()) {
+ GLenum error = m_lostContextErrors.first();
m_lostContextErrors.remove(0);
- return err;
+ return error;
}
if (isContextLost())
return GL_NO_ERROR;
- return webContext()->getError();
+ 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 :)
+ GLenum error = m_syntheticErrors.first();
+ m_syntheticErrors.remove(0);
+ return error;
+ }
+
+ return contextGL()->GetError();
}
const char* const* WebGLRenderingContextBase::ExtensionTracker::prefixes() const
@@ -6055,9 +6079,10 @@ void WebGLRenderingContextBase::synthesizeGLError(GLenum error, const char* func
printGLErrorToConsole(message);
}
if (!isContextLost()) {
- webContext()->synthesizeGLError(error);
+ if (!m_syntheticErrors.contains(error))
+ m_syntheticErrors.append(error);
} else {
- if (m_lostContextErrors.find(error) == WTF::kNotFound)
+ if (!m_lostContextErrors.contains(error))
m_lostContextErrors.append(error);
}
InspectorInstrumentation::didFireWebGLError(canvas(), errorType);

Powered by Google App Engine
This is Rietveld 408576698