From 0fc2e712d1d6df51e6cb10209d5906e51939ea76 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 30 May 2024 17:05:17 +0300 Subject: [PATCH 01/14] Move files to their new locations. --- ARCHITECTURE.md => doc/ARCHITECTURE.md | 0 {src => vello/src}/glyph.rs | 0 {src => vello/src}/lib.rs | 0 {src => vello/src}/recording.rs | 0 {src => vello/src}/render.rs | 0 {src => vello/src}/scene.rs | 0 {src => vello/src}/shaders.rs | 0 {src => vello/src}/util.rs | 0 {src => vello/src}/wgpu_engine.rs | 0 {crates/encoding => vello_encoding}/Cargo.toml | 0 {crates/encoding => vello_encoding}/README.md | 0 {crates/encoding => vello_encoding}/src/binning.rs | 0 {crates/encoding => vello_encoding}/src/clip.rs | 0 {crates/encoding => vello_encoding}/src/config.rs | 0 {crates/encoding => vello_encoding}/src/draw.rs | 0 {crates/encoding => vello_encoding}/src/encoding.rs | 0 {crates/encoding => vello_encoding}/src/estimate.rs | 0 {crates/encoding => vello_encoding}/src/glyph.rs | 0 {crates/encoding => vello_encoding}/src/glyph_cache.rs | 0 {crates/encoding => vello_encoding}/src/image_cache.rs | 0 {crates/encoding => vello_encoding}/src/lib.rs | 0 {crates/encoding => vello_encoding}/src/mask.rs | 0 {crates/encoding => vello_encoding}/src/math.rs | 0 {crates/encoding => vello_encoding}/src/monoid.rs | 0 {crates/encoding => vello_encoding}/src/path.rs | 0 {crates/encoding => vello_encoding}/src/ramp_cache.rs | 0 {crates/encoding => vello_encoding}/src/resolve.rs | 0 {crates/shaders => vello_shaders}/Cargo.toml | 0 {crates/shaders => vello_shaders}/README.md | 0 {crates/shaders => vello_shaders}/build.rs | 0 {shader => vello_shaders/shader}/UNLICENSE | 0 {shader => vello_shaders/shader}/backdrop.wgsl | 0 {shader => vello_shaders/shader}/backdrop_dyn.wgsl | 0 {shader => vello_shaders/shader}/bbox_clear.wgsl | 0 {shader => vello_shaders/shader}/binning.wgsl | 0 {shader => vello_shaders/shader}/clip_leaf.wgsl | 0 {shader => vello_shaders/shader}/clip_reduce.wgsl | 0 {shader => vello_shaders/shader}/coarse.wgsl | 0 {shader => vello_shaders/shader}/draw_leaf.wgsl | 0 {shader => vello_shaders/shader}/draw_reduce.wgsl | 0 {shader => vello_shaders/shader}/fine.wgsl | 0 {shader => vello_shaders/shader}/flatten.wgsl | 0 {shader => vello_shaders/shader}/path_count.wgsl | 0 {shader => vello_shaders/shader}/path_count_setup.wgsl | 0 {shader => vello_shaders/shader}/path_tiling.wgsl | 0 {shader => vello_shaders/shader}/path_tiling_setup.wgsl | 0 {shader => vello_shaders/shader}/pathtag_reduce.wgsl | 0 {shader => vello_shaders/shader}/pathtag_reduce2.wgsl | 0 {shader => vello_shaders/shader}/pathtag_scan.wgsl | 0 {shader => vello_shaders/shader}/pathtag_scan1.wgsl | 0 {shader => vello_shaders/shader}/permutations | 0 {shader => vello_shaders/shader}/shared/bbox.wgsl | 0 {shader => vello_shaders/shader}/shared/blend.wgsl | 0 {shader => vello_shaders/shader}/shared/bump.wgsl | 0 {shader => vello_shaders/shader}/shared/clip.wgsl | 0 {shader => vello_shaders/shader}/shared/config.wgsl | 0 {shader => vello_shaders/shader}/shared/cubic.wgsl | 0 {shader => vello_shaders/shader}/shared/drawtag.wgsl | 0 {shader => vello_shaders/shader}/shared/pathtag.wgsl | 0 {shader => vello_shaders/shader}/shared/ptcl.wgsl | 0 {shader => vello_shaders/shader}/shared/segment.wgsl | 0 {shader => vello_shaders/shader}/shared/tile.wgsl | 0 {shader => vello_shaders/shader}/shared/transform.wgsl | 0 {shader => vello_shaders/shader}/shared/util.wgsl | 0 {shader => vello_shaders/shader}/tile_alloc.wgsl | 0 {crates/shaders => vello_shaders}/src/compile/mod.rs | 0 {crates/shaders => vello_shaders}/src/compile/msl.rs | 0 {crates/shaders => vello_shaders}/src/compile/permutations.rs | 0 {crates/shaders => vello_shaders}/src/compile/preprocess.rs | 0 {crates/shaders => vello_shaders}/src/cpu.rs | 0 {crates/shaders => vello_shaders}/src/cpu/backdrop.rs | 0 {crates/shaders => vello_shaders}/src/cpu/bbox_clear.rs | 0 {crates/shaders => vello_shaders}/src/cpu/binning.rs | 0 {crates/shaders => vello_shaders}/src/cpu/clip_leaf.rs | 0 {crates/shaders => vello_shaders}/src/cpu/clip_reduce.rs | 0 {crates/shaders => vello_shaders}/src/cpu/coarse.rs | 0 {crates/shaders => vello_shaders}/src/cpu/draw_leaf.rs | 0 {crates/shaders => vello_shaders}/src/cpu/draw_reduce.rs | 0 {crates/shaders => vello_shaders}/src/cpu/euler.rs | 0 {crates/shaders => vello_shaders}/src/cpu/fine.rs | 0 {crates/shaders => vello_shaders}/src/cpu/flatten.rs | 0 {crates/shaders => vello_shaders}/src/cpu/path_count.rs | 0 {crates/shaders => vello_shaders}/src/cpu/path_count_setup.rs | 0 {crates/shaders => vello_shaders}/src/cpu/path_tiling.rs | 0 {crates/shaders => vello_shaders}/src/cpu/path_tiling_setup.rs | 0 {crates/shaders => vello_shaders}/src/cpu/pathtag_reduce.rs | 0 {crates/shaders => vello_shaders}/src/cpu/pathtag_scan.rs | 0 {crates/shaders => vello_shaders}/src/cpu/tile_alloc.rs | 0 {crates/shaders => vello_shaders}/src/cpu/util.rs | 0 {crates/shaders => vello_shaders}/src/lib.rs | 0 {crates/shaders => vello_shaders}/src/types.rs | 0 {crates/tests => vello_tests}/Cargo.toml | 0 {crates/tests => vello_tests}/build.rs | 0 {crates/tests => vello_tests}/debug_outputs/.gitignore | 0 {crates/tests => vello_tests}/src/lib.rs | 0 {crates/tests => vello_tests}/tests/smoke.rs | 0 96 files changed, 0 insertions(+), 0 deletions(-) rename ARCHITECTURE.md => doc/ARCHITECTURE.md (100%) rename {src => vello/src}/glyph.rs (100%) rename {src => vello/src}/lib.rs (100%) rename {src => vello/src}/recording.rs (100%) rename {src => vello/src}/render.rs (100%) rename {src => vello/src}/scene.rs (100%) rename {src => vello/src}/shaders.rs (100%) rename {src => vello/src}/util.rs (100%) rename {src => vello/src}/wgpu_engine.rs (100%) rename {crates/encoding => vello_encoding}/Cargo.toml (100%) rename {crates/encoding => vello_encoding}/README.md (100%) rename {crates/encoding => vello_encoding}/src/binning.rs (100%) rename {crates/encoding => vello_encoding}/src/clip.rs (100%) rename {crates/encoding => vello_encoding}/src/config.rs (100%) rename {crates/encoding => vello_encoding}/src/draw.rs (100%) rename {crates/encoding => vello_encoding}/src/encoding.rs (100%) rename {crates/encoding => vello_encoding}/src/estimate.rs (100%) rename {crates/encoding => vello_encoding}/src/glyph.rs (100%) rename {crates/encoding => vello_encoding}/src/glyph_cache.rs (100%) rename {crates/encoding => vello_encoding}/src/image_cache.rs (100%) rename {crates/encoding => vello_encoding}/src/lib.rs (100%) rename {crates/encoding => vello_encoding}/src/mask.rs (100%) rename {crates/encoding => vello_encoding}/src/math.rs (100%) rename {crates/encoding => vello_encoding}/src/monoid.rs (100%) rename {crates/encoding => vello_encoding}/src/path.rs (100%) rename {crates/encoding => vello_encoding}/src/ramp_cache.rs (100%) rename {crates/encoding => vello_encoding}/src/resolve.rs (100%) rename {crates/shaders => vello_shaders}/Cargo.toml (100%) rename {crates/shaders => vello_shaders}/README.md (100%) rename {crates/shaders => vello_shaders}/build.rs (100%) rename {shader => vello_shaders/shader}/UNLICENSE (100%) rename {shader => vello_shaders/shader}/backdrop.wgsl (100%) rename {shader => vello_shaders/shader}/backdrop_dyn.wgsl (100%) rename {shader => vello_shaders/shader}/bbox_clear.wgsl (100%) rename {shader => vello_shaders/shader}/binning.wgsl (100%) rename {shader => vello_shaders/shader}/clip_leaf.wgsl (100%) rename {shader => vello_shaders/shader}/clip_reduce.wgsl (100%) rename {shader => vello_shaders/shader}/coarse.wgsl (100%) rename {shader => vello_shaders/shader}/draw_leaf.wgsl (100%) rename {shader => vello_shaders/shader}/draw_reduce.wgsl (100%) rename {shader => vello_shaders/shader}/fine.wgsl (100%) rename {shader => vello_shaders/shader}/flatten.wgsl (100%) rename {shader => vello_shaders/shader}/path_count.wgsl (100%) rename {shader => vello_shaders/shader}/path_count_setup.wgsl (100%) rename {shader => vello_shaders/shader}/path_tiling.wgsl (100%) rename {shader => vello_shaders/shader}/path_tiling_setup.wgsl (100%) rename {shader => vello_shaders/shader}/pathtag_reduce.wgsl (100%) rename {shader => vello_shaders/shader}/pathtag_reduce2.wgsl (100%) rename {shader => vello_shaders/shader}/pathtag_scan.wgsl (100%) rename {shader => vello_shaders/shader}/pathtag_scan1.wgsl (100%) rename {shader => vello_shaders/shader}/permutations (100%) rename {shader => vello_shaders/shader}/shared/bbox.wgsl (100%) rename {shader => vello_shaders/shader}/shared/blend.wgsl (100%) rename {shader => vello_shaders/shader}/shared/bump.wgsl (100%) rename {shader => vello_shaders/shader}/shared/clip.wgsl (100%) rename {shader => vello_shaders/shader}/shared/config.wgsl (100%) rename {shader => vello_shaders/shader}/shared/cubic.wgsl (100%) rename {shader => vello_shaders/shader}/shared/drawtag.wgsl (100%) rename {shader => vello_shaders/shader}/shared/pathtag.wgsl (100%) rename {shader => vello_shaders/shader}/shared/ptcl.wgsl (100%) rename {shader => vello_shaders/shader}/shared/segment.wgsl (100%) rename {shader => vello_shaders/shader}/shared/tile.wgsl (100%) rename {shader => vello_shaders/shader}/shared/transform.wgsl (100%) rename {shader => vello_shaders/shader}/shared/util.wgsl (100%) rename {shader => vello_shaders/shader}/tile_alloc.wgsl (100%) rename {crates/shaders => vello_shaders}/src/compile/mod.rs (100%) rename {crates/shaders => vello_shaders}/src/compile/msl.rs (100%) rename {crates/shaders => vello_shaders}/src/compile/permutations.rs (100%) rename {crates/shaders => vello_shaders}/src/compile/preprocess.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/backdrop.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/bbox_clear.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/binning.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/clip_leaf.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/clip_reduce.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/coarse.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/draw_leaf.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/draw_reduce.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/euler.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/fine.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/flatten.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/path_count.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/path_count_setup.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/path_tiling.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/path_tiling_setup.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/pathtag_reduce.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/pathtag_scan.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/tile_alloc.rs (100%) rename {crates/shaders => vello_shaders}/src/cpu/util.rs (100%) rename {crates/shaders => vello_shaders}/src/lib.rs (100%) rename {crates/shaders => vello_shaders}/src/types.rs (100%) rename {crates/tests => vello_tests}/Cargo.toml (100%) rename {crates/tests => vello_tests}/build.rs (100%) rename {crates/tests => vello_tests}/debug_outputs/.gitignore (100%) rename {crates/tests => vello_tests}/src/lib.rs (100%) rename {crates/tests => vello_tests}/tests/smoke.rs (100%) diff --git a/ARCHITECTURE.md b/doc/ARCHITECTURE.md similarity index 100% rename from ARCHITECTURE.md rename to doc/ARCHITECTURE.md diff --git a/src/glyph.rs b/vello/src/glyph.rs similarity index 100% rename from src/glyph.rs rename to vello/src/glyph.rs diff --git a/src/lib.rs b/vello/src/lib.rs similarity index 100% rename from src/lib.rs rename to vello/src/lib.rs diff --git a/src/recording.rs b/vello/src/recording.rs similarity index 100% rename from src/recording.rs rename to vello/src/recording.rs diff --git a/src/render.rs b/vello/src/render.rs similarity index 100% rename from src/render.rs rename to vello/src/render.rs diff --git a/src/scene.rs b/vello/src/scene.rs similarity index 100% rename from src/scene.rs rename to vello/src/scene.rs diff --git a/src/shaders.rs b/vello/src/shaders.rs similarity index 100% rename from src/shaders.rs rename to vello/src/shaders.rs diff --git a/src/util.rs b/vello/src/util.rs similarity index 100% rename from src/util.rs rename to vello/src/util.rs diff --git a/src/wgpu_engine.rs b/vello/src/wgpu_engine.rs similarity index 100% rename from src/wgpu_engine.rs rename to vello/src/wgpu_engine.rs diff --git a/crates/encoding/Cargo.toml b/vello_encoding/Cargo.toml similarity index 100% rename from crates/encoding/Cargo.toml rename to vello_encoding/Cargo.toml diff --git a/crates/encoding/README.md b/vello_encoding/README.md similarity index 100% rename from crates/encoding/README.md rename to vello_encoding/README.md diff --git a/crates/encoding/src/binning.rs b/vello_encoding/src/binning.rs similarity index 100% rename from crates/encoding/src/binning.rs rename to vello_encoding/src/binning.rs diff --git a/crates/encoding/src/clip.rs b/vello_encoding/src/clip.rs similarity index 100% rename from crates/encoding/src/clip.rs rename to vello_encoding/src/clip.rs diff --git a/crates/encoding/src/config.rs b/vello_encoding/src/config.rs similarity index 100% rename from crates/encoding/src/config.rs rename to vello_encoding/src/config.rs diff --git a/crates/encoding/src/draw.rs b/vello_encoding/src/draw.rs similarity index 100% rename from crates/encoding/src/draw.rs rename to vello_encoding/src/draw.rs diff --git a/crates/encoding/src/encoding.rs b/vello_encoding/src/encoding.rs similarity index 100% rename from crates/encoding/src/encoding.rs rename to vello_encoding/src/encoding.rs diff --git a/crates/encoding/src/estimate.rs b/vello_encoding/src/estimate.rs similarity index 100% rename from crates/encoding/src/estimate.rs rename to vello_encoding/src/estimate.rs diff --git a/crates/encoding/src/glyph.rs b/vello_encoding/src/glyph.rs similarity index 100% rename from crates/encoding/src/glyph.rs rename to vello_encoding/src/glyph.rs diff --git a/crates/encoding/src/glyph_cache.rs b/vello_encoding/src/glyph_cache.rs similarity index 100% rename from crates/encoding/src/glyph_cache.rs rename to vello_encoding/src/glyph_cache.rs diff --git a/crates/encoding/src/image_cache.rs b/vello_encoding/src/image_cache.rs similarity index 100% rename from crates/encoding/src/image_cache.rs rename to vello_encoding/src/image_cache.rs diff --git a/crates/encoding/src/lib.rs b/vello_encoding/src/lib.rs similarity index 100% rename from crates/encoding/src/lib.rs rename to vello_encoding/src/lib.rs diff --git a/crates/encoding/src/mask.rs b/vello_encoding/src/mask.rs similarity index 100% rename from crates/encoding/src/mask.rs rename to vello_encoding/src/mask.rs diff --git a/crates/encoding/src/math.rs b/vello_encoding/src/math.rs similarity index 100% rename from crates/encoding/src/math.rs rename to vello_encoding/src/math.rs diff --git a/crates/encoding/src/monoid.rs b/vello_encoding/src/monoid.rs similarity index 100% rename from crates/encoding/src/monoid.rs rename to vello_encoding/src/monoid.rs diff --git a/crates/encoding/src/path.rs b/vello_encoding/src/path.rs similarity index 100% rename from crates/encoding/src/path.rs rename to vello_encoding/src/path.rs diff --git a/crates/encoding/src/ramp_cache.rs b/vello_encoding/src/ramp_cache.rs similarity index 100% rename from crates/encoding/src/ramp_cache.rs rename to vello_encoding/src/ramp_cache.rs diff --git a/crates/encoding/src/resolve.rs b/vello_encoding/src/resolve.rs similarity index 100% rename from crates/encoding/src/resolve.rs rename to vello_encoding/src/resolve.rs diff --git a/crates/shaders/Cargo.toml b/vello_shaders/Cargo.toml similarity index 100% rename from crates/shaders/Cargo.toml rename to vello_shaders/Cargo.toml diff --git a/crates/shaders/README.md b/vello_shaders/README.md similarity index 100% rename from crates/shaders/README.md rename to vello_shaders/README.md diff --git a/crates/shaders/build.rs b/vello_shaders/build.rs similarity index 100% rename from crates/shaders/build.rs rename to vello_shaders/build.rs diff --git a/shader/UNLICENSE b/vello_shaders/shader/UNLICENSE similarity index 100% rename from shader/UNLICENSE rename to vello_shaders/shader/UNLICENSE diff --git a/shader/backdrop.wgsl b/vello_shaders/shader/backdrop.wgsl similarity index 100% rename from shader/backdrop.wgsl rename to vello_shaders/shader/backdrop.wgsl diff --git a/shader/backdrop_dyn.wgsl b/vello_shaders/shader/backdrop_dyn.wgsl similarity index 100% rename from shader/backdrop_dyn.wgsl rename to vello_shaders/shader/backdrop_dyn.wgsl diff --git a/shader/bbox_clear.wgsl b/vello_shaders/shader/bbox_clear.wgsl similarity index 100% rename from shader/bbox_clear.wgsl rename to vello_shaders/shader/bbox_clear.wgsl diff --git a/shader/binning.wgsl b/vello_shaders/shader/binning.wgsl similarity index 100% rename from shader/binning.wgsl rename to vello_shaders/shader/binning.wgsl diff --git a/shader/clip_leaf.wgsl b/vello_shaders/shader/clip_leaf.wgsl similarity index 100% rename from shader/clip_leaf.wgsl rename to vello_shaders/shader/clip_leaf.wgsl diff --git a/shader/clip_reduce.wgsl b/vello_shaders/shader/clip_reduce.wgsl similarity index 100% rename from shader/clip_reduce.wgsl rename to vello_shaders/shader/clip_reduce.wgsl diff --git a/shader/coarse.wgsl b/vello_shaders/shader/coarse.wgsl similarity index 100% rename from shader/coarse.wgsl rename to vello_shaders/shader/coarse.wgsl diff --git a/shader/draw_leaf.wgsl b/vello_shaders/shader/draw_leaf.wgsl similarity index 100% rename from shader/draw_leaf.wgsl rename to vello_shaders/shader/draw_leaf.wgsl diff --git a/shader/draw_reduce.wgsl b/vello_shaders/shader/draw_reduce.wgsl similarity index 100% rename from shader/draw_reduce.wgsl rename to vello_shaders/shader/draw_reduce.wgsl diff --git a/shader/fine.wgsl b/vello_shaders/shader/fine.wgsl similarity index 100% rename from shader/fine.wgsl rename to vello_shaders/shader/fine.wgsl diff --git a/shader/flatten.wgsl b/vello_shaders/shader/flatten.wgsl similarity index 100% rename from shader/flatten.wgsl rename to vello_shaders/shader/flatten.wgsl diff --git a/shader/path_count.wgsl b/vello_shaders/shader/path_count.wgsl similarity index 100% rename from shader/path_count.wgsl rename to vello_shaders/shader/path_count.wgsl diff --git a/shader/path_count_setup.wgsl b/vello_shaders/shader/path_count_setup.wgsl similarity index 100% rename from shader/path_count_setup.wgsl rename to vello_shaders/shader/path_count_setup.wgsl diff --git a/shader/path_tiling.wgsl b/vello_shaders/shader/path_tiling.wgsl similarity index 100% rename from shader/path_tiling.wgsl rename to vello_shaders/shader/path_tiling.wgsl diff --git a/shader/path_tiling_setup.wgsl b/vello_shaders/shader/path_tiling_setup.wgsl similarity index 100% rename from shader/path_tiling_setup.wgsl rename to vello_shaders/shader/path_tiling_setup.wgsl diff --git a/shader/pathtag_reduce.wgsl b/vello_shaders/shader/pathtag_reduce.wgsl similarity index 100% rename from shader/pathtag_reduce.wgsl rename to vello_shaders/shader/pathtag_reduce.wgsl diff --git a/shader/pathtag_reduce2.wgsl b/vello_shaders/shader/pathtag_reduce2.wgsl similarity index 100% rename from shader/pathtag_reduce2.wgsl rename to vello_shaders/shader/pathtag_reduce2.wgsl diff --git a/shader/pathtag_scan.wgsl b/vello_shaders/shader/pathtag_scan.wgsl similarity index 100% rename from shader/pathtag_scan.wgsl rename to vello_shaders/shader/pathtag_scan.wgsl diff --git a/shader/pathtag_scan1.wgsl b/vello_shaders/shader/pathtag_scan1.wgsl similarity index 100% rename from shader/pathtag_scan1.wgsl rename to vello_shaders/shader/pathtag_scan1.wgsl diff --git a/shader/permutations b/vello_shaders/shader/permutations similarity index 100% rename from shader/permutations rename to vello_shaders/shader/permutations diff --git a/shader/shared/bbox.wgsl b/vello_shaders/shader/shared/bbox.wgsl similarity index 100% rename from shader/shared/bbox.wgsl rename to vello_shaders/shader/shared/bbox.wgsl diff --git a/shader/shared/blend.wgsl b/vello_shaders/shader/shared/blend.wgsl similarity index 100% rename from shader/shared/blend.wgsl rename to vello_shaders/shader/shared/blend.wgsl diff --git a/shader/shared/bump.wgsl b/vello_shaders/shader/shared/bump.wgsl similarity index 100% rename from shader/shared/bump.wgsl rename to vello_shaders/shader/shared/bump.wgsl diff --git a/shader/shared/clip.wgsl b/vello_shaders/shader/shared/clip.wgsl similarity index 100% rename from shader/shared/clip.wgsl rename to vello_shaders/shader/shared/clip.wgsl diff --git a/shader/shared/config.wgsl b/vello_shaders/shader/shared/config.wgsl similarity index 100% rename from shader/shared/config.wgsl rename to vello_shaders/shader/shared/config.wgsl diff --git a/shader/shared/cubic.wgsl b/vello_shaders/shader/shared/cubic.wgsl similarity index 100% rename from shader/shared/cubic.wgsl rename to vello_shaders/shader/shared/cubic.wgsl diff --git a/shader/shared/drawtag.wgsl b/vello_shaders/shader/shared/drawtag.wgsl similarity index 100% rename from shader/shared/drawtag.wgsl rename to vello_shaders/shader/shared/drawtag.wgsl diff --git a/shader/shared/pathtag.wgsl b/vello_shaders/shader/shared/pathtag.wgsl similarity index 100% rename from shader/shared/pathtag.wgsl rename to vello_shaders/shader/shared/pathtag.wgsl diff --git a/shader/shared/ptcl.wgsl b/vello_shaders/shader/shared/ptcl.wgsl similarity index 100% rename from shader/shared/ptcl.wgsl rename to vello_shaders/shader/shared/ptcl.wgsl diff --git a/shader/shared/segment.wgsl b/vello_shaders/shader/shared/segment.wgsl similarity index 100% rename from shader/shared/segment.wgsl rename to vello_shaders/shader/shared/segment.wgsl diff --git a/shader/shared/tile.wgsl b/vello_shaders/shader/shared/tile.wgsl similarity index 100% rename from shader/shared/tile.wgsl rename to vello_shaders/shader/shared/tile.wgsl diff --git a/shader/shared/transform.wgsl b/vello_shaders/shader/shared/transform.wgsl similarity index 100% rename from shader/shared/transform.wgsl rename to vello_shaders/shader/shared/transform.wgsl diff --git a/shader/shared/util.wgsl b/vello_shaders/shader/shared/util.wgsl similarity index 100% rename from shader/shared/util.wgsl rename to vello_shaders/shader/shared/util.wgsl diff --git a/shader/tile_alloc.wgsl b/vello_shaders/shader/tile_alloc.wgsl similarity index 100% rename from shader/tile_alloc.wgsl rename to vello_shaders/shader/tile_alloc.wgsl diff --git a/crates/shaders/src/compile/mod.rs b/vello_shaders/src/compile/mod.rs similarity index 100% rename from crates/shaders/src/compile/mod.rs rename to vello_shaders/src/compile/mod.rs diff --git a/crates/shaders/src/compile/msl.rs b/vello_shaders/src/compile/msl.rs similarity index 100% rename from crates/shaders/src/compile/msl.rs rename to vello_shaders/src/compile/msl.rs diff --git a/crates/shaders/src/compile/permutations.rs b/vello_shaders/src/compile/permutations.rs similarity index 100% rename from crates/shaders/src/compile/permutations.rs rename to vello_shaders/src/compile/permutations.rs diff --git a/crates/shaders/src/compile/preprocess.rs b/vello_shaders/src/compile/preprocess.rs similarity index 100% rename from crates/shaders/src/compile/preprocess.rs rename to vello_shaders/src/compile/preprocess.rs diff --git a/crates/shaders/src/cpu.rs b/vello_shaders/src/cpu.rs similarity index 100% rename from crates/shaders/src/cpu.rs rename to vello_shaders/src/cpu.rs diff --git a/crates/shaders/src/cpu/backdrop.rs b/vello_shaders/src/cpu/backdrop.rs similarity index 100% rename from crates/shaders/src/cpu/backdrop.rs rename to vello_shaders/src/cpu/backdrop.rs diff --git a/crates/shaders/src/cpu/bbox_clear.rs b/vello_shaders/src/cpu/bbox_clear.rs similarity index 100% rename from crates/shaders/src/cpu/bbox_clear.rs rename to vello_shaders/src/cpu/bbox_clear.rs diff --git a/crates/shaders/src/cpu/binning.rs b/vello_shaders/src/cpu/binning.rs similarity index 100% rename from crates/shaders/src/cpu/binning.rs rename to vello_shaders/src/cpu/binning.rs diff --git a/crates/shaders/src/cpu/clip_leaf.rs b/vello_shaders/src/cpu/clip_leaf.rs similarity index 100% rename from crates/shaders/src/cpu/clip_leaf.rs rename to vello_shaders/src/cpu/clip_leaf.rs diff --git a/crates/shaders/src/cpu/clip_reduce.rs b/vello_shaders/src/cpu/clip_reduce.rs similarity index 100% rename from crates/shaders/src/cpu/clip_reduce.rs rename to vello_shaders/src/cpu/clip_reduce.rs diff --git a/crates/shaders/src/cpu/coarse.rs b/vello_shaders/src/cpu/coarse.rs similarity index 100% rename from crates/shaders/src/cpu/coarse.rs rename to vello_shaders/src/cpu/coarse.rs diff --git a/crates/shaders/src/cpu/draw_leaf.rs b/vello_shaders/src/cpu/draw_leaf.rs similarity index 100% rename from crates/shaders/src/cpu/draw_leaf.rs rename to vello_shaders/src/cpu/draw_leaf.rs diff --git a/crates/shaders/src/cpu/draw_reduce.rs b/vello_shaders/src/cpu/draw_reduce.rs similarity index 100% rename from crates/shaders/src/cpu/draw_reduce.rs rename to vello_shaders/src/cpu/draw_reduce.rs diff --git a/crates/shaders/src/cpu/euler.rs b/vello_shaders/src/cpu/euler.rs similarity index 100% rename from crates/shaders/src/cpu/euler.rs rename to vello_shaders/src/cpu/euler.rs diff --git a/crates/shaders/src/cpu/fine.rs b/vello_shaders/src/cpu/fine.rs similarity index 100% rename from crates/shaders/src/cpu/fine.rs rename to vello_shaders/src/cpu/fine.rs diff --git a/crates/shaders/src/cpu/flatten.rs b/vello_shaders/src/cpu/flatten.rs similarity index 100% rename from crates/shaders/src/cpu/flatten.rs rename to vello_shaders/src/cpu/flatten.rs diff --git a/crates/shaders/src/cpu/path_count.rs b/vello_shaders/src/cpu/path_count.rs similarity index 100% rename from crates/shaders/src/cpu/path_count.rs rename to vello_shaders/src/cpu/path_count.rs diff --git a/crates/shaders/src/cpu/path_count_setup.rs b/vello_shaders/src/cpu/path_count_setup.rs similarity index 100% rename from crates/shaders/src/cpu/path_count_setup.rs rename to vello_shaders/src/cpu/path_count_setup.rs diff --git a/crates/shaders/src/cpu/path_tiling.rs b/vello_shaders/src/cpu/path_tiling.rs similarity index 100% rename from crates/shaders/src/cpu/path_tiling.rs rename to vello_shaders/src/cpu/path_tiling.rs diff --git a/crates/shaders/src/cpu/path_tiling_setup.rs b/vello_shaders/src/cpu/path_tiling_setup.rs similarity index 100% rename from crates/shaders/src/cpu/path_tiling_setup.rs rename to vello_shaders/src/cpu/path_tiling_setup.rs diff --git a/crates/shaders/src/cpu/pathtag_reduce.rs b/vello_shaders/src/cpu/pathtag_reduce.rs similarity index 100% rename from crates/shaders/src/cpu/pathtag_reduce.rs rename to vello_shaders/src/cpu/pathtag_reduce.rs diff --git a/crates/shaders/src/cpu/pathtag_scan.rs b/vello_shaders/src/cpu/pathtag_scan.rs similarity index 100% rename from crates/shaders/src/cpu/pathtag_scan.rs rename to vello_shaders/src/cpu/pathtag_scan.rs diff --git a/crates/shaders/src/cpu/tile_alloc.rs b/vello_shaders/src/cpu/tile_alloc.rs similarity index 100% rename from crates/shaders/src/cpu/tile_alloc.rs rename to vello_shaders/src/cpu/tile_alloc.rs diff --git a/crates/shaders/src/cpu/util.rs b/vello_shaders/src/cpu/util.rs similarity index 100% rename from crates/shaders/src/cpu/util.rs rename to vello_shaders/src/cpu/util.rs diff --git a/crates/shaders/src/lib.rs b/vello_shaders/src/lib.rs similarity index 100% rename from crates/shaders/src/lib.rs rename to vello_shaders/src/lib.rs diff --git a/crates/shaders/src/types.rs b/vello_shaders/src/types.rs similarity index 100% rename from crates/shaders/src/types.rs rename to vello_shaders/src/types.rs diff --git a/crates/tests/Cargo.toml b/vello_tests/Cargo.toml similarity index 100% rename from crates/tests/Cargo.toml rename to vello_tests/Cargo.toml diff --git a/crates/tests/build.rs b/vello_tests/build.rs similarity index 100% rename from crates/tests/build.rs rename to vello_tests/build.rs diff --git a/crates/tests/debug_outputs/.gitignore b/vello_tests/debug_outputs/.gitignore similarity index 100% rename from crates/tests/debug_outputs/.gitignore rename to vello_tests/debug_outputs/.gitignore diff --git a/crates/tests/src/lib.rs b/vello_tests/src/lib.rs similarity index 100% rename from crates/tests/src/lib.rs rename to vello_tests/src/lib.rs diff --git a/crates/tests/tests/smoke.rs b/vello_tests/tests/smoke.rs similarity index 100% rename from crates/tests/tests/smoke.rs rename to vello_tests/tests/smoke.rs From e345a05005bb7b4a99b981b28e3d685d4af87c6d Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 30 May 2024 17:13:37 +0300 Subject: [PATCH 02/14] Make `Cargo.toml` files compatible with the directory structure. --- Cargo.toml | 52 +++++--------------------------------- examples/simple/Cargo.toml | 2 +- vello/Cargo.toml | 37 +++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 46 deletions(-) create mode 100644 vello/Cargo.toml diff --git a/Cargo.toml b/Cargo.toml index eee72917..889edfe0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,10 @@ [workspace] resolver = "2" members = [ - "crates/encoding", - "crates/shaders", - "crates/tests", + "vello", + "vello_encoding", + "vello_shaders", + "vello_tests", "examples/headless", "examples/with_winit", @@ -27,53 +28,14 @@ rust-version = "1.75" license = "Apache-2.0 OR MIT" repository = "https://github.com/linebender/vello" -[package] -name = "vello" -version.workspace = true -description = "An experimental GPU compute-centric 2D renderer." -categories = ["rendering", "graphics"] -keywords = ["2d", "vector-graphics"] -exclude = ["/.github/", "/doc/", "/examples/", ".gitignore"] -edition.workspace = true -rust-version.workspace = true -license.workspace = true -repository.workspace = true - -[features] -default = ["wgpu"] -# Enables GPU memory usage estimation. This performs additional computations -# in order to estimate the minimum required allocations for buffers backing -# bump-allocated GPU memory. -# TODO: Turn this into a runtime option used at resolve time and remove the feature. -bump_estimate = ["vello_encoding/bump_estimate"] -hot_reload = ["vello_shaders/compile"] -buffer_labels = [] - -[lints] -workspace = true - -[dependencies] -vello_encoding = { workspace = true } -vello_shaders = { workspace = true } -bytemuck = { workspace = true } -skrifa = { workspace = true } -peniko = { workspace = true } -wgpu = { workspace = true, optional = true } -log = { workspace = true } -raw-window-handle = { workspace = true } -static_assertions = { workspace = true } -futures-intrusive = { workspace = true } -wgpu-profiler = { workspace = true, optional = true } -thiserror = { workspace = true } - [workspace.lints] clippy.doc_markdown = "warn" clippy.semicolon_if_nothing_returned = "warn" [workspace.dependencies] -vello = { version = "0.1.0", path = "." } -vello_encoding = { version = "0.1.0", path = "crates/encoding" } -vello_shaders = { version = "0.1.0", path = "crates/shaders" } +vello = { version = "0.1.0", path = "vello" } +vello_encoding = { version = "0.1.0", path = "vello_encoding" } +vello_shaders = { version = "0.1.0", path = "vello_shaders" } bytemuck = { version = "1.16.0", features = ["derive"] } skrifa = "0.19.1" peniko = "0.1.0" diff --git a/examples/simple/Cargo.toml b/examples/simple/Cargo.toml index 5591b598..927f4855 100644 --- a/examples/simple/Cargo.toml +++ b/examples/simple/Cargo.toml @@ -12,7 +12,7 @@ workspace = true [dependencies] # When using this example outside of the original Vello workspace, # remove the path property of the following Vello dependency requirement. -vello = { version = "0.1.0", path = "../../" } +vello = { version = "0.1.0", path = "../../vello" } anyhow = "1.0.83" pollster = "0.3.0" wgpu = "0.20.0" diff --git a/vello/Cargo.toml b/vello/Cargo.toml new file mode 100644 index 00000000..4d721ac8 --- /dev/null +++ b/vello/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "vello" +version.workspace = true +description = "An experimental GPU compute-centric 2D renderer." +categories = ["rendering", "graphics"] +keywords = ["2d", "vector-graphics"] +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true + +[features] +default = ["wgpu"] +# Enables GPU memory usage estimation. This performs additional computations +# in order to estimate the minimum required allocations for buffers backing +# bump-allocated GPU memory. +# TODO: Turn this into a runtime option used at resolve time and remove the feature. +bump_estimate = ["vello_encoding/bump_estimate"] +hot_reload = ["vello_shaders/compile"] +buffer_labels = [] + +[lints] +workspace = true + +[dependencies] +vello_encoding = { workspace = true } +vello_shaders = { workspace = true } +bytemuck = { workspace = true } +skrifa = { workspace = true } +peniko = { workspace = true } +wgpu = { workspace = true, optional = true } +log = { workspace = true } +raw-window-handle = { workspace = true } +static_assertions = { workspace = true } +futures-intrusive = { workspace = true } +wgpu-profiler = { workspace = true, optional = true } +thiserror = { workspace = true } From 7f79c30c43b9e9b23668949231b994fe9f6bf02f Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 30 May 2024 17:27:27 +0300 Subject: [PATCH 03/14] Update shader directory references to the new structure. --- vello/Cargo.toml | 1 + vello/src/shaders.rs | 2 +- vello_shaders/build.rs | 15 +++------------ 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/vello/Cargo.toml b/vello/Cargo.toml index 4d721ac8..10c91d22 100644 --- a/vello/Cargo.toml +++ b/vello/Cargo.toml @@ -16,6 +16,7 @@ default = ["wgpu"] # bump-allocated GPU memory. # TODO: Turn this into a runtime option used at resolve time and remove the feature. bump_estimate = ["vello_encoding/bump_estimate"] +# Hot reloading assumes that the shader files are located in ../vello_shaders/shader hot_reload = ["vello_shaders/compile"] buffer_labels = [] diff --git a/vello/src/shaders.rs b/vello/src/shaders.rs index e844595b..068b5776 100644 --- a/vello/src/shaders.rs +++ b/vello/src/shaders.rs @@ -62,7 +62,7 @@ pub fn full_shaders( #[cfg(feature = "hot_reload")] let mut shaders = vello_shaders::compile::ShaderInfo::from_dir(concat!( env!("CARGO_MANIFEST_DIR"), - "/shader" + "/../vello_shaders/shader" )); #[cfg(not(feature = "hot_reload"))] let shaders = vello_shaders::SHADERS; diff --git a/vello_shaders/build.rs b/vello_shaders/build.rs index de46700b..eb52fa2a 100644 --- a/vello_shaders/build.rs +++ b/vello_shaders/build.rs @@ -8,7 +8,7 @@ mod types; use std::env; use std::fmt::Write; -use std::path::{Path, PathBuf}; +use std::path::Path; use compile::ShaderInfo; @@ -16,18 +16,9 @@ fn main() { let out_dir = env::var_os("OUT_DIR").unwrap(); let dest_path = Path::new(&out_dir).join("shaders.rs"); - println!("cargo:rerun-if-changed=../../shader"); + println!("cargo:rerun-if-changed=shader"); - // The shaders are defined under the workspace root and not in this crate so we need to locate - // them somehow. Cargo doesn't define an environment variable that points at the root workspace - // directory. In hermetic build environments that don't support relative paths (such as Bazel) - // we support supplying a `WORKSPACE_MANIFEST_FILE` that is expected to be an absolute path to - // the Cargo.toml file at the workspace root. If that's not present, we use a relative path. - let workspace_dir = env::var("WORKSPACE_MANIFEST_FILE") - .ok() - .and_then(|p| Path::new(&p).parent().map(|p| p.to_owned())) - .unwrap_or(PathBuf::from("../../")); - let shader_dir = Path::new(&workspace_dir).join("shader"); + let shader_dir = Path::new("shader"); let mut shaders = compile::ShaderInfo::from_dir(shader_dir); // Drop the HashMap and sort by name so that we get deterministic order. From 0542a184fa32c71d1a8b2767a3b06bef0dc0f803 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 30 May 2024 17:41:26 +0300 Subject: [PATCH 04/14] Update `with_winit` hot reloading shader directory reference. --- examples/with_winit/src/hot_reload.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/with_winit/src/hot_reload.rs b/examples/with_winit/src/hot_reload.rs index ba17897c..17c3b8fc 100644 --- a/examples/with_winit/src/hot_reload.rs +++ b/examples/with_winit/src/hot_reload.rs @@ -20,7 +20,7 @@ pub(crate) fn hot_reload(mut f: impl FnMut() -> Option<()> + Send + 'static) -> debouncer.watcher().watch( &Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../shader") + .join("../../vello_shaders/shader") .canonicalize()?, // We currently don't support hot reloading the imports, so don't recurse into there RecursiveMode::NonRecursive, From e8c2cfda9687f71f075fe98b240b2a262e72e731 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 30 May 2024 17:54:33 +0300 Subject: [PATCH 05/14] Update some of the documentation to reflect the new structure. --- .github/copyright.sh | 4 +- .vscode/settings.json | 26 ++-- README.md | 4 +- doc/ARCHITECTURE.md | 19 ++- vello/README.md | 296 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 322 insertions(+), 27 deletions(-) create mode 100644 vello/README.md diff --git a/.github/copyright.sh b/.github/copyright.sh index b090c087..07de4c95 100755 --- a/.github/copyright.sh +++ b/.github/copyright.sh @@ -7,7 +7,7 @@ # -g "!src/special_directory" # Check all the standard Rust source files -output=$(rg "^// Copyright (19|20)[\d]{2} (.+ and )?the Vello Authors( and .+)?$\n^// SPDX-License-Identifier: Apache-2\.0 OR MIT$\n\n" --files-without-match --multiline -g "*.rs" -g "!{shader,crates/shaders/src/cpu}" .) +output=$(rg "^// Copyright (19|20)[\d]{2} (.+ and )?the Vello Authors( and .+)?$\n^// SPDX-License-Identifier: Apache-2\.0 OR MIT$\n\n" --files-without-match --multiline -g "*.rs" -g "!vello_shaders/{shader,src/cpu}" .) if [ -n "$output" ]; then echo -e "The following files lack the correct copyright header:\n" @@ -20,7 +20,7 @@ if [ -n "$output" ]; then fi # Check all the shaders, both WGSL and CPU shaders in Rust, as they also have Unlicense -output=$(rg "^// Copyright (19|20)[\d]{2} (.+ and )?the Vello Authors( and .+)?$\n^// SPDX-License-Identifier: Apache-2\.0 OR MIT OR Unlicense$\n\n" --files-without-match --multiline -g "{shader,crates/shaders/src/cpu}/**/*.{rs,wgsl}" .) +output=$(rg "^// Copyright (19|20)[\d]{2} (.+ and )?the Vello Authors( and .+)?$\n^// SPDX-License-Identifier: Apache-2\.0 OR MIT OR Unlicense$\n\n" --files-without-match --multiline -g "vello_shaders/{shader,src/cpu}/**/*.{rs,wgsl}" .) if [ -n "$output" ]; then echo -e "The following shader files lack the correct copyright header:\n" diff --git a/.vscode/settings.json b/.vscode/settings.json index bda7c872..6be52f08 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,18 +1,18 @@ { "wgsl-analyzer.customImports": { - "bbox": "${workspaceFolder}/shader/shared/bbox.wgsl", - "blend": "${workspaceFolder}/shader/shared/blend.wgsl", - "bump": "${workspaceFolder}/shader/shared/bump.wgsl", - "clip": "${workspaceFolder}/shader/shared/clip.wgsl", - "config": "${workspaceFolder}/shader/shared/config.wgsl", - "cubic": "${workspaceFolder}/shader/shared/cubic.wgsl", - "drawtag": "${workspaceFolder}/shader/shared/drawtag.wgsl", - "pathtag": "${workspaceFolder}/shader/shared/pathtag.wgsl", - "ptcl": "${workspaceFolder}/shader/shared/ptcl.wgsl", - "segment": "${workspaceFolder}/shader/shared/segment.wgsl", - "tile": "${workspaceFolder}/shader/shared/tile.wgsl", - "transform": "${workspaceFolder}/shader/shared/transform.wgsl", - "util": "${workspaceFolder}/shader/shared/util.wgsl" + "bbox": "${workspaceFolder}/vello_shaders/shader/shared/bbox.wgsl", + "blend": "${workspaceFolder}/vello_shaders/shader/shared/blend.wgsl", + "bump": "${workspaceFolder}/vello_shaders/shader/shared/bump.wgsl", + "clip": "${workspaceFolder}/vello_shaders/shader/shared/clip.wgsl", + "config": "${workspaceFolder}/vello_shaders/shader/shared/config.wgsl", + "cubic": "${workspaceFolder}/vello_shaders/shader/shared/cubic.wgsl", + "drawtag": "${workspaceFolder}/vello_shaders/shader/shared/drawtag.wgsl", + "pathtag": "${workspaceFolder}/vello_shaders/shader/shared/pathtag.wgsl", + "ptcl": "${workspaceFolder}/vello_shaders/shader/shared/ptcl.wgsl", + "segment": "${workspaceFolder}/vello_shaders/shader/shared/segment.wgsl", + "tile": "${workspaceFolder}/vello_shaders/shader/shared/tile.wgsl", + "transform": "${workspaceFolder}/vello_shaders/shader/shared/transform.wgsl", + "util": "${workspaceFolder}/vello_shaders/shader/shared/util.wgsl" }, "wgsl-analyzer.diagnostics.nagaVersion": "main", "wgsl-analyzer.preprocessor.shaderDefs": [ diff --git a/README.md b/README.md index 077c024b..f9e27ee0 100644 --- a/README.md +++ b/README.md @@ -274,9 +274,9 @@ Licensed under either of at your option. -In addition, all files in the [`shader`](https://github.com/linebender/vello/tree/main/shader) and [`src/cpu_shader`](https://github.com/linebender/vello/tree/main/src/cpu_shader) +In addition, all files in the [`vello_shaders/shader`](https://github.com/linebender/vello/tree/main/vello_shaders/shader) and [`vello_shaders/src/cpu`](https://github.com/linebender/vello/tree/main/vello_shaders/src/cpu) directories and subdirectories thereof are alternatively licensed under -the Unlicense ([shader/UNLICENSE](https://github.com/linebender/vello/tree/main/shader/UNLICENSE) or ). +the Unlicense ([shader/UNLICENSE](https://github.com/linebender/vello/tree/main/vello_shaders/shader/UNLICENSE) or ). For clarity, these files are also licensed under either of the above licenses. The intent is for this research to be used in as broad a context as possible. diff --git a/doc/ARCHITECTURE.md b/doc/ARCHITECTURE.md index 7abbe374..f0650f5e 100644 --- a/doc/ARCHITECTURE.md +++ b/doc/ARCHITECTURE.md @@ -31,16 +31,15 @@ Our current priority is to fill in missing features and to fix rendering artifac The repository is structured as such: -- `crates/` - - `encoding/` - Types that represent the data that needs to be rendered. - - `shaders/` - Infrastructure to preprocess and cross-compile shaders at compile time; see "Shader templating". - - `cpu/` - Functions that perform the same work as their equivalently-named WGSL shaders for the CPU fallbacks. The name is a bit loose; they're "shaders" in the sense that they work on resource bindings with the exact same layout as actual GPU shaders. - - `tests/` - Helper code for writing tests; current has a single smoke test and not much else. - `doc/` - Various documents detailing the vision for Vello as it was developed. This directory should probably be refactored away; adding to it not recommended. -- `examples/` - Example projects using Vello. Each example is its own crate, with its own dependencies. The simplest example is the `shapes` one. -- `shader/` - This is where the magic happens. WGSL shaders that define the compute operations (often variations of prefix sum) that Vello does to render a scene. - - `shared/` - Shared types, functions and constants included in other shaders through non-standard `#import` preprocessor directives (see "Shader templating"). -- `src/` - Code for the main `vello` crate. +- `examples/` - Example projects using Vello. Each example is its own crate, with its own dependencies. The simplest example is called `simple`. +- `vello/` - Code for the main `vello` crate. +- `vello_encoding/` - Types that represent the data that needs to be rendered. +- `vello_shaders/` - Infrastructure to preprocess and cross-compile shaders at compile time; see "Shader templating". + - `shader/` - This is where the magic happens. WGSL shaders that define the compute operations (often variations of prefix sum) that Vello does to render a scene. + - `shared/` - Shared types, functions and constants included in other shaders through non-standard `#import` preprocessor directives (see "Shader templating"). + - `cpu/` - Functions that perform the same work as their equivalently-named WGSL shaders for the CPU fallbacks. The name is a bit loose; they're "shaders" in the sense that they work on resource bindings with the exact same layout as actual GPU shaders. +- `vello_tests/` - Helper code for writing tests; current has a single smoke test and not much else. ## Shader templating @@ -81,7 +80,7 @@ In principle, other backends could consume a `Recording`, but for now the only i ### CPU rendering -The code in `cpu_shader/*.rs` and `cpu_dispatch.rs` provides *some* support for CPU-side rendering. It's in an awkward place right now: +The code in `vello_shaders/src/cpu/*.rs` and `vello_shaders/src/cpu.rs` provides *some* support for CPU-side rendering. It's in an awkward place right now: - It's called through WgpuEngine, so the dependency on wgpu is still there. - Fine rasterization (the part at the end that puts pixels on screen) doesn't work in CPU yet (see [#386]). diff --git a/vello/README.md b/vello/README.md new file mode 100644 index 00000000..f9e27ee0 --- /dev/null +++ b/vello/README.md @@ -0,0 +1,296 @@ +
+ +# Vello + +**An experimental GPU compute-centric 2D renderer** + +[![Linebender Zulip](https://img.shields.io/badge/Linebender-%23gpu-blue?logo=Zulip)](https://xi.zulipchat.com/#narrow/stream/197075-gpu) +[![dependency status](https://deps.rs/repo/github/linebender/vello/status.svg)](https://deps.rs/repo/github/linebender/vello) +[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](#license) +[![wgpu version](https://img.shields.io/badge/wgpu-v0.20.0-orange.svg)](https://crates.io/crates/wgpu) + +[![Crates.io](https://img.shields.io/crates/v/vello.svg)](https://crates.io/crates/vello) +[![Docs](https://docs.rs/vello/badge.svg)](https://docs.rs/vello) +[![Build status](https://github.com/linebender/vello/workflows/CI/badge.svg)](https://github.com/linebender/vello/actions) + +
+ +Vello is an experimental 2D graphics rendering engine written in Rust, with a focus on GPU compute. +It can draw large 2D scenes with interactive or near-interactive performance, using [`wgpu`] for GPU access. + +Quickstart to run an example program: + +```shell +cargo run -p with_winit +``` + +![image](https://github.com/linebender/vello/assets/8573618/cc2b742e-2135-4b70-8051-c49aeddb5d19) + +It is used as the rendering backend for [Xilem], a Rust GUI toolkit. + +> [!WARNING] +> Vello can currently be considered in an alpha state. In particular, we're still working on the following: +> +> - [Implementing blur and filter effects](https://github.com/linebender/vello/issues/476). +> - [Conflations artifacts](https://github.com/linebender/vello/issues/49). +> - [GPU memory allocation strategy](https://github.com/linebender/vello/issues/366) +> - [Glyph caching](https://github.com/linebender/vello/issues/204) + +## Motivation + +Vello is meant to fill the same place in the graphics stack as other vector graphics renderers like [Skia](https://skia.org/), [Cairo](https://www.cairographics.org/), and its predecessor project [Piet](https://github.com/linebender/piet). +On a basic level, that means it provides tools to render shapes, images, gradients, text, etc, using a PostScript-inspired API, the same that powers SVG files and [the browser `` element](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D). + +Vello's selling point is that it gets better performance than other renderers by better leveraging the GPU. +In traditional PostScript-style renderers, some steps of the render process like sorting and clipping either need to be handled in the CPU or done through the use of intermediary textures. +Vello avoids this by using prefix-sum algorithms to parallelize work that usually needs to happen in sequence, so that work can be offloaded to the GPU with minimal use of temporary buffers. + +This means that Vello needs a GPU with support for compute shaders to run. + +## Getting started + +Vello is meant to be integrated deep in UI render stacks. +While drawing in a Vello scene is easy, actually rendering that scene to a surface requires setting up a wgpu context, which is a non-trivial task. + +To use Vello as the renderer for your PDF reader / GUI toolkit / etc, your code will have to look roughly like this: + +```rust +// Initialize wgpu and get handles +let (width, height) = ...; +let device: wgpu::Device = ...; +let queue: wgpu::Queue = ...; +let surface: wgpu::Surface<'_> = ...; +let texture_format: wgpu::TextureFormat = ...; +let mut renderer = Renderer::new( + &device, + RendererOptions { + surface_format: Some(texture_format), + use_cpu: false, + antialiasing_support: vello::AaSupport::all(), + num_init_threads: NonZeroUsize::new(1), + }, +).expect("Failed to create renderer"); + +// Create scene and draw stuff in it +let mut scene = vello::Scene::new(); +scene.fill( + vello::peniko::Fill::NonZero, + vello::Affine::IDENTITY, + vello::Color::rgb8(242, 140, 168), + None, + &vello::Circle::new((420.0, 200.0), 120.0), +); + +// Draw more stuff +scene.push_layer(...); +scene.fill(...); +scene.stroke(...); +scene.pop_layer(...); + +// Render to your window/buffer/etc. +let surface_texture = surface.get_current_texture() + .expect("failed to get surface texture"); +renderer + .render_to_surface( + &device, + &queue, + &scene, + &surface_texture, + &vello::RenderParams { + base_color: Color::BLACK, // Background color + width, + height, + antialiasing_method: AaConfig::Msaa16, + }, + ) + .expect("Failed to render to surface"); +surface_texture.present(); +``` + +See the [`examples/`](https://github.com/linebender/vello/tree/main/examples) folder to see how that code integrates with frameworks like winit and bevy. + +## Performance + +We've observed 177 fps for the paris-30k test scene on an M1 Max, at a resolution of 1600 pixels square, which is excellent performance and represents something of a best case for the engine. + +More formal benchmarks are on their way. + +## Integrations + +### SVG + +A separate Linebender integration for rendering SVG files is available through the [`vello_svg`](https://github.com/linebender/vello_svg) crate. + +### Lottie + +A separate Linebender integration for playing Lottie animations is available through the [`velato`](https://github.com/linebender/velato) crate. + +## Examples + +Our examples are provided in separate packages in the [`examples`](https://github.com/linebender/vello/tree/main/examples) folder. +This allows them to have independent dependencies and faster builds. +Examples must be selected using the `--package` (or `-p`) Cargo flag. + +### Winit + +Our [winit] example ([examples/with_winit](https://github.com/linebender/vello/tree/main/examples/with_winit)) demonstrates rendering to a [winit] window. +By default, this renders the [GhostScript Tiger] as well as all SVG files you add in the [examples/assets/downloads/](https://github.com/linebender/vello/tree/main/examples/assets/downloads) directory. +A custom list of SVG file paths (and directories to render all SVG files from) can be provided as arguments instead. +It also includes a collection of test scenes showing the capabilities of `vello`, which can be shown with `--test-scenes`. + +```shell +cargo run -p with_winit +``` + + + +### Bevy + +There is a separate community integration for rendering raw scenes or Lottie and SVG files in [Bevy] through [`bevy_vello`](https://github.com/loopystudios/bevy_vello). + +## Platforms + +We aim to target all environments which can support WebGPU with the [default limits](https://www.w3.org/TR/webgpu/#limits). +We defer to [`wgpu`] for this support. +Other platforms are more tricky, and may require special building/running procedures. + +### Web + +Because Vello relies heavily on compute shaders, we rely on the emerging WebGPU standard to run on the web. +Until browser support becomes widespread, it will probably be necessary to use development browser versions (e.g. Chrome Canary) and explicitly enable WebGPU. + +The following command builds and runs a web version of the [winit demo](#winit). +This uses [`cargo-run-wasm`](https://github.com/rukai/cargo-run-wasm) to build the example for web, and host a local server for it + +```shell +# Make sure the Rust toolchain supports the wasm32 target +rustup target add wasm32-unknown-unknown + +# The binary name must also be explicitly provided as it differs from the package name +cargo run_wasm -p with_winit --bin with_winit_bin +``` + +There is also a web demo [available here](https://linebender.github.io/vello) on supporting web browsers. + +> [!WARNING] +> The web is not currently a primary target for Vello, and WebGPU implementations are incomplete, so you might run into issues running this example. + +### Android + +The [`with_winit`](#winit) example supports running on Android, using [cargo apk](https://crates.io/crates/cargo-apk). + +```shell +cargo apk run -p with_winit +``` + +> [!TIP] +> cargo apk doesn't support running in release mode without configuration. +> See [their crates page docs](https://crates.io/crates/cargo-apk) (around `package.metadata.android.signing.`). +> +> See also [cargo-apk#16](https://github.com/rust-mobile/cargo-apk/issues/16). +> To run in release mode, you must add the following to `examples/with_winit/Cargo.toml` (changing `$HOME` to your home directory): + +```toml +[package.metadata.android.signing.release] +path = "$HOME/.android/debug.keystore" +keystore_password = "android" +``` + +> [!NOTE] +> As `cargo apk` does not allow passing command line arguments or environment variables to the app when ran, these can be embedded into the +> program at compile time (currently for Android only) +> `with_winit` currently supports the environment variables: +> +> - `VELLO_STATIC_LOG`, which is equivalent to `RUST_LOG` +> - `VELLO_STATIC_ARGS`, which is equivalent to passing in command line arguments + +For example (with unix shell environment variable syntax): + +```sh +VELLO_STATIC_LOG="vello=trace" VELLO_STATIC_ARGS="--test-scenes" cargo apk run -p with_winit --lib +``` + +## Minimum supported Rust Version (MSRV) + +This version of Vello has been verified to compile with **Rust 1.75** and later. + +Future versions of Vello might increase the Rust version requirement. +It will not be treated as a breaking change and as such can even happen with small patch releases. + +
+Click here if compiling fails. + +As time has passed, some of Vello's dependencies could have released versions with a higher Rust requirement. +If you encounter a compilation issue due to a dependency and don't want to upgrade your Rust toolchain, then you could downgrade the dependency. + +```sh +# Use the problematic dependency's name and version +cargo update -p package_name --precise 0.1.1 +``` + +
+ +## Community + +Discussion of Vello development happens in the [Linebender Zulip](https://xi.zulipchat.com/), specifically the [#gpu stream](https://xi.zulipchat.com/#narrow/stream/197075-gpu). All public content can be read without logging in. + +Contributions are welcome by pull request. The [Rust code of conduct] applies. + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in the work by you, as defined in the Apache-2.0 license, shall be +licensed as noted in the "License" section, without any additional terms or conditions. + +## History + +Vello was previously known as `piet-gpu`. +This prior incarnation used a custom cross-API hardware abstraction layer, called `piet-gpu-hal`, instead of [`wgpu`]. + +An archive of this version can be found in the branches [`custom-hal-archive-with-shaders`] and [`custom-hal-archive`]. +This succeeded the previous prototype, [piet-metal], and included work adapted from [piet-dx12]. + +The decision to lay down `piet-gpu-hal` in favor of WebGPU is discussed in detail in the blog post [Requiem for piet-gpu-hal]. + +A [vision](https://github.com/linebender/vello/tree/main/doc/vision.md) document dated December 2020 explained the longer-term goals of the project, and how we might get there. +Many of these items are out-of-date or completed, but it still may provide some useful background. + +## Related projects + +Vello takes inspiration from many other rendering projects, including: + +- [Pathfinder](https://github.com/servo/pathfinder) +- [Spinel](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/) +- [Forma](https://github.com/google/forma) +- [Massively Parallel Vector Graphics](https://w3.impa.br/~diego/projects/GanEtAl14/) +- [Random-access rendering of general vector graphics](https://hhoppe.com/proj/ravg/) + +## License + +Licensed under either of + +- Apache License, Version 2.0 + ([LICENSE-APACHE](LICENSE-APACHE) or ) +- MIT license + ([LICENSE-MIT](LICENSE-MIT) or ) + +at your option. + +In addition, all files in the [`vello_shaders/shader`](https://github.com/linebender/vello/tree/main/vello_shaders/shader) and [`vello_shaders/src/cpu`](https://github.com/linebender/vello/tree/main/vello_shaders/src/cpu) +directories and subdirectories thereof are alternatively licensed under +the Unlicense ([shader/UNLICENSE](https://github.com/linebender/vello/tree/main/vello_shaders/shader/UNLICENSE) or ). +For clarity, these files are also licensed under either of the above licenses. +The intent is for this research to be used in as broad a context as possible. + +The files in subdirectories of the [`examples/assets`](https://github.com/linebender/vello/tree/main/examples/assets) directory are licensed solely under +their respective licenses, available in the `LICENSE` file in their directories. + +[piet-metal]: https://github.com/linebender/piet-metal +[`wgpu`]: https://wgpu.rs/ +[Xilem]: https://github.com/linebender/xilem/ +[rust code of conduct]: https://www.rust-lang.org/policies/code-of-conduct +[`custom-hal-archive-with-shaders`]: https://github.com/linebender/piet-gpu/tree/custom-hal-archive-with-shaders +[`custom-hal-archive`]: https://github.com/linebender/piet-gpu/tree/custom-hal-archive +[piet-dx12]: https://github.com/bzm3r/piet-dx12 +[GhostScript tiger]: https://commons.wikimedia.org/wiki/File:Ghostscript_Tiger.svg +[winit]: https://github.com/rust-windowing/winit +[Bevy]: https://bevyengine.org/ +[Requiem for piet-gpu-hal]: https://raphlinus.github.io/rust/gpu/2023/01/07/requiem-piet-gpu-hal.html From 577846bc909b6994db2b8f7a310e4635e4f66aed Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 30 May 2024 20:13:20 +0300 Subject: [PATCH 06/14] Add license files to all published packages. --- LICENSE-MIT | 2 +- vello/LICENSE-APACHE | 202 ++++++++++++++++++++++++++++++++++ vello/LICENSE-MIT | 25 +++++ vello_encoding/LICENSE-APACHE | 202 ++++++++++++++++++++++++++++++++++ vello_encoding/LICENSE-MIT | 25 +++++ vello_shaders/LICENSE-APACHE | 202 ++++++++++++++++++++++++++++++++++ vello_shaders/LICENSE-MIT | 25 +++++ 7 files changed, 682 insertions(+), 1 deletion(-) create mode 100644 vello/LICENSE-APACHE create mode 100644 vello/LICENSE-MIT create mode 100644 vello_encoding/LICENSE-APACHE create mode 100644 vello_encoding/LICENSE-MIT create mode 100644 vello_shaders/LICENSE-APACHE create mode 100644 vello_shaders/LICENSE-MIT diff --git a/LICENSE-MIT b/LICENSE-MIT index 3530c97d..48ff8e41 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2020 Raph Levien +Copyright 2020 the Vello Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/vello/LICENSE-APACHE b/vello/LICENSE-APACHE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vello/LICENSE-APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vello/LICENSE-MIT b/vello/LICENSE-MIT new file mode 100644 index 00000000..48ff8e41 --- /dev/null +++ b/vello/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright 2020 the Vello Authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/vello_encoding/LICENSE-APACHE b/vello_encoding/LICENSE-APACHE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vello_encoding/LICENSE-APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vello_encoding/LICENSE-MIT b/vello_encoding/LICENSE-MIT new file mode 100644 index 00000000..48ff8e41 --- /dev/null +++ b/vello_encoding/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright 2020 the Vello Authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/vello_shaders/LICENSE-APACHE b/vello_shaders/LICENSE-APACHE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vello_shaders/LICENSE-APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vello_shaders/LICENSE-MIT b/vello_shaders/LICENSE-MIT new file mode 100644 index 00000000..48ff8e41 --- /dev/null +++ b/vello_shaders/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright 2020 the Vello Authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. From fdb73f3a61ea97e1d62df0f0fb53dca2258fb6da Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 30 May 2024 22:56:36 +0300 Subject: [PATCH 07/14] Restore support for hermetic build environments. --- vello_shaders/build.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vello_shaders/build.rs b/vello_shaders/build.rs index eb52fa2a..6527f587 100644 --- a/vello_shaders/build.rs +++ b/vello_shaders/build.rs @@ -18,7 +18,10 @@ fn main() { println!("cargo:rerun-if-changed=shader"); - let shader_dir = Path::new("shader"); + // To support hermetic build environments that don't support relative paths (such as Bazel) + // we use Cargo's CARGO_MANIFEST_DIR environment variable to compose an absolute path. + let manifest_dir = env!("CARGO_MANIFEST_DIR"); + let shader_dir = Path::new(&manifest_dir).join("shader"); let mut shaders = compile::ShaderInfo::from_dir(shader_dir); // Drop the HashMap and sort by name so that we get deterministic order. From cdf847e374f848a1101f92fdfd1065ba79c2fb75 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Thu, 30 May 2024 23:04:31 +0300 Subject: [PATCH 08/14] Read `CARGO_MANIFEST_DIR` at runtime into an `OsString`. --- vello_shaders/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vello_shaders/build.rs b/vello_shaders/build.rs index 6527f587..4ed2cb72 100644 --- a/vello_shaders/build.rs +++ b/vello_shaders/build.rs @@ -20,7 +20,7 @@ fn main() { // To support hermetic build environments that don't support relative paths (such as Bazel) // we use Cargo's CARGO_MANIFEST_DIR environment variable to compose an absolute path. - let manifest_dir = env!("CARGO_MANIFEST_DIR"); + let manifest_dir = env::var_os("CARGO_MANIFEST_DIR").unwrap(); let shader_dir = Path::new(&manifest_dir).join("shader"); let mut shaders = compile::ShaderInfo::from_dir(shader_dir); From 1ffed14b31f67f96cb3ac806ecd65d2ff39cf210 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Fri, 31 May 2024 13:00:31 +0300 Subject: [PATCH 09/14] Add a central function to determine the shader path. --- Cargo.lock | 1 + examples/with_winit/Cargo.toml | 1 + examples/with_winit/src/hot_reload.rs | 5 +---- vello/Cargo.toml | 1 - vello/src/shaders.rs | 5 +---- vello_shaders/build.rs | 8 ++------ vello_shaders/src/compile/mod.rs | 16 +++++++++++++++- 7 files changed, 21 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 782e1dd4..3f27914f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3112,6 +3112,7 @@ dependencies = [ "tracing-subscriber", "tracing_android_trace", "vello", + "vello_shaders", "wasm-bindgen-futures", "web-sys", "wgpu", diff --git a/examples/with_winit/Cargo.toml b/examples/with_winit/Cargo.toml index c5e7fe43..b0ff817d 100644 --- a/examples/with_winit/Cargo.toml +++ b/examples/with_winit/Cargo.toml @@ -48,6 +48,7 @@ env_logger = "0.11.3" [target.'cfg(not(any(target_arch = "wasm32", target_os = "android")))'.dependencies] vello = { workspace = true, features = ["hot_reload"] } +vello_shaders = { workspace = true, features = ["compile"] } notify-debouncer-mini = "0.3.0" diff --git a/examples/with_winit/src/hot_reload.rs b/examples/with_winit/src/hot_reload.rs index 17c3b8fc..e9dd3a28 100644 --- a/examples/with_winit/src/hot_reload.rs +++ b/examples/with_winit/src/hot_reload.rs @@ -1,7 +1,6 @@ // Copyright 2023 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::path::Path; use std::time::Duration; use anyhow::Result; @@ -19,9 +18,7 @@ pub(crate) fn hot_reload(mut f: impl FnMut() -> Option<()> + Send + 'static) -> )?; debouncer.watcher().watch( - &Path::new(env!("CARGO_MANIFEST_DIR")) - .join("../../vello_shaders/shader") - .canonicalize()?, + vello_shaders::compile::shader_dir().as_path(), // We currently don't support hot reloading the imports, so don't recurse into there RecursiveMode::NonRecursive, )?; diff --git a/vello/Cargo.toml b/vello/Cargo.toml index 10c91d22..4d721ac8 100644 --- a/vello/Cargo.toml +++ b/vello/Cargo.toml @@ -16,7 +16,6 @@ default = ["wgpu"] # bump-allocated GPU memory. # TODO: Turn this into a runtime option used at resolve time and remove the feature. bump_estimate = ["vello_encoding/bump_estimate"] -# Hot reloading assumes that the shader files are located in ../vello_shaders/shader hot_reload = ["vello_shaders/compile"] buffer_labels = [] diff --git a/vello/src/shaders.rs b/vello/src/shaders.rs index 068b5776..abba984b 100644 --- a/vello/src/shaders.rs +++ b/vello/src/shaders.rs @@ -60,10 +60,7 @@ pub fn full_shaders( //let force_gpu_from = Some("binning"); #[cfg(feature = "hot_reload")] - let mut shaders = vello_shaders::compile::ShaderInfo::from_dir(concat!( - env!("CARGO_MANIFEST_DIR"), - "/../vello_shaders/shader" - )); + let mut shaders = vello_shaders::compile::ShaderInfo::from_default(); #[cfg(not(feature = "hot_reload"))] let shaders = vello_shaders::SHADERS; diff --git a/vello_shaders/build.rs b/vello_shaders/build.rs index 4ed2cb72..4334aef7 100644 --- a/vello_shaders/build.rs +++ b/vello_shaders/build.rs @@ -16,13 +16,9 @@ fn main() { let out_dir = env::var_os("OUT_DIR").unwrap(); let dest_path = Path::new(&out_dir).join("shaders.rs"); - println!("cargo:rerun-if-changed=shader"); + println!("cargo:rerun-if-changed={}", compile::shader_dir().display()); - // To support hermetic build environments that don't support relative paths (such as Bazel) - // we use Cargo's CARGO_MANIFEST_DIR environment variable to compose an absolute path. - let manifest_dir = env::var_os("CARGO_MANIFEST_DIR").unwrap(); - let shader_dir = Path::new(&manifest_dir).join("shader"); - let mut shaders = compile::ShaderInfo::from_dir(shader_dir); + let mut shaders = compile::ShaderInfo::from_default(); // Drop the HashMap and sort by name so that we get deterministic order. let mut shaders = shaders.drain().collect::>(); diff --git a/vello_shaders/src/compile/mod.rs b/vello_shaders/src/compile/mod.rs index ea6bbb2e..31a25916 100644 --- a/vello_shaders/src/compile/mod.rs +++ b/vello_shaders/src/compile/mod.rs @@ -5,7 +5,8 @@ use naga::front::wgsl; use naga::valid::{Capabilities, ModuleInfo, ValidationError, ValidationFlags}; use naga::{AddressSpace, ArraySize, ImageClass, Module, StorageAccess, WithSpan}; use std::collections::{HashMap, HashSet}; -use std::path::Path; +use std::path::{Path, PathBuf}; +use std::sync::OnceLock; use thiserror::Error; pub mod permutations; @@ -129,6 +130,11 @@ impl ShaderInfo { }) } + /// Same as [`ShaderInfo::from_dir`] but uses the default shader directory provided by [`shader_dir`]. + pub fn from_default() -> HashMap { + ShaderInfo::from_dir(shader_dir()) + } + pub fn from_dir(shader_dir: impl AsRef) -> HashMap { use std::fs; let shader_dir = shader_dir.as_ref(); @@ -198,3 +204,11 @@ fn postprocess(wgsl: &str) -> String { } output } + +/// Returns the absolute path to the directory containing the WGSL shaders. +/// +/// The path is determined at compile time. +pub fn shader_dir() -> &'static PathBuf { + static SHADER_DIR: OnceLock = OnceLock::new(); + SHADER_DIR.get_or_init(|| Path::new(env!("CARGO_MANIFEST_DIR")).join("shader")) +} From 8e0493096d75018dd943770042dba87cea86bf96 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Fri, 31 May 2024 14:50:20 +0300 Subject: [PATCH 10/14] Add note about reproducible builds. --- vello_shaders/src/compile/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/vello_shaders/src/compile/mod.rs b/vello_shaders/src/compile/mod.rs index 31a25916..12fbb008 100644 --- a/vello_shaders/src/compile/mod.rs +++ b/vello_shaders/src/compile/mod.rs @@ -208,6 +208,7 @@ fn postprocess(wgsl: &str) -> String { /// Returns the absolute path to the directory containing the WGSL shaders. /// /// The path is determined at compile time. +// NOTE: Embedding build environemnt info into the code makes reproducible builds trickier. pub fn shader_dir() -> &'static PathBuf { static SHADER_DIR: OnceLock = OnceLock::new(); SHADER_DIR.get_or_init(|| Path::new(env!("CARGO_MANIFEST_DIR")).join("shader")) From d8026b1ab5371c09511f13c1fe60cc991789014d Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Fri, 31 May 2024 14:53:03 +0300 Subject: [PATCH 11/14] Fix typo. --- vello_shaders/src/compile/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vello_shaders/src/compile/mod.rs b/vello_shaders/src/compile/mod.rs index 12fbb008..4333cbcb 100644 --- a/vello_shaders/src/compile/mod.rs +++ b/vello_shaders/src/compile/mod.rs @@ -208,7 +208,7 @@ fn postprocess(wgsl: &str) -> String { /// Returns the absolute path to the directory containing the WGSL shaders. /// /// The path is determined at compile time. -// NOTE: Embedding build environemnt info into the code makes reproducible builds trickier. +// NOTE: Embedding build environment info into the code makes reproducible builds trickier. pub fn shader_dir() -> &'static PathBuf { static SHADER_DIR: OnceLock = OnceLock::new(); SHADER_DIR.get_or_init(|| Path::new(env!("CARGO_MANIFEST_DIR")).join("shader")) From eb2686e7e2c8f5d89d8832e350113fe96be1698d Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Mon, 3 Jun 2024 15:15:00 +0300 Subject: [PATCH 12/14] Remove optional appendix from Apache 2.0 license files. --- LICENSE-APACHE | 26 -------------------------- vello/LICENSE-APACHE | 26 -------------------------- vello_encoding/LICENSE-APACHE | 26 -------------------------- vello_shaders/LICENSE-APACHE | 26 -------------------------- 4 files changed, 104 deletions(-) diff --git a/LICENSE-APACHE b/LICENSE-APACHE index d6456956..d9a10c0d 100644 --- a/LICENSE-APACHE +++ b/LICENSE-APACHE @@ -1,4 +1,3 @@ - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -175,28 +174,3 @@ of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vello/LICENSE-APACHE b/vello/LICENSE-APACHE index d6456956..d9a10c0d 100644 --- a/vello/LICENSE-APACHE +++ b/vello/LICENSE-APACHE @@ -1,4 +1,3 @@ - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -175,28 +174,3 @@ of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vello_encoding/LICENSE-APACHE b/vello_encoding/LICENSE-APACHE index d6456956..d9a10c0d 100644 --- a/vello_encoding/LICENSE-APACHE +++ b/vello_encoding/LICENSE-APACHE @@ -1,4 +1,3 @@ - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -175,28 +174,3 @@ of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vello_shaders/LICENSE-APACHE b/vello_shaders/LICENSE-APACHE index d6456956..d9a10c0d 100644 --- a/vello_shaders/LICENSE-APACHE +++ b/vello_shaders/LICENSE-APACHE @@ -1,4 +1,3 @@ - Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -175,28 +174,3 @@ of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. From 31ab0748c77d8ef64019b0a90a51cde8fe47550a Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Mon, 3 Jun 2024 15:19:52 +0300 Subject: [PATCH 13/14] Add note about compiling machine. --- vello_shaders/src/compile/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vello_shaders/src/compile/mod.rs b/vello_shaders/src/compile/mod.rs index 4333cbcb..ab0d9c9e 100644 --- a/vello_shaders/src/compile/mod.rs +++ b/vello_shaders/src/compile/mod.rs @@ -207,7 +207,7 @@ fn postprocess(wgsl: &str) -> String { /// Returns the absolute path to the directory containing the WGSL shaders. /// -/// The path is determined at compile time. +/// The path is determined at compile time and is likely only valid on the compiling machine. // NOTE: Embedding build environment info into the code makes reproducible builds trickier. pub fn shader_dir() -> &'static PathBuf { static SHADER_DIR: OnceLock = OnceLock::new(); From 93689675adc52567ccb470cdf394cc05eea19345 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Mon, 3 Jun 2024 15:36:45 +0300 Subject: [PATCH 14/14] Add basic docs to the `vello_shaders` root module. --- vello_shaders/src/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vello_shaders/src/lib.rs b/vello_shaders/src/lib.rs index b8083ed7..a45cc6d4 100644 --- a/vello_shaders/src/lib.rs +++ b/vello_shaders/src/lib.rs @@ -1,6 +1,22 @@ // Copyright 2023 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT +//! This is a utility library to help integrate the [Vello] shader modules into any renderer +//! project. It provides the necessary metadata to construct the individual compute pipelines +//! on any GPU API while leaving the responsibility of all API interactions +//! (such as resource management and command encoding) up to the client. +//! +//! The shaders can be pre-compiled to any target shading language at build time based on +//! feature flags. Currently only WGSL and Metal Shading Language are supported. +//! +//! Your first choice should be to use the build time generated [`SHADERS`]. +//! +//! Alternatively you could use runtime compiled shaders via the [`compile`] module +//! by enabling the `compile` feature. This option is useful for active development +//! as it enables you to do hot reloading of shaders. +//! +//! [Vello]: https://github.com/linebender/vello + mod types; #[cfg(feature = "compile")]