flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
162.17k stars 26.65k forks source link

Custom shader on web platform error: FormatException: Invalid Shader Data #146688

Closed rusoleal closed 4 weeks ago

rusoleal commented 1 month ago

Steps to reproduce

Just playing with custom shaders, detected an issue on web platform.

Please check this dummy example with a very basic custom shader: https://github.com/rusoleal/flutter_shader_web_test

This test is working as expected on native platforms.

ON web platform, crash trying to load the shader from FragmentProgram.fromAsset('shaders/simple.frag').

Expected results

No crashing on web platform.

Actual results

Native platforms: works as expected Web platform: crash loading shader

Code sample

Code sample ```dart [Paste your code here] ```

Screenshots or Video

code available on https://github.com/rusoleal/flutter_shader_web_test

Logs

No response

Flutter Doctor output

Doctor output [✓] Flutter (Channel stable, 3.19.5, on macOS 14.4.1 23E224 darwin-arm64, locale es-ES) • Flutter version 3.19.5 on channel stable at /Users/rubenleal/Documents/flutter/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 300451adae (2 weeks ago), 2024-03-27 21:54:07 -0500 • Engine revision e76c956498 • Dart version 3.3.3 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/rubenleal/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2023.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) [✓] VS Code (version 1.88.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (3 available) • iPad de Ruben (mobile) • 7f8f62326a414e616a709acc6bf5b493b608db01 • ios • iOS 17.4.1 21E236 • macOS (desktop) • macos • darwin-arm64 • macOS 14.4.1 23E224 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.123 [✓] Network resources • All expected network resources are available. • No issues found!
huycozy commented 4 weeks ago

Hi @rusoleal, this is a known issue at https://github.com/flutter/flutter/issues/141838 that has been fixed on beta and master channels. You can switch to these channels and retry:

flutter channel master
flutter upgrade

Closing the issue as fixed.

github-actions[bot] commented 2 weeks ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.