Bug 1748019 - Add GRAPHICS profile markers to WebGLParent. r=gfx-reviewers,lsalzman

Also:
* Add label for WebGLContext::Create.
* *Remove* label for WebGLContext::Draw*, since the labels for these are
  showing up in draw-call-heavy profiles. (~1.5%)
* WebGLContext::UniformData continues to not have a label, since that
  would likely add another 2-3% labelling overhead.
* Add missing !mHost check to RecvTexImage.

Differential Revision: https://phabricator.services.mozilla.com/D134883
This commit is contained in:
Kelsey Gilbert 2021-12-31 00:56:07 +00:00
parent 828392669a
commit 1c16bd06c0
3 changed files with 11 additions and 6 deletions

View File

@ -485,6 +485,7 @@ UniquePtr<webgl::FormatUsageAuthority> WebGLContext::CreateFormatUsage(
RefPtr<WebGLContext> WebGLContext::Create(HostWebGLContext& host,
const webgl::InitContextDesc& desc,
webgl::InitContextResult* const out) {
AUTO_PROFILER_LABEL("WebGLContext::Create", GRAPHICS);
nsCString failureId = "FEATURE_FAILURE_WEBGL_UNKOWN"_ns;
const bool forceEnabled = StaticPrefs::webgl_force_enabled();
ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);

View File

@ -653,7 +653,7 @@ void WebGLContext::DrawArraysInstanced(GLenum mode, GLint first,
GLsizei vertCount,
GLsizei instanceCount) {
const FuncScope funcScope(*this, "drawArraysInstanced");
AUTO_PROFILER_LABEL("WebGLContext::DrawArraysInstanced", GRAPHICS);
// AUTO_PROFILER_LABEL("WebGLContext::DrawArraysInstanced", GRAPHICS);
if (IsContextLost()) return;
const gl::GLContext::TlsScope inTls(gl);
@ -712,7 +712,6 @@ void WebGLContext::DrawArraysInstanced(GLenum mode, GLint first,
{
ScopedDrawCallWrapper wrapper(*this);
if (vertCount && instanceCount) {
AUTO_PROFILER_LABEL("glDrawArraysInstanced", GRAPHICS);
if (HasInstancedDrawing(*this)) {
gl->fDrawArraysInstanced(mode, first, vertCount, instanceCount);
} else {
@ -830,7 +829,7 @@ void WebGLContext::DrawElementsInstanced(GLenum mode, GLsizei indexCount,
GLenum type, WebGLintptr byteOffset,
GLsizei instanceCount) {
const FuncScope funcScope(*this, "drawElementsInstanced");
AUTO_PROFILER_LABEL("WebGLContext::DrawElementsInstanced", GRAPHICS);
// AUTO_PROFILER_LABEL("WebGLContext::DrawElementsInstanced", GRAPHICS);
if (IsContextLost()) return;
const gl::GLContext::TlsScope inTls(gl);
@ -912,7 +911,6 @@ void WebGLContext::DrawElementsInstanced(GLenum mode, GLsizei indexCount,
}
if (indexCount && instanceCount) {
AUTO_PROFILER_LABEL("glDrawElementsInstanced", GRAPHICS);
if (HasInstancedDrawing(*this)) {
if (MOZ_UNLIKELY(collapseToDrawArrays)) {
gl->fDrawArraysInstanced(mode, 0, 1, instanceCount);

View File

@ -33,6 +33,7 @@ using IPCResult = mozilla::ipc::IPCResult;
IPCResult WebGLParent::RecvDispatchCommands(Shmem&& rawShmem,
const uint64_t cmdsByteSize) {
AUTO_PROFILER_LABEL("WebGLParent::RecvDispatchCommands", GRAPHICS);
if (!mHost) {
return IPC_FAIL(this, "HostWebGLContext is not initialized.");
}
@ -80,6 +81,10 @@ IPCResult WebGLParent::RecvTexImage(const uint32_t level,
const uvec3& offset,
const webgl::PackingInfo& pi,
webgl::TexUnpackBlobDesc&& desc) {
if (!mHost) {
return IPC_FAIL(this, "HostWebGLContext is not initialized.");
}
mHost->TexImage(level, respecFormat, offset, pi, desc);
return IPC_OK();
}
@ -102,8 +107,8 @@ IPCResult WebGLParent::RecvGetFrontBufferSnapshot(
IPCResult WebGLParent::GetFrontBufferSnapshot(
webgl::FrontBufferSnapshotIpc* const ret, IProtocol* aProtocol) {
AUTO_PROFILER_LABEL("WebGLParent::GetFrontBufferSnapshot", GRAPHICS);
*ret = {};
if (!mHost) {
return IPC_FAIL(aProtocol, "HostWebGLContext is not initialized.");
}
@ -138,6 +143,7 @@ IPCResult WebGLParent::RecvGetBufferSubData(const GLenum target,
const uint64_t srcByteOffset,
const uint64_t byteSize,
Shmem* const ret) {
AUTO_PROFILER_LABEL("WebGLParent::RecvGetBufferSubData", GRAPHICS);
if (!mHost) {
return IPC_FAIL(this, "HostWebGLContext is not initialized.");
}
@ -166,8 +172,8 @@ IPCResult WebGLParent::RecvGetBufferSubData(const GLenum target,
IPCResult WebGLParent::RecvReadPixels(const webgl::ReadPixelsDesc& desc,
const uint64_t byteSize,
webgl::ReadPixelsResultIpc* const ret) {
AUTO_PROFILER_LABEL("WebGLParent::RecvReadPixels", GRAPHICS);
*ret = {};
if (!mHost) {
return IPC_FAIL(this, "HostWebGLContext is not initialized.");
}