We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3870 - opengles2 renderer by default do rgb/bgr conversion
Summary: opengles2 renderer by default do rgb/bgr conversion
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: don't know
Hardware: All All
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-10 18:03 UTC by Sylvain
Modified: 2017-10-11 09:35 UTC (History)
0 users

See Also:


Attachments
patch (2.53 KB, patch)
2017-10-11 09:34 UTC, Sylvain
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain 2017-10-10 18:03:05 UTC
For a texture that has a format SDL_PIXELFORMAT_ARGB8888 (default, as texture_format[0]), opengles2 renderer selects a gl format "GL_RGBA" in GLES2_CreateTexture(). This parameter is used for loading the pixels data with glTexImage2D().
But this leads to have a fragment shader that have to swap r/b.
This is the default path that does swapping for each RenderCopy.

Event if we don't notice anything, could this has a (very) little performance impact ?

Other renderers: 
opengl render uses format = GL_BGRA. 
D3D11 is also using DXGI_FORMAT_B8G8R8A8_UNORM.

maybe opengles2 renderer should also use GL_BGRA and do no swapping in his shader.
Comment 1 Sylvain 2017-10-11 09:34:50 UTC
Created attachment 2974 [details]
patch

In openGLES2, GL_BGRA_EXT depends on the extension GL_EXT_texture_format_BGRA8888.

Here's the patch I thought to submit, to use minimal shader path.
I tested both on desktop and android device. But I see no fps improvements.
So just discarding it, and closing the issue.
Comment 2 Sylvain 2017-10-11 09:35:23 UTC
Closing as invalid.