I'm trying to make a shader with flutter.
#version 460 core
#include <flutter/runtime_effect.glsl>
precision mediump float;
uniform vec2 uSize;
uniform sampler2D image;
out vec4 fragColor;
void main() {
vec3 dodge = vec3(0.5);
vec2 uv = FlutterFragCoord().xy / uSize;
vec4 sample = texture(image, uv);
fragColor = vec4(dodge / (1.0 - sample.rgb), sample.a);
}
When compile the project. It says syntax error, unexpected SAMPLE, expecting COMMA or SEMICOLON on vec4 sample = texture(image, uv).
Please help me solve this problem, I don't know much about shader or glsl.
My origin task is, use color dodge blending on canvas. But not affect the alpha channel. The builtin color blending mode in Flutter will affect alpha channel.
My second choice is ColorFilter or ImageFilter, but it seems there is no way to custom the filter. There is a ColorFilter.matrix(), but I cannot build a color dodge effect with matrix.