mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 04:31:30 +11:00
parent
5dbeb992e9
commit
7d5063b187
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,14 +1,15 @@
|
||||||
{
|
{
|
||||||
"wgsl-analyzer.customImports": {
|
"wgsl-analyzer.customImports": {
|
||||||
"bbox": "${workspaceFolder}/piet-wgsl/shader/shared/bbox.wgsl",
|
"bbox": "${workspaceFolder}/piet-wgsl/shader/shared/bbox.wgsl",
|
||||||
|
"blend": "${workspaceFolder}/piet-wgsl/shader/shared/blend.wgsl",
|
||||||
"bump": "${workspaceFolder}/piet-wgsl/shader/shared/bump.wgsl",
|
"bump": "${workspaceFolder}/piet-wgsl/shader/shared/bump.wgsl",
|
||||||
"clip": "${workspaceFolder}/piet-wgsl/shader/shared/clip.wgsl",
|
"clip": "${workspaceFolder}/piet-wgsl/shader/shared/clip.wgsl",
|
||||||
"config": "${workspaceFolder}/piet-wgsl/shader/shared/config.wgsl",
|
"config": "${workspaceFolder}/piet-wgsl/shader/shared/config.wgsl",
|
||||||
"cubic": "${workspaceFolder}/piet-wgsl/shader/shared/cubic.wgsl",
|
"cubic": "${workspaceFolder}/piet-wgsl/shader/shared/cubic.wgsl",
|
||||||
"drawtag": "${workspaceFolder}/piet-wgsl/shader/shared/drawtag.wgsl",
|
"drawtag": "${workspaceFolder}/piet-wgsl/shader/shared/drawtag.wgsl",
|
||||||
"segment": "${workspaceFolder}/piet-wgsl/shader/shared/segment.wgsl",
|
|
||||||
"pathtag": "${workspaceFolder}/piet-wgsl/shader/shared/pathtag.wgsl",
|
"pathtag": "${workspaceFolder}/piet-wgsl/shader/shared/pathtag.wgsl",
|
||||||
"ptcl": "${workspaceFolder}/piet-wgsl/shader/shared/ptcl.wgsl",
|
"ptcl": "${workspaceFolder}/piet-wgsl/shader/shared/ptcl.wgsl",
|
||||||
|
"segment": "${workspaceFolder}/piet-wgsl/shader/shared/segment.wgsl",
|
||||||
"tile": "${workspaceFolder}/piet-wgsl/shader/shared/tile.wgsl"
|
"tile": "${workspaceFolder}/piet-wgsl/shader/shared/tile.wgsl"
|
||||||
},
|
},
|
||||||
"wgsl-analyzer.diagnostics.nagaVersion": "main",
|
"wgsl-analyzer.diagnostics.nagaVersion": "main",
|
||||||
|
|
|
@ -28,20 +28,20 @@ fn main(
|
||||||
let width_in_tiles = config.width_in_tiles;
|
let width_in_tiles = config.width_in_tiles;
|
||||||
let ix = wg_id.x * width_in_tiles + local_id.x;
|
let ix = wg_id.x * width_in_tiles + local_id.x;
|
||||||
var backdrop = 0;
|
var backdrop = 0;
|
||||||
if (local_id.x < width_in_tiles) {
|
if local_id.x < width_in_tiles {
|
||||||
backdrop = tiles[ix].backdrop;
|
backdrop = tiles[ix].backdrop;
|
||||||
}
|
}
|
||||||
sh_backdrop[local_id.x] = backdrop;
|
sh_backdrop[local_id.x] = backdrop;
|
||||||
// iterate log2(WG_SIZE) times
|
// iterate log2(WG_SIZE) times
|
||||||
for (var i = 0u; i < firstTrailingBit(WG_SIZE); i += 1u) {
|
for (var i = 0u; i < firstTrailingBit(WG_SIZE); i += 1u) {
|
||||||
workgroupBarrier();
|
workgroupBarrier();
|
||||||
if (local_id.x >= (1u << i)) {
|
if local_id.x >= (1u << i) {
|
||||||
backdrop += sh_backdrop[local_id.x - (1u << i)];
|
backdrop += sh_backdrop[local_id.x - (1u << i)];
|
||||||
}
|
}
|
||||||
workgroupBarrier();
|
workgroupBarrier();
|
||||||
sh_backdrop[local_id.x] = backdrop;
|
sh_backdrop[local_id.x] = backdrop;
|
||||||
}
|
}
|
||||||
if (local_id.x < width_in_tiles) {
|
if local_id.x < width_in_tiles {
|
||||||
tiles[ix].backdrop = backdrop;
|
tiles[ix].backdrop = backdrop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ var<workgroup> sh_path_ix: array<u32, WG_SIZE>;
|
||||||
fn main(
|
fn main(
|
||||||
@builtin(global_invocation_id) global_id: vec3<u32>,
|
@builtin(global_invocation_id) global_id: vec3<u32>,
|
||||||
@builtin(local_invocation_id) local_id: vec3<u32>,
|
@builtin(local_invocation_id) local_id: vec3<u32>,
|
||||||
@builtin(workgroup_id) wg_id: vec3<u32>,
|
@builtin(workgroup_id) wg_id: vec3<u32>,
|
||||||
) {
|
) {
|
||||||
let inp = clip_inp[global_id.x];
|
let inp = clip_inp[global_id.x];
|
||||||
let is_push = inp >= 0;
|
let is_push = inp >= 0;
|
||||||
|
|
|
@ -189,7 +189,7 @@ fn main(
|
||||||
// blend state
|
// blend state
|
||||||
var render_blend_depth = 0u;
|
var render_blend_depth = 0u;
|
||||||
var max_blend_depth = 0u;
|
var max_blend_depth = 0u;
|
||||||
|
|
||||||
while true {
|
while true {
|
||||||
for (var i = 0u; i < N_SLICE; i += 1u) {
|
for (var i = 0u; i < N_SLICE; i += 1u) {
|
||||||
atomicStore(&sh_bitmaps[i][local_id.x], 0u);
|
atomicStore(&sh_bitmaps[i][local_id.x], 0u);
|
||||||
|
|
|
@ -120,7 +120,7 @@ fn main(
|
||||||
}
|
}
|
||||||
if linewidth >= 0.0 {
|
if linewidth >= 0.0 {
|
||||||
// Note: doesn't deal with anisotropic case
|
// Note: doesn't deal with anisotropic case
|
||||||
linewidth *= sqrt(abs(matrx.x * matrx.w - matrx.y * matrx.z));
|
linewidth *= sqrt(abs(matrx.x * matrx.w - matrx.y * matrx.z));
|
||||||
}
|
}
|
||||||
switch tag_word {
|
switch tag_word {
|
||||||
// DRAWTAG_FILL_COLOR, DRAWTAG_FILL_IMAGE
|
// DRAWTAG_FILL_COLOR, DRAWTAG_FILL_IMAGE
|
||||||
|
|
|
@ -93,9 +93,9 @@ fn set_lum(c: vec3<f32>, l: f32) -> vec3<f32> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_sat_inner(
|
fn set_sat_inner(
|
||||||
cmin: ptr<function, f32>,
|
cmin: ptr<function, f32>,
|
||||||
cmid: ptr<function, f32>,
|
cmid: ptr<function, f32>,
|
||||||
cmax: ptr<function, f32>,
|
cmax: ptr<function, f32>,
|
||||||
s: f32
|
s: f32
|
||||||
) {
|
) {
|
||||||
if *cmax > *cmin {
|
if *cmax > *cmin {
|
||||||
|
@ -228,10 +228,10 @@ let COMPOSE_PLUS_LIGHTER = 13u;
|
||||||
// Apply general compositing operation.
|
// Apply general compositing operation.
|
||||||
// Inputs are separated colors and alpha, output is premultiplied.
|
// Inputs are separated colors and alpha, output is premultiplied.
|
||||||
fn blend_compose(
|
fn blend_compose(
|
||||||
cb: vec3<f32>,
|
cb: vec3<f32>,
|
||||||
cs: vec3<f32>,
|
cs: vec3<f32>,
|
||||||
ab: f32,
|
ab: f32,
|
||||||
as_: f32,
|
as_: f32,
|
||||||
mode: u32
|
mode: u32
|
||||||
) -> vec4<f32> {
|
) -> vec4<f32> {
|
||||||
var fa = 0.0;
|
var fa = 0.0;
|
||||||
|
|
Loading…
Reference in a new issue