mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 12:44:11 -10:00
Three of Bevy's shader_advanced examples now run as written, each through a general feature.
A compute writes a mesh (shader_advanced/compute_mesh). A <Compute file> binds each var<storage> its file declares:
either its own buffer, its first contents in the type's storage layout and kept from frame to frame, or a mesh's
vertex or index slab in Bevy's MeshAllocator, found by its part's name (systems/compute/src/slab.rs). A uniform
field given { start: NAME } or { end: NAME } is that mesh's range in the slab, counted in the array's elements, and
is packed each frame once the allocator has placed the mesh. The allocator's slabs carry STORAGE usage, set before
MeshAllocatorPlugin's finish makes the allocator, as the example's plugin sets it. A <BufferMesh> with indices and
normals is now Bevy's indexed Mesh, its index buffer kept, instead of flat triangles (systems/mesh/src/indexed.rs);
3d/vertex_colors, which takes that path, still passes. Every row with a name now gets a Bevy Name, not only bare
entities.
Your own phase item (shader_advanced/custom_phase_item). <PhaseItem> puts raea-sys-phase's PhaseItem and an Aabb on
an <Entity>. A new crate, systems/phase, queues it into each view's Opaque3d phase with a pipeline of its shader
file as written, drawing its own vertex buffer (its stride and attributes) and index buffer with its depth state,
as the example's queue_custom_phase_item does.
A frame pass as written (shader_advanced/custom_post_processing). A <FramePass file> binds its file's own @group(0)
declarations: each texture_2d<f32> is the frame (the one `frame` names) or an image, each sampler Bevy's default or
the one given, each var<uniform> its value (systems/framepass/src/written.rs). Its uniforms may change frame by
frame: like a compute's entry and bind, they are a keyed string column, and the pass repacks them when they change.
FramePass moves out of materials.tsx (at its 500-line limit) into 3d/framepass.tsx. The group(0) declaration parser
the compute and the pass share is raea-sys-shader's bindings::group0.
A camera on the Engine's target now draws a w x h Viewport of the w x (h + 1) tag-row target, as orthographic
cameras already did. A perspective camera had a sub view of the whole target, so a draw in clip space, such as the
phase item's triangle, mapped to 721 rows: its bottom edge landed 0.75 px low and the port passed at SSIM 0.9936 with
2355 pixels off. It is now pixel-exact. The whole suite was rerun with the change.
Results:
- compute_mesh passes at frames 5 and 10 (SSIM 0.999999, 2 pixels off at a 2% threshold). Eight mutants all fail the
bar: no dispatch, either range set to 0, indices written into the vertex slab, the compute's mesh unnamed, the
other cube's colour, no shadows, and the other cube moved.
- custom_phase_item passes at frames 5 and 10 with SSIM 1.0 and 0 pixels off. Mutants: the second attribute at
offset 12, a vertex given another colour, and the top vertex at y 0.9 all fail the bar; a vertex moved from 0.866 to
0.86 passes on SSIM (0.9953) but leaves 1556 pixels off, where the port leaves 0.
- custom_post_processing passes at frames 10, 30 and 60 (SSIM 0.99995, 0 pixels off). Mutants: no white clear colour
fails the bar; intensity times 4/3 (8100 pixels off), a slower turn (4256), a linear sampler (16) and sin(t) for
sin(sin(t)) (2964 at frame 60) pass on SSIM but leave pixels off. The pass before tone mapping draws the same
frame, as it should: the camera is not HDR, so Bevy tone-maps in the material shader and its tonemapping node is
skipped.
- After the change, the whole suite passes: 141 of 141 ported (two first-run misses rerun clean: standard_widgets
missed its replayed menu click on the Bevy side, automatic_instancing missed its frame-time bar under another load).
101 lines
8.1 KiB
TOML
101 lines
8.1 KiB
TOML
[package]
|
|
name = "raea-render"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
license = "FSL-1.1-ALv2"
|
|
publish = false
|
|
description = "raea's render engine: an edit's rows drawn by Bevy (3D) or the direct GPU path, its sound mixed, its video encoded"
|
|
|
|
[dependencies]
|
|
# a frame's rows as the passes read them (FrameRows, the edit, the clock, row helpers, bevy_api)
|
|
raea-sys-frame = { path = "../../systems/frame" }
|
|
# the passes, each a crate of its own (systems/)
|
|
raea-sys-splat = { path = "../../systems/splat" }
|
|
raea-sys-sprite = { path = "../../systems/sprite" }
|
|
raea-sys-rt = { path = "../../systems/rt" }
|
|
# soft shadows (experimental_pbr_pcss) are under the native feature with raea-runtime-scene3d/pcss: WebGPU refuses their sampling
|
|
bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app", "multi_threaded", "3d_bevy_render", "ui_bevy_render", "png", "tonemapping_luts", "ktx2", "zstd_rust"] }
|
|
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "hdr"] }
|
|
# an edit as rows keyed per frame, and 3D shapes as values (docs/media.feature M2)
|
|
raea-core-program = { path = "../../core/program" }
|
|
# worn surfaces on a mesh row (`wear`)
|
|
raea-sys-wear = { path = "../../systems/wear" }
|
|
# procedural surfaces on a mesh row (`proc`)
|
|
raea-sys-procmat = { path = "../../systems/procmat" }
|
|
raea-core-shape = { path = "../../core/shape" }
|
|
# text in the 3D world (<RichText>): each glyph a lit, shaded entity
|
|
raea-sys-text3d = { path = "../../systems/text3d" }
|
|
raea-runtime-gpuframe = { path = "../../runtime/gpuframe", optional = true }
|
|
raea-runtime-scene3d = { path = "../../runtime/scene3d" }
|
|
raea-runtime-plugins = { path = "../../runtime/plugins" }
|
|
raea-sys-screen = { path = "../../systems/screen" }
|
|
raea-sys-matchmove = { path = "../../systems/matchmove" }
|
|
raea-sys-grid = { path = "../../systems/grid" }
|
|
raea-sys-meshseq = { path = "../../systems/meshseq" }
|
|
raea-sys-environment = { path = "../../systems/environment" }
|
|
raea-sys-look = { path = "../../systems/look" }
|
|
raea-sys-compose = { path = "../../systems/compose" }
|
|
raea-sys-material = { path = "../../systems/material" }
|
|
raea-sys-framepass = { path = "../../systems/framepass" }
|
|
raea-sys-compute = { path = "../../systems/compute" }
|
|
raea-sys-phase = { path = "../../systems/phase" }
|
|
raea-sys-sampler = { path = "../../systems/sampler" }
|
|
raea-sys-parity = { path = "../../systems/parity" }
|
|
raea-sys-shader = { path = "../../systems/shader" }
|
|
# three.js's shaders: a ShaderMaterial's GLSL and a node material's WGSL (docs/r3f.feature R3F11)
|
|
raea-sys-three-shader = { path = "../../systems/three-shader" }
|
|
raea-sys-post = { path = "../../systems/post" }
|
|
raea-sys-fog = { path = "../../systems/fog" }
|
|
raea-sys-fog-half = { path = "../../systems/fog-half" }
|
|
raea-sys-volume = { path = "../../systems/volume" }
|
|
# a field of grass made in tiles by distance (<Grass>)
|
|
raea-sys-grass = { path = "../../systems/grass" }
|
|
serde_json = { version = "1", features = ["float_roundtrip"] }
|
|
# the direct render's views, the 2D rows, clips' masks and the paint device (runtime/view)
|
|
raea-runtime-view = { path = "../../runtime/view", optional = true }
|
|
raea-sys-page = { path = "../../systems/page", optional = true }
|
|
# the shared device; its passes' errors, stalls and latency in the run's trace, as raea-render's
|
|
raea-gpu-device = { path = "../../gpu/device", optional = true }
|
|
raea-io-trace = { path = "../../io/trace", optional = true }
|
|
# the same wgpu Bevy uses (the NV12 pass records on its device)
|
|
wgpu = "=30.0.1"
|
|
bytemuck = "1"
|
|
# the media plane: clips decode through a MediaBackend (soft everywhere, apple on Apple)
|
|
raea-io-media = { path = "../../io/media", default-features = false, features = ["soft-audio", "apple"], optional = true }
|
|
|
|
# Bevy's Solari and MetalFX's denoiser on it (the raytracing feature)
|
|
raea-render-raytrace = { path = "raytrace", optional = true }
|
|
|
|
[features]
|
|
# native: everything that only exists to render on the machine itself (clips' decoders, the GPU frame path and its
|
|
# traces, the direct views, and Bevy's built-in font, JPEG, SMAA's and area lights' tables and gamepads, which a
|
|
# page's download goes without); without it raea-render is the program format and the 3D engine, which is what a browser build needs (docs/web-export.md, milestone 1)
|
|
native = ["bevy/default_font", "bevy/jpeg", "bevy/smaa_luts", "bevy/area_light_luts", "bevy/bevy_gilrs", "dep:raea-sys-page", "bevy/experimental_pbr_pcss", "raea-runtime-scene3d/pcss", "dep:raea-runtime-gpuframe", "dep:raea-runtime-view", "raea-sys-matchmove/native", "raea-sys-frame/native", "raea-sys-splat/native", "raea-sys-material/native", "raea-sys-text3d/native", "dep:raea-io-media", "dep:raea-gpu-device", "dep:raea-io-trace"]
|
|
# web: the 3D engine on WebGPU in a browser (wasm32-unknown-unknown, without native)
|
|
web = ["bevy/webgpu"]
|
|
# AV1 (dav1d decode, rav1e encode) as a media backend: on by default; an exported game's player goes without it
|
|
# (lightspeed R7: about 1 MB of code no game uses)
|
|
default = ["native", "h264", "av1", "scripts", "network"]
|
|
# Bevy's Solari, ray-traced lighting and its reference path tracer (docs/raytracing.feature RT3), and MetalFX's
|
|
# denoiser on it on the Mac (RT4)
|
|
raytracing = ["native", "dep:raea-render-raytrace"]
|
|
# the soft backend's H.264 (openh264): mezzanines, raea-render export's GOPs, portable video decode; an exported game's
|
|
# player goes without it and decodes video on the platform (lightspeed R7)
|
|
h264 = ["native", "raea-io-media/h264"]
|
|
av1 = ["native", "raea-io-media/av1"]
|
|
# an HTML composition's <script>s and its http(s) assets (Google Fonts, CDN images): the native build always has both, so
|
|
# these name what a build wants and add nothing to native
|
|
scripts = ["native"]
|
|
network = ["native"]
|
|
# every Bevy feature a game developer or animator might use: the plugin catalog's "bevy" declaration
|
|
# (sdk/raea/bench/bevy-plugins/package.json, 0.20). Measured beside the default build before it joins `default`
|
|
# (the adopt-0.20 pass, docs/bevy-upgrade.md); native only, so the web build goes without
|
|
bevy-all = ["bevy/bevy_gilrs", "bevy/gamepad", "bevy/area_light_luts", "bevy/experimental_pbr_pcss", "bevy/dfg_lut", "bevy/smaa_luts", "bevy/tonemapping_luts", "bevy/bluenoise_texture", "bevy/bevy_gizmos", "bevy/bevy_gizmos_render", "bevy/bevy_dev_tools", "bevy/debug", "bevy/bevy_ui_debug", "bevy/file_watcher", "bevy/embedded_watcher", "bevy/asset_processor", "bevy/png", "bevy/jpeg", "bevy/ktx2", "bevy/zstd_rust", "bevy/basis-universal", "bevy/exr", "bevy/hdr", "bevy/webp", "bevy/dds", "bevy/tga", "bevy/bmp", "bevy/gif", "bevy/ico", "bevy/qoi", "bevy/pnm", "bevy/tiff", "bevy/compressed_image_saver", "bevy/picking", "bevy/bevy_picking", "bevy/mesh_picking", "bevy/sprite_picking", "bevy/ui_picking", "bevy/meshlet", "bevy/meshlet_processor", "bevy/bevy_solari", "bevy/bevy_animation", "bevy/gltf_animation", "bevy/morph", "bevy/morph_animation", "bevy/bevy_gltf", "bevy/bevy_sprite", "bevy/bevy_sprite_render", "bevy/2d_bevy_render", "bevy/3d_bevy_render", "bevy/ui_bevy_render", "bevy/bevy_ui_widgets", "bevy/bevy_feathers", "bevy/custom_cursor", "bevy/bevy_input_focus", "bevy/bevy_camera_controller", "bevy/free_camera", "bevy/pan_camera", "bevy/bevy_text", "bevy/system_font_discovery", "bevy/scene", "bevy/bevy_state", "bevy/serialize", "bevy/reflect_functions", "bevy/reflect_documentation", "bevy/sysinfo_plugin", "bevy/bevy_clipboard", "bevy/system_clipboard", "bevy/clipboard_image", "bevy/ghost_nodes", "bevy/bevy_settings", "bevy/shader_format_spirv", "bevy/bevy_debug_stepping", "bevy/bevy_world_serialization", "bevy/bevy_audio", "bevy/mp3", "bevy/flac", "bevy/vorbis", "bevy/wav", "bevy/aac", "bevy/mp4", "bevy/http", "bevy/https", "bevy/web_asset_cache", "bevy/bevy_curve", "bevy/complex_script_segmentation", "bevy/compressed_image_saver_universal", "bevy/pan_orbit_camera", "bevy/pan_orbit_gizmo", "bevy/render_dev_tools"]
|
|
# per-system spans as a chrome trace (RUST_LOG=info, trace-*.json in the working directory)
|
|
trace = ["bevy/trace", "bevy/trace_chrome"]
|
|
|
|
[package.metadata.cargo-shear]
|
|
# raea-core-shape is unused since a mesh row's shape went to raea_sys_material::mesh::shape_mesh. Its line sits beside
|
|
# an unlanded branch's (scene-loop: raea-sys-procmat), so it goes, with this table, once that branch lands
|
|
ignored = ["raea-core-shape"]
|