WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
Bug 231354
ANGLE Metal RGB textures are slow to initialise compared to RGBA textures when uploading video contents
https://bugs.webkit.org/show_bug.cgi?id=231354
Summary
ANGLE Metal RGB textures are slow to initialise compared to RGBA textures whe...
Kimmo Kinnunen
Reported
2021-10-07 04:11:39 PDT
ANGLE Metal RGB textures are slow to initialise compared to RGBA textures The emulated alpha channel forces very slow path for textures that are initialized as undefined. This causes very slow video texture uploads, 1ms vs 5ms on macOS Intel. Video textures allocate texture memory via texImage2D(.., nullptr) and then fully draw over it with a FBO draw. Sample Count, Samples %, Normalized CPU %, Symbol 1426, 23.6%, 2.0%, WebCore::GraphicsContextGLOpenGL::copyTextureFromMedia(WebCore::MediaPlayer&, unsigned int, unsigned int, int, unsigned int, unsigned int, unsigned int, bool, bool) (in WebCore) 1287, 21.3%, 1.8%, WebCore::GraphicsContextGLCVANGLE::copyPixelBufferToTexture(__CVBuffer*, unsigned int, int, unsigned int, unsigned int, unsigned int, WebCore::GraphicsContextGL::FlipY) (in WebCore) 1287, 21.3%, 1.8%, WebCore::GraphicsContextGLOpenGL::texImage2DDirect(unsigned int, int, unsigned int, int, int, int, unsigned int, unsigned int, void const*) (in WebCore) 1287, 21.3%, 1.8%, gl::TexImage2D(unsigned int, int, int, int, int, int, unsigned int, unsigned int, void const*) (in libANGLE-shared.dylib) 1287, 21.3%, 1.8%, gl::Context::texImage2D(gl::TextureTarget, int, int, int, int, int, unsigned int, unsigned int, void const*) (in libANGLE-shared.dylib) 1285, 21.3%, 1.8%, gl::Texture::setImage(gl::Context*, gl::PixelUnpackState const&, gl::Buffer*, gl::TextureTarget, int, unsigned int, gl::Extents const&, unsigned int, unsigned int, unsigned char const*) (in libANGLE-shared.dylib) 1283, 21.3%, 1.8%, rx::TextureMtl::setImageImpl(gl::Context const*, gl::ImageIndex const&, gl::InternalFormat const&, gl::Extents const&, unsigned int, unsigned int, gl::PixelUnpackState const&, gl::Buffer*, unsigned char const*) (in libANGLE-shared.dylib) 1282, 21.3%, 1.8%, rx::TextureMtl::redefineImage(gl::Context const*, gl::ImageIndex const&, rx::mtl::Format const&, gl::Extents const&) (in libANGLE-shared.dylib) 1272, 21.1%, 1.8%, rx::TextureMtl::checkForEmulatedChannels(gl::Context const*, rx::mtl::Format const&, std::__1::shared_ptr<rx::mtl::Texture> const&) (in libANGLE-shared.dylib) 1233, 20.4%, 1.7%, rx::mtl::InitializeTextureContents(gl::Context const*, std::__1::shared_ptr<rx::mtl::Texture> const&, rx::mtl::Format const&, rx::mtl::ImageNativeIndex const&) (in libANGLE-shared.dylib) 1029, 17.1%, 1.4%, rx::mtl::Texture::replaceRegion(rx::ContextMtl*, MTLRegion const&, gl::LevelIndexWrapper<unsigned int> const&, unsigned int, unsigned char const*, unsigned long, unsigned long) (in libANGLE-shared.dylib)
Attachments
Add attachment
proposed patch, testcase, etc.
Kenneth Russell
Comment 1
2021-10-08 18:50:57 PDT
There's a chance the core ANGLE folks (Geoff, Jonah) might have some advice on how to optimize this.
Geoff Lang
Comment 2
2021-10-12 07:44:09 PDT
There are a couple options we've done on different backends: - Clear with a GPU clear when possible - Use swizzled samplers to always sample 1.0 from the alpha channel of these textures. I think it's still recommended to clear first even with this, there are many paths that need to be aware of this emulated alpha (ReadPixels, CopyTexImage, Blit) - If this is a glTexImage2D call with non-null data, you can add a new data upload function that writes the 1.0 alpha. Otherwise, just try to avoid re-initializing textures too frequently. Caching the allocated textures would avoid this issue.
Radar WebKit Bug Importer
Comment 3
2021-10-14 04:12:17 PDT
<
rdar://problem/84245586
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug