Error "invalid swizzle mask 'eval'"

22 views
Skip to first unread message

Kirill Grouchnikov

unread,
Sep 17, 2021, 4:42:16 PMSep 17
to skia-discuss
Following the example from SkSl intro I've created this code snippet that is using Skiko (Kotlin bindings for Skia):

val effect = RuntimeEffect.makeForShader("uniform shader input;"
+"half4 main(float2 coord) { return input.eval(coord).bgra; }")

When I run it, it crashes with:

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: error: 1: invalid swizzle mask 'eval'

The JNI code for Skiko's RuntimeEffect.makeForShader is over here, calling SkRuntimeEffect::MakeForShader and looking at the error code. I've been looking at https://github.com/google/skia/blob/main/src/sksl/ir/SkSLSwizzle.cpp but I can't quite understand what makes the "input.eval" part error out.

Ethan Nicholas

unread,
Sep 17, 2021, 4:49:09 PMSep 17
to skia-d...@googlegroups.com
The ".eval" syntax is quite recent, so I'd guess that you're using the current instructions against an older version of Skia.

Try it with the previous syntax: sample(input, coord) instead of input.eval(coord).

--
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/b8caa5d5-fbeb-4a39-8338-35847d177204n%40googlegroups.com.

Kirill Grouchnikov

unread,
Sep 17, 2021, 6:17:38 PMSep 17
to skia-discuss

Thanks, sample(input, coord) works.

Skiko just switched to m94 build of Skia yesterday, and the build that I am linking against is using m93.

Kirill Grouchnikov

unread,
Sep 27, 2021, 4:57:28 PMSep 27
to skia-discuss
Is there a way to know which release launched with the new eval syntax?

I see that https://bugs.chromium.org/p/skia/issues/detail?id=12302 is the main bug tracker for this new syntax, and that the CLs started landing in early August and continued into September. 

https://skia.org/docs/user/release/release_notes/ doesn't have info on m94 at all, even though dev branch seems to be on m96 already.

Brian Osman

unread,
Sep 27, 2021, 5:08:50 PMSep 27
to skia-d...@googlegroups.com
Looking up the commit that added .eval, we see that it was first part of M95: https://chromiumdash.appspot.com/commit/3099f798e75fa7b7f1e5c2b8180b522a6c7822ed

It looks like the description of the feature got added to the wrong section of the RELEASE_NOTES (M94). Sorry about that.

Kirill Grouchnikov

unread,
Sep 27, 2021, 5:13:49 PMSep 27
to skia-discuss
Thanks, I'll wait to switch to eval once Compose Desktop goes from m94 to m95

You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/AYCdOdmtg48/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/CAMcBjo4DFGg2G0tSg66M06SqOnzyUfv3knv0JkMUpp3wpMJhZA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages