WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
81103
[Texmap] Implement BGRA swizzling detection
https://bugs.webkit.org/show_bug.cgi?id=81103
Summary
[Texmap] Implement BGRA swizzling detection
Simon Hausmann
Reported
2012-03-14 07:25:55 PDT
We used to check if GL_EXT_texture_format_BGRA8888 is listed in the extensions to assume that the driver supports swizzling from GL_BGRA to the GL_RGBA texture format. Unfortunately this does not work reliably with all chipsets.
Attachments
Patch
(5.29 KB, patch)
2013-02-01 15:36 PST
,
Igor Trindade Oliveira
no flags
Details
Formatted Diff
Diff
Patch V2
(5.37 KB, patch)
2013-02-01 15:55 PST
,
Igor Trindade Oliveira
no flags
Details
Formatted Diff
Diff
Patch v3
(5.15 KB, patch)
2013-02-01 15:59 PST
,
Igor Trindade Oliveira
noam
: review+
noam
: commit-queue-
Details
Formatted Diff
Diff
Patch
(5.24 KB, patch)
2013-02-04 11:55 PST
,
Igor Trindade Oliveira
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Simon Hausmann
Comment 1
2012-03-15 02:34:04 PDT
r110703
removed the swizzling for GLES.
Simon Hausmann
Comment 2
2012-03-15 02:42:46 PDT
From
http://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexSubImage2D.xml
it appears that the format passed to glTexSubImage2D is supposed to be the same: "GL_INVALID_OPERATION is generated if the texture array has not been defined by a previous glTexImage2D or glCopyTexImage2D operation whose internalformat matches the format of glTexSubImage2D."
Simon Hausmann
Comment 3
2012-03-15 02:48:28 PDT
Another interesting point: <k5kangas> You might also want to quote OpenGLES2 spec, v2.0.25, page 72, "Each of the TexSubImage commands <k5kangas> interprets and processes pixel groups in exactly the manner of its TexImage coun- <k5kangas> terpart, except that the assignment of R, G, B, and A pixel group values to the <k5kangas> texture components is controlled by the internalformat of the texture array, not <k5kangas> by an argument to the command.
Noam Rosenthal
Comment 4
2012-03-15 02:55:24 PDT
(In reply to
comment #3
)
> Another interesting point: > > <k5kangas> You might also want to quote OpenGLES2 spec, v2.0.25, page 72, "Each of the TexSubImage commands > <k5kangas> interprets and processes pixel groups in exactly the manner of its TexImage coun- > <k5kangas> terpart, except that the assignment of R, G, B, and A pixel group values to the > <k5kangas> texture components is controlled by the internalformat of the texture array, not > <k5kangas> by an argument to the command.
Interesting. I wonder why this is the only thing that had worked for desktop and Harmattan then :)
Igor Trindade Oliveira
Comment 5
2013-02-01 15:36:23 PST
Created
attachment 186167
[details]
Patch Proposed patch
Viatcheslav Ostapenko
Comment 6
2013-02-01 15:46:40 PST
Comment on
attachment 186167
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=186167&action=review
> Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp:589 > + return context->getExtensions()->supports("GL_EXT_texture_format_BGRA8888");
It is called so many times. I doubt that swizzling support can change during app execution and would cache result here. Something like this: static bool canSwizzle = context->getExtensions()->supports("GL_EXT_texture_format_BGRA8888"); return canSwizzle;
Igor Trindade Oliveira
Comment 7
2013-02-01 15:55:08 PST
Created
attachment 186175
[details]
Patch V2 Proposed patch.
Igor Trindade Oliveira
Comment 8
2013-02-01 15:59:32 PST
Created
attachment 186178
[details]
Patch v3 Fix left over from other patch.
Noam Rosenthal
Comment 9
2013-02-01 22:57:20 PST
Comment on
attachment 186178
[details]
Patch v3 View in context:
https://bugs.webkit.org/attachment.cgi?id=186178&action=review
I remember this kind of patch had a tendency to break stuff :) Can someone validate it on more than one GLES2 hardware?
> Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp:591 > #if defined(TEXMAP_OPENGL_ES_2) > - // FIXME: Implement reliable detection. See also
https://bugs.webkit.org/show_bug.cgi?id=81103
. > - return false; > + static bool supportsExternalTextureBGRA = context->getExtensions()->supports("GL_EXT_texture_format_BGRA8888"); > + return supportsExternalTextureBGRA; > #else
I think we shoul switch here to isGLES2Compliant() instead of an #ifdef
Igor Trindade Oliveira
Comment 10
2013-02-02 00:16:28 PST
(In reply to
comment #9
)
> (From update of
attachment 186178
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=186178&action=review
> > I remember this kind of patch had a tendency to break stuff :) > Can someone validate it on more than one GLES2 hardware?
I tested in mesa3d llvmpipe, intel and mali t400. The reverted implementation(changeset
r110703
) was slightly different. Basically it was just using BGRA in the external format, however in the GLESv2 case, when BGRA is used it also needs to be used in the internal texture format.
> > > Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp:591 > > #if defined(TEXMAP_OPENGL_ES_2) > > - // FIXME: Implement reliable detection. See also
https://bugs.webkit.org/show_bug.cgi?id=81103
. > > - return false; > > + static bool supportsExternalTextureBGRA = context->getExtensions()->supports("GL_EXT_texture_format_BGRA8888"); > > + return supportsExternalTextureBGRA; > > #else > > I think we shoul switch here to isGLES2Compliant() instead of an #ifdef
Noam Rosenthal
Comment 11
2013-02-02 01:45:26 PST
(In reply to
comment #10
)
> (In reply to
comment #9
) > > (From update of
attachment 186178
[details]
[details]) > > View in context:
https://bugs.webkit.org/attachment.cgi?id=186178&action=review
> > > > I remember this kind of patch had a tendency to break stuff :) > > Can someone validate it on more than one GLES2 hardware? > > I tested in mesa3d llvmpipe, intel and mali t400. > The reverted implementation(changeset
r110703
) was slightly different. Basically it was just using BGRA in the external format, however in the GLESv2 case, when BGRA is used it also needs to be used in the internal texture format.
Yes, in the N9 case that's the only thing that worked (and N9 was the only GLESv2 device running TextureMapper at the time). But I think this should be ok, if you can address the other comment :)
Noam Rosenthal
Comment 12
2013-02-03 01:14:56 PST
Comment on
attachment 186178
[details]
Patch v3 See previous comment.
Igor Trindade Oliveira
Comment 13
2013-02-04 11:55:20 PST
Created
attachment 186427
[details]
Patch Patch for landing.
WebKit Review Bot
Comment 14
2013-02-04 13:50:53 PST
Comment on
attachment 186427
[details]
Patch Clearing flags on attachment: 186427 Committed
r141807
: <
http://trac.webkit.org/changeset/141807
>
WebKit Review Bot
Comment 15
2013-02-04 13:50:57 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug