skia2/src/sksl
John Stiles 77da3e24dd Report invalid octal numbers correctly.
Previously, we'd report them as an overflowed integer.

Change-Id: Ia3632b4bc880829fb04b08a002d7ce9523567a54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472056
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-16 14:32:59 +00:00
..
analysis Make Program owned-elements public. 2021-10-07 13:44:34 +00:00
codegen Simplify literal creation in SPIR-V. 2021-11-15 14:52:18 +00:00
dsl Removed the final remnants of IRGenerator 2021-10-19 13:17:01 +00:00
generated Report invalid octal numbers correctly. 2021-11-16 14:32:59 +00:00
ir Replace getConstantSubexpression with getConstantValue. 2021-11-15 14:46:21 +00:00
lex Report invalid octal numbers correctly. 2021-11-16 14:32:59 +00:00
transform Broke DSLWriter into two separate classes 2021-10-07 15:28:58 +00:00
BUILD.bazel [infra] Add POC Bazel rules for CanvasKit 2021-11-12 21:38:46 +00:00
GLSL.std.450.h Remove trailing whitespace. 2017-10-09 21:20:34 +00:00
README Remove large swaths of code related to .fp files 2021-07-08 16:53:47 +00:00
sksl_frag.sksl Add sk_SecondaryFragColor built-in. 2021-11-01 21:25:19 +00:00
sksl_gpu.sksl Add support for clamp($genUType, ...) in SkSL. 2021-11-11 18:43:42 +00:00
sksl_public.sksl Add support for clamp($genUType, ...) in SkSL. 2021-11-11 18:43:42 +00:00
sksl_rt_shader.sksl Remove blend and colorFilter sksl modules 2021-08-31 17:35:19 +00:00
sksl_vert.sksl Remove sk_ClipDistance. 2020-09-25 20:29:10 +00:00
SkSLAnalysis.cpp Enforce basic limits on global size in SkSL. 2021-11-04 18:34:19 +00:00
SkSLAnalysis.h Migrate IsConstantExpression out of SkSLAnalysis. 2021-10-07 13:40:00 +00:00
SkSLBuiltinTypes.cpp Fix up samplerCube/textureCube for ES2 conformance. 2021-10-14 15:21:31 +00:00
SkSLBuiltinTypes.h Fix up samplerCube/textureCube for ES2 conformance. 2021-10-14 15:21:31 +00:00
SkSLCompiler.cpp Replace fSkVMDebugTrace program setting with SkVMDebugInfo. 2021-11-12 14:13:14 +00:00
SkSLCompiler.h Add sk_SecondaryFragColor built-in. 2021-11-01 21:25:19 +00:00
SkSLConstantFolder.cpp Move ErrorOnDivideByZero out of ConstantFolder interface. 2021-11-15 15:37:39 +00:00
SkSLConstantFolder.h Move ErrorOnDivideByZero out of ConstantFolder interface. 2021-11-15 15:37:39 +00:00
SkSLContext.cpp Allow Mangler to be used outside of Inliner. 2021-09-16 21:53:19 +00:00
SkSLContext.h Moved SkSL intrinsics from IRGenerator to Context 2021-09-29 22:15:49 +00:00
SkSLDehydrator.cpp Replace trio of XxxxLiteral types with a single Literal type. 2021-09-13 17:32:34 +00:00
SkSLDehydrator.h Removed StringFragment alias in favor of skstd::string_view 2021-06-10 18:07:03 +00:00
SkSLDSLParser.cpp Report invalid octal numbers correctly. 2021-11-16 14:32:59 +00:00
SkSLDSLParser.h Removed useless modifiersWithDefaults method from DSLParser 2021-10-04 14:39:51 +00:00
SkSLErrorReporter.cpp Reland "Use SkSL "offset" to actually mean "line"" 2021-09-27 19:48:39 +00:00
SkSLFileOutputStream.h Update skslc to compile multiple files during one invocation. 2020-11-12 15:05:27 +00:00
SkSLInliner.cpp Allow inlining of functions with unassigned out-params. 2021-11-11 19:33:06 +00:00
SkSLInliner.h Allow inlining of functions with unassigned out-params. 2021-11-11 19:33:06 +00:00
SkSLIntrinsicList.h Remove SkSL shade/blend/filter intrinsics 2021-09-03 16:55:38 +00:00
SkSLIntrinsicMap.cpp Moved SkSL intrinsics from IRGenerator to Context 2021-09-29 22:15:49 +00:00
SkSLIntrinsicMap.h Moved SkSL intrinsics from IRGenerator to Context 2021-09-29 22:15:49 +00:00
SkSLLexer.cpp Report invalid octal numbers correctly. 2021-11-16 14:32:59 +00:00
SkSLLexer.h Report invalid octal numbers correctly. 2021-11-16 14:32:59 +00:00
SkSLMain.cpp Add variable slot information to SkVMDebugInfo. 2021-11-15 14:24:08 +00:00
SkSLMangler.cpp Use string_view in Mangler. 2021-09-16 02:32:23 +00:00
SkSLMangler.h Use string_view in Mangler. 2021-09-16 02:32:23 +00:00
SkSLMemoryLayout.h Reland "Add support for half-precision types in Metal." 2021-10-30 14:33:52 +00:00
SkSLMemoryPool.h Free unused scratch space from idle Pools. 2020-10-29 15:20:43 +00:00
SkSLModifiersPool.h Migrate ModifiersPool into the context. 2021-05-04 21:24:55 +00:00
SkSLOperators.cpp Migrate determineBinaryExpression to Operator. 2021-03-01 14:15:34 +00:00
SkSLOperators.h Reland "Add format-specifier warnings to SkDebugf." 2021-06-25 17:57:43 +00:00
SkSLOutputStream.cpp Add line breaks to make dehydrated files more merge-friendly. 2020-10-08 18:55:02 +00:00
SkSLOutputStream.h Made SkSL DSL into public API 2021-03-04 21:03:58 +00:00
SkSLParsedModule.h Moved SkSL intrinsics from IRGenerator to Context 2021-09-29 22:15:49 +00:00
SkSLPool.cpp Use thread_local on iOS 2021-09-20 17:51:38 +00:00
SkSLPool.h Use scopes to attach and detach SkSL memory pools. 2021-08-09 14:25:18 +00:00
SkSLProgramSettings.h Replace fSkVMDebugTrace program setting with SkVMDebugInfo. 2021-11-12 14:13:14 +00:00
SkSLRehydrator.cpp Require LoopUnrollInfo in ForStatement::Make. 2021-10-06 16:12:26 +00:00
SkSLRehydrator.h Removed the final remnants of IRGenerator 2021-10-19 13:17:01 +00:00
SkSLSampleUsage.cpp Remove fExpression (matrix expression) from SampleUsage 2021-05-21 18:04:03 +00:00
SkSLString.cpp Add parser support for u suffix on literals. 2021-11-16 13:50:14 +00:00
SkSLStringStream.h Made SkSL DSL into public API 2021-03-04 21:03:58 +00:00
SkSLThreadContext.cpp Removed the final remnants of IRGenerator 2021-10-19 13:17:01 +00:00
SkSLThreadContext.h Removed the final remnants of IRGenerator 2021-10-19 13:17:01 +00:00
SkSLUtil.cpp Rename Uint to UInt. 2021-11-02 15:05:52 +00:00
SkSLUtil.h Remove GrTypesPriv.h dep from SkSLUtil.h when SK_SUPPORT_GPU=0 2021-10-28 16:52:35 +00:00
spirv.h Remove trailing whitespace. 2017-10-09 21:20:34 +00:00

Overview
========

SkSL ("Skia Shading Language") is a variant of GLSL which is used as Skia's
internal shading language. SkSL is, at its heart, a single standardized version
of GLSL which avoids all of the various version and dialect differences found
in GLSL "in the wild", but it does bring a few of its own changes to the table.

Skia uses the SkSL compiler to convert SkSL code to GLSL, GLSL ES, or SPIR-V
before handing it over to the graphics driver.


Differences from GLSL
=====================

* Precision modifiers are not used. 'float', 'int', and 'uint' are always high
  precision. New types 'half', 'short', and 'ushort' are medium precision (we
  do not use low precision).
* Vector types are named <base type><columns>, so float2 instead of vec2 and
  bool4 instead of bvec4
* Matrix types are named <base type><columns>x<rows>, so float2x3 instead of
  mat2x3 and double4x4 instead of dmat4
* "@if" and "@switch" are static versions of if and switch. They behave exactly
  the same as if and switch in all respects other than it being a compile-time
  error to use a non-constant expression as a test.
* GLSL caps can be referenced via the syntax 'sk_Caps.<name>', e.g.
  sk_Caps.canUseAnyFunctionInShader. The value will be a constant boolean or int,
  as appropriate. As SkSL supports constant folding and branch elimination, this
  means that an 'if' statement which statically queries a cap will collapse down
  to the chosen branch, meaning that:

    if (sk_Caps.externalTextureSupport)
        do_something();
    else
        do_something_else();

  will compile as if you had written either 'do_something();' or
  'do_something_else();', depending on whether that cap is enabled or not.
* no #version statement is required, and it will be ignored if present
* the output color is sk_FragColor (do not declare it)
* use sk_Position instead of gl_Position. sk_Position is in device coordinates
  rather than normalized coordinates.
* use sk_PointSize instead of gl_PointSize
* use sk_VertexID instead of gl_VertexID
* use sk_InstanceID instead of gl_InstanceID
* the fragment coordinate is sk_FragCoord, and is always relative to the upper
  left.
* use sk_Clockwise instead of gl_FrontFacing. This is always relative to an
  upper left origin.
* you do not need to include ".0" to make a number a float (meaning that
  "float2(x, y) * 4" is perfectly legal in SkSL, unlike GLSL where it would
  often have to be expressed "float2(x, y) * 4.0". There is no performance
  penalty for this, as the number is converted to a float at compile time)
* type suffixes on numbers (1.0f, 0xFFu) are both unnecessary and unsupported
* creating a smaller vector from a larger vector (e.g. float2(float3(1))) is
  intentionally disallowed, as it is just a wordier way of performing a swizzle.
  Use swizzles instead.
* Swizzle components, in addition to the normal rgba / xyzw components, can also
  be LTRB (meaning "left/top/right/bottom", for when we store rectangles in
  vectors), and may also be the constants '0' or '1' to produce a constant 0 or
  1 in that channel instead of selecting anything from the source vector.
  foo.rgb1 is equivalent to float4(foo.rgb, 1).
* All texture functions are named "sample", e.g. sample(sampler2D, float3) is
  equivalent to GLSL's textureProj(sampler2D, float3).
* Functions support the 'inline' modifier, which causes the compiler to ignore
  its normal inlining heuristics and inline the function if at all possible
* some built-in functions and one or two rarely-used language features are not
  yet supported (sorry!)