BGRA glReadPixels throws error on PowerVR SGX540

RESOLVED FIXED in mozilla13

Status

()

Core
Graphics
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Joe Drew (not getting mail), Assigned: jgilbert)

Tracking

Trunk
mozilla13
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

6 years ago
Bug 727311 discovered that WebGL in readback mode didn't work on the Nexus S and the Galaxy Nexus. The OES_read_format spec[1] says that

    The preferred type and format combination returned may depend
    on the read surface bound to the current GL context.

I suspect this is what is biting us; we query the preferred type and format before we've bound our offscreen framebuffer.

For now, BGRA support is disabled altogether. It'd be nice to be able to use it where it actually works, though.

1. http://www.khronos.org/registry/gles/extensions/OES/OES_read_format.txt
(Assignee)

Comment 1

6 years ago
A note that OES_read_format is not strictly relevant to GLES2, since that behavior has been folded into core. The behavior should be the same though. (Unfortunately, the GLES2 spec is even less well worded than the extension)
Assignee: nobody → jgilbert
Status: NEW → ASSIGNED
(Assignee)

Comment 2

6 years ago
Created attachment 599385 [details] [diff] [review]
Check valid read formats before readPixels
Attachment #599385 - Flags: review?(bjacob)
(Reporter)

Comment 3

6 years ago
Comment on attachment 599385 [details] [diff] [review]
Check valid read formats before readPixels

We should use GetOptimalReadFormats when creating framebuffers too, since we use RGBA by default all over the place when creating FBOs.
Comment on attachment 599385 [details] [diff] [review]
Check valid read formats before readPixels

Review of attachment 599385 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with this comment:

::: gfx/gl/GLContext.cpp
@@ +1707,5 @@
>  
> +static void
> +GetOptimalReadFormats(GLContext* gl, GLenum& format, GLenum& type) {
> +    if (gl->IsGLES2()) {
> +        bool hasBGRA_UBtye = false;

Typo: Btye -> Byte. Also, a _ after 'has' would be nice.
Attachment #599385 - Flags: review?(bjacob) → review+
(Assignee)

Comment 5

6 years ago
Created attachment 599777 [details] [diff] [review]
Check valid read formats before readPixels

Fixed and r+ carried forward.
Attachment #599385 - Attachment is obsolete: true
Attachment #599777 - Flags: review+
(Assignee)

Comment 6

6 years ago
(In reply to Joe Drew (:JOEDREW!) from comment #3)
> Comment on attachment 599385 [details] [diff] [review]
> Check valid read formats before readPixels
> 
> We should use GetOptimalReadFormats when creating framebuffers too, since we
> use RGBA by default all over the place when creating FBOs.

We can do this, but it's slightly different. All this stuff is only relevant to readPixels. For FBOs, we are working with textures, so we need a different set of extensions. For textures, there is also no hint which would be faster. We could bank on BGRA always being faster, but I don't know as this is a safe bet. Perhaps this is a good thing to blocklist for?

As an aside, ANGLE uses BGRA internally even if you request RGBA.
(Assignee)

Updated

6 years ago
Blocks: 729726
(Assignee)

Comment 7

6 years ago
Bug for BGRA-texture-backed FBOs is up at bug 729726.
(Assignee)

Comment 8

6 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/c3a8909af707
Target Milestone: --- → mozilla13
https://hg.mozilla.org/mozilla-central/rev/c3a8909af707
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.