Bitwise xor in SkBlender and ES2Restrictions

65 views
Skip to first unread message

Luboš Luňák

unread,
Nov 26, 2021, 5:17:40 AM11/26/21
to skia-d...@googlegroups.com

Hello,

for certain historical reasons I need to do an old-style bitwise xor blending
operation. I've written a blender that converts the float to int, applies the
^ operator and converts back, but compiling that reports an error about ^
operator not being allowed. Looking at the code this is because of
strictES2Mode check, needed because of OpenGL ES.

The thing is, I don't use OpenGL, I use only Vulkan, Metal and raster
backends. And if I disable the check, everything seems to work fine. Is that
check actually only OpenGL-specific and am I guaranteed that it works fine
with these other backends, or am I just lucky here and should I find a
different way to implement it?

--
Luboš Luňák
l.l...@collabora.com

Brian Osman

unread,
Nov 27, 2021, 6:40:52 PM11/27/21
to skia-d...@googlegroups.com
Yes, it will actually work fine. (It's obviously not tested as thoroughly as everything else, but it is tested). Basically, we limit custom shaders/blenders/etc... to strict ES2 mode. That guarantees that our clients (particularly those that embed/expose Skia and then run on a wide variety of devices) can run any effect on ANY device, regardless of backend. Note that many shader features beyond ES2 are *not* implemented on the raster backend (yet), but bitwise integer operations are. (For example, complex loops that can't be unrolled, many ES3 intrinsics, etc...)

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/202111261117.30569.l.lunak%40collabora.com.
Reply all
Reply to author
Forward
0 new messages