Skip to content

fix(flame_3d): Use float for numLights uniform to fix GLES crash#3810

Open
agnath18K wants to merge 1 commit intoflame-engine:mainfrom
agnath18K:fix/flame_3d-gles-uint-crash
Open

fix(flame_3d): Use float for numLights uniform to fix GLES crash#3810
agnath18K wants to merge 1 commit intoflame-engine:mainfrom
agnath18K:fix/flame_3d-gles-uint-crash

Conversation

@agnath18K
Copy link
Contributor

Description

Fixes #3809

flame_3d crashes on Android GLES because spatial_material.frag declares uint numLights and lighting_info.dart sets it via shader.setUint(). Impeller's GLES backend only supports float uniforms — the uint path hits an unhandled shader type and crashes.

Changed uintfloat in the shader and setUintsetFloat in Dart. The value is a light count (0–3) so float works identically. Recompiled the shaderbundle.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

No test added — the crash only reproduces on a real GLES device/emulator, not in unit tests. The existing lighting logic is unchanged; only the uniform type is corrected.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

@wolfenrain
Copy link
Contributor

We should verify if this still works on iOS/macos

I don't mind changing it to an float, but if I recall we had weird float issues on the other platforms 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flame_3d] Fatal crash on Android GLES: uint uniform in spatial_material.frag

2 participants

Comments