mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
shader: delete more unused code and variables
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
parent
a73e7cf282
commit
326f7f0d03
|
@ -17,8 +17,6 @@ layout(set = 0, binding = 0) buffer AnnotatedBuf {
|
||||||
|
|
||||||
layout(set = 0, binding = 1) buffer AllocBuf {
|
layout(set = 0, binding = 1) buffer AllocBuf {
|
||||||
uint n_elements; // paths
|
uint n_elements; // paths
|
||||||
// Will be incremented atomically to claim tiles
|
|
||||||
uint tile_ix;
|
|
||||||
uint alloc;
|
uint alloc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,8 +40,6 @@ shared uint bitmaps[N_SLICE][N_TILE];
|
||||||
shared uint count[N_SLICE][N_TILE];
|
shared uint count[N_SLICE][N_TILE];
|
||||||
shared uint sh_chunk_start[N_TILE];
|
shared uint sh_chunk_start[N_TILE];
|
||||||
|
|
||||||
shared float sh_right_edge[N_TILE];
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
uint my_n_elements = n_elements;
|
uint my_n_elements = n_elements;
|
||||||
uint my_partition = gl_WorkGroupID.x;
|
uint my_partition = gl_WorkGroupID.x;
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -108,27 +108,9 @@ void main() {
|
||||||
PathStrokeLine line;
|
PathStrokeLine line;
|
||||||
float dx;
|
float dx;
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
/*
|
|
||||||
case PathSeg_FillLine:
|
|
||||||
case PathSeg_StrokeLine:
|
|
||||||
line = PathSeg_StrokeLine_read(ref);
|
|
||||||
xmin = min(line.p0.x, line.p1.x) - line.stroke.x;
|
|
||||||
xmax = max(line.p0.x, line.p1.x) + line.stroke.x;
|
|
||||||
ymin = min(line.p0.y, line.p1.y) - line.stroke.y;
|
|
||||||
ymax = max(line.p0.y, line.p1.y) + line.stroke.y;
|
|
||||||
dx = line.p1.x - line.p0.x;
|
|
||||||
float dy = line.p1.y - line.p0.y;
|
|
||||||
// Set up for per-scanline coverage formula, below.
|
|
||||||
float invslope = abs(dy) < 1e-9 ? 1e9 : dx / dy;
|
|
||||||
c = (line.stroke.x + abs(invslope) * (0.5 * float(TILE_HEIGHT_PX) + line.stroke.y)) * SX;
|
|
||||||
b = invslope; // Note: assumes square tiles, otherwise scale.
|
|
||||||
a = (line.p0.x - (line.p0.y - 0.5 * float(TILE_HEIGHT_PX)) * b) * SX;
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
case PathSeg_FillCubic:
|
case PathSeg_FillCubic:
|
||||||
case PathSeg_StrokeCubic:
|
case PathSeg_StrokeCubic:
|
||||||
PathStrokeCubic cubic = PathSeg_StrokeCubic_read(ref);
|
PathStrokeCubic cubic = PathSeg_StrokeCubic_read(ref);
|
||||||
// Commented out code is for computing error bound on conversion to quadratics
|
|
||||||
vec2 err_v = 3.0 * (cubic.p2 - cubic.p1) + cubic.p0 - cubic.p3;
|
vec2 err_v = 3.0 * (cubic.p2 - cubic.p1) + cubic.p0 - cubic.p3;
|
||||||
float err = err_v.x * err_v.x + err_v.y * err_v.y;
|
float err = err_v.x * err_v.x + err_v.y * err_v.y;
|
||||||
// The number of quadratics.
|
// The number of quadratics.
|
||||||
|
|
|
@ -10,15 +10,8 @@
|
||||||
#define TILE_WIDTH_PX 16
|
#define TILE_WIDTH_PX 16
|
||||||
#define TILE_HEIGHT_PX 16
|
#define TILE_HEIGHT_PX 16
|
||||||
|
|
||||||
// TODO: make the image size dynamic.
|
|
||||||
#define IMAGE_WIDTH (WIDTH_IN_TILES*TILE_WIDTH_PX)
|
|
||||||
#define IMAGE_HEIGHT (HEIGHT_IN_TILES*TILE_HEIGHT_PX)
|
|
||||||
|
|
||||||
#define PTCL_INITIAL_ALLOC 1024
|
#define PTCL_INITIAL_ALLOC 1024
|
||||||
|
|
||||||
// Stuff for new algorithm follows; some of the above should get
|
|
||||||
// deleted.
|
|
||||||
|
|
||||||
// These should probably be renamed and/or reworked. In the binning
|
// These should probably be renamed and/or reworked. In the binning
|
||||||
// kernel, they represent the number of bins. Also, the workgroup size
|
// kernel, they represent the number of bins. Also, the workgroup size
|
||||||
// of that kernel is equal to the number of bins, but should probably
|
// of that kernel is equal to the number of bins, but should probably
|
||||||
|
|
Binary file not shown.
|
@ -227,14 +227,14 @@ impl<D: Device> Renderer<D> {
|
||||||
&[],
|
&[],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let bin_alloc_buf_host = device.create_buffer(12, host)?;
|
let bin_alloc_buf_host = device.create_buffer(8, host)?;
|
||||||
let bin_alloc_buf_dev = device.create_buffer(12, dev)?;
|
let bin_alloc_buf_dev = device.create_buffer(8, dev)?;
|
||||||
|
|
||||||
// TODO: constants
|
// TODO: constants
|
||||||
let bin_alloc_start = ((n_paths + 255) & !255) * 8;
|
let bin_alloc_start = ((n_paths + 255) & !255) * 8;
|
||||||
device.write_buffer(
|
device.write_buffer(
|
||||||
&bin_alloc_buf_host,
|
&bin_alloc_buf_host,
|
||||||
&[n_paths as u32, 0, bin_alloc_start as u32],
|
&[n_paths as u32, bin_alloc_start as u32],
|
||||||
)?;
|
)?;
|
||||||
let bin_code = include_bytes!("../shader/binning.spv");
|
let bin_code = include_bytes!("../shader/binning.spv");
|
||||||
let bin_pipeline = device.create_simple_compute_pipeline(bin_code, 3, 0)?;
|
let bin_pipeline = device.create_simple_compute_pipeline(bin_code, 3, 0)?;
|
||||||
|
|
Loading…
Reference in a new issue