skia2/src/sksl
Roland McGrath edf06b207a Ignore Clang's -Wdeprecated-register for flex-generated code
This change fixes the Fuchsia build.

Change-Id: I9342e5aacf75067f01aff883ccf100d11b8f4462
Reviewed-on: https://skia-review.googlesource.com/9849
Reviewed-by: Michael Jurka <mikejurka@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2017-03-20 18:44:56 +00:00
..
ast Re-land of skslc switch support 2017-02-27 19:01:55 +00:00
ir Re-land of skslc switch support 2017-02-27 19:01:55 +00:00
disable_flex_warnings.h Ignore Clang's -Wdeprecated-register for flex-generated code 2017-03-20 18:44:56 +00:00
GLSL.std.450.h
layout.flex changed skslc layout parsing strategy 2017-03-01 17:23:58 +00:00
lex.layout.c changed skslc layout parsing strategy 2017-03-01 17:23:58 +00:00
lex.layout.cpp changed skslc layout parsing strategy 2017-03-01 17:23:58 +00:00
lex.layout.h changed skslc layout parsing strategy 2017-03-01 17:23:58 +00:00
lex.sksl.c Re-land of skslc switch support 2017-02-27 19:01:55 +00:00
README Replaced all calls to fragmentPosition() with sk_FragCoord 2017-02-13 14:49:09 +00:00
sksl_frag.include added support for sk_ClipDistance 2017-02-09 19:29:33 +00:00
sksl_geom.include sksl support for geometry shaders 2017-02-17 22:00:23 +00:00
sksl_vert.include sksl support for geometry shaders 2017-02-17 22:00:23 +00:00
sksl.flex changed skslc layout parsing strategy 2017-03-01 17:23:58 +00:00
sksl.include sksl support for geometry shaders 2017-02-17 22:00:23 +00:00
SkSLCFGGenerator.cpp Re-land of skslc switch support 2017-02-27 19:01:55 +00:00
SkSLCFGGenerator.h Revert "Added dead variable / code elimination to skslc." 2017-02-06 19:25:13 +00:00
SkSLCodeGenerator.h re-land of added sk_FragCoord support to skslc 2016-12-13 14:28:53 +00:00
SkSLCompiler.cpp wired up SPIR-V validator 2017-03-16 14:42:20 +00:00
SkSLCompiler.h sksl support for geometry shaders 2017-02-17 22:00:23 +00:00
SkSLContext.h fixed assertion error when calling matrixCompMult() 2017-02-07 23:08:47 +00:00
SkSLErrorReporter.h re-land of added sk_FragCoord support to skslc 2016-12-13 14:28:53 +00:00
SkSLGLSLCodeGenerator.cpp put sksl->glsl modifiers in correct order 2017-03-10 15:49:04 +00:00
SkSLGLSLCodeGenerator.h Re-land of skslc switch support 2017-02-27 19:01:55 +00:00
SkSLIRGenerator.cpp Re-land of skslc switch support 2017-02-27 19:01:55 +00:00
SkSLIRGenerator.h Re-land of skslc switch support 2017-02-27 19:01:55 +00:00
SkSLMain.cpp sksl support for geometry shaders 2017-02-17 22:00:23 +00:00
SkSLMemoryLayout.h added support for push_constant layout 2016-11-22 08:39:36 -08:00
SkSLParser.cpp changed skslc layout parsing strategy 2017-03-01 17:23:58 +00:00
SkSLParser.h changed skslc layout parsing strategy 2017-03-01 17:23:58 +00:00
SkSLPosition.h re-land of switched skslc from std::string to SkString 2016-11-21 17:14:43 +00:00
SkSLSPIRVCodeGenerator.cpp fixed duplicate interface variable in SPIR-V output 2017-03-02 20:23:00 +00:00
SkSLSPIRVCodeGenerator.h fixed SPIR-V vector equality tests 2017-02-21 22:56:00 +00:00
SkSLToken.h changed skslc layout parsing strategy 2017-03-01 17:23:58 +00:00
SkSLUtil.cpp Force classic locale when parsing floats in skslc. 2017-01-03 18:58:45 +00:00
SkSLUtil.h re-land of added sk_FragCoord support to skslc 2016-12-13 14:28:53 +00:00
spirv.h

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
=====================

SkSL is based on GLSL 4.5. For the most part, write SkSL exactly as you would
desktop GLSL, and the SkSL compiler will take care of version and dialect
differences (for instance, you always use "in" and "out", and skslc will handle
translating them to "varying" and "attribute" as appropriate). Be aware of the 
following differences between SkSL and GLSL:

* GLSL caps can be referenced via the syntax 'sk_Caps.<name>', e.g.
  sk_Caps.sampleVariablesSupport. 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 will be ignored if present
* the output color is sk_FragColor (do not declare it)
* use sk_VertexID instead of gl_VertexID
* the fragment coordinate is sk_FragCoord, and is always relative to the upper
  left.
* lowp, mediump, and highp are always permitted (but will only be respected if 
  you run on a device which supports them)
* you do not need to include ".0" to make a number a float (meaning that
  "vec2(x, y) * 4" is perfectly legal in SkSL, unlike GLSL where it would often
  have to be expressed "vec2(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. vec2(vec3(1))) is
  intentionally disallowed, as it is just a wordier way of performing a swizzle.
  Use swizzles instead.
* Use texture() instead of textureProj(), e.g. texture(sampler2D, vec3) is
  equivalent to GLSL's textureProj(sampler2D, vec3)
* some built-in functions and one or two rarely-used language features are not
  yet supported (sorry!)

SkSL is still under development, and is expected to diverge further from GLSL
over time.