| 1 | // Storage-buffer instance transport. Concatenated after `shaders.wgsl` on backends |
| 2 | // with storage buffer support; `shaders_webgl.wgsl` is the WebGL2 counterpart that |
| 3 | // decodes the same records from a texture instead. |
| 4 | // |
| 5 | // All buffers share `@group(1) @binding(0)` because each pipeline binds only the |
| 6 | // buffer its own entry points read. |
| 7 | |
| 8 | @group(1) @binding(0) var<storage, read> b_quads: array<Quad>; |
| 9 | @group(1) @binding(0) var<storage, read> b_shadows: array<Shadow>; |
| 10 | @group(1) @binding(0) var<storage, read> b_path_vertices: array<PathRasterizationVertex>; |
| 11 | @group(1) @binding(0) var<storage, read> b_path_sprites: array<PathSprite>; |
| 12 | @group(1) @binding(0) var<storage, read> b_underlines: array<Underline>; |
| 13 | @group(1) @binding(0) var<storage, read> b_mono_sprites: array<MonochromeSprite>; |
| 14 | @group(1) @binding(0) var<storage, read> b_poly_sprites: array<PolychromeSprite>; |
| 15 | |
| 16 | fn load_quad(instance_id: u32) -> Quad { |
| 17 | return b_quads[instance_id]; |
| 18 | } |
| 19 | |
| 20 | fn load_shadow(instance_id: u32) -> Shadow { |
| 21 | return b_shadows[instance_id]; |
| 22 | } |
| 23 | |
| 24 | fn load_path_vertex(vertex_id: u32) -> PathRasterizationVertex { |
| 25 | return b_path_vertices[vertex_id]; |
| 26 | } |
| 27 | |
| 28 | fn load_path_sprite(instance_id: u32) -> PathSprite { |
| 29 | return b_path_sprites[instance_id]; |
| 30 | } |
| 31 | |
| 32 | fn load_underline(instance_id: u32) -> Underline { |
| 33 | return b_underlines[instance_id]; |
| 34 | } |
| 35 | |
| 36 | fn load_mono_sprite(instance_id: u32) -> MonochromeSprite { |
| 37 | return b_mono_sprites[instance_id]; |
| 38 | } |
| 39 | |
| 40 | fn load_poly_sprite(instance_id: u32) -> PolychromeSprite { |
| 41 | return b_poly_sprites[instance_id]; |
| 42 | } |