[Breaking change]: OpenGLES fragment shader coordinate system now matches other backends

132 views
Skip to first unread message

Aaron Clarke

unread,
Jun 4, 2026, 12:04:41 PM (12 days ago) Jun 4
to Flutter Public Announcements (flutter-announce)

Authors of fragment shaders previously had to make special accommodations for Impeller OpenGLES backends with conditional compilation to flip the y-coordinates of samplers.  That requirement has been removed and the conditional compilation can be removed now.


Not removing the conditional compilation flip can result in things being drawn upside down on Impeller OpenGLES.


When will the change happen?

This change is already present on the main channel after 475014b679b1a9539d20290ecfc0f665bcaccfac.  It will be present in the next stable release after 3.44.0.


How to prepare for this change?

The conditional compilation inside the fragment shaders can be removed.


Before:

void main() {

  vec2 uv = FlutterFragCoord().xy / u_size;

#ifdef IMPELLER_TARGET_OPENGLES

  uv.y = 1.0 - uv.y;

#endif

  fragColor = texture(u_texture, uv);

}


After:

void main() {

  vec2 uv = FlutterFragCoord().xy / u_size;

  fragColor = texture(u_texture, uv);

}


If you are authoring a package with fragment shaders, make sure to increase your Flutter dependency in pubspec.yaml to match the new stable version.  To aid with this transition there is a temporary macro that can be used until the next stable release, IMPELLER_OPENGLES_UNFLIPPED_DEPRECATED ( 1787981a1b8d700eed9398fb3ae3fe83d9d16c39 ).  This allows the authoring of fragment shaders that are supported before 3.44.0 and until the macro is removed.


void main() {

  vec2 uv = FlutterFragCoord().xy / u_size;

#if defined(IMPELLER_TARGET_OPENGLES) && 

    !defined(IMPELLER_OPENGLES_UNFLIPPED_DEPRECATED)

  uv.y = 1.0 - uv.y;

#endif

  fragColor = texture(u_texture, uv);

}


Reply all
Reply to author
Forward
0 new messages