Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDon't use BGRA8 unless GL_EXT_texture_storage is available #3239
Conversation
| /// not supported, supported but not for BGRA8 format, or full support. | ||
| #[derive(PartialEq, Debug)] | ||
| enum TexStorageSupport { | ||
| None, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
jamienicol
Oct 29, 2018
Author
Contributor
I can't claim to be an expert on idiomatic rust, but my logic is that the level of support for glTexStorage is a tri-state: No support, support for non-bgra, and full support. In terms of how we use the variable, there is nothing special about the None case, nor in common about the two would-be Some cases. So using an Option feels less conceptually correct, and would require messier matching code, in my opinion.
|
Listed my concerns below
webrender/src/device/gl.rs, line 744 at r1 (raw file): Previously, jamienicol (Jamie Nicol) wrote…
I don't mind the enum here. It's just that webrender/src/device/gl.rs, line 911 at r1 (raw file):
I think this should be removed now? It collides with your new config enum webrender/src/device/gl.rs, line 915 at r1 (raw file):
shouldn't this be webrender/src/device/gl.rs, line 924 at r1 (raw file):
shouldn't we only have that when webrender/src/device/gl.rs, line 1407 at r1 (raw file):
great! |
webrender/src/device/gl.rs, line 744 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Ah okay. Would "Never" or "NotSupported" be a better name then? webrender/src/device/gl.rs, line 911 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
We still need this to decide whether to use RGBA8 as the internal format (swizzling during upload). I'll try again to see if I can come up with some more simple logic for all of this. But unfortunately the conditions aren't that simple. webrender/src/device/gl.rs, line 915 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Hmm, yes it should be. In this case BGRA isn't supported as an internal format, so we will use RGBA instead. Which means we can in fact use glTexStorage. webrender/src/device/gl.rs, line 924 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
GLES 3 always supports glTexStorage for standard formats. However, it only supports glTexStorage with BGRA8 when GL_EXT_texture_storage && GL_EXT_texture_format_BGRA8888 |
webrender/src/device/gl.rs, line 744 at r1 (raw file): Previously, jamienicol (Jamie Nicol) wrote…
I don't think we should change webrender/src/device/gl.rs, line 924 at r1 (raw file): Previously, jamienicol (Jamie Nicol) wrote…
if it always supports |
webrender/src/device/gl.rs, line 924 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Because without GL_EXT_texture_storage, we have glTexStorage but it doesn't work with BGRA. Only with GL_EXT_texture_storage (and GL_EXT_texture_format_BGRA8888) do we have a glTexStorage that does work with BGRA. |
We recently changed to use the glTexStorage* family of functions, along with sized internal format types, such as BGRA8. Unfortunately, the GL_EXT_texture_format_BGRA8888 extension does not provide BGRA8 as a valid format unless the GL_EXT_texture_storage extension is also available, which is not usually the case on GLES3 as glTexStorage* are built in. Unfortunately this means we must fall back to using glTexImage* rather than glTexStorage* when dealing with BGRA data. Longer term it will make sense to ensure the provided data is in RGBA format, as the benifits of immutable storage are desirable.
|
Okay, the latest version restructures the logic and adds some more comments so hopefully it's a bit more obvious. And I fixed it so we do indeed use TexStorage when BGRA is not supported (ie the internal format is RGBA). I also renamed TexStorageSupport to TexStorageUsage, because I think it makes more sense for that last case: TexStorage is still not technically supported for BGRA internal formats, but we are using it for our BGRA textures (because they have RGBA internal formats). Then I could happily rename "None" to "Never" to avoid that issue. |
|
Got one additional concern
webrender/src/device/gl.rs, line 944 at r2 (raw file):
this assertion doesn't appear correct. if we don't support BGRA we can still be running on GLES |
webrender/src/device/gl.rs, line 944 at r2 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Yes we can, but texture uploads won't work because GLES cannot convert between formats during upload. Practically speaking, it seems like pretty much every android device does support BGRA, except the emulator. Again, the real solution is to use RGBA. I can remove the assertion in the mean time if you want though. |
webrender/src/device/gl.rs, line 944 at r2 (raw file): Previously, jamienicol (Jamie Nicol) wrote…
I'm just confused by the fact that we are in |
|
@jamienicol could you launch a try? |
|
Try run looks good: https://treeherder.mozilla.org/#/jobs?repo=try&selectedJob=209780494&revision=019bb574894c88bb74c22e17c13b3b2de231d05f |
|
Thanks! |
|
|
Don't use BGRA8 unless GL_EXT_texture_storage is available https://bugzilla.mozilla.org/show_bug.cgi?id=1499785 We recently changed to use the glTexStorage* family of functions, along with sized internal format types, such as BGRA8. Unfortunately, the GL_EXT_texture_format_BGRA8888 extension does not provide BGRA8 as a valid format unless the GL_EXT_texture_storage extension is also available, which is not usually the case on GLES3 as glTexStorage* are built in. Unfortunately this means we must fall back to using glTexImage* rather than glTexStorage* when dealing with BGRA data. Longer term it will make sense to ensure the provided data is in RGBA format, as the benifits of immutable storage are desirable. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/3239) <!-- Reviewable:end -->
|
|
jamienicol commentedOct 29, 2018
•
edited by larsbergstrom
https://bugzilla.mozilla.org/show_bug.cgi?id=1499785
We recently changed to use the glTexStorage* family of functions,
along with sized internal format types, such as BGRA8. Unfortunately,
the GL_EXT_texture_format_BGRA8888 extension does not provide BGRA8 as
a valid format unless the GL_EXT_texture_storage extension is also
available, which is not usually the case on GLES3 as glTexStorage*
are built in.
Unfortunately this means we must fall back to using glTexImage* rather
than glTexStorage* when dealing with BGRA data. Longer term it will
make sense to ensure the provided data is in RGBA format, as the
benifits of immutable storage are desirable.
This change is