Title: Performance Benchmarking - Plan · Issue #235 · processing/libprocessing · GitHub
Open Graph Title: Performance Benchmarking - Plan · Issue #235 · processing/libprocessing
X Title: Performance Benchmarking - Plan · Issue #235 · processing/libprocessing
Description: PERFORMANCE TESTING SUITE TYPES OF FUNCTIONS: 1. CPU NATIVE FUNCTIONS / PROCESSES These can be done in gitHub actions CI/CD and locally Use Rust benchmark harness like Criterion for Local benchmarking. Codspeed for CI/CD integration. Tes...
Open Graph Description: PERFORMANCE TESTING SUITE TYPES OF FUNCTIONS: 1. CPU NATIVE FUNCTIONS / PROCESSES These can be done in gitHub actions CI/CD and locally Use Rust benchmark harness like Criterion for Local benchmark...
X Description: PERFORMANCE TESTING SUITE TYPES OF FUNCTIONS: 1. CPU NATIVE FUNCTIONS / PROCESSES These can be done in gitHub actions CI/CD and locally Use Rust benchmark harness like Criterion for Local benchmark...
Opengraph URL: https://github.com/processing/libprocessing/issues/235
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Performance Benchmarking - Plan","articleBody":"# PERFORMANCE TESTING SUITE\n\n## TYPES OF FUNCTIONS:\n\n### 1. CPU NATIVE FUNCTIONS / PROCESSES\n\n- These can be done in gitHub actions CI/CD and locally\n - Use Rust benchmark harness like **Criterion** for Local benchmarking. **Codspeed** for CI/CD integration.\n - Test for both function and functionality\n - `sphere_mesh()` → pure mesh generation cost (function)\n - `create_sphere()` → mesh generation + Bevy asset insertion + ECS entity creation (functionality)\n\n ```rust\n CPU performance suite\n\n 1. Function-level benchmarks\n → sphere_mesh(), tessellate_path(),\n arc_path(), build_polygon_path(), compile_shader()\n\n 2. Functionality-level benchmarks\n → create_sphere(), flush_draw_commands() with many commands,\n create_from_geometry(), set_property()\n\n 3. Workload tiers\n → light / medium / heavy inputs\n\n 4. Metrics\n → p50, p90, p95, p99, throughput, allocations if possible\n\n 5. CI gates\n → compare against baseline, fail only on sustained regression,\n not tiny noise\n ```\n\n### 2. GPU NATIVE RENDER FUNCTIONS / PROCESSES (WHICH IS DONE BY BEVY)\n\n- Should be run locally by maintainers before raising/merging PR.\n\n***Notes: External libraries also degrade sometimes in performance. We also need to have that in account.***\n\n## CRATE: **`processing_render`**\n\n**TL;DR: `processing_render` is mostly CPU-heavy in the parts that generate and prepare render data: `tessellation`, `mesh generation`, `geometry mutation`, `shader/material setup`, `command flushing`, and `buffer/image conversion`. These CPU-side generators are the most likely areas contributors will modify, so V1 should focus on deterministic CPU benchmarks for those hot paths.**\n\n**For GPU benchmarking, we should measure the complete rendering pipeline rather than isolated snippets, because actual GPU work is mostly executed inside Bevy/wgpu. A full render benchmark harness can be added in V2 for frame time, GPU compute dispatch, readback, particles, and end-to-end scene rendering.**\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/render\u003c/code>\u003c/b>\u003c/summary>\n\n> ⇒ Prepares the data required for rendering. CPU computations to prepare data-structures that are rendered by Bevy.\n>\n> \u003cdetails>\n> \u003csummary>CPU processes\u003c/summary>\n>\n> > \u003cdetails>\n> > \u003csummary>\u003ccode>processing_render/src/render/primitive\u003c/code>\u003c/summary>\n> >\n> > > \u003cdetails>\n> > > \u003csummary>\u003ccode>processing_render/src/render/primitive/mod.rs\u003c/code>\u003c/summary>\n> > >\n> > > > This has the code for generating Mesh with **Tessellators.** These mostly contains CPU intensive calculations that forms the base that gets rendered.\n> > > >\n> > > > CPU intensive fns: `tessellate_path(...)`\n> > > >\n> > > > Key terms:\n> > > >\n> > > > \u003cdetails>\n> > > > \u003csummary>\u003cb>Tessellator (\u003ca href=\"https://github.com/nical/lyon\">github\u003c/a>)\u003c/b>\u003c/summary>\n> > > >\n> > > > > **T**essellators such as the ones provided by lyon take complex shapes as input and generate geometry made of triangles that can be easily consumed by graphics APIs such as OpenGL, Vulkan or D3D.\n> > > > >\n> > > > > TessellationMode:\n> > > > >\n> > > > > ```rust\n> > > > > pub enum TessellationMode {\n> > > > > Fill, // fill the inside of the shape.\n> > > > > Stroke(f32), // draw only the outline/border of the shape.\n> > > > > }\n> > > > > ```\n> > > >\n> > > > \u003c/details>\n> > > >\n> > > > \u003cdetails>\n> > > > \u003csummary>\u003cb>Mesh\u003c/b>\u003c/summary>\n> > > >\n> > > > > `Mesh` is the renderable geometry object.\n> > > >\n> > > > \u003c/details>\n> > > >\n> > > > \u003cdetails>\n> > > > \u003csummary>\u003cb>Path\u003c/b>\u003c/summary>\n> > > >\n> > > > > A **Lyon `Path`** is a data structure from the Rust `lyon` crate that describes a **2D vector shape**.\n> > > > >\n> > > > > ```rust\n> > > > > pub struct Path {\n> > > > > points: Box\u003c[Point]>,\n> > > > > verbs: Box\u003c[Verb]>,\n> > > > > num_attributes: usize,\n> > > > > }\n> > > > >\n> > > > > pub struct Point2D\u003cT, U> {\n> > > > > pub x: T,\n> > > > > pub y: T,\n> > > > > #[doc(hidden)]\n> > > > > pub _unit: PhantomData\u003cU>,\n> > > > > }\n> > > > >\n> > > > > pub(crate) enum Verb {\n> > > > > LineTo,\n> > > > > QuadraticTo,\n> > > > > CubicTo,\n> > > > > Begin,\n> > > > > Close,\n> > > > > End,\n> > > > > }\n> > > > > ```\n> > > > >\n> > > > > Example:\n> > > > >\n> > > > > Let's say points:\n> > > > >\n> > > > > ```\n> > > > > (0, 0)\n> > > > > (100, 0)\n> > > > > (100, 50)\n> > > > > (0, 50)\n> > > > > ```\n> > > > >\n> > > > > Let's say verbs\n> > > > >\n> > > > > ```\n> > > > > MoveTo\n> > > > > LineTo\n> > > > > LineTo\n> > > > > LineTo\n> > > > > Close\n> > > > > ```\n> > > > >\n> > > > > This means:\n> > > > >\n> > > > > ```\n> > > > > Start at (0,0)\n> > > > > Draw line to (100,0)\n> > > > > Draw line to (100,50)\n> > > > > Draw line to (0,50)\n> > > > > Close the shape\n> > > > > ```\n> > > >\n> > > > \u003c/details>\n> > >\n> > > \u003c/details>\n> > >\n> > > \u003cdetails>\n> > > \u003csummary>\u003ccode>processing_render/src/render/primitive/arc.rs\u003c/code>\u003c/summary>\n> > >\n> > > > builds arc paths for fill/stroke modes and tessellates them into Bevy mesh geometry.\n> > > >\n> > > > CPU intensive fns: **`arc_path(...)`**, `tessellate_path(...)` being called from `arc_stroke(...)` and `arc_fill(...)`\n> > >\n> > > \u003c/details>\n> > >\n> > > \u003cdetails>\n> > > \u003csummary>\u003ccode>processing_render/src/render/primitive/curves.rs\u003c/code>\u003c/summary>\n> > >\n> > > > curve paths and stroke-tessellates them into Bevy mesh geometry.\n> > > > CPU intensive: `builder.cubic_bezier_to(...)` `tessellate_path(...)`\n> > >\n> > > \u003c/details>\n> > >\n> > > \u003cdetails>\n> > > \u003csummary>\u003ccode>processing_render/src/render/primitive/ellipse.rs\u003c/code>\u003c/summary>\n> > >\n> > > > `ellipse.rs` builds an ellipse as four cubic Bézier curve segments and tessellates it into Bevy mesh geometry.\n> > > >\n> > > > CPU intensive fns: `ellipse_path(...)` `b.cubic_bezier_to(...)` `tessellate_path(...)`\n> > >\n> > > \u003c/details>\n> > >\n> > > \u003cdetails>\n> > > \u003csummary>\u003ccode>processing_render/src/render/primitive/line.rs\u003c/code>\u003c/summary>\n> > >\n> > > > `line.rs` builds a simple two-point line path and stroke-tessellates it into Bevy mesh geometry.\n> > > >\n> > > > Usually not CPU intensive\n> > >\n> > > \u003c/details>\n> > >\n> > > \u003cdetails>\n> > > \u003csummary>\u003ccode>processing_render/src/render/primitive/quad.rs\u003c/code>\u003c/summary>\n> > >\n> > > > `quad.rs` draws quadrilaterals by directly writing filled quad mesh data, or by path-tessellating the quad outline for strokes.\n> > > >\n> > > > CPU intensive: `simple_quad(...)` `quad_path(...)` only if Stroke mode is used\n> > >\n> > > \u003c/details>\n> > >\n> > > \u003cdetails>\n> > > \u003csummary>\u003ccode>processing_render/src/render/primitive/rect.rs\u003c/code>\u003c/summary>\n> > >\n> > > > `rect.rs` draws rectangles by directly writing simple filled rectangle mesh data, or by building/tessellating a Lyon path for strokes and rounded corners.\n> > > >\n> > > > CPU intensive: `simple_rect(...)`, Intensive in Stroke mode, or when it has round corners\n> > >\n> > > \u003c/details>\n> > >\n> > > \u003cdetails>\n> > > \u003csummary>\u003ccode>processing_render/src/render/primitive/shape.rs\u003c/code>\u003c/summary>\n> > >\n> > > > `shape.rs` implements `beginShape()/vertex()/endShape()` support by collecting custom shape vertices\n> > > >\n> > > > CPU intensive:\n> > > > `build_polygon_fill(...) build_polygon_stroke(...) tessellate_path(...) build_polygon_path(...) expand_curve_vertices(...) flush_curve_points(...) build_direct_fill(...)`\n> > >\n> > > \u003c/details>\n> > >\n> > > \u003cdetails>\n> > > \u003csummary>\u003ccode>processing_render/src/render/primitive/shape3d.rs\u003c/code>\u003c/summary>\n> > >\n> > > > `shape3d.rs` creates reusable Bevy `Mesh` objects for built-in 3D primitives like box, sphere, cylinder, cone, torus, capsule, grid, and plane.\n> > > >\n> > > > CPU intensive:\n> > > >\n> > > > ```\n> > > > sphere.mesh().uv(sectors, stacks)\n> > > > cylinder.mesh().resolution(detail).build()\n> > > > cone.mesh().resolution(detail).build()\n> > > > torus.mesh().major_resolution(...).minor_resolution(...).build()\n> > > > capsule.mesh().longitudes(detail).latitudes(...).build()\n> > > > frustum.mesh().resolution(detail).build()\n> > > > ```\n> > >\n> > > \u003c/details>\n> > >\n> > > \u003cdetails>\n> > > \u003csummary>\u003ccode>processing_render/src/render/primitive/triangle.rs\u003c/code>\u003c/summary>\n> > >\n> > > > `triangle.rs` draws triangles by directly writing filled triangle mesh data, or by path-tessellating the triangle outline for strokes.\n> > > >\n> > > > CPU intensive: Not so much, usually cheap\n> > >\n> > > \u003c/details>\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003ccode>processing_render/src/render/transform.rs\u003c/code>\u003c/summary>\n> >\n> > > The main responsibility of `TransformStack` is to **keep track of the current transformation applied to everything you draw**.\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003ccode>processing_render/src/render/mesh_builder.rs\u003c/code>\u003c/summary>\n> >\n> > > This `MeshBuilder` is the adapter between **Lyon tessellation** and **Bevy Mesh**. convert Lyon's generated geometry into Bevy's mesh format. (Mostly an abstraction layer used else where, no heavy computations)\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003ccode>processing_render/src/render/material.rs\u003c/code>\u003c/summary>\n> >\n> > > This file manages **materials**: color, texture, PBR lighting properties, custom materials, and blending. (Mostly book keeping and adapter fn)\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003ccode>processing_render/src/render/command.rs\u003c/code>\u003c/summary>\n> >\n> > > Mostly helper fn for pushing Draw Commands in to `CommandBuffer` Queue\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003ccode>processing_render/src/render/mod.rs\u003c/code>\u003c/summary>\n> >\n> > > Main orchestration layer. Module file for Flushes from Command Buffer and write to Render State, **prepares renderable entities/assets,** nothing is rendered yet.\n> >\n> > \u003c/details>\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/geometry\u003c/code>\u003c/b>\u003c/summary>\n\n> ⇒ This file is for **retained geometry**. Meaning: unlike `rect()`, `ellipse()`, etc. which may generate fresh mesh data every frame, `Geometry` lets you create a mesh once, keep it as an asset, mutate it, and render/reuse it later.\n>\n> \u003cdetails>\n> \u003csummary>CPU processes\u003c/summary>\n>\n> > \u003cdetails>\n> > \u003csummary>\u003ccode>processing_render/src/geometry/mod.rs\u003c/code>\u003c/summary>\n> >\n> > > Module file for geometry. This module mostly makes use of render/primitive fns.\n> > > **CPU intensive fns are : create_sphere() / create_grid() / create_box()**\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003ccode>processing_render/src/geometry/attribute.rs\u003c/code>\u003c/summary>\n> >\n> > > This file manages **vertex attributes for retained `Geometry` meshes**.\n> > > **Vertex**: A **vertex** is a single point in 2D or 3D space that forms the building block of a mesh. (Mostly book keeping). **No CPU intensive calculations**\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003ccode>processing_render/src/geometry/layout.rs\u003c/code>\u003c/summary>\n> >\n> > > This file defines **vertex layouts** for retained `Geometry`. No CPU intensive tasks mostly book keeping.\n> >\n> > \u003c/details>\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/material\u003c/code>\u003c/b>\u003c/summary>\n\n> \u003cdetails>\n> \u003csummary>CPU processes\u003c/summary>\n>\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>processing_render/src/material/mod.rs\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > `material/mod.rs` defines Processing's Bevy material plugin.\n> > >\n> > > ```\n> > > create_pbr / set_property / destroy\n> > > → normal CPU-side material management\n> > >\n> > > MaterialExtension methods\n> > > → CPU-side render-pipeline callbacks triggered by Bevy\n> > > while preparing GPU pipelines/shaders\n> > >\n> > > Actual GPU work\n> > > → happens later inside Bevy/wgpu\n> > > ```\n> > >\n> > > CPU intensive: `set_property(...) -> mat.shader.reflection().parameter(&name)`\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>processing_render/src/material/custom.rs\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > ```\n> > > create_shader / load_shader\n> > > → CPU-heavy shader loading + WESL/WGSL compilation/parsing\n> > >\n> > > create_custom / set_property / destroy_shader\n> > > → normal CPU-side custom material/shader management\n> > >\n> > > apply_reflect_field / find_param_containing_field\n> > > → CPU-side reflection/property lookup helpers\n> > >\n> > > prepare_asset\n> > > → CPU-side render-asset preparation triggered by Bevy;\n> > > builds bind groups, material properties, shader references,\n> > > and pipeline metadata\n> > >\n> > > extract_* / check_entities_needing_specialization\n> > > → CPU-side Bevy render-world bookkeeping for changed/visible\n> > > custom materials\n> > >\n> > > specialize\n> > > → CPU-side render-pipeline callback triggered by\n> > > Bevy while preparing GPU pipeline variants\n> > >\n> > > Actual GPU work\n> > > → happens later inside Bevy/wgpu\n> > > ```\n> > >\n> > > CPU intensive: `compile_shader(...)` `create_shader(...)` `load_shader(...)`\n> > > `create_custom(...)` `set_property(...)` `apply_reflect_field(...)find_param_containing_field(...)`\n> > >\n> > > Triggered by Bevy but CPU intensive\n> > > `prepare_asset(...)`\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>processing_render/src/material/pbr.rs\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > `pbr.rs` maps user-facing material property names like color, metallic, roughness, emissive, and texture into Bevy `StandardMaterial` fields.\n> > >\n> > > No CPU intensive\n> >\n> > \u003c/details>\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/particles\u003c/code>\u003c/b>\u003c/summary>\n\n> \u003cdetails>\n> \u003csummary>CPU processes\u003c/summary>\n>\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>processing_render/src/particles/kernels/mod.rs\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > `particles/kernels/mod.rs` registers built-in WGSL compute shader files for particle noise and transform kernels as embedded Bevy assets. Not CPU intensive\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>processing_render/src/particles/mod.rs\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > `particles/mod.rs` defines GPU-resident particle containers by allocating per-attribute GPU buffers, optionally seeding them from `Geometry`, and wiring particle rendering/compute plugins.\n> > >\n> > > ```\n> > > create / create_from_geometry\n> > > → CPU-side particle container + GPU-buffer setup\n> > >\n> > > make_buffer\n> > > → CPU-side asset creation + GPU readback buffer allocation\n> > > through RenderDevice\n> > >\n> > > attribute_values_to_bytes\n> > > → CPU-side data conversion; can be expensive for large meshes\n> > >\n> > > destroy\n> > > → CPU-side cleanup of particle buffers/entities\n> > >\n> > > Actual particle compute/rendering\n> > > → happens later in Bevy/wgpu through compute kernels\n> > > and GpuInstanceBatchPlugin\n> > > ```\n> > >\n> > > CPU intensive:\n> > > `create(...) create_from_geometry(...) make_buffer(...)`\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>processing_render/src/particles/material.rs\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > `particles/material.rs` defines the particle material extension that binds a per-particle color buffer and uses a custom WGSL fragment shader for particle rendering. No CPU intensive, usually book-keeping\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>processing_render/src/particles/pack.rs\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > `particles/pack.rs` packs particle position/rotation/scale/dead buffers into Bevy's GPU instancing buffers using a compute pass before mesh preprocessing.\n> > >\n> > > ```\n> > > extract_particles_draws\n> > > → CPU-side render-world extraction/bookkeeping\n> > >\n> > > get_or_create_pipeline\n> > > → CPU-side compute pipeline caching/specialization\n> > >\n> > > prepare_pack_bind_groups\n> > > → CPU-side GPU preparation: resolve buffers, create bind groups,\n> > > write uniforms\n> > >\n> > > dispatch_pack\n> > > → GPU dispatch trigger: begins compute pass and calls\n> > > dispatch_workgroups(...)\n> > >\n> > > Actual GPU work\n> > > → runs in pack.wgsl through Bevy/wgpu\n> > > ```\n> > >\n> > > CPU intensive: `prepare_pack_bind_groups(...)`\n> > > GPU triggering: `pass.dispatch_workgroups(...);`\n> >\n> > \u003c/details>\n>\n> \u003c/details>\n>\n> \u003cdetails>\n> \u003csummary>GPU processes\u003c/summary>\n>\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>processing_render/src/particles/kernels/noise.wgsl\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > `noise.wgsl` applies procedural 3D value-noise displacement to particle positions in parallel on the GPU.\n> > >\n> > > **GPU-intensive parts:** `value_noise(...), noise3(...)`\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>processing_render/src/particles/kernels/transform.wgsl\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > `transform.wgsl` applies scale, optional axis-angle rotation, and translation to particle positions in parallel on the GPU.\n> > >\n> > > **GPU intensive parts:** `cos(angle) sin(angle) cross(axis, p) dot(axis, p)`\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>processing_render/src/particles/pack.wgsl\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > `pack.wgsl` is the GPU compute shader that converts particle buffers into Bevy's per-instance mesh input/culling buffers triggered by **`processing_render/src/particles/pack.rs`**\n> > >\n> > > GPU intensive: `quat_to_basis(q)`\n> >\n> > \u003c/details>\n> >\n> > \u003cdetails>\n> > \u003csummary>\u003cb>\u003ccode>rocessing_render/src/particles/pack.wgsl\u003c/code>\u003c/b>\u003c/summary>\n> >\n> > > `particles.wgsl` is a particle fragment shader that multiplies the material color by each particle's per-instance color before running Bevy PBR lighting/output.\n> > >\n> > > GPU intensive: `fragment(...)`\n> >\n> > \u003c/details>\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/transform.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> This file provides CPU-side helper APIs for mutating Bevy `Transform` components: position, rotation, scale, look-at, and reset.\n>\n> \u003cdetails>\n> \u003csummary>\u003cb>CPU Processes\u003c/b>\u003c/summary>\n>\n> > None\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/time.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> This file exposes Processing-style time helpers for frame count, delta time, and elapsed time using Bevy's `Time` resource.\n>\n> \u003cdetails>\n> \u003csummary>\u003cb>CPU Processes\u003c/b>\u003c/summary>\n>\n> > None\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/surface.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `surface.rs` creates and manages Processing render surfaces: native windows, offscreen targets, resizing, pixel density, monitor placement, and window controls.\n>\n> ```rust\n> create_surface_* / spawn_surface\n> → CPU-side native window/surface setup;\n> → GPU surface/swapchain is created later by Bevy/wgpu\n>\n> prepare_offscreen\n> → CPU/memory-heavy for large surfaces because it\n> allocates pixel buffer: vec![0u8; width * height * pixel_size]\n>\n> resize / set_pixel_density\n> → CPU-side window metadata updates;\n> → may trigger GPU swapchain/texture resize later in Bevy/wgpu\n>\n> destroy\n> → CPU-side ECS + asset cleanup\n>\n> window property helpers\n> → cheap CPU-side bookkeeping\n> ```\n>\n> \u003cdetails>\n> \u003csummary>\u003cb>CPU Processes\u003c/b>\u003c/summary>\n>\n> > `prepare_offscreen(...)`\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/sketch.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `sketch.rs` loads a user sketch source file, stores it as a Bevy `Sketch` asset, and detects hot-reload updates.\n>\n> \u003cdetails>\n> \u003csummary>\u003cb>CPU Processes\u003c/b>\u003c/summary>\n>\n> > None (Not Heavy)\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/shader_value.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `shader_value.rs` defines a typed container for shader uniform/resource values and converts scalar/vector/matrix values to/from raw bytes for GPU buffer usage.\n>\n> \u003cdetails>\n> \u003csummary>\u003cb>CPU Processes\u003c/b>\u003c/summary>\n>\n> > None\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/monitor.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `monitor.rs` exposes simple CPU-side helpers for listing monitors and reading monitor properties like size, scale factor, refresh rate, and name.\n>\n> CPU Processes: None\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/light.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `light.rs` creates Bevy directional, point, and spot light entities for a Processing graphics surface.\n>\n> CPU heavy: None\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/image.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `image.rs` creates, loads, resizes, updates, reads back, and destroys Processing image/texture assets backed by Bevy GPU images.\n>\n> \u003cdetails>\n> \u003csummary>CPU Heavy\u003c/summary>\n>\n> > ```\n> > pixels_to_bytes(...)\n> > bytes_to_pixels(...)\n> > readback(...)\n> > prepare_update_region(...)\n> > resize(...)\n> > create_readback_buffer(...)\n> > ```\n>\n> \u003c/details>\n>\n> \u003cdetails>\n> \u003csummary>GPU Triggers\u003c/summary>\n>\n> > ```\n> > render_queue.write_texture(...)\n> > encoder.copy_texture_to_buffer(...)\n> > render_queue.submit(...)\n> > render_device.create_buffer(...)\n> > ```\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/graphics.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `graphics.rs` creates and manages the Processing graphics context: camera/render target setup, draw command recording/flushing, 2D/3D projection modes, render layers, texture updates, and GPU readback.\n>\n> \u003cdetails>\n> \u003csummary>CPU Heavy\u003c/summary>\n>\n> > ```\n> > create(...)\n> > sync_to_surface(...)\n> > readback_raw(...)\n> > prepare_update_region(...)\n> > warmup(...)\n> > ```\n>\n> \u003c/details>\n>\n> \u003cdetails>\n> \u003csummary>GPU Triggers\u003c/summary>\n>\n> > ```\n> > app.update()\n> > encoder.copy_texture_to_buffer(...)\n> > render_queue.submit(...)\n> > render_queue.write_texture(...)\n> > ```\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/gltf.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `gltf.rs` loads GLTF scenes, extracts named meshes/materials/cameras/lights, and adapts them into Processing/Bevy `Geometry`, materials, transforms, and render layers.\n>\n> \u003cdetails>\n> \u003csummary>CPU\u003c/summary>\n>\n> > ```\n> > load(...)\n> > compute_global_transform(...)\n> > geometry(...)\n> > material(...)\n> > ```\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/compute.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `compute.rs` provides generic GPU compute support: creates shader buffers, builds compute pipelines from custom shaders, binds resources/uniforms, dispatches compute workgroups, and reads buffers back to CPU.\n>\n> \u003cdetails>\n> \u003csummary>CPU\u003c/summary>\n>\n> > ```\n> > create_buffer(...)\n> > create_buffer_with_data(...)\n> > read_buffer_gpu(...)\n> > create_compute(...)\n> > set_compute_property(...)\n> > dispatch(...)\n> > ```\n>\n> \u003c/details>\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/color.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `color.rs` defines Processing-style color modes/spaces and converts normalized or scaled color inputs into Bevy `Color` values.\n>\n> CPU intensive: None\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/camera.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> `camera.rs` adds orbit/free/pan camera controls and updates camera transforms from mouse/input state.\n>\n> CPU heavy: None\n\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>\u003cb>\u003ccode>processing_render/src/lib.rs\u003c/code>\u003c/b>\u003c/summary>\n\n> public API\n>\n> \u003cdetails>\n> \u003csummary>CPU\u003c/summary>\n>\n> > ```\n> > shader_create\n> > shader_load\n> > compute_create\n> > geometry_sphere\n> > geometry_grid\n> > gltf_load\n> > particles_emit\n> > graphics_update\n> > image_update\n> > ```\n>\n> \u003c/details>\n>\n> \u003cdetails>\n> \u003csummary>GPU\u003c/summary>\n>\n> > ```\n> > graphics_flush\n> > graphics_present\n> > graphics_readback\n> > image_readback\n> > buffer_read\n> > compute_dispatch\n> > particles_apply\n> > particles_emit_gpu\n> > ```\n>\n> \u003c/details>\n\n\u003c/details>","author":{"url":"https://github.com/arrxy","@type":"Person","name":"arrxy"},"datePublished":"2026-08-26T21:52:33Z","url":"https://github.com/processing/libprocessing/issues/235"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:13f763da-0b72-5c1d-3ba6-c35739be16f4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9810:67A5B:10A73D:16F285:6B05F762 |
| html-safe-nonce | df66af64c320619cb5288c3b893f3d9bb263f802726a2a7fb745d97ecab27753 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODEwOjY3QTVCOjEwQTczRDoxNkYyODU6NkIwNUY3NjIiLCJ2aXNpdG9yX2lkIjoiNjg2NzIxNDc4ODkzOTA4NTY2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | abf583ab954e89f6067c90b0924cb97335a1b67ac16b7d2c1fd342e931cc971e |
| hovercard-subject-tag | issue:5261774990 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/processing/libprocessing/235/issue_layout |
| twitter:image | https://opengraph.githubassets.com/20b387cf40717b9d6d2bc2970ea814296a3c3dd4a19c03a31ec4a90f357aeed5/processing/libprocessing/issues/235 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/20b387cf40717b9d6d2bc2970ea814296a3c3dd4a19c03a31ec4a90f357aeed5/processing/libprocessing/issues/235 |
| og:image:alt | PERFORMANCE TESTING SUITE TYPES OF FUNCTIONS: 1. CPU NATIVE FUNCTIONS / PROCESSES These can be done in gitHub actions CI/CD and locally Use Rust benchmark harness like Criterion for Local benchmark... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | arrxy |
| hostname | github.com |
| expected-hostname | github.com |
| None | c214754a6652274794ed4e054a7b71be999d69843f103ba54893001d45010ece |
| turbo-cache-control | no-preview |
| go-import | github.com/processing/libprocessing git https://github.com/processing/libprocessing.git |
| octolytics-dimension-user_id | 1617169 |
| octolytics-dimension-user_login | processing |
| octolytics-dimension-repository_id | 1101329545 |
| octolytics-dimension-repository_nwo | processing/libprocessing |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1101329545 |
| octolytics-dimension-repository_network_root_nwo | processing/libprocessing |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7d164a4e71eb333b2b17fd5b17e18efb7855505c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width