summaryrefslogtreecommitdiff
path: root/src/modules
AgeCommit message (Collapse)Author
2023-07-31modules/rkt: remove TIL_MODULE_EXPERIMENTAL flagVito Caputo
Now that the "scener" interface seems to be semi usable and capable of editing... things are looking more complete in the sense that there's no huge gaping holes and a lot of the dust has settled. It's also looking pretty good for this sticking around long-term, so I'm removing the experimental flag making this more discoverable and visible in general. There's still work to be done surrounding GNU Rocket the library, like getting it using non-blocking connects, and there's a need for forgetting tracks which the protocol doesn't support currently. But it'd be silly to wait on getting those things upstream before making rkt more visible.
2023-07-31modules/signals: experimental signals moduleVito Caputo
Playing with libs/sig in 2D, this isn't really an interesting module by itself in terms of visual output. But it might have utility as a diagnostic thing if libs/sig becomes a more used thing. At the very least, for now, it's useful for observing affects of and iterating on libs/sig development. So I'm merging this, just gated behind TIL_MODULE_EXPERIMENTAL so it's not in rtv rotation or presented as something in the usual modules list.
2023-07-30modules/rkt: first stab at scene editing for scenerVito Caputo
This augments the NEWSCENE_SETUP state to also handle editing existing settings, which is slightly different but actually overlaps with the already implemented invalid input stuff. There's still work to do, and the UX is kind of awkward at best. But this takes us from having no ability to edit existing scenes, to being able to actually make edits interactively while it's all live... with a modicum of interactive guidance via the setup machinery. It basically behaves just like creating a new scene, except instead of the <enter>-accepted "preferred" values, you accept the existing relevant setting. So as-is, when editing, you have no shortcut for getting back the "preferred" value for a given setting. That's been replaced with the existing value for that setting. You also get seemingly spurious redundant queries for module names in things like compose::layers, but they're really not the same since the first time you get asked it's actually the full settings string you're getting an opportunity to specify wholesale, but can accept to seed the layer's settings as-is, which you will then be given an opportunity to edit piecemeal. It's that subsequent piecemeal editing of the individual settings within the nested instance that can feel like a spurious duplication, especialy when a given layer has just a bare-value module name and no subsequent settings.. like "plasma". You'd be asked if you want "plasma" for the layers/[N], then asked if you want "plasma" _again_ for the layers/[N]/[0] since the module name is an unnamed setting at position 0 within the layers/[N] instance. It was tempting to try streamline that a bit, but there's actually utility in having an opportunity to paste in a full settings string for the layers/[N] if you have a serialized scene onhand you want to dump in there. Then after that, you can juts smash enter as much as necessary to accept what you pasted in without editing those in the piecemeal phase. Or, if there was actually something in what you pasted you did want to change, change it during that piecemeal phase. I think it at least kind of works.
2023-07-30modules/checkers: add blurb about context clonesVito Caputo
There's an outstanding issue surrounding the need for context clones, and I'd just like to write something down somewhere before it falls off my radar. Presently it's just checkers that exercises this need, so it makes sense to put it here for now, until I get around to actually taking action on the issue.
2023-07-28modules/*: use til_fragmenter_slice_per_cpu_x16() where applicableVito Caputo
Mechanical change switching til_fragmenter_slice_per_cpu() users over to til_fragmenter_slice_per_cpu_x16(), except sparkler where it's quite detrimental to performance.
2023-07-28modules/rkt: minor error message formatting fixVito Caputo
Better spearate the generic error line from surrounding text with an extra newline
2023-07-28modules/rkt: s/_EDITSCENE/_SCENE/Vito Caputo
This was a bit of an aspirational misnomer, editing scenes isn't actually implemented yet. What the EDITSCENE state currently implements is the per-scene dialog+prompt, which originally was going to just be the scene editing flow but became more of a "view a specified scene's details" with a prompt of its own. Nothing functionally changes, just mechanical internal renames.
2023-07-25modules/rkt: fix vestigial til_str_newf() useVito Caputo
This is leftover from development when it used a fmt string in combination with the key, before the desc path was getting properly appended.
2023-07-21modules/shapes: drop atan2_approx()Vito Caputo
With the addition of the "radcache" in b6362c, the need for a faster approximate atan2f() is largely eliminated. And there seems to be a bug in the implementation as-is taken from https://mazzo.li/posts/vectorized-atan2.html You can see the bug as vertical line artifact around the center where the X coordinate would be 0. Rather than debug what's wrong with this approximation's implementation surrounding its quadrant adjustments, let's just resume using atan2f() and let the cache keep things quick.
2023-07-17modules/rkt: limit Rocket reconnect frequency to 2HZVito Caputo
On Linux I don't notice a significant affect on anything letting rkt try connect every frame when offline but in creative mode. On Windows however, Dan reported significant latencies in the Scener prompt responsiveness and visible slowdowns in this condition. I suspect the WIN32 Rocket library's sync_tcp_connect() code is the real problem here. But for now I can ameliorate things a bit by just hammering on that code path less when unconnected.
2023-07-16modules/rkt: pause on entering scene 99999Vito Caputo
This is only relevant to creative mode. Stops RocketEditor from continuing playback endlessly until user intervention beyond the current end of the demo.
2023-07-16modules/rkt: track last scene in ctxt->last_sceneVito Caputo
Prepartory commit for pausing playback upon entering 99999 scene It needs to trigger only on the edge of entering the scene to permit RocketEditor to unpause playback even if still in scene 99999, if that's what the user is trying to do. It'd be annoying to have it just keep asserting a paused state until the scene idx leaves 99999... But this also enables triggering anything on scene change edges, for future stuff.
2023-07-16modules/rkt: cleanup Rocket track namesVito Caputo
- strip off the leading /path/to/rkt/module prefix - separate taps from their scene context path with ':' vs. '/' RocketEditor doesn't currently support recursive grouping, so this is as good as it gets. Note this commit will break the existing tracks for alphazed, so you'll have to use a newer .zip for track data if building your rototiller from source. Or build from a prior commit.
2023-07-16module/rkt: pull rkt_context_t to sync_get_trackfVito Caputo
Preparatory commit for rewriting track paths a bit to better group things in RocketEditor. I'll need access to rkt_context_t.til_module_context_t.setup->path for prefix matching purposes..
2023-07-15modules/roto: implement fill_module= settingVito Caputo
This makes it possible to tiled+rotate the output of another module in the same manner checkers::fill_module fills cells with module output. The default stays "none" for the classic roto with the psychedelic color cycling. When !"none" the color cycling doesn't get applied currently. It might be interesting to try support that in the future though.
2023-07-14modules/rkt: remove vestigial "/scenes" path appendVito Caputo
During rkt_scener development this append was at one time needed, as there was no retained reference to the scenes_settings for deriving paths from. Now that the path is derived from the actual scenes setting instance it's just resulting in a double trailing /scenes in the "/module/rkt/scenes/scenes:" heading Purely cosmetic fix
2023-07-13modules/rkt: '=' for current Rocket scene in scenerVito Caputo
Pressing '=' at either prompts now makes scener's current scene the current Rocket scene. While you could already do this manually by just looking at the scenes list for the one with the '*' in the Rocket column while either watching a production and pressing <enter> repeatedly to keep refreshing the scenes list... that's cumbersome and annoying, now just use this shortcut. Since this just copies Rocket's scene to the Scener scene index, it needed to properly handle scene 99999... hence the previous commits.
2023-07-13modules/rkt: include EXITED [99999] in scenes listVito Caputo
While there's no actual context for 99999, it's a state we need to represent visibly somehow.. so just make it appear like an epilogue scene off the end. I've included the Rocket/Scener/Pinned status columns consistently as well so you at least still get a visible indication when you've done something like pinned 99999 somehow (not that this is possible presently, but with future changes there will be more ways to copy the Rocket idx into Scener's idx)
2023-07-13modules/rkt: add 99999 exit scene defineVito Caputo
rkt_scener needs to know this value so define it in rkt.h and switch over all the existing 99999 instances.
2023-07-12modules/rtv: perform gc immediately in cleanup_channel()Vito Caputo
Until channel context paths are distinct it's buggy to let the contexts linger while constructing the next channel's contexts. Originally when the gc was added here the intention was to support stuff like the "ref" module and get the channels settings wired up immediately with more focus on rtv's details in this area. Supporting stuff like contexts backing some layers persisting across channels, while the others were swapped out, seemed potentially interesting (and it still is). But the rkt stuff became prioritized as rtv is more like a fuzzer than anything despite being the default module. And rkt related activities will continue for now, so let's just get rtv less likely to crash. A reliable repro for triggering an ASAN UAF bug without this commit is: --seed=0x64af3b05 '--module=rtv,duration=1,context_duration=1,channels=compose,caption_duration=2,snow_duration=0,snow_module=none,log_channels=on' '--video=sdl,fullscreen=off,size=640x480' A few channels in blinds will UAF while updating taps stored in a freed context, because the previous channel has a blinds in the same layer as the newly setup channel, putting the contexts at exactly the same paths on-stream. There's probably another bug in here that I need to dig into, but coexisting contexts at the same path on-stream was never the intention. The syncronous immediate gc ensures nothing remains of the previous channel before constructing the new one at the same path.
2023-07-12modules/rtv: fix settings path for channel settingsVito Caputo
The channel module name was being used as the settings instance name, which is redundant to the entries[0] "value as label" behavior with the module name also @ entries[0]. The resulting paths resembled: /module/rtv/compose/compose/layers/[N]/... /module/rtv/compose/compose/texture/... Now they are: /module/rtv/channel/compose/layers/[N]/... /module/rtv/channel/compose/texture/... There's still work to be done in this area of rtv. It's unclear if even a static "/module/rtv/channel" is correct, or if it should show the subscript of the channels[] entry currently being used when that becomes a proper nested settings situation, i.e. /module/rtv/channels/[0]/compose/layers/[N]/... ... /module/rtv/channels/[1]/spiro ... /module/rtv/channels/[2]/roto ... for a "channels=compose,spiro,roto" kind of hypothetical another option which might make sense is to have the channel path more like an auto-increment identifier so the channel contexts have unique paths and don't collide on the stream. This could be important for scenarios utilizing the "ref" module and trying to reuse parts of the context from one channel to the next. When the paths collide things tend to break in weird ways presently. this area needs more thought
2023-07-12modules/blinds: update taps in prepare_frameVito Caputo
Silly and unnecessarily racy to do this in render_fragment now that blinds is threaded
2023-07-11modules/blinds: make blinds threadedVito Caputo
This is a first stab at threading blinds, while here I got rid of the reliance on _checked() put_pixel for clipping. This could be better, things like using a block put/copy instead of put_pixel would be a huge advantage for blinds due to its naturally contiguous blocks per-blind. While this module when non-threaded wasn't especially slow, any module leaving cores idle is depriving other potentially threaded modules of utilizing them for the duration of the non-threaded render. So now that rototiller is being used for compositions and increasingly becoming something of a meta-demo, it's become important to make everything as threaded as possible.
2023-07-11modules/blinds: update taps at context create tooVito Caputo
Especially since taps are established on first use, it's desirable to get them online immediately so they show in things like --print-pipes and modules::rkt/RocketEditor and not spuriously once the context becomes actively rendered... This kind of thing will be done for all modules eventually
2023-07-11modules/shapes: cache per-pixel atan2 resultsVito Caputo
computing the angle for every pixel coordinate from the origin is costly, even with the approximate method added by c690303. An easy speedup is to only do this once for a given frame dimensions, and cache those results. In the form of a 32-bit float, it's equivalent to caching a full page of pixel data. This is slightly complicated by needing to be an effectively global cache and the potential for multiple shapes contexts rendering concurrently when part of a composition. I think this particular situation highlights a need for something equivalent generalized on-stream where modules can register discoverable caches of costly to compute information, having a high probability of being useful to others. In this particular case it was alphazed's use of shapes in two layers that made it an obvious win, even without any other modules needing atan2() per-pixel with a centered origin. With this commit: Configured settings as flags: --seed=0x64adabae '--module=compose,layers=blank\,shapes\\\,type\\\=pinwheel\\\,scale\\\=.9\\\,pinch\\\=.25\\\,pinch_spin\\\=.1\\\,pinches\\\=7\\\,points\\\=19\\\,spin\\\=.01\,shapes\\\,type\\\=pinwheel\\\,scale\\\=.9\\\,pinch\\\=1\\\,pinch_spin\\\=-.25\\\,pinches\\\=8\\\,points\\\=5\\\,spin\\\=0,texture=moire\,centers\=3' '--video=mem,size=1366x768' FPS: 73 FPS: 74 FPS: 73 Without: Configured settings as flags: --seed=0x64adb857 '--module=compose,layers=blank\,shapes\\\,type\\\=pinwheel\\\,scale\\\=.9\\\,pinch\\\=.25\\\,pinch_spin\\\=.1\\\,pinches\\\=7\\\,points\\\=19\\\,spin\\\=.01\,shapes\\\,type\\\=pinwheel\\\,scale\\\=.9\\\,pinch\\\=1\\\,pinch_spin\\\=-.25\\\,pinches\\\=8\\\,points\\\=5\\\,spin\\\=0,texture=moire\,centers\=3' '--video=mem,size=1366x768' FPS: 55 FPS: 54 FPS: 54 So it's significant, and in alphazed there's also a transition from one scene with two full-screen shapes layers into a checkered scene with shapes as the fill_module. Further amplifying the payoff.. infact whenever shapes is used for a fill_module in checkers, there's n_cpus shapes contexts created because checkers is threaded. All of those would be benefitting from the cache.
2023-07-09modules/spiro: skip color math+packing if texturedVito Caputo
The color stuff as-is isn't cheap and doesn't even get used if there's a texture present, so don't bother with it at all. This is especially significant since this module isn't threaded, so it ties up all the cores leaving most of them idle when part of a composition. Also since spiro doesn't clamp its coordinates to the fragment dimensions, only considering the frame dimensions, it must continue using the "checked" put_pixel variant...
2023-07-08modules/rkt: pile of __WIN32__ concessionsVito Caputo
This seems to make things work well enough for mingw+wine Will probably revisit in the future. Adding an ewouldblock helper rather than duplicating the ifdeffery seems likely Let's just leave it like this for now and find out if a real windows test succeeds
2023-07-08modules/rkt: switch to inet_addr()Vito Caputo
This is available in win32, unlike inet_aton()
2023-07-08modules/checkers: stop setting til_frame_plan_t.cpu_affinityVito Caputo
In the early days of checkers when I introduced fill_module= with the per-cpu contexts to still allow threaded rendering, the whole seed passing to contexts thing wasn't as well sorted out. This meant the contexts often produced vastly different outputs despite being the same module, same seed, and same settings. The consequence of that was that w/fill_module checkers would produce crazy randomized output when you expected the same output in the filled cells. But by using .cpu_affinity (which I had to implement just for this use case actually) at least the different outputs would become stable. It was a band-aid over a different problem that still needed sorting out. Nowadays, it seems like this is improved enough at least for alphazed to look correct without the affinity hack, so I'm removing it because it really kills checkers threaded performance. Whatever modules remain uncooperative WRT seed reproducibility, they'll just need to be fixed up.
2023-07-08modules/shapes: use new approximate atan2 functionVito Caputo
While here also did more minor optimizations moving things out of the inner loops that were only there out of laziness...
2023-07-08modules/shapes: introduce an approximate atan2f()Vito Caputo
Taken from this excellent post: https://mazzo.li/posts/vectorized-atan2.html While I haven't gone full vectorized, just getting rid of the regular atan2f() call will be a big improvement. This just adds the functionality, nothing is calling it yet.
2023-07-07modules/shapes: make threadedVito Caputo
This is just a first stab at threading shapes... whenever shapes finds itself in a scene it easily becomes a significant bottleneck, threading is a trivial path to improving that somewhat. While at it I also got rid of the need for _checked() variants which also helps a bit. But nothing here is proper optimization of the routines.. there's too much math happening per pixel in a naive fashion.
2023-07-07modules/rkt: cleanup some stale commentsVito Caputo
2023-07-06modules/rkt: omit unnecessary return variableVito Caputo
trivial simplification
2023-07-06modules/rkt: fix scener send error handlingVito Caputo
Silly typo, one of those fun C instances where it's surprising how silently mostly-working such a blatant mistake can be. For posterity: The way this was even observed as having an affect is while verifying graceful handling of connections broken while in the listen backlog. With an active scener session idle at the prompt, start another telnet, connecting without receiving any banner (queued via backlog), ^]cl that backlogged telnet. Then start another telnet in the same way. Now go to the idle scener session and quit. The latest telnet would just sit there, seemingly blocked behind the broken-while-backlogged connection. But what was really happening was the banner send got the error on the broken connection after accepting, as you'd expect. This bug in the errno tests prevented detecting the genuine error though, leaving the broken session connected indefinitely. Fun!
2023-07-05modules/rkt: fix recv loop to continue on non-NLVito Caputo
After putting the recv() in a for(;;) to not have to render a frame per byte received, I completely dropped the ball on moving the return and adding the continue to actually finish the change. This makes creating new scenes via pasting long settings strings far less laggy. A future improvement would be to not recv() a byte at a time, but this really isn't a perf-sensitive thing.
2023-07-05modules/rkt: basic support for Rocket reconnectsVito Caputo
This changes things so rkt won't exit with an error @ startup if RocketEditor isn't already listening. It also tolerates RocketEditor going away, and will show a "OFFLINE" overlay status text should that happen w/connect=on. Some status text has also been added to the "EXIT SCENE" 99999 scene for both the RocketEditor connection and the scener enabled/disabled status. No indicator yet for if scener has a connection though, only if it's listening or not via listen=on.
2023-07-05modules/rkt: trivial editscene message formatting fixupVito Caputo
Remove spurious space
2023-07-05modules/rkt: drop unused output variableVito Caputo
2023-07-05modules/rkt: rkt_scener_send_message() in another spotVito Caputo
Trivial related indentation adjustment too
2023-07-05modules/rkt: introduce a rudimentary scenes editorVito Caputo
This adds a BBS-style interface for creating new scenes in a live rkt session. It listens on tcp port 54321 on localhost by default, just use telnet to connect, the rest is fairly self-explanatory. This is still early days, but it's a whole lot more than nothing.
2023-07-05modules/rkt: resolve module_name->til_module_t in setupVito Caputo
With the "ref" builtin module established and seeming to work well enough, it looks unlikely we'll need access to unresolvable module names in the contexts. The thinking originally was that these names might have special syntax making them more generic. E.g something like "@/module/rkt/scenes/[1]/drizzle" for a module_name would have been supported, which would get resolved either at context create or even later (as in the ref builtin) at render time. But the ref builtin is using a path setting, so module names just stay module names. Maybe in the future a special syntax will be added for brevity reasons, but it does make the code more complicated vs. module names just being names and resolving them entirely at setup time. Anyhow, this commit does away with the module_name in the context's scenes. You can still access it via til_module_context_t.module.name anyways... it's basically just a resolution-of-name-to-context time constraint that's being codified now.
2023-07-04modules/*: return invalid setting on -EINVAL in setupVito Caputo
In the interests of improving error handling of interactive setups, return the setting that was invalid when setup returns -EINVAL. For now this is only supported for non-finalized/non-baking setup calls, i.e. (!res_setup). In the future I want this also supported for finalizing when res_setup is set. A lot of the -EINVAL returns are actually during that stage (or need to be added) due to that being when the more sensitive parsing occurs going from strings to native numeric types and such. The main reason it's not already being done in this commit is it'll churn quite a bit to get there, since the setup funcs don't generally have the setting pointers onhand at that phase. It'll require changing the string-value-centric local variables to instead all be the til_setting_t* holding those values. And if setup funcs aren't going to be so value-centric, the settings API will likely change to not even return the values directly anymore and only return the full-blown til_settings_t as the main return pointer, perhaps rid of their res_setting use even. Anyway, while here I did some random little cleanups too.
2023-07-04modules/rkt: discretize rkt_context_t.scenes[]Vito Caputo
Make this a distinct heap allocation so it can be enlarged when editing the scenes... (preparatory commit for scenes editing)
2023-06-24modules/rkt: move rkt types to a headerVito Caputo
Preparatory commit for adding an interactive scene editing server of sorts. It'll go in a separate listing, but needs these types as it'll operate on rkt_context_t->scenes[].
2023-06-16modules/moire: lose unnecessary branch in inner loopVito Caputo
I had benchmarked this change and it showed no difference at all on my 2c/4c i7 X230. But having just tried it on an RPi4B where it moved the test case from 54FPS to 60FPS, a +10% improvement, it's worth the readability loss. It's interesting how Intel's cleverness discourages optimizing in ways that benefit probably *all* the competition... even when the optimization is such a minor change in terms of effort.
2023-06-16modules/moire: some simple optimizationsVito Caputo
Major gain comes from eliminating the cosf() from the inner loop... There's still a bunch left on the table for moire but even just these changes turn 19FPS into 81FPS over here for: '--module=compose,layers=moire\\\,centers\\\=2\,moire\\\,centers\\\=2\,moire\\\,centers\\\=2\,moire\\\,centers\\\=2,texture=none' '--video=mem,size=1366x768'
2023-06-15modules/rkt: drop vestigial TODO comment about handlesVito Caputo
This was written when module names were going to have an @/path/to/context "handle" syntax. But instead I went the "ref" builtin module route, with path=/path/to/context as a setting. While it's more verbose in the settings, it "just works" everywhere that can take a module+settings because the ref builtin is just another module like any other. So this TODO is referring to something that won't happen in a "ref" builtin world.
2023-06-15modules/rkt: end the stream on scene 99999Vito Caputo
This conditionally will end the stream on scene 99999 if connect=off (playback mode) When connect=on it'll just make it show an "EXIT SCENE" diagnostic instead of the "NO SCENE" message. Now you just stick 99999 in the rkt:scene track to end the show. It's assumed 99999 scenes will never be needed...
2023-06-15modules/stars: quick n dirty ticks-based dt scaling of movementVito Caputo
This probably needs more work... it seems wrong to be bypassing the taps altogether when dt is 0
© All Rights Reserved