From 6a312e79e94ec4ab0375e8774fb9e5b4cc962082 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Wed, 9 Feb 2022 10:42:35 -0500 Subject: [PATCH] Update SkSL docs (isOpaque, folding) - Remove the isOpaque parameter from all makeShader calls - Add some folding to emphasize important parts of fiddles Bug: skia:12643 Change-Id: Iaae5d61b63b409a8754b5144dc2baf5927a14848 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506316 Reviewed-by: John Stiles Commit-Queue: Brian Osman --- site/docs/user/sksl.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/site/docs/user/sksl.md b/site/docs/user/sksl.md index 576274f19a..ff5bd88661 100644 --- a/site/docs/user/sksl.md +++ b/site/docs/user/sksl.md @@ -63,7 +63,7 @@ own shader code, you don't use `sample`. Instead, the `shader` object has a `.eval()` method. Regardless, Skia has simple methods for creating an `SkShader` from an `SkImage`, so it's easy to use images in your runtime effects: - + Because the object you bind and evaluate is an `SkShader`, you can directly use any Skia shader, without necessarily turning it into an image (texture) first. @@ -72,12 +72,12 @@ texture created to hold the gradient. Skia generates a single fragment shader that computes the gradient color, samples from the image's texture, and then multiplies the two together: - + Of course, you can even invoke another runtime effect, allowing you to combine shader snippets dynamically: - + --- @@ -99,7 +99,7 @@ passed to you, the scale is correct. However, if you want to adjust those coordinates (to do some kind of re-mapping of the image), remember that the coordinates are scaled up to the dimensions of the image: - + --- @@ -165,9 +165,9 @@ that is actually what you want when working with uniform colors. By labeling uni colors this way, your source colors (that you place in uniforms) will represent the same, consistent color regardless of the color space of the destination surface. - + -### Raw Image Shaders (no cs, no premul) +### Raw Image Shaders Although most images contain colors that should be color managed, some images contain data that isn't actually colors. This includes images storing normals, @@ -189,7 +189,7 @@ transformed to the working color space. This alters the normals, incorrectly. For the final draw, we use a raw image shader, which returns the original normals, ignoring the working color space. - + ### Working In a Known Color Space @@ -219,7 +219,7 @@ for example. Here's an example showing a sphere, with lighting math being done in the default working space (sRGB), and again with the math done in a linear space: - + --- @@ -253,4 +253,4 @@ The image below demonstrates this: properly premultiplied colors produce a smoot gradient as alpha decreases. Unpremultipled colors cause the gradient to display incorrectly, becoming too bright and shifting hue as the alpha changes. - +