[Impeller] document reverse-y requirement for ImageFilter.shader (#169761)

Otherwise things are upside down.
This commit is contained in:
Jonah Williams 2025-05-30 14:14:51 -07:00 committed by GitHub
parent 11bf180af0
commit 291a689a10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4242,6 +4242,10 @@ abstract class ImageFilter {
/// also be at least one sampler2D uniform, the first of which will be set by
/// the engine to contain the filter input.
///
/// When Impeller uses the OpenGL(ES) backend, the y-axis direction is
/// reversed. Custom fragment shaders must invert the y-axis on
/// GLES or they will render upside-down.
///
/// For example, the following is a valid fragment shader that can be used
/// with this API. Note that the uniform names are not required to have any
/// particular value.
@ -4257,7 +4261,12 @@ abstract class ImageFilter {
/// out vec4 frag_color;
///
/// void main() {
/// frag_color = texture(u_texture_input, FlutterFragCoord().xy / u_size) * u_time;
/// vec2 uv = FlutterFragCoord().xy / u_size;
/// // Reverse y axis for OpenGL backend.
/// #ifdef IMPELLER_TARGET_OPENGLES
/// uv.y = 1.0 - uv.y
/// #endif
/// frag_color = texture(u_texture_input, uv) * u_time;
///
/// }
///