• Home
Name Date Size #Lines LOC

..--

analysis/12-May-2024-1,082752

codegen/12-May-2024-12,21810,229

dsl/12-May-2024-2,4701,836

generated/12-May-2024-8,1548,147

ir/12-May-2024-11,8448,234

lex/12-May-2024-1,6161,187

transform/12-May-2024-540362

BUILD.bazelD12-May-20247.1 KiB217214

GLSL.std.450.hD12-May-20244 KiB13290

READMED12-May-20243.5 KiB6961

SkSLAnalysis.cppD12-May-202430.2 KiB804657

SkSLAnalysis.hD12-May-20246.7 KiB18262

SkSLBuiltinTypes.cppD12-May-202411.8 KiB179160

SkSLBuiltinTypes.hD12-May-20244.1 KiB138100

SkSLCompiler.cppD12-May-202426.7 KiB731559

SkSLCompiler.hD12-May-20248.8 KiB276170

SkSLConstantFolder.cppD12-May-202423.4 KiB580466

SkSLConstantFolder.hD12-May-20242.1 KiB6424

SkSLContext.cppD12-May-2024515 2613

SkSLContext.hD12-May-20241.3 KiB5826

SkSLDSLParser.cppD12-May-202462.4 KiB1,8051,610

SkSLDSLParser.hD12-May-20249.8 KiB354207

SkSLDehydrator.cppD12-May-202423.9 KiB621574

SkSLDehydrator.hD12-May-20243 KiB14795

SkSLErrorReporter.cppD12-May-2024912 3823

SkSLFileOutputStream.hD12-May-20241.5 KiB7958

SkSLInliner.cppD12-May-202456.1 KiB1,223938

SkSLInliner.hD12-May-20244.7 KiB12172

SkSLIntrinsicList.hD12-May-20243.9 KiB10997

SkSLIntrinsicMap.cppD12-May-20241.4 KiB5035

SkSLIntrinsicMap.hD12-May-2024918 4724

SkSLLexer.cppD12-May-202441.3 KiB531512

SkSLLexer.hD12-May-20243.1 KiB150130

SkSLMain.cppD12-May-202424.4 KiB563456

SkSLMangler.cppD12-May-20241.9 KiB5026

SkSLMangler.hD12-May-2024572 3516

SkSLMemoryLayout.hD12-May-20245.7 KiB171127

SkSLMemoryPool.hD12-May-2024999 4525

SkSLModifiersPool.hD12-May-2024797 3919

SkSLOperators.cppD12-May-202415.8 KiB404357

SkSLOperators.hD12-May-20243.2 KiB11257

SkSLOutputStream.cppD12-May-2024982 4127

SkSLOutputStream.hD12-May-20241.1 KiB5532

SkSLParsedModule.hD12-May-2024419 2612

SkSLPool.cppD12-May-20242.6 KiB9363

SkSLPool.hD12-May-20242.5 KiB9644

SkSLProgramSettings.hD12-May-20244.9 KiB11250

SkSLRehydrator.cppD12-May-202424.3 KiB571544

SkSLRehydrator.hD12-May-20247.4 KiB238144

SkSLSampleUsage.cppD12-May-20241.2 KiB3920

SkSLString.cppD12-May-20243.8 KiB165135

SkSLStringStream.hD12-May-20241.7 KiB9665

SkSLThreadContext.cppD12-May-20247.8 KiB206161

SkSLThreadContext.hD12-May-20246.7 KiB227111

SkSLUtil.cppD12-May-20244.2 KiB7962

SkSLUtil.hD12-May-202413.6 KiB467370

sksl_frag.skslD12-May-2024419 107

sksl_gpu.skslD12-May-202418.7 KiB517463

sksl_public.skslD12-May-20248.9 KiB239216

sksl_rt_shader.skslD12-May-202440 21

sksl_vert.skslD12-May-2024254 107

spirv.hD12-May-202427.7 KiB871780

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