aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/README
diff options
context:
space:
mode:
Diffstat (limited to 'src/sksl/README')
-rw-r--r--src/sksl/README24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/sksl/README b/src/sksl/README
index f590bbeae2..012895412e 100644
--- a/src/sksl/README
+++ b/src/sksl/README
@@ -13,12 +13,10 @@ 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:
-
+* 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.
@@ -35,7 +33,7 @@ following differences between SkSL and GLSL:
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
+* no #version statement is required, and it 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
@@ -43,15 +41,15 @@ following differences between SkSL and GLSL:
* 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
+ "float2x, y) * 4" is perfectly legal in SkSL, unlike GLSL where it would often
+ have to be expressed "float2x, 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
+* creating a smaller vector from a larger vector (e.g. float2float31))) 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)
+* Use texture() instead of textureProj(), e.g. texture(sampler2D, float3 is
+ equivalent to GLSL's textureProj(sampler2D, float3
* some built-in functions and one or two rarely-used language features are not
yet supported (sorry!)
@@ -96,7 +94,7 @@ Within an '.fp' fragment processor file:
(the sampler params to attach to the named sampler2D)
* global 'in' variables represent data passed to the fragment processor at
construction time. These variables become constructor parameters and are
- stored in fragment processor fields. vec2s map to SkPoints, and vec4s map to
+ stored in fragment processor fields. float2 map to SkPoints, and float4 map to
SkRects (in x, y, width, height) order.
* 'uniform' variables become, as one would expect, top-level uniforms. By
default they do not have any data provided to them; you will need to provide