--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -546,16 +546,17 @@ public:
}
};
////////////////////////////////////////
void
WebGLContext::DrawArrays(GLenum mode, GLint first, GLsizei vertCount)
{
+ AUTO_PROFILER_LABEL("WebGLContext::DrawArrays", GRAPHICS);
const char funcName[] = "drawArrays";
if (IsContextLost())
return;
MakeContextCurrent();
bool error = false;
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
@@ -572,27 +573,29 @@ WebGLContext::DrawArrays(GLenum mode, GL
const ScopedDrawWithTransformFeedback scopedTF(this, funcName, mode, vertCount,
instanceCount, &error);
if (error)
return;
{
ScopedDrawCallWrapper wrapper(*this);
+ AUTO_PROFILER_LABEL("glDrawArrays", GRAPHICS);
gl->fDrawArrays(mode, first, vertCount);
}
Draw_cleanup(funcName);
scopedTF.Advance();
}
void
WebGLContext::DrawArraysInstanced(GLenum mode, GLint first, GLsizei vertCount,
GLsizei instanceCount)
{
+ AUTO_PROFILER_LABEL("WebGLContext::DrawArraysInstanced", GRAPHICS);
const char funcName[] = "drawArraysInstanced";
if (IsContextLost())
return;
MakeContextCurrent();
bool error = false;
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
@@ -611,16 +614,17 @@ WebGLContext::DrawArraysInstanced(GLenum
const ScopedDrawWithTransformFeedback scopedTF(this, funcName, mode, vertCount,
instanceCount, &error);
if (error)
return;
{
ScopedDrawCallWrapper wrapper(*this);
+ AUTO_PROFILER_LABEL("glDrawArraysInstanced", GRAPHICS);
gl->fDrawArraysInstanced(mode, first, vertCount, instanceCount);
}
Draw_cleanup(funcName);
scopedTF.Advance();
}
////////////////////////////////////////
@@ -768,16 +772,17 @@ HandleDrawElementsErrors(WebGLContext* w
return;
}
}
void
WebGLContext::DrawElements(GLenum mode, GLsizei vertCount, GLenum type,
WebGLintptr byteOffset, const char* funcName)
{
+ AUTO_PROFILER_LABEL("WebGLContext::DrawElements", GRAPHICS);
if (!funcName) {
funcName = "drawElements";
}
if (IsContextLost())
return;
MakeContextCurrent();
@@ -800,32 +805,34 @@ WebGLContext::DrawElements(GLenum mode,
ScopedDrawCallWrapper wrapper(*this);
{
UniquePtr<gl::GLContext::LocalErrorScope> errorScope;
if (gl->IsANGLE()) {
errorScope.reset(new gl::GLContext::LocalErrorScope(*gl));
}
+ AUTO_PROFILER_LABEL("glDrawElements", GRAPHICS);
gl->fDrawElements(mode, vertCount, type,
reinterpret_cast<GLvoid*>(byteOffset));
if (errorScope) {
HandleDrawElementsErrors(this, funcName, *errorScope);
}
}
}
Draw_cleanup(funcName);
}
void
WebGLContext::DrawElementsInstanced(GLenum mode, GLsizei vertCount, GLenum type,
WebGLintptr byteOffset, GLsizei instanceCount)
{
+ AUTO_PROFILER_LABEL("WebGLContext::DrawElementsInstanced", GRAPHICS);
const char funcName[] = "drawElementsInstanced";
if (IsContextLost())
return;
MakeContextCurrent();
bool error = false;
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
@@ -847,19 +854,21 @@ WebGLContext::DrawElementsInstanced(GLen
ScopedDrawCallWrapper wrapper(*this);
{
UniquePtr<gl::GLContext::LocalErrorScope> errorScope;
if (gl->IsANGLE()) {
errorScope.reset(new gl::GLContext::LocalErrorScope(*gl));
}
+ AUTO_PROFILER_LABEL("glDrawElementsInstanced", GRAPHICS);
gl->fDrawElementsInstanced(mode, vertCount, type,
reinterpret_cast<GLvoid*>(byteOffset),
instanceCount);
+
if (errorScope) {
HandleDrawElementsErrors(this, funcName, *errorScope);
}
}
}
Draw_cleanup(funcName);
}