SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.14k
stars
522
forks
source link
[BUG] Custom SKSL Shaders - no longer compile #2795
As we upgrade from 2.88.6 to 3.0.0-preview, our custom shaders now don't compile, and have many errors.
What I am requesting here is documentation on the changes made to SKGL, to guide us in porting our custom shaders to 3.0.0.
Code
Here is our rather long Terrain Shader that works wonderfully inside SkiaSharp 2.88.6 (other than the inefficiencies, as seen in our doing a Quadruple Sampling and Lerping to simulate "LINEAR" sampling mode):
Description
As we upgrade from 2.88.6 to 3.0.0-preview, our custom shaders now don't compile, and have many errors.
What I am requesting here is documentation on the changes made to SKGL, to guide us in porting our custom shaders to 3.0.0.
Code
Here is our rather long Terrain Shader that works wonderfully inside SkiaSharp 2.88.6 (other than the inefficiencies, as seen in our doing a Quadruple Sampling and Lerping to simulate "LINEAR" sampling mode):
Expected Behavior
Expecting this to compile the same as it does for 2.88.6 -- or if not, then would like to have docs that guide me on the changes I need to make.
Actual Behavior
Instead I now get 23 compiler errors, as follows: error: 2: no type named 'fragmentProcessor' in fragmentProcessor elev_map; ^^^^^^^^^^^^^^^^^ error: 2: no type named 'elev_map' in fragmentProcessor elev_map; ^^^^^^^^ error: 2: expected a declaration, but found ';' in fragmentProcessor elev_map; ^ error: 3: no type named 'fragmentProcessor' in fragmentProcessor vfr_map; ^^^^^^^^^^^^^^^^^ error: 3: no type named 'vfr_map' in fragmentProcessor vfr_map; ^^^^^^^ error: 3: expected a declaration, but found ';' in fragmentProcessor vfr_map; ^ error: 32: duplicate definition of 'float smoothstep(float a, float b, float x)' float smoothstep(float a, float b, float x) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: 33: unknown identifier 'x' float t = clamp((x - a) / (b - a), 0.0, 1.0); ^ error: 33: unknown identifier 'a' float t = clamp((x - a) / (b - a), 0.0, 1.0); ^ error: 33: unknown identifier 'b' float t = clamp((x - a) / (b - a), 0.0, 1.0); ^ error: 33: unknown identifier 'a' float t = clamp((x - a) / (b - a), 0.0, 1.0); ^ error: 34: unknown identifier 't' return t t (3.0 - 2.0 t); ^ error: 34: unknown identifier 't' return t t (3.0 - 2.0 t); ^ error: 34: unknown identifier 't' return t t (3.0 - 2.0 * t); ^ error: 42: unknown identifier 'sample' return sample(elev_map, fc).xyz; ^^^^^^ error: 42: unknown identifier 'elev_map' return sample(elev_map, fc).xyz; ^^^^^^^^ error: 55: discard statement is only permitted in fragment shaders discard; // This shader is entirely off! ^^^^^^^ error: 111: unknown identifier 'sample' elevNorm = sample(elev_map, fc).xyz; ^^^^^^ error: 111: unknown identifier 'elev_map' elevNorm = sample(elev_map, fc).xyz; ^^^^^^^^ error: 122: discard statement is only permitted in fragment shaders discard; ^^^^^^^ error: 165: discard statement is only permitted in fragment shaders discard; ^^^^^^^ error: 178: unknown identifier 'sample' color = sample(vfr_map, paletteUV).rgba; // abgr; // argb; // rgba; // texture2D(sEnvMap, paletteUV).rgba; ^^^^^^ error: 178: unknown identifier 'vfr_map' color = sample(vfr_map, paletteUV).rgba; // abgr; // argb; // rgba; // texture2D(sEnvMap, paletteUV).rgba; ^^^^^^^ 23 errors
Version of SkiaSharp
3.x (Alpha)
Last Known Good Version of SkiaSharp
2.88.2 (Previous)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
Windows 11 Home
Devices
Windows 11, CyberPowerPC, Intel i9 14900K
Relevant Screenshots
No response
Relevant Log Output
No response
Code of Conduct