Sitelet https://github.com/flutter/flutter/issues/189331
Skip to content

[Impeller] GLES rejects draws that sample a texture in the vertex stage when the fragment shader uses all 16 samplers #189331

Description

@bdero

On the OpenGLES backend, BufferBindingsGLES allocates fragment stage texture units after the vertex stage's and validates the running unit index against the per-stage limit. On drivers reporting the GLES minimum of 16 fragment texture units (for example ANGLE on D3D11, so Windows), a draw whose fragment shader uses all 16 samplers fails validation as soon as the vertex stage also samples a texture, because the last fragment sampler lands on unit index 16. The render pass then aborts with a fatal check and takes the app down.

[ERROR:flutter/impeller/renderer/backend/gles/buffer_bindings_gles.cc(507)] Break on 'impeller::ImpellerValidationBreak' to inspect point of failure: Texture units specified exceed the capabilities for this shader stage.
[FATAL:flutter/impeller/renderer/backend/gles/render_pass_gles.cc(844)] Check failed: result. Must be able to encode GL commands without error.

Texture units are a combined resource in GL. glActiveTexture and sampler uniform values are valid up to GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS (at least 32 on ES3), and the per-stage limits only bound how many samplers a single stage's shader references. A draw with 16 fragment samplers plus 1 vertex stage sampler is therefore legal on every ES3 driver, but the per-stage index check rejects it. The same draw works when the fragment samplers land on units 0 through 15, which is why only draws with vertex stage textures are affected.

Hit in practice by Flutter GPU rendering of skinned meshes on Windows (a skinning matrix texture in the vertex stage on top of a lit fragment shader that declares 16 samplers). Reproduced continuously by the flutter_scene smoke suite's windows job, see bdero/flutter_scene#229 for the reduced scene and CI logs.

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

    c: crashStack traces logged to the consolee: impellerImpeller rendering backend issues and features requestse: openglengineflutter/engine related. See also e: labels.flutter-gpuplatform-windowsBuilding on or for Windows specificallyteam-fluttergpuOwned by Flutter GPU team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions