Closed Bug 1591436 Opened 5 years ago Closed 5 years ago

GL_INVALID_VALUE error in glTexImage3D on android emulator during reftests

Categories

(Core :: Graphics: WebRender, defect)

Unspecified
Android
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: jnicol, Assigned: jnicol)

References

Details

Attachments

(1 file)

Trying to get the reftests running for webrender on the android emulator, and in some tests glTexImage3D() raises a GL_INVALID_VALUE error. This causes us to panic in debug builds and may cause us to fail in release builds.

The problem is that the emulator's implementation of glTexImage3D() checks the width, height, and depth parameters against the value of GL_MAX_TEXTURE_SIZE. GL_MAX_TEXTURE_SIZE is just an ID, its value is not actually the maximum texture size. You need to query the actual max texture size using glGetIntegerv(GL_MAX_TEXTURE_SIZE), and compare against the returned value.

I will file this bug upstream, and look for a workaround. Worst case we may have to disable tests which create large textures until the emulator is fixed and updated.

I tried overriding Device.max_texture_size on the android emulator. This works for texture cache textures, as the texture cache will tile textures which are larger than Device::max_texture_size(). But we hit assertions in render_target.rs because it attempts to create textures > 3379, we clamp the size in Device::create_texture, then the render target asserts it is large enough, which fails.

The thing is, if we didn't clamp the texture size in create_texture() for render target textures, it would actually succeed. Because this bug only affects glTexImage3D(), not glTexStorage3D(). For render target textures, which are RGBA, we use glTexStorage3D. We only use glTexImage3D for BGRA standalone texture cache textures.

I looked in to exposing a different max texture size based on the texture target and format, as a proxy for which of TexImage and TexStorage we would use, but it got a bit messy. I now think we'll actually be better off just forcing us to use glTexStorage when running on the emulator (by using RGBA textures + swizzling for BGRA images).

A bug in the android emulator means that glTexImage3D thinks the maximum texture
size is the value of GL_MAX_TEXTURE_SIZE, rather than the value returned by
glGetIntegerv(GL_MAX_TEXTURE_SIZE). This means that calls to glTexImage3D fail
when width, height, or depth > 3379.

This forces us to use glTexStorage3D instead of glTexImage3D, avoiding
this bug. This relies upon swizzling, which is indeed supported on the
android emulator.

Pushed by jnicol@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f39fa8f0265d
Avoid using glTexImage3D on android emulator. r=gw
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
Assignee: nobody → jnicol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: