diff --git a/vello_shaders/shader/backdrop.wgsl b/vello_shaders/shader/backdrop.wgsl index acf97aa2..79f4a103 100644 --- a/vello_shaders/shader/backdrop.wgsl +++ b/vello_shaders/shader/backdrop.wgsl @@ -15,7 +15,7 @@ var config: Config; @group(0) @binding(1) var tiles: array; -let WG_SIZE = 64u; +const WG_SIZE = 64u; var sh_backdrop: array; diff --git a/vello_shaders/shader/backdrop_dyn.wgsl b/vello_shaders/shader/backdrop_dyn.wgsl index 7bdf5c70..69ecaf7f 100644 --- a/vello_shaders/shader/backdrop_dyn.wgsl +++ b/vello_shaders/shader/backdrop_dyn.wgsl @@ -19,7 +19,7 @@ var paths: array; @group(0) @binding(3) var tiles: array; -let WG_SIZE = 256u; +const WG_SIZE = 256u; var sh_row_width: array; var sh_row_count: array; diff --git a/vello_shaders/shader/binning.wgsl b/vello_shaders/shader/binning.wgsl index 91048272..2c30ca8f 100644 --- a/vello_shaders/shader/binning.wgsl +++ b/vello_shaders/shader/binning.wgsl @@ -39,15 +39,12 @@ struct BinHeader { var bin_header: array; // conversion factors from coordinates to bin -let SX = 0.00390625; -let SY = 0.00390625; -//let SX = 1.0 / f32(N_TILE_X * TILE_WIDTH); -//let SY = 1.0 / f32(N_TILE_Y * TILE_HEIGHT); - -let WG_SIZE = 256u; -let N_SLICE = 8u; -//let N_SLICE = WG_SIZE / 32u; -let N_SUBSLICE = 4u; +const SX = 1.0 / f32(N_TILE_X * TILE_WIDTH); +const SY = 1.0 / f32(N_TILE_Y * TILE_HEIGHT); + +const WG_SIZE = 256u; +const N_SLICE = WG_SIZE / 32u; +const N_SUBSLICE = 4u; var sh_bitmaps: array, N_TILE>, N_SLICE>; // store count values packed two u16's to a u32 diff --git a/vello_shaders/shader/clip_leaf.wgsl b/vello_shaders/shader/clip_leaf.wgsl index e947177d..0fe02294 100644 --- a/vello_shaders/shader/clip_leaf.wgsl +++ b/vello_shaders/shader/clip_leaf.wgsl @@ -27,7 +27,7 @@ var draw_monoids: array; @group(0) @binding(6) var clip_bboxes: array>; -let WG_SIZE = 256u; +const WG_SIZE = 256u; var sh_bic: array; var sh_stack: array; var sh_stack_bbox: array, WG_SIZE>; diff --git a/vello_shaders/shader/clip_reduce.wgsl b/vello_shaders/shader/clip_reduce.wgsl index a181201c..6b8979a5 100644 --- a/vello_shaders/shader/clip_reduce.wgsl +++ b/vello_shaders/shader/clip_reduce.wgsl @@ -16,7 +16,7 @@ var reduced: array; @group(0) @binding(3) var clip_out: array; -let WG_SIZE = 256u; +const WG_SIZE = 256u; var sh_bic: array; var sh_parent: array; var sh_path_ix: array; diff --git a/vello_shaders/shader/coarse.wgsl b/vello_shaders/shader/coarse.wgsl index d47b43b9..70603237 100644 --- a/vello_shaders/shader/coarse.wgsl +++ b/vello_shaders/shader/coarse.wgsl @@ -46,9 +46,8 @@ var ptcl: array; // Much of this code assumes WG_SIZE == N_TILE. If these diverge, then // a fair amount of fixup is needed. -let WG_SIZE = 256u; -//let N_SLICE = WG_SIZE / 32u; -let N_SLICE = 8u; +const WG_SIZE = 256u; +const N_SLICE = WG_SIZE / 32u; var sh_bitmaps: array, N_TILE>, N_SLICE>; var sh_part_count: array; diff --git a/vello_shaders/shader/draw_leaf.wgsl b/vello_shaders/shader/draw_leaf.wgsl index 9f7d020c..e572a276 100644 --- a/vello_shaders/shader/draw_leaf.wgsl +++ b/vello_shaders/shader/draw_leaf.wgsl @@ -32,7 +32,7 @@ var clip_inp: array; #import util -let WG_SIZE = 256u; +const WG_SIZE = 256u; fn read_transform(transform_base: u32, ix: u32) -> Transform { let base = transform_base + ix * 6u; diff --git a/vello_shaders/shader/fine.wgsl b/vello_shaders/shader/fine.wgsl index ec213033..e09e2ee7 100644 --- a/vello_shaders/shader/fine.wgsl +++ b/vello_shaders/shader/fine.wgsl @@ -23,7 +23,7 @@ var segments: array; #import blend #import ptcl -let GRADIENT_WIDTH = 512; +const GRADIENT_WIDTH = 512; @group(0) @binding(2) var ptcl: array; @@ -49,25 +49,25 @@ var image_atlas: texture_2d; const MASK_LUT_INDEX: u32 = 8; #ifdef msaa8 -let MASK_WIDTH = 32u; -let MASK_HEIGHT = 32u; -let SH_SAMPLES_SIZE = 512u; -let SAMPLE_WORDS_PER_PIXEL = 2u; +const MASK_WIDTH = 32u; +const MASK_HEIGHT = 32u; +const SH_SAMPLES_SIZE = 512u; +const SAMPLE_WORDS_PER_PIXEL = 2u; // This might be better in uniform, but that has 16 byte alignment @group(0) @binding(MASK_LUT_INDEX) var mask_lut: array; #endif #ifdef msaa16 -let MASK_WIDTH = 64u; -let MASK_HEIGHT = 64u; -let SH_SAMPLES_SIZE = 1024u; -let SAMPLE_WORDS_PER_PIXEL = 4u; +const MASK_WIDTH = 64u; +const MASK_HEIGHT = 64u; +const SH_SAMPLES_SIZE = 1024u; +const SAMPLE_WORDS_PER_PIXEL = 4u; @group(0) @binding(MASK_LUT_INDEX) var mask_lut: array; #endif -let WG_SIZE = 64u; +const WG_SIZE = 64u; var sh_count: array; // This array contains the winding number of the top left corner of each @@ -108,11 +108,11 @@ fn span(a: f32, b: f32) -> u32 { return u32(max(ceil(max(a, b)) - floor(min(a, b)), 1.0)); } -let SEG_SIZE = 5u; +const SEG_SIZE = 5u; // See cpu_shaders/util.rs for explanation of these. -let ONE_MINUS_ULP: f32 = 0.99999994; -let ROBUST_EPSILON: f32 = 2e-7; +const ONE_MINUS_ULP: f32 = 0.99999994; +const ROBUST_EPSILON: f32 = 2e-7; // Multisampled path rendering algorithm. // @@ -836,7 +836,7 @@ fn extend_mode(t: f32, mode: u32) -> f32 { } } -let PIXELS_PER_THREAD = 4u; +const PIXELS_PER_THREAD = 4u; #ifndef msaa diff --git a/vello_shaders/shader/flatten.wgsl b/vello_shaders/shader/flatten.wgsl index d3a9012a..cb4fb7cc 100644 --- a/vello_shaders/shader/flatten.wgsl +++ b/vello_shaders/shader/flatten.wgsl @@ -43,12 +43,12 @@ struct SubdivResult { a2: f32, } -let D = 0.67; +const D = 0.67; fn approx_parabola_integral(x: f32) -> f32 { return x * inverseSqrt(sqrt(1.0 - D + (D * D * D * D + 0.25 * x * x))); } -let B = 0.39; +const B = 0.39; fn approx_parabola_inv_integral(x: f32) -> f32 { return x * sqrt(1.0 - B + (B * B + 0.5 * x * x)); } diff --git a/vello_shaders/shader/path_count.wgsl b/vello_shaders/shader/path_count.wgsl index 7de89278..9a489c20 100644 --- a/vello_shaders/shader/path_count.wgsl +++ b/vello_shaders/shader/path_count.wgsl @@ -38,8 +38,8 @@ fn span(a: f32, b: f32) -> u32 { } // See cpu_shaders/util.rs for explanation of these. -let ONE_MINUS_ULP: f32 = 0.99999994; -let ROBUST_EPSILON: f32 = 2e-7; +const ONE_MINUS_ULP: f32 = 0.99999994; +const ROBUST_EPSILON: f32 = 2e-7; // Note regarding clipping to bounding box: // diff --git a/vello_shaders/shader/path_count_setup.wgsl b/vello_shaders/shader/path_count_setup.wgsl index a9c4a916..2daa7fd1 100644 --- a/vello_shaders/shader/path_count_setup.wgsl +++ b/vello_shaders/shader/path_count_setup.wgsl @@ -12,7 +12,7 @@ var bump: BumpAllocators; var indirect: IndirectCount; // Partition size for path count stage -let WG_SIZE = 256u; +const WG_SIZE = 256u; @compute @workgroup_size(1) fn main() { diff --git a/vello_shaders/shader/path_tiling.wgsl b/vello_shaders/shader/path_tiling.wgsl index 63f982b8..e15dc75b 100644 --- a/vello_shaders/shader/path_tiling.wgsl +++ b/vello_shaders/shader/path_tiling.wgsl @@ -31,8 +31,8 @@ fn span(a: f32, b: f32) -> u32 { } // See cpu_shaders/util.rs for explanation of these. -let ONE_MINUS_ULP: f32 = 0.99999994; -let ROBUST_EPSILON: f32 = 2e-7; +const ONE_MINUS_ULP: f32 = 0.99999994; +const ROBUST_EPSILON: f32 = 2e-7; // One invocation for each tile that is to be written. // Total number of invocations = bump.seg_counts diff --git a/vello_shaders/shader/path_tiling_setup.wgsl b/vello_shaders/shader/path_tiling_setup.wgsl index 4d5bf2e3..8698a6c2 100644 --- a/vello_shaders/shader/path_tiling_setup.wgsl +++ b/vello_shaders/shader/path_tiling_setup.wgsl @@ -15,7 +15,7 @@ var indirect: IndirectCount; var ptcl: array; // Partition size for path tiling stage -let WG_SIZE = 256u; +const WG_SIZE = 256u; @compute @workgroup_size(1) fn main() { diff --git a/vello_shaders/shader/pathtag_reduce.wgsl b/vello_shaders/shader/pathtag_reduce.wgsl index ab6e10e9..beefd56e 100644 --- a/vello_shaders/shader/pathtag_reduce.wgsl +++ b/vello_shaders/shader/pathtag_reduce.wgsl @@ -13,8 +13,8 @@ var scene: array; @group(0) @binding(2) var reduced: array; -let LG_WG_SIZE = 8u; -let WG_SIZE = 256u; +const LG_WG_SIZE = 8u; +const WG_SIZE = 256u; var sh_scratch: array; diff --git a/vello_shaders/shader/pathtag_reduce2.wgsl b/vello_shaders/shader/pathtag_reduce2.wgsl index eb8621f0..fe47a62a 100644 --- a/vello_shaders/shader/pathtag_reduce2.wgsl +++ b/vello_shaders/shader/pathtag_reduce2.wgsl @@ -13,8 +13,8 @@ var reduced_in: array; @group(0) @binding(1) var reduced: array; -let LG_WG_SIZE = 8u; -let WG_SIZE = 256u; +const LG_WG_SIZE = 8u; +const WG_SIZE = 256u; var sh_scratch: array; diff --git a/vello_shaders/shader/pathtag_scan.wgsl b/vello_shaders/shader/pathtag_scan.wgsl index 27a34bdf..686fae81 100644 --- a/vello_shaders/shader/pathtag_scan.wgsl +++ b/vello_shaders/shader/pathtag_scan.wgsl @@ -16,8 +16,8 @@ var reduced: array; @group(0) @binding(3) var tag_monoids: array; -let LG_WG_SIZE = 8u; -let WG_SIZE = 256u; +const LG_WG_SIZE = 8u; +const WG_SIZE = 256u; #ifdef small var sh_parent: array; diff --git a/vello_shaders/shader/pathtag_scan1.wgsl b/vello_shaders/shader/pathtag_scan1.wgsl index 7f3b4765..fc5236b0 100644 --- a/vello_shaders/shader/pathtag_scan1.wgsl +++ b/vello_shaders/shader/pathtag_scan1.wgsl @@ -16,8 +16,8 @@ var reduced2: array; @group(0) @binding(2) var tag_monoids: array; -let LG_WG_SIZE = 8u; -let WG_SIZE = 256u; +const LG_WG_SIZE = 8u; +const WG_SIZE = 256u; var sh_parent: array; // These could be combined? diff --git a/vello_shaders/shader/shared/blend.wgsl b/vello_shaders/shader/shared/blend.wgsl index f8090430..48510a8f 100644 --- a/vello_shaders/shader/shared/blend.wgsl +++ b/vello_shaders/shader/shared/blend.wgsl @@ -3,23 +3,23 @@ // Color mixing modes -let MIX_NORMAL = 0u; -let MIX_MULTIPLY = 1u; -let MIX_SCREEN = 2u; -let MIX_OVERLAY = 3u; -let MIX_DARKEN = 4u; -let MIX_LIGHTEN = 5u; -let MIX_COLOR_DODGE = 6u; -let MIX_COLOR_BURN = 7u; -let MIX_HARD_LIGHT = 8u; -let MIX_SOFT_LIGHT = 9u; -let MIX_DIFFERENCE = 10u; -let MIX_EXCLUSION = 11u; -let MIX_HUE = 12u; -let MIX_SATURATION = 13u; -let MIX_COLOR = 14u; -let MIX_LUMINOSITY = 15u; -let MIX_CLIP = 128u; +const MIX_NORMAL = 0u; +const MIX_MULTIPLY = 1u; +const MIX_SCREEN = 2u; +const MIX_OVERLAY = 3u; +const MIX_DARKEN = 4u; +const MIX_LIGHTEN = 5u; +const MIX_COLOR_DODGE = 6u; +const MIX_COLOR_BURN = 7u; +const MIX_HARD_LIGHT = 8u; +const MIX_SOFT_LIGHT = 9u; +const MIX_DIFFERENCE = 10u; +const MIX_EXCLUSION = 11u; +const MIX_HUE = 12u; +const MIX_SATURATION = 13u; +const MIX_COLOR = 14u; +const MIX_LUMINOSITY = 15u; +const MIX_CLIP = 128u; fn screen(cb: vec3, cs: vec3) -> vec3 { return cb + cs - (cb * cs); @@ -196,20 +196,20 @@ fn blend_mix(cb: vec3, cs: vec3, mode: u32) -> vec3 { // Composition modes -let COMPOSE_CLEAR = 0u; -let COMPOSE_COPY = 1u; -let COMPOSE_DEST = 2u; -let COMPOSE_SRC_OVER = 3u; -let COMPOSE_DEST_OVER = 4u; -let COMPOSE_SRC_IN = 5u; -let COMPOSE_DEST_IN = 6u; -let COMPOSE_SRC_OUT = 7u; -let COMPOSE_DEST_OUT = 8u; -let COMPOSE_SRC_ATOP = 9u; -let COMPOSE_DEST_ATOP = 10u; -let COMPOSE_XOR = 11u; -let COMPOSE_PLUS = 12u; -let COMPOSE_PLUS_LIGHTER = 13u; +const COMPOSE_CLEAR = 0u; +const COMPOSE_COPY = 1u; +const COMPOSE_DEST = 2u; +const COMPOSE_SRC_OVER = 3u; +const COMPOSE_DEST_OVER = 4u; +const COMPOSE_SRC_IN = 5u; +const COMPOSE_DEST_IN = 6u; +const COMPOSE_SRC_OUT = 7u; +const COMPOSE_DEST_OUT = 8u; +const COMPOSE_SRC_ATOP = 9u; +const COMPOSE_DEST_ATOP = 10u; +const COMPOSE_XOR = 11u; +const COMPOSE_PLUS = 12u; +const COMPOSE_PLUS_LIGHTER = 13u; // Apply general compositing operation. // Inputs are separated colors and alpha, output is premultiplied. diff --git a/vello_shaders/shader/shared/bump.wgsl b/vello_shaders/shader/shared/bump.wgsl index 9270fc2f..c1cdaa48 100644 --- a/vello_shaders/shader/shared/bump.wgsl +++ b/vello_shaders/shader/shared/bump.wgsl @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT OR Unlicense // Bitflags for each stage that can fail allocation. -let STAGE_BINNING: u32 = 0x1u; -let STAGE_TILE_ALLOC: u32 = 0x2u; -let STAGE_FLATTEN: u32 = 0x4u; -let STAGE_PATH_COUNT: u32 = 0x8u; -let STAGE_COARSE: u32 = 0x10u; +const STAGE_BINNING: u32 = 0x1u; +const STAGE_TILE_ALLOC: u32 = 0x2u; +const STAGE_FLATTEN: u32 = 0x4u; +const STAGE_PATH_COUNT: u32 = 0x8u; +const STAGE_COARSE: u32 = 0x10u; // This must be kept in sync with the struct in config.rs in the encoding crate. struct BumpAllocators { diff --git a/vello_shaders/shader/shared/config.wgsl b/vello_shaders/shader/shared/config.wgsl index e586e3e0..7e87a285 100644 --- a/vello_shaders/shader/shared/config.wgsl +++ b/vello_shaders/shader/shared/config.wgsl @@ -43,31 +43,30 @@ struct Config { // Geometry of tiles and bins -let TILE_WIDTH = 16u; -let TILE_HEIGHT = 16u; +const TILE_WIDTH = 16u; +const 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; +const N_TILE_X = 16u; +const N_TILE_Y = 16u; +const N_TILE = N_TILE_X * N_TILE_Y; // Not currently supporting non-square tiles -let TILE_SCALE = 0.0625; +const TILE_SCALE = 0.0625; // The "split" point between using local memory in fine for the blend stack and spilling to the blend_spill buffer. // A higher value will increase vgpr ("register") pressure in fine, but decrease required dynamic memory allocation. // If changing, also change in vello_shaders/src/cpu/coarse.rs. -let BLEND_STACK_SPLIT = 4u; +const BLEND_STACK_SPLIT = 4u; // The following are computed in draw_leaf from the generic gradient parameters // encoded in the scene, and stored in the gradient's info struct, for // consumption during fine rasterization. // Radial gradient kinds -let RAD_GRAD_KIND_CIRCULAR = 1u; -let RAD_GRAD_KIND_STRIP = 2u; -let RAD_GRAD_KIND_FOCAL_ON_CIRCLE = 3u; -let RAD_GRAD_KIND_CONE = 4u; +const RAD_GRAD_KIND_CIRCULAR = 1u; +const RAD_GRAD_KIND_STRIP = 2u; +const RAD_GRAD_KIND_FOCAL_ON_CIRCLE = 3u; +const RAD_GRAD_KIND_CONE = 4u; // Radial gradient flags -let RAD_GRAD_SWAPPED = 1u; +const RAD_GRAD_SWAPPED = 1u; diff --git a/vello_shaders/shader/shared/cubic.wgsl b/vello_shaders/shader/shared/cubic.wgsl index 158a4a36..10a306a7 100644 --- a/vello_shaders/shader/shared/cubic.wgsl +++ b/vello_shaders/shader/shared/cubic.wgsl @@ -11,4 +11,4 @@ struct Cubic { flags: u32, } -let CUBIC_IS_STROKE = 1u; +const CUBIC_IS_STROKE = 1u; diff --git a/vello_shaders/shader/shared/drawtag.wgsl b/vello_shaders/shader/shared/drawtag.wgsl index 9d887be3..245594eb 100644 --- a/vello_shaders/shader/shared/drawtag.wgsl +++ b/vello_shaders/shader/shared/drawtag.wgsl @@ -16,20 +16,20 @@ struct DrawMonoid { // Each draw object has a 32-bit draw tag, which is a bit-packed // version of the draw monoid. -let DRAWTAG_NOP = 0u; -let DRAWTAG_FILL_COLOR = 0x44u; -let DRAWTAG_FILL_LIN_GRADIENT = 0x114u; -let DRAWTAG_FILL_RAD_GRADIENT = 0x29cu; -let DRAWTAG_FILL_SWEEP_GRADIENT = 0x254u; -let DRAWTAG_FILL_IMAGE = 0x248u; -let DRAWTAG_BLURRED_ROUNDED_RECT = 0x2d4u; -let DRAWTAG_BEGIN_CLIP = 0x9u; -let DRAWTAG_END_CLIP = 0x21u; +const DRAWTAG_NOP = 0u; +const DRAWTAG_FILL_COLOR = 0x44u; +const DRAWTAG_FILL_LIN_GRADIENT = 0x114u; +const DRAWTAG_FILL_RAD_GRADIENT = 0x29cu; +const DRAWTAG_FILL_SWEEP_GRADIENT = 0x254u; +const DRAWTAG_FILL_IMAGE = 0x248u; +const DRAWTAG_BLURRED_ROUNDED_RECT = 0x2d4u; +const DRAWTAG_BEGIN_CLIP = 0x9u; +const DRAWTAG_END_CLIP = 0x21u; /// The first word of each draw info stream entry contains the flags. This is not a part of the /// draw object stream but get used after the draw objects have been reduced on the GPU. /// 0 represents a non-zero fill. 1 represents an even-odd fill. -let DRAW_INFO_FLAGS_FILL_RULE_BIT = 1u; +const DRAW_INFO_FLAGS_FILL_RULE_BIT = 1u; fn draw_monoid_identity() -> DrawMonoid { return DrawMonoid(); diff --git a/vello_shaders/shader/shared/pathtag.wgsl b/vello_shaders/shader/shared/pathtag.wgsl index b58995fc..cebf0a04 100644 --- a/vello_shaders/shader/shared/pathtag.wgsl +++ b/vello_shaders/shader/shared/pathtag.wgsl @@ -10,34 +10,34 @@ struct TagMonoid { path_ix: u32, } -let PATH_TAG_SEG_TYPE = 3u; -let PATH_TAG_LINETO = 1u; -let PATH_TAG_QUADTO = 2u; -let PATH_TAG_CUBICTO = 3u; -let PATH_TAG_F32 = 8u; -let PATH_TAG_TRANSFORM = 0x20u; -let PATH_TAG_PATH = 0x10u; -let PATH_TAG_STYLE = 0x40u; -let PATH_TAG_SUBPATH_END = 4u; +const PATH_TAG_SEG_TYPE = 3u; +const PATH_TAG_LINETO = 1u; +const PATH_TAG_QUADTO = 2u; +const PATH_TAG_CUBICTO = 3u; +const PATH_TAG_F32 = 8u; +const PATH_TAG_TRANSFORM = 0x20u; +const PATH_TAG_PATH = 0x10u; +const PATH_TAG_STYLE = 0x40u; +const PATH_TAG_SUBPATH_END = 4u; // Size of the `Style` data structure in words -let STYLE_SIZE_IN_WORDS: u32 = 2u; +const STYLE_SIZE_IN_WORDS: u32 = 2u; -let STYLE_FLAGS_STYLE: u32 = 0x80000000u; -let STYLE_FLAGS_FILL: u32 = 0x40000000u; -let STYLE_MITER_LIMIT_MASK: u32 = 0xFFFFu; +const STYLE_FLAGS_STYLE: u32 = 0x80000000u; +const STYLE_FLAGS_FILL: u32 = 0x40000000u; +const STYLE_MITER_LIMIT_MASK: u32 = 0xFFFFu; -let STYLE_FLAGS_START_CAP_MASK: u32 = 0x0C000000u; -let STYLE_FLAGS_END_CAP_MASK: u32 = 0x03000000u; +const STYLE_FLAGS_START_CAP_MASK: u32 = 0x0C000000u; +const STYLE_FLAGS_END_CAP_MASK: u32 = 0x03000000u; -let STYLE_FLAGS_CAP_BUTT: u32 = 0u; -let STYLE_FLAGS_CAP_SQUARE: u32 = 0x01000000u; -let STYLE_FLAGS_CAP_ROUND: u32 = 0x02000000u; +const STYLE_FLAGS_CAP_BUTT: u32 = 0u; +const STYLE_FLAGS_CAP_SQUARE: u32 = 0x01000000u; +const STYLE_FLAGS_CAP_ROUND: u32 = 0x02000000u; -let STYLE_FLAGS_JOIN_MASK: u32 = 0x30000000u; -let STYLE_FLAGS_JOIN_BEVEL: u32 = 0u; -let STYLE_FLAGS_JOIN_MITER: u32 = 0x10000000u; -let STYLE_FLAGS_JOIN_ROUND: u32 = 0x20000000u; +const STYLE_FLAGS_JOIN_MASK: u32 = 0x30000000u; +const STYLE_FLAGS_JOIN_BEVEL: u32 = 0u; +const STYLE_FLAGS_JOIN_MITER: u32 = 0x10000000u; +const STYLE_FLAGS_JOIN_ROUND: u32 = 0x20000000u; // TODO: Declare the remaining STYLE flags here. diff --git a/vello_shaders/shader/shared/ptcl.wgsl b/vello_shaders/shader/shared/ptcl.wgsl index e6d20a0a..467739c8 100644 --- a/vello_shaders/shader/shared/ptcl.wgsl +++ b/vello_shaders/shader/shared/ptcl.wgsl @@ -3,26 +3,26 @@ // Layout of per-tile command list // Initial allocation, in u32's. -let PTCL_INITIAL_ALLOC = 64u; -let PTCL_INCREMENT = 256u; +const PTCL_INITIAL_ALLOC = 64u; +const PTCL_INCREMENT = 256u; // Amount of space taken by jump -let PTCL_HEADROOM = 2u; +const PTCL_HEADROOM = 2u; // Tags for PTCL commands -let CMD_END = 0u; -let CMD_FILL = 1u; -let CMD_STROKE = 2u; -let CMD_SOLID = 3u; -let CMD_COLOR = 5u; -let CMD_LIN_GRAD = 6u; -let CMD_RAD_GRAD = 7u; -let CMD_SWEEP_GRAD = 8u; -let CMD_IMAGE = 9u; -let CMD_BEGIN_CLIP = 10u; -let CMD_END_CLIP = 11u; -let CMD_JUMP = 12u; -let CMD_BLUR_RECT = 13u; +const CMD_END = 0u; +const CMD_FILL = 1u; +const CMD_STROKE = 2u; +const CMD_SOLID = 3u; +const CMD_COLOR = 5u; +const CMD_LIN_GRAD = 6u; +const CMD_RAD_GRAD = 7u; +const CMD_SWEEP_GRAD = 8u; +const CMD_IMAGE = 9u; +const CMD_BEGIN_CLIP = 10u; +const CMD_END_CLIP = 11u; +const CMD_JUMP = 12u; +const CMD_BLUR_RECT = 13u; // The individual PTCL structs are written here, but read/write is by // hand in the relevant shaders diff --git a/vello_shaders/shader/tile_alloc.wgsl b/vello_shaders/shader/tile_alloc.wgsl index c6073d12..00915fef 100644 --- a/vello_shaders/shader/tile_alloc.wgsl +++ b/vello_shaders/shader/tile_alloc.wgsl @@ -26,7 +26,7 @@ var paths: array; @group(0) @binding(5) var tiles: array; -let WG_SIZE = 256u; +const WG_SIZE = 256u; var sh_tile_count: array; var sh_tile_offset: u32; diff --git a/vello_shaders/src/compile/preprocess.rs b/vello_shaders/src/compile/preprocess.rs index 74195f5f..6fba45d0 100644 --- a/vello_shaders/src/compile/preprocess.rs +++ b/vello_shaders/src/compile/preprocess.rs @@ -169,15 +169,7 @@ pub fn preprocess( } } if stack.iter().all(|item| item.active) { - // Naga does not yet recognize `const` but web does not allow global `let`. We - // use `let` in our canonical sources to satisfy wgsl-analyzer but replace with - // `const` when targeting web. - if line.starts_with("let ") { - output.push_str("const"); - output.push_str(&line[3..]); - } else { - output.push_str(line); - } + output.push_str(line); output.push('\n'); } }