mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
implement variable output sizing
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
parent
c67696714b
commit
c4f5a69a0d
Binary file not shown.
Binary file not shown.
|
@ -83,7 +83,7 @@ void main() {
|
||||||
// Per-tile state
|
// Per-tile state
|
||||||
uint tile_x = gl_LocalInvocationID.x % N_TILE_X;
|
uint tile_x = gl_LocalInvocationID.x % N_TILE_X;
|
||||||
uint tile_y = gl_LocalInvocationID.x / N_TILE_X;
|
uint tile_y = gl_LocalInvocationID.x / N_TILE_X;
|
||||||
uint this_tile_ix = (bin_tile_y + tile_y) * WIDTH_IN_TILES + bin_tile_x + tile_x;
|
uint this_tile_ix = (bin_tile_y + tile_y) * conf.width_in_tiles + bin_tile_x + tile_x;
|
||||||
CmdRef cmd_ref = CmdRef(conf.ptcl_base + this_tile_ix * PTCL_INITIAL_ALLOC);
|
CmdRef cmd_ref = CmdRef(conf.ptcl_base + this_tile_ix * PTCL_INITIAL_ALLOC);
|
||||||
uint cmd_limit = cmd_ref.offset + PTCL_INITIAL_ALLOC - 2 * Cmd_size;
|
uint cmd_limit = cmd_ref.offset + PTCL_INITIAL_ALLOC - 2 * Cmd_size;
|
||||||
// The nesting depth of the clip stack
|
// The nesting depth of the clip stack
|
||||||
|
@ -370,7 +370,7 @@ void main() {
|
||||||
rd_ix += N_TILE;
|
rd_ix += N_TILE;
|
||||||
if (rd_ix >= ready_ix && partition_ix >= n_partitions) break;
|
if (rd_ix >= ready_ix && partition_ix >= n_partitions) break;
|
||||||
}
|
}
|
||||||
if (bin_tile_x + tile_x < WIDTH_IN_TILES && bin_tile_y + tile_y < HEIGHT_IN_TILES) {
|
if (bin_tile_x + tile_x < conf.width_in_tiles && bin_tile_y + tile_y < conf.height_in_tiles) {
|
||||||
Cmd_End_write(cmd_ref);
|
Cmd_End_write(cmd_ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -91,7 +91,7 @@ void main() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint tile_ix = gl_WorkGroupID.y * WIDTH_IN_TILES + gl_WorkGroupID.x;
|
uint tile_ix = gl_WorkGroupID.y * conf.width_in_tiles + gl_WorkGroupID.x;
|
||||||
CmdRef cmd_ref = CmdRef(conf.ptcl_base + tile_ix * PTCL_INITIAL_ALLOC);
|
CmdRef cmd_ref = CmdRef(conf.ptcl_base + tile_ix * PTCL_INITIAL_ALLOC);
|
||||||
|
|
||||||
uvec2 xy_uint = uvec2(gl_GlobalInvocationID.x, gl_LocalInvocationID.y + TILE_HEIGHT_PX * gl_WorkGroupID.y);
|
uvec2 xy_uint = uvec2(gl_GlobalInvocationID.x, gl_LocalInvocationID.y + TILE_HEIGHT_PX * gl_WorkGroupID.y);
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -10,10 +10,6 @@
|
||||||
#define LG_WG_FACTOR 1
|
#define LG_WG_FACTOR 1
|
||||||
#define WG_FACTOR (1<<LG_WG_FACTOR)
|
#define WG_FACTOR (1<<LG_WG_FACTOR)
|
||||||
|
|
||||||
// TODO: compute all these
|
|
||||||
|
|
||||||
#define WIDTH_IN_TILES 128
|
|
||||||
#define HEIGHT_IN_TILES 96
|
|
||||||
#define TILE_WIDTH_PX 16
|
#define TILE_WIDTH_PX 16
|
||||||
#define TILE_HEIGHT_PX 16
|
#define TILE_HEIGHT_PX 16
|
||||||
|
|
||||||
|
@ -32,6 +28,8 @@
|
||||||
struct Config {
|
struct Config {
|
||||||
uint n_elements; // paths
|
uint n_elements; // paths
|
||||||
uint n_pathseg;
|
uint n_pathseg;
|
||||||
|
uint width_in_tiles;
|
||||||
|
uint height_in_tiles;
|
||||||
uint tile_base;
|
uint tile_base;
|
||||||
uint bin_base;
|
uint bin_base;
|
||||||
uint ptcl_base;
|
uint ptcl_base;
|
||||||
|
|
|
@ -56,10 +56,10 @@ void main() {
|
||||||
y1 = int(ceil(fill.bbox.w * SY));
|
y1 = int(ceil(fill.bbox.w * SY));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
x0 = clamp(x0, 0, WIDTH_IN_TILES);
|
x0 = clamp(x0, 0, int(conf.width_in_tiles));
|
||||||
y0 = clamp(y0, 0, HEIGHT_IN_TILES);
|
y0 = clamp(y0, 0, int(conf.height_in_tiles));
|
||||||
x1 = clamp(x1, 0, WIDTH_IN_TILES);
|
x1 = clamp(x1, 0, int(conf.width_in_tiles));
|
||||||
y1 = clamp(y1, 0, HEIGHT_IN_TILES);
|
y1 = clamp(y1, 0, int(conf.height_in_tiles));
|
||||||
|
|
||||||
Path path;
|
Path path;
|
||||||
path.bbox = uvec4(x0, y0, x1, y1);
|
path.bbox = uvec4(x0, y0, x1, y1);
|
||||||
|
|
Binary file not shown.
|
@ -222,8 +222,8 @@ impl Renderer {
|
||||||
let state_buf = session.create_buffer(1 * 1024 * 1024, dev)?;
|
let state_buf = session.create_buffer(1 * 1024 * 1024, dev)?;
|
||||||
let image_dev = session.create_image2d(WIDTH as u32, HEIGHT as u32, dev)?;
|
let image_dev = session.create_image2d(WIDTH as u32, HEIGHT as u32, dev)?;
|
||||||
|
|
||||||
let mut config_buf_host = session.create_buffer(7*4, host)?;
|
let mut config_buf_host = session.create_buffer(9*4, host)?;
|
||||||
let config_buf_dev = session.create_buffer(7*4, dev)?;
|
let config_buf_dev = session.create_buffer(9*4, dev)?;
|
||||||
|
|
||||||
// TODO: constants
|
// TODO: constants
|
||||||
const PATH_SIZE: usize = 12;
|
const PATH_SIZE: usize = 12;
|
||||||
|
@ -241,7 +241,7 @@ impl Renderer {
|
||||||
alloc += (n_pathseg * PATHSEG_SIZE + 3) & !3;
|
alloc += (n_pathseg * PATHSEG_SIZE + 3) & !3;
|
||||||
let anno_base = alloc;
|
let anno_base = alloc;
|
||||||
alloc += (n_paths * ANNO_SIZE + 3) & !3;
|
alloc += (n_paths * ANNO_SIZE + 3) & !3;
|
||||||
config_buf_host.write(&[n_paths as u32, n_pathseg as u32, tile_base as u32, bin_base as u32, ptcl_base as u32, pathseg_base as u32, anno_base as u32])?;
|
config_buf_host.write(&[n_paths as u32, n_pathseg as u32, WIDTH_IN_TILES as u32, HEIGHT_IN_TILES as u32, tile_base as u32, bin_base as u32, ptcl_base as u32, pathseg_base as u32, anno_base as u32])?;
|
||||||
|
|
||||||
let mut memory_buf_host = session.create_buffer(2*4, host)?;
|
let mut memory_buf_host = session.create_buffer(2*4, host)?;
|
||||||
let memory_buf_dev = session.create_buffer(128 * 1024 * 1024, dev)?;
|
let memory_buf_dev = session.create_buffer(128 * 1024 * 1024, dev)?;
|
||||||
|
|
Loading…
Reference in a new issue