Skip to content

Mesh Shaders Tracking Issue #7197

Open
Open
@SupaMaggie70Incorporated

Description

Should replace #3018.

Progress

Spec: being added in #7885. The spec there is currently the most up to date reference.

Current open PR(s) and other work

#7345
#7930

naga

wgpu-hal backends

Other

Features

  • Multiview mesh shaders #7262
  • Per-primitive fragment shader inputs
  • Primitive ID builtin (I haven't looked at or thought about this yet at all)
  • Queries
  • Point primitives(at least in vulkan)
  • Finalize limits. I haven't spent enough time looking at how limits are handled. But it may be that for example some devices allow having very large x and y dimensions for dispatches and low z dimensions. Right now we just use the lowest of all dimensions.

Current Priorities

Current workarounds

Possibly incorrect validation layers error

See KhronosGroup/Vulkan-ValidationLayers#10404.

Once everything is implemented correctly this shouldn't be an actual issue. All the built-ins (except the indices stuff) will need to be in the same struct anyway, since you can only have one such struct for builtins per 15.1.1.

Issues to work out

  • How to implement multiview, what features, etc
  • What information needs to be exposed through adapter limits
  • How should point primitives be handled(probably not possible on directX?)
  • Per primitive things on fragment shader

API differences

Task payload handling

  • GLSL - only a single variable with the taskPayloadSharedEXT storage class per compilation unit(or none). This is then automatically passed to the entry point.
  • SPIR-V - Variables can have the TaskPayloadWorkgroupEXT storage class. This is then optionally passed as an argument to OpEmitMeshTasksEXT. For mesh shaders the payload variable is inferred.
  • HLSL - For mesh shaders, input is taken as in payload MeshPayloadStruct MeshPayload in function signature. groupshared payload_t MeshPayload is taken as an argument to DispatchMesh in task shaders.
  • MSL - Task shaders write the payload using object_data Payload& outPayload [[payload]] in the function parameters. Mesh shaders read them with object_data const Payload& payload [[payload]].

Current proposed method: in WGSL, an @payload(global_var) attribute for entry points. Potential drawbacks:

  • May not be able to properly parse all SPIR-V shaders. This is a tradeoff, as HLSL/SPIRV have the potential payload output specified in the emitMeshTasks function, while MSL/GLSL has it specified in the entry signature. This should be fine anyway, but may require smarter parsing for SPIRV.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions