summaryrefslogtreecommitdiff
path: root/src/modules
AgeCommit message (Collapse)Author
2022-05-03modules/voronoi: slightly underscale to prevent OOB accessVito Caputo
We don't actually want to produce indices 0-width and 0-height
2022-05-02modules/rtv: silence compiler warning about parensVito Caputo
2022-05-02modules/rtv: plug big channel leak on context destroyVito Caputo
There's more to cleanup in rtv destruction, but this is the major one.
2022-05-02modules/submit: fix bilerp mode out-of-bounds accessVito Caputo
Found via -fsanitize=address, this is a quick and dirty way to prevent the OOB access without adding more conditionals, just prevent scaling the fragment dimensions to the full grid dimensions. This could be done better by reworking things a bit and putting zero at the center of the grid with a -1..+1 mapping, so rounding towards zero would land in the middle as opposed to off the start, with the existing .5f offset. But for now just fix the bug, nobody will notice the slight LCD overscan-style difference of bilerp=on vs. off due to this way.
2022-05-02modules/montage: fix fragnum misuse as cpu #Vito Caputo
This was causing the snow module to scribble via montage, since snow uses per-cpu rand seeds indexed using the cpu value. I didn't dig in to see if this was a vestigial thing where fragnum once was passed as a parameter (it's also in til_fb_fragment_t.number, but probably wasn't always that way). But it's now used as a cpu idx, but since they're the same type nothing complained, they say programming is hard.
2022-05-01modules/rtv: make "compose" the default channelVito Caputo
Also shortened the durations across the board, and defaulted snow to "none". With "compose" being another meta module, and the randomized settings, this actually gives a more interesting grand tour of everything possible.
2022-05-01til_fb: add draw flags for controlling texturabilityVito Caputo
Just adds TIL_FB_DRAW_FLAG_TEXTURABLE so callers can granularly inhibit texturing if desired.
2022-05-01til_fb: introduce a fragment texture sourceVito Caputo
Idea here is to provide texture sources for obtaining pixel colors at the til_fb_put_pixel/fill drawing API, making it possible for at least overlayable modules to serve as mask/stencil operators where their drawn areas are populated by the contents of another fragment produced dynamically, potentially by other modules altogether. This commit adds a texture=modulename option to the compose module for specifying if a texture should be used when compositing, excepting and defaulting to "none" for disabling texturing. A future commit should expand this compose option to accept a potential list of modules for composing the texture in the same way as the main layers= list functions. Something this all immediately makes clear is the need for a better settings syntax, probably in the form of all module setting specifiers optionally being followed by a squence of settings, with support for escaping to handle nested situations.
2022-05-01modules/julia: randomize initial stateVito Caputo
Same as for roto and plasma...
2022-05-01modules/plasma: randomize initial state of contextsVito Caputo
As with roto, it's important to differentiate plasma instances when layered... plus it's kind of boring to always start plasma identically.
2022-05-01modules/roto: randomize roto initial stateVito Caputo
Just something quick and dirty to differentiate roto layers, plus it's kind of boring having roto always start at the same state.
2022-05-01modules/rtv: snow_module=blank is blanking, "none" for disabledVito Caputo
It's no longer necessary to specify both snow_duration=0 AND snow_module=none to disable snow, just specify snow_module=none. A future commit should really make describing the "snow_duration" setting contingent on snow_module != "none".
2022-05-01modules/*: make use of generic fragmentersVito Caputo
Just one case, modules/submit, was using 32x32 tiles and is now using 64x64. I don't expect it to make any difference. While here I fixed up the num_cpus/n_cpus naming inconsistencies, normalizing on n_cpus.
2022-05-01til: wire n_cpus up to the fragmenter functionVito Caputo
Fragmenting is often dimensioned according to the number of cpus, and by not supplying this to the fragmenter it was made rather common for module contexts to plumb this themselves - in some cases incorporating a context type/create/destroy rigamarole for the n_cpus circuit alone. So just plumb it in libtil, and the prepare_frame functions can choose to ignore it if they have something more desirable onhand. Future commits will remove a bunch of n_cpus from module contexts in favor of this.
2022-04-29modules/rtv: except snow_module=none,snow_duration=0Vito Caputo
The code was deliberately showing a single frame of snow when snow_duration=0, since the durations are integral seconds ther was no way to have a sub 1-second snow otherwise. snow_module=none just means cleared for the snow_duration, not no snow mechanism whatsoever. So the combination of 0 duration and "none" was still flashing a single blank frame. With this commit the combination of "none" and 0 snow_duration prevents even a single frame of blank snow from being rendered.
2022-04-29modules/rtv: align all struct membersVito Caputo
cosmetic indentation fixup
2022-04-29modules/rtv: rtv_channel_t: s/settings/settings_as_arg/Vito Caputo
Mechanical rename to something less ambiguous in a world with til_settings_t, til_setting_t, and til_setup_t etc.
2022-04-29modules/voronoi: voronoi diagram moduleVito Caputo
This adds a voronoi diagram module, which when used as an overlay produces a mosaic effect. Some settings: cells=N number of voronoi cells randomize={on,off} randomizes the cell locations every frame dirty={on,off} uses a faster sloppy/dithery-looking method Some TODO items: - use a more space efficient representation of the distance buffer, maybe use uint16_t relative offsets into the cells rather than pointers - capping their quantity to 64KiB - anti-alias edges between cells
2022-04-28libs/din: minor optimizationVito Caputo
compute scaled x/y coordinates less often by reusing them
2022-04-28modules/swab: switch to tiled fragmenterVito Caputo
Quick FPS based comparisons shows this simple change gets a nearly 10% FPS boost on this particular 4-core i7 laptop.
2022-04-27modules/pixbounce: randomize pixmap sizesPhilip J Freeman
2022-04-27modules/pixbounce: add 2 new pixmapsPhilip J Freeman
2022-04-27modules/pixmap: randomize colorsPhilip J Freeman
2022-04-27til_fb: til_fb_fragment_t.{pitch,stride} uint32_t unitsVito Caputo
Originally it seemed sensible to make these units of bytes, for flexibility reasons. But it's advantageous for everything to be able to assume pixels are always 4-byte/32-bit aligned. Having the stride/pitch be in bytes of units made it theoretically possible to produce unaligned rows of pixels, which would break that assumption. I don't think anything was ever actually producing such things, and I've added some asserts to the {sdl,drm}_fb.c page acquisition code to go fatal on such pages. This change required going through all the modules and get rid of their uint32_t vs. void* dances and other such 1-byte vs. 4-byte scaling arithmetic. Code is simpler now, and probably faster in some cases. And now allows future work to just assume things cna always occur 4-bytes at a time without concern for unaligned accesses.
2022-04-25modules/flui2d: add some gamma correctionVito Caputo
Without gamma correction the linear colors don't really pop, this helps tremendously. The gamma factor is hard-coded at 1.4 currently but may make sense as a runtime setting.
2022-04-25modules/flui2d: colorify the density fieldVito Caputo
This is a first approximation at introducing colors to flui2d, the emitter colors aren't really well tuned or anything yet.
2022-04-25modules/flui2d: introduce another emitter; "clockgrid"Vito Caputo
Inspired by my little fomo match-four game PoC, this is a similar style phased emitter grid layout producing some neat turbulent interactions. Introduces an emitters={figure8,clockgrid} setting, and when clockgrid is used, a clockstep=[.05-.99] for the radians step made from one grid cell's emitter to the next where 1=2PI.
2022-04-25modules/pixbounce: rand start pos and dirPhilip J Freeman
2022-04-25modules/swarm: use put_pixel_checked() to stop segfaultingVito Caputo
During rtv runs we'd occasionally segfault in the unchecked line drawing. This needs to be fixed, but for now just go slower.
2022-04-25modules/blinds: add count and orientation settingsVito Caputo
This adds count=N and orientation={horizontal,vertical} settings. Which was precipitated by the introduction of a vertical blinds mode. e.g.: --module=blinds,count=32,orientation=vertical or for a quick tour of the possibilities: --module=rtv,channels=blinds,duration=1,context_duration=1,snow_duration=0 weeeee
2022-04-25modules/compose: implement layer setting randomizerVito Caputo
It's getting crazy in here, this is fun: --module=rtv,channels=compose,duration=1,snow_duration=0,context_duration=1 which will rejigger the commpose module w/randomized layers every second.
2022-04-25modules/*: set TIL_MODULE_OVERLAYABLE where appropriateVito Caputo
In the interests of facilitating randomized automagic layered compositing, tell the world when you're overlay-appropriate.
2022-04-24*: free setup allocations via til_setup_free()Vito Caputo
This should plug a bulk of the setup leaks. Some of the free_funcs still need to be changed to bespoke ones in modules that allocate nested things in their respective setup, so those are still leaking the nested things which are usually just a small strdup of some kind.
2022-04-24*: s/void */til_setup_t */Vito Caputo
This brings something resembling an actual type to the private objects returrned in *res_setup. Internally libtil/rototiller wants this to be a til_setup_t, and it's up to the private users of what's returned in *res_setup to embed this appropriately and either use container_of() or casting when simply embedded at the start to go between til_setup_t and their private containing struct. Everywhere *res_setup was previously allocated using calloc() is now using til_setup_new() with a free_func, which til_setup_new() will initialize appropriately. There's still some remaining work to do with the supplied free_func in some modules, where free() isn't quite appropriate. Setup freeing isn't actually being performed yet, but this sets the foundation for that to happen in a subsequent commit that cleans up the setup leaks. Many modules use a static default setup for when no setup has been provided. In those cases, the free_func would be NULL, which til_setup_new() refuses to do. When setup freeing actually starts happening, it'll simply skip freeing when til_setup_t.free_func is NULL.
2022-04-22modules/compose: randomize layer settingsVito Caputo
Randomize the setting of the layered modules like rtv does. This needs to free the setup, similarly to the others, once that facility is added.
2022-04-22modules/montage: randomize module setupsVito Caputo
Instead of always showing defaults, randomize the setup like rtv does.
2022-04-22til: make til_module_randomize_setup() return -errnoVito Caputo
This makes the arg return optional by using a res_arg pointer, instead returning -ENOMEM when it would have returned NULL on allocation failures. This also makes it possible to detect when no setup was performed, by returning 0 in such a case. Now returns 1 when setup occurs and res pointers populated.
2022-04-22til: add til_module_randomize_setup() from rtvVito Caputo
This commit pulls the setup randomizer out of rtv into libtil proper, so other modules may make use of it. Other than adding an assert no functional changes occurred. It may make sense to split this into two functions; one which takes a til_module_t as-is, and a lower-level bare setup function callback based function that doesn't know about til_module_t the former would call into. That way generic setup randomization can occur (the same setup machinery is used in video contexts for example) without necessarily having a til_module_t on hand.
2022-04-22modules/checkers: experimenting with a checkers overlayVito Caputo
This adds a checkers style overlay module, it's not terribly interesting but may be made more useful if modules start differentiating themselves as substantial vs. overlay effects. It'd be nice if rtv/compose could automagically apply and randomize overlay modules atop others, which would make use of this type of thing as well as encourage more small modules like these be written.
2022-04-22modules/montage: stop assuming modules don't fragmentVito Caputo
There's been a longstanding todo item in montage where it was ignoring the fragmenter returned by a module's prepare_frame(). This commit continues with the single-threaded rendering of the modules within their respective tiles, still ad-hoc open coded. But now actually applies the fragmenter returned as if the rendering were being threaded, since when a module returns a fragmenter from its prepare_frame() it may strongly depend on that fragmenting for its output.
2022-04-19modules/blinds: add simple 80s-aesthetic window blindsVito Caputo
This isn't super interesting but I might just start adding simplistic overlay style modules for compositing/transition use.
2022-04-19*: s/til_fb_fragment_zero/til_fb_fragment_clear/Vito Caputo
Mechanical renaming of "zero" to "clear" throughout for this context.
2022-04-14modules/*: remove srand() initializationsVito Caputo
Just rely on til_init()'s srand() ensuring things are fresh.
2022-04-01modules/*: instantiate and use setupsVito Caputo
Now modules allocate and return an opaque setup pointer in res_setup when they implement a setup method. Defaults are utilized when ${module}_create_context() receives a NULL setup. The default setup used in this case should match the defaults/preferred values emitted by the module's setup method. But performing setup should always be optional, so a NULL setup provided to create_context() is to be expected. No cleanup of these setup instances is currently performed, so it's a small memory leak for now. Since these are opaque and may contain nested references to other allocations, simply using free() somewhere in the frontend is insufficient. There will probably need to be something like a til_module_t.setup_free() method added in the future which modules may assign libc's free() to when appropriate, or their own more elaborate version. Lifecycle for the settings is very simple; the setup method returns an instance, the caller is expected to free it when no longer needed (once free is implemented). The create_context consumer of a given setup must make its own copy of the settings if necessary, and may not keep a reference - it must assume the setup will be freed immediately after create_context() returns. This enables the ability to reuse a setup instance across multiple create_context() calls if desired, one can imagine something like running the same module with the same settings multiple times across multiple displays for instance. If the module has significant entropy the output will differ despite being configured identically... With this commit one may change settings for any of the modules *while* the modules are actively rendering a given context, and the settings should *not* be visible. They should only affect the context they're supplied to.
2022-03-30*: wire up context-specific setup instancesVito Caputo
This is a preparatory commit for cleaning up the existing sloppy global-ish application of settings during the iterative _setup() call sequences. Due to how this has evolved from a very rudimentary thing enjoying many assumptions about there ever only being a single module instance being configured by the settings, there's a lot of weirdness and inconsistency surrounding module setup WRT changes being applied instantaneously to /all/ existing and future context's renderings of a given module vs. requiring a new context be created to realize changes. This commit doesn't actually change any of that, but puts the plumbing in place for the setup methods to allocate and initialize a private struct encapsulating the parsed and validated setup once the settings are complete. This opaque setup pointer will then be provided to the associated create_context() method as the setup pointer. Then the created context can configure itself using the provided setup when non-NULL, or simply use defaults when NULL. A future commit will update the setup methods to allocate and populate their respective setup structs, adding the structs as needed, as well as updating their create_context() methods to utilize those setups. One consequence of these changes when fully realized will be that every setting change will require a new context be created from the changed settings for the change to be realized. For settings appropriately manipulated at runtime the concept of knobs was introduced but never finished. That will have to be finished in the future to enable more immediate/interactive changing of settings-like values appropriate for interactive manipulation
2022-03-30*: use til_module_create_context() in more placesVito Caputo
Just mechanical replacement of some remaining ad-hoc til_module_t.create_context() calls. The montage module continues using an ad-hoc call because it forces num_cpus=1 since it's already a threaded using a fragment per module's tile. This suggests the til_module_create_context() call should probably accept a num_cpus parameter, perhaps treating a 0 value as the "automagic" discover value so callers can explicitly set it when necessary.
2022-03-28modules/swarm: add lines drawing styleVito Caputo
Introduce drawing styles, adding a line style in addition to the existing points. Settings are style={points,lines}, default is now lines.
2022-03-28modules/swarm: remove extra ticks multiply on leader radsVito Caputo
No idea why this was in there. Though it makes the leader jump by huge values, since it still winds up as samples on the same path, just non-continuous, the swarm still appears correct, hiding this braino. If you reduce the SWARM_SIZE to a tiny number like 2 though, it becomes very obvious that the leader is teleporting all over the place.
2022-03-25modules/compose: -EINVAL on empty layers settingVito Caputo
This resulted in a NULL ptr deref, simply treating as invalid since what's the point of handling a composition devoid of any layers - it's probably a mistake.
2022-03-19modules/sparkler: clarify BSP-tree setting descsVito Caputo
attempt at making these more clear
© All Rights Reserved