diff --git a/docs/docs/shaders/assets/simple-uniform.png b/docs/docs/shaders/assets/simple-uniform.png
index b0255bcff7..c624c10028 100644
Binary files a/docs/docs/shaders/assets/simple-uniform.png and b/docs/docs/shaders/assets/simple-uniform.png differ
diff --git a/docs/docs/shaders/language.md b/docs/docs/shaders/language.md
index a0e2c4e508..4fda84cbfb 100644
--- a/docs/docs/shaders/language.md
+++ b/docs/docs/shaders/language.md
@@ -30,11 +30,11 @@ if (!source) {
Creates a shader from source.
Shaders can be nested with one another.
-| Name | Type | Description |
-|:---------|:----------------|:------------------------------|
-| source | `RuntimeEffect` | Compiled shaders |
-| uniforms | `number` | uniform values |
-| children | `Shader` | Shaders to be used as uniform |
+| Name | Type | Description |
+|:---------|:---------------------------------------------------------------------|:------------------------------|
+| source | `RuntimeEffect` | Compiled shaders |
+| uniforms | { [name: string]: number | Vector | number[]}
| uniform values |
+| children | `Shader` | Shaders to be used as uniform |
### Simple Shader
@@ -63,25 +63,30 @@ const SimpleShader = () => {
### Using Uniforms
+Uniforms are variables used to parametrize shaders.
+The following uniform types are supported: `float`, `float2`, `float3`, `float4`, `float2x2`, `float3x3`, `float4x4`, `int`, `int2`, `int3` and, `int4`.
+
```tsx twoslash
-import {Canvas, Skia, Paint, Shader, Fill} from "@shopify/react-native-skia";
+import {Canvas, Skia, Paint, Shader, Fill, vec} from "@shopify/react-native-skia";
const source = Skia.RuntimeEffect.Make(`
-uniform float blue;
+uniform vec2 c;
uniform float r;
+uniform float blue;
vec4 main(vec2 pos) {
vec2 normalized = pos/vec2(2 * r);
- return distance(pos, vec2(r)) > r ? vec4(1) : vec4(normalized.x, normalized.y, blue, 1);
+ return distance(pos, c) > r ? vec4(1) : vec4(normalized, blue, 1);
}`)!;
const UniformShader = () => {
- const blue = 1.0;
const r = 128;
+ const c = vec(2 * r, r);
+ const blue = 1.0;
return (
@@ -122,4 +127,4 @@ const NestedShader = () => {
};
```
-![Simple Shader](assets/nested.png)
\ No newline at end of file
+![Simple Shader](assets/nested.png)
diff --git a/example/src/Examples/Filters/Filters.tsx b/example/src/Examples/Filters/Filters.tsx
index 87d5cd8bf6..14524aa1ba 100644
--- a/example/src/Examples/Filters/Filters.tsx
+++ b/example/src/Examples/Filters/Filters.tsx
@@ -27,7 +27,10 @@ export const Filters = () => {
return (