summaryrefslogtreecommitdiff
path: root/src/gpu
Commit message (Collapse)AuthorAge
*-. integration: the text on pardes's rasterizer, the GPU move's files and the ↵Gabriel Schneider117 min.
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | live-coding example together A merge of sk-text (korlovpv), gpu-s4b (nqwsztut) and demo1-b (oroqkmvu), no conflicts, built beside cloud9's c9-cli. zig build test: 192/192 steps, 151/151 tests; test-text: 52/52 steps, 4/4 tests. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
| * | Add pardes's frame recording to CellsGabriel Schneider117 min.
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved from pardes's src/gui/gui.zig (step S4b, the last of moving its renderer here): begin and submit acquire a frame's command buffer and give a frame up; mapCells grows and maps the cell instance buffer for the embedder to write in place; uploadCells sends it after the atlas's dirty rows; record makes the frame's render pass, cleared to the embedder's colour, and draws its groups (Group: cells, then pictures, then decor, each a run of instances), a scroll's shifted rows clipped to the rectangle given, then the overlay. uploadAtlas, drawImages, pushLayerOpacity and drawOverlay are Cells' own now.
| * | Add pardes's cell resources, pictures, overlay and atlas uploadGabriel Schneider117 min.
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved from pardes's src/gui/gui.zig (step S4a of moving its renderer here): Cells is now a struct over the embedder's device and swapchain format holding the four pipelines (and the addon one, made on first use), the glyph atlas's texture, nearest sampler and upload buffer, the pictures' linear sampler, the cells', pictures' and overlay's buffers, and the pictures' textures by key. init and deinit make and release them; image uploads a picture's RGBA, or only its dirty rows into the texture of the picture it replaces; mapImages, uploadImages and drawImages carry the frame's picture instances and draws, an ImageDraw's texture either one of Cells' own or the caller's, borrowed (an addon's premultiplied output); uploadAtlas sends the Atlas's dirty rows; uploadOverlay, pushLayerOpacity and drawOverlay the overlay's triangles. The SPIR-V is the embedder's `<name>.spv` imports; Cells.zig imports the Atlas as `font_atlas`.
| * | Add pardes's presentation on SDL_GPUGabriel Schneider117 min.
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved from pardes's src/gui/gui.zig (step S3 of moving its renderer here): src/gpu/Present.zig, the device, the window's claim or a software presenter through SDL_Renderer (a transparent window, which the GPU API will not claim, or a claim refused), the present mode and frames in flight, detach and attach for a window closed and opened again, the frame's target (the swapchain's image, or a capture texture in test mode and for the soft presenter), the soft present (the frame read back, put in a streaming texture and flipped) and a captured frame's read back. The window stays the embedder's and is passed in where it is used. What pardes did inside these with its own state comes back instead: a soft present's phase times (Timings), each presented frame's pixels through a frame tap, a captured frame's mapped bytes and times (readFrame, then releaseFrame) and their byte order (bgr). Present.zig imports the embedder's SDL translation as `c` and Cells.zig as `gpu_cells`.
* | | Merge the GPU move's font shim, glyph atlas and cell shadersGabriel Schneider117 min.
|\| | | |/ |/| | | | | | | | | sketchbook-next with gpu-s2 (vendor/font.{c,h}, src/font/Atlas.zig, src/gpu/Cells.zig, src/gpu/shaders/): no conflicts. Nothing of sketchbook's own uses them yet. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
| * Add pardes's cell shaders, instance ABI and GPU resource helpersGabriel Schneider117 min.
| | | | | | | | | | | | | | | | | | | | | | Moved verbatim from pardes's src/gui/gui.zig (step S1 of moving its renderer here): the seven GLSL shaders and their committed SPIR-V under src/gpu/shaders/, and src/gpu/Cells.zig with the instance structs the shaders read, the vertex inputs, makePipeline, the layer blend, texture2d and growInstances (which takes the device instead of pardes's Gui). Cells.zig imports the embedder's own SDL translation as `c`; pardes compiles it from this checkout. `zig build shaders` refreshes the prebuilt SPIR-V.
* | audio: a GPU buffer streamed within the frame, at a lead the host measuresGabriel Schneider117 min.
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A compute shader's output was heard only after the sketch read it back (f.download, a frame later) and pushed it behind a lead of its own choosing; spheres kept 100 ms, and a change it made left for the device 96 ms later on average (measured, dummy driver, 60 Hz). f.audioBuffer(key, buffer, .{ .count, .offset }) streams `count` f32 a shader wrote: the host copies them back while it runs the frame's commands, waiting on the copy's fence (Executor.read: 0.2 ms on average here, 2 ms at the 99th percentile on a loaded machine), and queues them on the stream, so nothing is in flight between frames and the sketch keeps no books. Input.lead says how far ahead to make sound: the slowest of the last 64 frames' worth of samples (timed between the ends of the frames' commands, where the pushes are), plus the device's pull (what SDL takes from a stream at once, read from the device: 1024 here), plus half a pull for each underrun, a sample less each frame after; capped at 8192. A sketch pushes `in.lead -| in.stream(key).queued` a frame, and its change leaves after about what is queued ahead of it, a pull: 19 to 27 ms on average with SDL's 1024-sample pulls, 6.3 to 6.5 ms with 256 (SDL_AUDIO_DEVICE_SAMPLE_FRAMES; 17 under heavy load). Stream.underruns counts the pushes that found a stream empty though the frame before had fed it (a gap). The voices keep their 2048 samples: mixed to the lead, a one-shot longer than it is mixed over several frames, and voices.script's expect-audio and expect-no-audio, which look one frame at a time, failed. On the web, audio.buffer reads the buffer back with mapAsync and queues it on arrival, in order, counting it as queued meanwhile; in.lead stays at 100 ms there. The measurements (a probe patched into the host for the purpose, kept out of the tree) are in the 02-pardes-code scratch, .scratch/sketch/gpusynth. Tests: the lead's arithmetic (audio.zig, in test-audio's filter); spheres' play script checks its stream is fed. zig build test: 164/164 steps, 49/49 tests run (the rest cached); zig build test-audio: 48/48 steps, with the voices sketch's wasm, so web.zig compiles; voices.script passes four runs in four. web/host.js: node --check only, no browser run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
* gpu: add a post-process pass with optional depth sampling, and describe the ↵Gabriel Schneider117 min.
| | | | | | | | | | executor pardes shares `f.postProcess(source, target, .{...})` records a fullscreen pass that samples a completed render into a distinct target image: colour at fragment binding 0 and, with `sample_depth`, depth at 1, which needs the source's latest pass to have depth and one sample (missing depth, multisampled depth and feedback loops are rejected). The scene format's version 4 carries it, the executor records it on the caller's command buffer and owns the sampler, the web host does the same with its texture and sampler pairs, and native profiling reports the work as `postprocess`. The README says how to use it. docs/pardes-rendering.md describes the executor as pardes uses it for addon scenes: a borrowed SDL GPU device, `record` into the caller's command buffer, `run`, `output` and `postProcess`. The working copy as it stood on 2026-11-16; message written by Claude from the diff, at the author's request.
* Add glTF scene rendering, resource setup and 9P controlsGabriel Schneider20 hours