Name Date Size

..25-Oct-20244 KiB

analysis/H25-Oct-20244 KiB

BUILD.bazelH A D25-Oct-20247.1 KiB

codegen/H25-Oct-20244 KiB

dsl/H25-Oct-20244 KiB

generated/H25-Oct-20244 KiB

GLSL.std.450.hH A D25-Oct-20244 KiB

ir/H25-Oct-20244 KiB

lex/H25-Oct-20244 KiB

READMEH A D25-Oct-20243.5 KiB

sksl_frag.skslH A D25-Oct-2024419

sksl_gpu.skslH A D25-Oct-202418.7 KiB

sksl_public.skslH A D25-Oct-20248.9 KiB

sksl_rt_shader.skslH A D25-Oct-202440

sksl_vert.skslH A D25-Oct-2024254

SkSLAnalysis.cppH A D25-Oct-202430.2 KiB

SkSLAnalysis.hH A D25-Oct-20246.7 KiB

SkSLBuiltinTypes.cppH A D25-Oct-202411.8 KiB

SkSLBuiltinTypes.hH A D25-Oct-20244.1 KiB

SkSLCompiler.cppH A D25-Oct-202426.7 KiB

SkSLCompiler.hH A D25-Oct-20248.8 KiB

SkSLConstantFolder.cppH A D25-Oct-202423.4 KiB

SkSLConstantFolder.hH A D25-Oct-20242.1 KiB

SkSLContext.cppH A D25-Oct-2024515

SkSLContext.hH A D25-Oct-20241.3 KiB

SkSLDehydrator.cppH A D25-Oct-202423.9 KiB

SkSLDehydrator.hH A D25-Oct-20243 KiB

SkSLDSLParser.cppH A D25-Oct-202462.4 KiB

SkSLDSLParser.hH A D25-Oct-20249.8 KiB

SkSLErrorReporter.cppH A D25-Oct-2024912

SkSLFileOutputStream.hH A D25-Oct-20241.5 KiB

SkSLInliner.cppH A D25-Oct-202456.1 KiB

SkSLInliner.hH A D25-Oct-20244.7 KiB

SkSLIntrinsicList.hH A D25-Oct-20243.9 KiB

SkSLIntrinsicMap.cppH A D25-Oct-20241.4 KiB

SkSLIntrinsicMap.hH A D25-Oct-2024918

SkSLLexer.cppH A D25-Oct-202441.3 KiB

SkSLLexer.hH A D25-Oct-20243.1 KiB

SkSLMain.cppH A D25-Oct-202424.4 KiB

SkSLMangler.cppH A D25-Oct-20241.9 KiB

SkSLMangler.hH A D25-Oct-2024572

SkSLMemoryLayout.hH A D25-Oct-20245.7 KiB

SkSLMemoryPool.hH A D25-Oct-2024999

SkSLModifiersPool.hH A D25-Oct-2024797

SkSLOperators.cppH A D25-Oct-202415.8 KiB

SkSLOperators.hH A D25-Oct-20243.2 KiB

SkSLOutputStream.cppH A D25-Oct-2024982

SkSLOutputStream.hH A D25-Oct-20241.1 KiB

SkSLParsedModule.hH A D25-Oct-2024419

SkSLPool.cppH A D25-Oct-20242.6 KiB

SkSLPool.hH A D25-Oct-20242.5 KiB

SkSLProgramSettings.hH A D25-Oct-20244.9 KiB

SkSLRehydrator.cppH A D25-Oct-202424.3 KiB

SkSLRehydrator.hH A D25-Oct-20247.4 KiB

SkSLSampleUsage.cppH A D25-Oct-20241.2 KiB

SkSLString.cppH A D25-Oct-20243.8 KiB

SkSLStringStream.hH A D25-Oct-20241.7 KiB

SkSLThreadContext.cppH A D25-Oct-20247.8 KiB

SkSLThreadContext.hH A D25-Oct-20246.7 KiB

SkSLUtil.cppH A D25-Oct-20244.2 KiB

SkSLUtil.hH A D25-Oct-202413.6 KiB

spirv.hH A D25-Oct-202427.7 KiB

transform/H25-Oct-20244 KiB

README

1Overview
2========
3
4SkSL ("Skia Shading Language") is a variant of GLSL which is used as Skia's
5internal shading language. SkSL is, at its heart, a single standardized version
6of GLSL which avoids all of the various version and dialect differences found
7in GLSL "in the wild", but it does bring a few of its own changes to the table.
8
9Skia uses the SkSL compiler to convert SkSL code to GLSL, GLSL ES, or SPIR-V
10before handing it over to the graphics driver.
11
12
13Differences from GLSL
14=====================
15
16* Precision modifiers are not used. 'float', 'int', and 'uint' are always high
17  precision. New types 'half', 'short', and 'ushort' are medium precision (we
18  do not use low precision).
19* Vector types are named <base type><columns>, so float2 instead of vec2 and
20  bool4 instead of bvec4
21* Matrix types are named <base type><columns>x<rows>, so float2x3 instead of
22  mat2x3 and double4x4 instead of dmat4
23* "@if" and "@switch" are static versions of if and switch. They behave exactly
24  the same as if and switch in all respects other than it being a compile-time
25  error to use a non-constant expression as a test.
26* GLSL caps can be referenced via the syntax 'sk_Caps.<name>', e.g.
27  sk_Caps.canUseAnyFunctionInShader. The value will be a constant boolean or int,
28  as appropriate. As SkSL supports constant folding and branch elimination, this
29  means that an 'if' statement which statically queries a cap will collapse down
30  to the chosen branch, meaning that:
31
32    if (sk_Caps.externalTextureSupport)
33        do_something();
34    else
35        do_something_else();
36
37  will compile as if you had written either 'do_something();' or
38  'do_something_else();', depending on whether that cap is enabled or not.
39* no #version statement is required, and it will be ignored if present
40* the output color is sk_FragColor (do not declare it)
41* use sk_Position instead of gl_Position. sk_Position is in device coordinates
42  rather than normalized coordinates.
43* use sk_PointSize instead of gl_PointSize
44* use sk_VertexID instead of gl_VertexID
45* use sk_InstanceID instead of gl_InstanceID
46* the fragment coordinate is sk_FragCoord, and is always relative to the upper
47  left.
48* use sk_Clockwise instead of gl_FrontFacing. This is always relative to an
49  upper left origin.
50* you do not need to include ".0" to make a number a float (meaning that
51  "float2(x, y) * 4" is perfectly legal in SkSL, unlike GLSL where it would
52  often have to be expressed "float2(x, y) * 4.0". There is no performance
53  penalty for this, as the number is converted to a float at compile time)
54* type suffixes on numbers (1.0f, 0xFFu) are both unnecessary and unsupported
55* creating a smaller vector from a larger vector (e.g. float2(float3(1))) is
56  intentionally disallowed, as it is just a wordier way of performing a swizzle.
57  Use swizzles instead.
58* Swizzle components, in addition to the normal rgba / xyzw components, can also
59  be LTRB (meaning "left/top/right/bottom", for when we store rectangles in
60  vectors), and may also be the constants '0' or '1' to produce a constant 0 or
61  1 in that channel instead of selecting anything from the source vector.
62  foo.rgb1 is equivalent to float4(foo.rgb, 1).
63* All texture functions are named "sample", e.g. sample(sampler2D, float3) is
64  equivalent to GLSL's textureProj(sampler2D, float3).
65* Functions support the 'inline' modifier, which causes the compiler to ignore
66  its normal inlining heuristics and inline the function if at all possible
67* some built-in functions and one or two rarely-used language features are not
68  yet supported (sorry!)
69