mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
876a3ad581
We need to reduce the number of buffer bindings to 8 so it can run on all WebGPU devices. The best candidate was to combine info and bin_data, which are written by two different stages (draw_leaf and binning, respectively), both read by coarse, and are unstructured, so the only real shader change needed is to add the offset for the binning data. I thought I was going to have to do a blit to make it fit, but fortunately that wasn't needed. Progress to #202
39 lines
817 B
WebGPU Shading Language
39 lines
817 B
WebGPU Shading Language
// SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense
|
|
|
|
struct Config {
|
|
width_in_tiles: u32,
|
|
height_in_tiles: u32,
|
|
|
|
target_width: u32,
|
|
target_height: u32,
|
|
|
|
n_drawobj: u32,
|
|
n_path: u32,
|
|
n_clip: u32,
|
|
|
|
// To reduce the number of bindings, info and bin data are combined
|
|
// into one buffer.
|
|
bin_data_start: u32,
|
|
|
|
// offsets within scene buffer (in u32 units)
|
|
// Note: this is a difference from piet-gpu, which is in bytes
|
|
pathtag_base: u32,
|
|
pathdata_base: u32,
|
|
|
|
drawtag_base: u32,
|
|
drawdata_base: u32,
|
|
|
|
transform_base: u32,
|
|
linewidth_base: u32,
|
|
}
|
|
|
|
// Geometry of tiles and bins
|
|
|
|
let TILE_WIDTH = 16u;
|
|
let TILE_HEIGHT = 16u;
|
|
// Number of tiles per bin
|
|
let N_TILE_X = 16u;
|
|
let N_TILE_Y = 16u;
|
|
//let N_TILE = N_TILE_X * N_TILE_Y;
|
|
let N_TILE = 256u;
|