• Home
Name Date Size #Lines LOC

..--

analysis/03-May-2024-1,350982

codegen/03-May-2024-12,88510,777

dsl/03-May-2024-2,7272,076

generated/03-May-2024-8,1888,181

ir/03-May-2024-13,1679,435

lex/03-May-2024-1,7441,299

tracing/03-May-2024-942692

transform/03-May-2024-623438

BUILD.bazelD03-May-202428 KiB872818

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

READMED03-May-20243.5 KiB6961

SkSLAnalysis.cppD03-May-202427.6 KiB753613

SkSLAnalysis.hD03-May-20247.2 KiB19264

SkSLBuiltinMap.cppD03-May-20241.4 KiB5035

SkSLBuiltinMap.hD03-May-2024965 4824

SkSLBuiltinTypes.cppD03-May-202413 KiB200181

SkSLBuiltinTypes.hD03-May-20244.9 KiB164121

SkSLCompiler.cppD03-May-202428.5 KiB780601

SkSLCompiler.hD03-May-20249.1 KiB284177

SkSLConstantFolder.cppD03-May-202425 KiB621496

SkSLConstantFolder.hD03-May-20242.1 KiB6424

SkSLContext.cppD03-May-2024510 2613

SkSLContext.hD03-May-20241.3 KiB5826

SkSLDSLParser.cppD03-May-202464.9 KiB1,8691,665

SkSLDSLParser.hD03-May-20249.7 KiB342189

SkSLDehydrator.cppD03-May-202426 KiB678623

SkSLDehydrator.hD03-May-20243.1 KiB14897

SkSLErrorReporter.cppD03-May-2024971 3924

SkSLFileOutputStream.hD03-May-20241.5 KiB7958

SkSLGLSL.hD03-May-2024979 5716

SkSLInliner.cppD03-May-202456.2 KiB1,226941

SkSLInliner.hD03-May-20244.7 KiB12172

SkSLIntrinsicList.hD03-May-20244 KiB11098

SkSLLexer.cppD03-May-202459.8 KiB2,0682,049

SkSLLexer.hD03-May-20243.1 KiB150130

SkSLMain.cppD03-May-202428.5 KiB658545

SkSLMangler.cppD03-May-20242 KiB5328

SkSLMangler.hD03-May-2024575 3516

SkSLMemoryLayout.hD03-May-20245.7 KiB171127

SkSLMemoryPool.hD03-May-2024999 4525

SkSLModifiersPool.hD03-May-2024797 3919

SkSLOperators.cppD03-May-202416.3 KiB419371

SkSLOperators.hD03-May-20243.6 KiB12262

SkSLOutputStream.cppD03-May-2024987 4127

SkSLOutputStream.hD03-May-20241.1 KiB5532

SkSLParsedModule.hD03-May-2024413 2612

SkSLPool.cppD03-May-20242.6 KiB9363

SkSLPool.hD03-May-20242.5 KiB9644

SkSLProgramSettings.hD03-May-20245.4 KiB11953

SkSLRehydrator.cppD03-May-202428.8 KiB678640

SkSLRehydrator.hD03-May-20246.5 KiB234167

SkSLSampleUsage.cppD03-May-20241.2 KiB3920

SkSLSharedCompiler.cppD03-May-20242 KiB5827

SkSLSharedCompiler.hD03-May-2024703 3919

SkSLString.cppD03-May-20242.6 KiB9984

SkSLStringStream.hD03-May-20241.2 KiB5940

SkSLThreadContext.cppD03-May-20245.3 KiB162125

SkSLThreadContext.hD03-May-20246.7 KiB227111

SkSLUtil.cppD03-May-20244.8 KiB8769

SkSLUtil.hD03-May-202415.9 KiB422283

binary_format.mdD03-May-202420.2 KiB767515

sksl_frag.skslD03-May-2024419 107

sksl_gpu.skslD03-May-202418.7 KiB517463

sksl_public.skslD03-May-20249.1 KiB245221

sksl_rt_shader.skslD03-May-202440 21

sksl_vert.skslD03-May-2024254 107

spirv.hD03-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