Skip to content

Updatable MeshGeometry throws RangeError after a mesh shrinks #292

Description

@Ram-Dawson

Summary

MeshGeometry.applyMeshData can throw a RangeError when an updatable mesh is updated from a larger vertex count to a smaller one.

Reproduction

  1. Check out repro/updatable-mesh-shrink-before from the linked reproduction repository.
  2. Run fvm flutter pub get.
  3. Run fvm flutter drive --driver=test_driver/integration_test.dart --target=integration_test/updatable_mesh_shrink_test.dart -d <device-id> --enable-flutter-gpu --enable-impeller.

Observed behavior

The shrink update throws from the GPU upload path:

RangeError (end): Invalid value: Not in inclusive range 0..4032: 4416
  ByteData.sublistView
  _RingBufferStream.writeRange
  MeshGeometry.applyMeshData

The stale range retained by a previously larger mesh extends beyond the smaller snapshot's CPU byte array. In a manual Flutter UI this exception escapes the slider callback, so the slider can appear to stop updating.

Expected behavior

Shrinking and then regrowing an updatable mesh should not attempt to upload bytes outside the current mesh snapshot.

Supporting evidence

The reproduction repository includes a focused failing tag, text evidence, and two supporting Android UI captures. The screenshots are not a same-frame visual comparison; the RangeError and focused integration test are the behavioral evidence.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions