Skip to content

Runtime shader program fails to link on Linux with Impeller #179185

@planetmarshall

Description

@planetmarshall

Steps to reproduce

Note that the issue cannot be reproduced on NVIDIA platforms as the OpenGLES implementation allows linking
of shaders from different language versions. This may also be the case with other drivers.

The issue has been reproduced on AMD, Arm Mali and Broadcom Videocore drivers.

  1. Clone https://github.com/planetmarshall/flutter-runtime-effect.git
    git clone https://github.com/planetmarshall/flutter-runtime-effect.git
    
  2. Run the application under Linux with Impeller enabled
    cd flutter-runtime-effect
    flutter run -d linux --enable-impeller
    

Expected results

The application runs and the effect is successfully displayed.

Actual results

The application runs but the effect is not displayed. The following error is present in the log:

[ERROR:flutter/impeller/renderer/backend/gles/pipeline_library_gles.cc(169)] Break on 'ImpellerValidationBreak' to inspect point of failure: Could not link shader program: error: all shaders must use same shading language version

Vertex Shader:
#version 100

struct FrameInfo
{
    mat4 mvp;
};

uniform FrameInfo frame_info;

attribute vec2 position;
varying vec2 _fragCoord;

void main()
{
    gl_Position = frame_info.mvp * vec4(position, 0.0, 1.0);
    _fragCoord = position;
    gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
}


Fragment Shader:
#version 300 es
precision mediump float;
precision highp int;

uniform highp vec2 u_size;
uniform highp sampler2D u_texture;

in highp vec2 _fragCoord;
layout(location = 0) out highp vec4 fragColor;

void main()
{
    highp vec2 _24 = _fragCoord / u_size;
    _24.y = 1.0 - _24.y;
    highp vec4 _42 = texture(u_texture, _24);
    highp float _51 = dot(_42.xyz, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
    fragColor = vec4(_51, _51, _51, _42.w);
}

Code sample

See https://github.com/planetmarshall/flutter-runtime-effect.git

Screenshots or Video

No response

Logs

Logs
Launching lib/main.dart on Linux in debug mode...
Building Linux application...                                   
✓ Built build/linux/x64/debug/bundle/runtime_effect
pci id for fd 16: 10de:28e0, driver (null)
pci id for fd 17: 10de:28e0, driver (null)
[IMPORTANT:flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc(99)] Using the Impeller rendering backend (OpenGL).
Gdk-Message: 13:17:22.785: Unable to load  from the cursor theme
Syncing files to device Linux...                                    64ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on Linux is available at: http://127.0.0.1:33037/9pTlZvjQyNw=/
The Flutter DevTools debugger and profiler on Linux is available at: http://127.0.0.1:33037/9pTlZvjQyNw=/devtools/?uri=ws://127.0.0.1:33037/9pTlZvjQyNw=/ws
[ERROR:flutter/impeller/renderer/backend/gles/pipeline_library_gles.cc(169)] Break on 'ImpellerValidationBreak' to inspect point of failure: Could not link shader program: error: all shaders must use same shading language version

Vertex Shader:
#version 100

struct FrameInfo
{
    mat4 mvp;
};

uniform FrameInfo frame_info;

attribute vec2 position;
varying vec2 _fragCoord;

void main()
{
    gl_Position = frame_info.mvp * vec4(position, 0.0, 1.0);
    _fragCoord = position;
    gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
}


Fragment Shader:
#version 300 es
precision mediump float;
precision highp int;

uniform highp vec2 u_size;
uniform highp sampler2D u_texture;

in highp vec2 _fragCoord;
layout(location = 0) out highp vec4 fragColor;

void main()
{
    highp vec2 _24 = _fragCoord / u_size;
    _24.y = 1.0 - _24.y;
    highp vec4 _42 = texture(u_texture, _24);
    highp float _51 = dot(_42.xyz, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
    fragColor = vec4(_51, _51, _51, _42.w);
}


[ERROR:flutter/impeller/renderer/backend/gles/pipeline_library_gles.cc(245)] Break on 'ImpellerValidationBreak' to inspect point of failure: Could not link pipeline program.
[ERROR:flutter/impeller/renderer/backend/gles/pipeline_library_gles.cc(169)] Break on 'ImpellerValidationBreak' to inspect point of failure: Could not link shader program: error: all shaders must use same shading language version

Vertex Shader:
#version 100

struct FrameInfo
{
    mat4 mvp;
};

uniform FrameInfo frame_info;

attribute vec2 position;
varying vec2 _fragCoord;

void main()
{
    gl_Position = frame_info.mvp * vec4(position, 0.0, 1.0);
    _fragCoord = position;
    gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
}


Fragment Shader:
#version 300 es
precision mediump float;
precision highp int;

uniform highp vec2 u_size;
uniform highp sampler2D u_texture;

in highp vec2 _fragCoord;
layout(location = 0) out highp vec4 fragColor;

void main()
{
    highp vec2 _24 = _fragCoord / u_size;
    _24.y = 1.0 - _24.y;
    highp vec4 _42 = texture(u_texture, _24);
    highp float _51 = dot(_42.xyz, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625));
    fragColor = vec4(_51, _51, _51, _42.w);
}


[ERROR:flutter/impeller/renderer/backend/gles/pipeline_library_gles.cc(245)] Break on 'ImpellerValidationBreak' to inspect point of failure: Could not link pipeline program.
[ERROR:flutter/impeller/entity/contents/runtime_effect_contents.cc(212)] Break on 'ImpellerValidationBreak' to inspect point of failure: Failed to get or create runtime effect pipeline.
[ERROR:flutter/impeller/renderer/render_pass.cc(64)] Break on 'ImpellerValidationBreak' to inspect point of failure: Attempted to add an invalid command to the render pass.
[ERROR:flutter/impeller/renderer/render_pass.cc(64)] Break on 'ImpellerValidationBreak' to inspect point of failure: Attempted to add an invalid command to the render pass.
[ERROR:flutter/impeller/renderer/render_pass.cc(64)] Break on 'ImpellerValidationBreak' to inspect point of failure: Attempted to add an invalid command to the render pass.
[ERROR:flutter/impeller/renderer/render_pass.cc(64)] Break on 'ImpellerValidationBreak' to inspect point of failure: Attempted to add an invalid command to the render pass.
Lost connection to device.

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel main, 3.39.0-1.0.pre-322, on Arch Linux 6.16.7-arch1-1, locale en_GB.UTF-8)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/to/linux-android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
[✓] Connected device (1 available)
[✓] Network resources

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolee: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.found in release: 3.38Found to occur in 3.38found in release: 3.39Found to occur in 3.39has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-linuxBuilding on or for Linux specificallyr: fixedIssue is closed as already fixed in a newer versionteam-linuxOwned by the Linux platform teamtriaged-linuxTriaged by the Linux platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions