summaryrefslogtreecommitdiff
path: root/src/til.c
AgeCommit message (Collapse)Author
2022-05-23til: simplify fragment->cleared maintenanceVito Caputo
Just assume a fragment has been logically cleared after til_module_render() has done all its potential steps. I'm not certain this doesn't break some existing assumptions WRT fragmented/threaded clears and their propagation out to the outer frame. But I've been operating under the assumption that this was already happening in terms of an implicit setting of til_fb_fragment_t.cleared after a module's render happened. Except I don't see anything in the existing code or history actually doing that, which is odd. For modules that don't invoke til_fb_fragment_clear() explicitly because they are frame-fillers (think submit, swab, ray, julia, plasma, these are all full-frame renders that don't benefit from pre-clearing), they weren't leaving fragment->cleared set, despite having fully initialized the frame's contents. We should be able to just assume after prepare/render/finish has happened for a given module, the target fragment has been cleared. Commit 4e5286 had introduced somewhat complicated .cleared maintenance and propagation for threaded renders, but when we just treat all finished module renders into a given fragment as logically clearing the fragment we can just skip all that.
2022-05-21til: supply a seed to til_module_t.create_context()Vito Caputo
In the recent surge of ADD-style rtv+compose focused development, a bunch of modules were changed to randomize initial states at context_create() so they wouldn't be so repetitive. But the way this was done in a way that made it impossible to suppress the randomized initial state, which sometimes may be desirable in compositions. Imagine for instance something like the checkers module, rendering one module in the odd cells, and another module into the even cells. Imagine if these modules are actually the same, but if checkers used one seed for all the odd cells and another seed for all the even cells. If the modules used actually utilized the seed provided, checkers would be able to differentiate the odd from even by seeding them differently even when the modules are the same. This commit is a step in that direction, but rototiller and all the composite modules (rtv,compose,montage) are simply passing rand() as the seeds. Also none of the modules have yet been modified to actually make use of these seeds. Subsequent commits will update modules to seed their pseudo-randomized initial state from the seed value rather than always calling things like rand() themselves.
2022-05-21modules/shapes: add procedural 2D shapes moduleVito Caputo
Mostly for compositing purposes, here will be a corpus of 2D shapes, parameterized/procedurally generated and able to rotate and perhaps have other dynamics added. What shapes are there presently I had started implementing in checkers as "styles", before realizing they really should just be a separate module checkers can call into. Not terribly interesting by itself, but as blinds and checkers demonstrated, these things deliver a lot of value in compositional situations. They're creating the palette to draw from.
2022-05-01til: introduce "blank" built-in moduleVito Caputo
rtv special-cased handling a nil module to mean clear the fragment, and called this "none" But it really makes more sense for rtv to treat "none" as not doing anything at all for its snow_module - not even blanking. And it would be nice to have a consistent way to express a blank module throughout rototiller, so this introduces a concept of built-in modules accessible only via explicit lookup by name which don't get enumerated via til_get_modules(), as they're inherently uninteresting more utility-oriented modules for use by other modules. For now it's only "blank" that constitutes the built-ins list, but expanding this is only a matter of introducing more modules there. Future commits will rework rtv to use "blank" in place of its current "none", and rtv's "none" will be reworked to represent no snow mechanism at all, obviating the need to specify snow_duration=0,snow_module=none required today.
2022-05-01til: introduce some generic fragmenters for convenienceVito Caputo
Most of the threaded modules have settled down on two basic forms of fragmenter function: 1. a slice per cpu, where tile-oriented locality isn't useful 2. ~64x64 tiles, in scenarios where screen-space locality helps Now that n_cpus is wired up to the fragmenter, #1 can be fulfilled without requiring a module-private context plumbing n_cpus from create_context(). A future commit will replace some module-specific fragmenters by returning one of these instead as res_fragmenter in their prepare_frame(), wherever applicable.
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-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-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-22til: wire up modules/checkersVito Caputo
expose the checkers module to the rest of the world
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-14til: seed srand in til_init()Vito Caputo
A future commit will remove srand() calls from modules, relying instead on this srand() in til_init(). As mentioned in the comment, if modules actually want reproducible deterministic pseudo-random values they should use rand_r() (or their own PRNG) where they can control the seed.
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-19*: de-constify til_setting_t throughoutVito Caputo
Now that til_setting_t.desc is not only a thing, but a thing that is intended to be refreshed regularly in the course of things like GUI interactive settings construction, it's not really appropriate to try even act like this these are const anymore.
2022-03-19til: add til_module_destroy_context() helperVito Caputo
2022-03-19*: normalize setting description capitalizationsVito Caputo
Always only capitalize the first letter, never capitalize like titles.
2022-03-12til_settings: always describe relevant settingsVito Caputo
The existing iterative *_setup() interface only described settings not found, quietly accepting usable settings already present in the til_settings_t. This worked fine for the existing interactive text setup thing, but it's especially problematic for providing a GUI setup frontend. This commit makes it so the *_setup() methods always describe undescribed settings they recognize, leaving the setup frontend loop calling into the *_setup() methods to both apply the description validation if wanted and actually tie the description to respective setting returned by the _setup() methods as being related to the returned description. A new helper called til_settings_get_and_describe_value() has been introduced primarily for use of module setup methods to simplify this nonsense, replacing the til_settings_get_value() calls and surrounding logic, but retaining the til_setting_desc_t definitions largely verbatim. This also results in discarding of some ad-hoc til_setting_desc_check() calls, now that there's a centralized place where settings become "described" (setup_interactively in the case of rototiller). Now a GUI frontend (like glimmer) would just provide its own setup_interactively() equivalent for constructing its widgets for a given *_setup() method's chain of returned descs. Whereas in the past this wasn't really feasible unless there was never going to be pre-supplied settings. I suspect the til_setting_desc_check() integration into setup_interactively() needs more work, but I think this is good enough for now and I'm out of spare time for the moment.
2021-10-01*: librototiller->libtilVito Caputo
Largely mechanical rename of librototiller -> libtil, but introducing a til_ prefix to all librototiller (now libtil) functions and types where a rototiller prefix was absent. This is just a step towards a more libized librototiller, and til is just a nicer to type/read prefix than rototiller_.
© All Rights Reserved