Bug 314719
| Summary: | [WPE][GTK] Atlas textures use spec-violating glTexImage2D(internal=GL_RGBA, format=GL_BGRA), render black on strict GLES drivers | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Alejandro G. Castro <alex> |
| Component: | New Bugs | Assignee: | Alejandro G. Castro <alex> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | commit-queue, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | 315035 | ||
| Bug Blocks: | |||
Alejandro G. Castro
SkiaGPUAtlas allocates BitmapTextures with the UseBGRALayout flag, which is meant to give them BGRA storage. BitmapTexture::allocateTexture() and BitmapTexture::reset() currently call:
glTexImage2D(target, 0, GL_RGBA, w, h, 0, textureFormat(), UNSIGNED_BYTE, nullptr);
where textureFormat() returns GL_BGRA for UseBGRALayout textures. So the actual call for atlas textures is:
glTexImage2D(target, 0, GL_RGBA, w, h, 0, GL_BGRA, UNSIGNED_BYTE, nullptr);
This combination is undefined per the EXT_texture_format_BGRA8888 spec, which mandates internalFormat == format == GL_BGRA_EXT:
https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_format_BGRA8888.txt
Driver behaviour observed:
* Mesa (Intel/AMD/llvmpipe): permissive — accepts the call. Downstream rendering happens to come out correct because TextureMapper's shaders swizzle BGRA→RGBA at sample time.
* Adreno (Pixel 7, Android arm64): strict — rejects every upload with GL_INVALID_OPERATION (0x502). Confirmed by glGetError() instrumentation: 100% of atlas uploads fail. The texture is left in undefined state, and SkImages::BorrowTextureFrom(..., kRGBA_8888_SkColorType, ...) reading from undefined storage renders solid black on subsequent FALLBACK direct-draws.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alejandro G. Castro
Pull request: https://github.com/WebKit/WebKit/pull/64834
EWS
Committed 313395@main (b47541a2e001): <https://commits.webkit.org/313395@main>
Reviewed commits have been landed. Closing PR #64834 and removing active labels.
Radar WebKit Bug Importer
<rdar://problem/177318630>
WebKit Commit Bot
Re-opened since this is blocked by bug 315035
Alejandro G. Castro
Pull request: https://github.com/WebKit/WebKit/pull/65193
EWS
Committed 313653@main (1f31db09ec64): <https://commits.webkit.org/313653@main>
Reviewed commits have been landed. Closing PR #65193 and removing active labels.