Skip to content

[Flutter GPU] shader bundle carries compute workgroup size and storage buffer bindings #188477

Description

@bdero

Part of #188474.

The Flutter GPU shader bundle records uniform structs and uniform textures, but not the workgroup size or storage-buffer bindings a compute shader needs. impellerc already reflects storage buffers from SPIR-V, the data just is not serialized into the bundle. Flutter GPU needs the storage bindings to bind buffers from Dart, and the workgroup size so the Metal backend can pass threadsPerThreadgroup at dispatch.

A compute bundle also cannot be built at all today. GenerateShaderFB compiles all five backend variants and fails the whole bundle if any is null, and a compute shader cannot be expressed in the current OpenGL ES 100 / desktop GL 120 output, so the GL cross-compile fails even when only Metal is needed. This issue handles both, the metadata and unblocking the build.

Changes

  • Add workgroup_size_x/y/z and a storage-buffer descriptor list to the BackendShader table in shader_bundle.fbs. Record read versus read_write access per storage binding from the readonly qualifier, it is cheap to reflect now and avoids a later format change. Keep the new fields optional so existing bundles still parse.
  • Emit the workgroup size and storage bindings from shader_bundle_data.cc reflection.
  • Make the GL and GLES backend variants optional for shaders those targets cannot represent (compute shaders for now), rather than failing the whole bundle. Keep producing the Metal and Vulkan variants. Wave 3's output-tier work makes the GL and GLES variants real by emitting 310 es and 430.
  • Metal scope. Do not add a per-shader GLES tier or GL access fields yet, those land with the OpenGL work.

This issue covers only the Flutter GPU shader bundle. It does not touch the runtime stage format, which backs the FragmentProgram raster API.

Testing

Build a bundle containing a compute shader and assert it succeeds with the Metal and Vulkan variants present, and that the workgroup size and storage descriptors round-trip.

Dependencies

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilitye: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.flutter-gputeam-fluttergpuOwned by Flutter GPU team

    Type

    No type

    Projects

    Status
    💡 Features

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions