-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] SKSL doesn't recognize 'smoothstep', or 'fwidth' (and other OpenGL operators) #2649
Comments
add this line to your nuget.config and enable prerelease
|
For now, we are omitting the feature that requires 'fwidth' (i.e. elevation contour lines on the map), and have simulated, well-enough, the 'smoothstep' with our own method: float smoothstep(float min, float max, float val) { So we're less desperate for this currently. I think we may wait for the first official "Pre-release" of 3.0 to test out the 'fwidth'. Since the 3.0 Shader support API has changed, it wouldn't be a trivial "trial" for us -- we'd actually have to change code to test it, but since we have to release our next release to production in 2 months, we can't use 3.0 for that. We have 3-4 releases per year, and are tentatively planning to incorporate SkiaSharp 3.0 with 'fwidth' (contour lines) and the actual 'smoothstep' by our July 2024 release next year. |
maybe
|
Thank you for this! |
@angelofb : In Visual Studio 2022, Nuget still won't show me the Alpha release option for SkiaSharp. I have "pre-releases" checkbox checked in VStudio 2022, and can see the "pre-releases" fine, but 2.88 is still the latest it shows in Visual Studio 2022. Is there some other way to get the 3.0 alpha? Or got any tips on how to make Visual Studio show it? |
Have you checked the "Include prerelease" option? Also make sure package source is not selected to show "nuget.org" only. |
THANKS!! That worked -- I was set to "nuget.org" -- I've never noticed that setting before. I changed it to "skiasharp-eap" and now I can see the alpha releases. I'll be trying those out very soon. |
Not sure if this issue is now resolved in v3? |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. |
I'm not sure yet either. Is it supposedly resolved in v3? I've been hoping to push off validation of this until v3 reaches Beta, rather than while it's still in Alpha. |
Description
We are needing SkiaSharp's SKSL to provide better OpenGL shader support - namely 'smoothstep' and 'fwidth'.
Both of these operators (built-in methods) result in this shader compiler error:
And the shader won't compile.
NOTE: We're using latest Skia 2.88.6 (not .3 as shown below, as it didn't give me the .6 option)
NOTE#2: If we can't get Skia to do these operations, our fallback is to do something more complex where we do it using OpenTK/OpenGL - with a RenderTarget that hopefully we can share back with SKIA, where we can Blit our OpenTK/GL result onto an SKGLSurface in some efficient manner.
Code
Our actual shader is far more involved, but the following very simple shader code triggers the exact same error:
Then in C#, our code looks like this: (where 'source' string is equal to the SKSL code above)
Error returns as "error: 48: unknown identifier 'smoothstep'"
Expected Behavior
I was sure hoping that SKSL would support these very useful and commonly used operators - smoothstep and fwidth, and that we could see the same effects here as we were producing using OpenGL, in a 3D view context.
Actual Behavior
Shader won't compile, and therefore does not run at all.
Version of SkiaSharp
2.88.3 (Current)
Last Known Good Version of SkiaSharp
Other (Please indicate in the description)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
Window 11. Latest Home Edition
Devices
Dell XPS PC
Relevant Screenshots
No response
Relevant Log Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: